From 3bb57fb887036a5d1efcb2c088b398b26c708e44 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Sat, 14 Sep 2024 17:51:32 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=95=86=E5=93=81?=
=?UTF-8?q?=E5=BC=B9=E7=AA=97=E9=80=BB=E8=BE=91=EF=BC=8C=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E5=95=86=E5=93=81=E8=A7=84=E6=A0=BC=E5=92=8C=E4=BB=B7=E6=A0=BC?=
=?UTF-8?q?=E5=B1=95=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/goodPopup.vue | 69 +++++++++++++----------------
config/app.js | 6 +--
pages/cart/cart.vue | 4 +-
pages/index/index.vue | 7 +--
pagesOrder/detail/detail.vue | 2 +-
pagesOrder/order/component/good.vue | 10 ++---
pagesOrder/settle/settle.vue | 4 +-
7 files changed, 48 insertions(+), 54 deletions(-)
diff --git a/components/goodPopup.vue b/components/goodPopup.vue
index b0189ae..411a0b6 100644
--- a/components/goodPopup.vue
+++ b/components/goodPopup.vue
@@ -6,53 +6,34 @@
商品名称
- {{ datas.name || datas.goods_name || datas.store_name }}
+ {{ datas.sku_name}}
-
-
-
+
+
+
-
- 商品价格
- ¥ {{price}}
-
-
+
+
购买重量*
-
+
@@ -63,6 +44,13 @@
+
+ 小计
+
+ {{ `${datas.batch}${datas.unit_name}起批` }}
+
+ ¥ {{ subtotal }}
+
取消
@@ -106,10 +94,10 @@
});
const attr_value = ref({});
const setData = (e) => {
- datas.value = e;
+ datas.value = e.attr_value[0]
attr_value.value = e.attr_value
- if (Number(e.batch) > 0) {
- datas.value.cart_num = e.batch;
+ if (Number(e.attr_value[0].batch) > 0) {
+ datas.value.cart_num = e.attr_value[0].batch;
} else {
datas.value.cart_num = 1;
}
@@ -122,7 +110,12 @@
}
const radioClick = (key) => {
checkedProduct.value = key
- price.value = attr_value.value[key].price
+ datas.value = attr_value.value[key]
+ if (Number(datas.value.batch) > 0) {
+ datas.value.cart_num = datas.value.batch;
+ } else {
+ datas.value.cart_num = 1;
+ }
};
const change = () => {
if (+datas.value.cart_num < +datas.value.batch) return uni.$u.toast(
diff --git a/config/app.js b/config/app.js
index 313fd1e..dea5d28 100644
--- a/config/app.js
+++ b/config/app.js
@@ -3,9 +3,9 @@ let WSS_URL
import store from "@/store/user.js"
// 环境
// let env = "dev"
-let env = "prod"
+// let env = "prod"
// let env = "release";
-// let env = "local";
+let env = "local";
switch (env) {
case 'dev':
@@ -17,7 +17,7 @@ switch (env) {
WSS_URL = 'wss://ceshi-multi-store.lihaink.cn/pull'
break;
case 'local':
- BASE_URL = 'http://192.168.1.7:8545';
+ BASE_URL = 'http://192.168.1.22:8545';
WSS_URL = 'wss://ceshi-multi-store.lihaink.cn/pull'
break;
default:
diff --git a/pages/cart/cart.vue b/pages/cart/cart.vue
index b12151d..a19bc14 100644
--- a/pages/cart/cart.vue
+++ b/pages/cart/cart.vue
@@ -33,7 +33,7 @@
{{item.goods_name}}
- {{item.unit_name}}
+ {{item.sku_name}}
原价:¥{{item[priceKey.op_price]}}
@@ -41,7 +41,7 @@
¥{{item[priceKey.price]}}
- {{item.cart_num}}
+ {{item.cart_num}}/{{item.unit_name}}
diff --git a/pages/index/index.vue b/pages/index/index.vue
index f98fa38..9099a79 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -447,7 +447,7 @@
getGoodList();
}
- const addCart = (product_id, cart_num) => { //加入购物车
+ const addCart = (product_id, cart_num,attr_value_id) => { //加入购物车
console.log("触发了加入购物车")
cartCreateApi({
@@ -456,7 +456,8 @@
is_new: 0, // 是否直接购买0否1是
// goods_id: id,
store_id: STORE_INFO.id,
- product_id: product_id
+ product_id: product_id,
+ attr_value_id:attr_value_id
}).then(res => {
getCartList();
}).catch(err => {
@@ -688,7 +689,7 @@
});
console.log('data', data)
- addCart(data.product_id, data.cart_num);
+ addCart(data.product_id, data.cart_num,data.id);
}
diff --git a/pagesOrder/detail/detail.vue b/pagesOrder/detail/detail.vue
index e87fd3e..3c01b86 100644
--- a/pagesOrder/detail/detail.vue
+++ b/pagesOrder/detail/detail.vue
@@ -97,7 +97,7 @@
¥{{item.price}}
- {{}}
+ {{item.sku_name}}
x{{item.nums}}{{item.unit_name}}
diff --git a/pagesOrder/order/component/good.vue b/pagesOrder/order/component/good.vue
index f788f8b..fe4242f 100644
--- a/pagesOrder/order/component/good.vue
+++ b/pagesOrder/order/component/good.vue
@@ -19,19 +19,19 @@
-
+
{{item.store_name}}
-
+
¥{{item.price}}
- {{item.unit_name}}
+ {{item.sku_name}}
-
- x{{item.cart_num}}
+
+ x{{item.cart_num}}/{{item.unit_name}}
diff --git a/pagesOrder/settle/settle.vue b/pagesOrder/settle/settle.vue
index db77dba..9694ea9 100644
--- a/pagesOrder/settle/settle.vue
+++ b/pagesOrder/settle/settle.vue
@@ -43,8 +43,8 @@
¥{{ item.price }}
- {{ item.unit_name }}
- x{{ item.cart_num }}
+ {{ item.sku_name }}
+ x{{ item.cart_num }}/{{ item.unit_name }}