From 002937f5a24bdc1056e3358bc351132492f4f7e7 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Tue, 25 Jun 2024 13:44:10 +0800 Subject: [PATCH] add --- config/app.js | 1 + pageQuota/vipUser/index.vue | 24 +++-------------- pages/cart/cart.vue | 49 +++++++++++++++++------------------ pages/index/index.vue | 51 +++++++++++++++++-------------------- 4 files changed, 51 insertions(+), 74 deletions(-) diff --git a/config/app.js b/config/app.js index e71ad8f..877f933 100644 --- a/config/app.js +++ b/config/app.js @@ -10,6 +10,7 @@ switch (env) { case 'dev': BASE_URL = 'https://test-multi-store.lihaink.cn'; WSS_URL = 'wss://test-multi-store.lihaink.cn/pull' + // WSS_URL = 'ws://192.168.1.22:8787' break; case 'liu': BASE_URL = 'http://192.168.1.201:8545'; diff --git a/pageQuota/vipUser/index.vue b/pageQuota/vipUser/index.vue index 224f94f..d052115 100644 --- a/pageQuota/vipUser/index.vue +++ b/pageQuota/vipUser/index.vue @@ -214,7 +214,7 @@ }); // 浏览器监听user-1 - const user_channel = connection.subscribe(`wechat_mmp_${userInfo.id}}`); + const user_channel = connection.subscribe(`wechat_mmp_${userInfo.id}`); user_channel.on('message', function(data) { console.log("收到消息--", data); @@ -425,6 +425,9 @@ const submit = async () => { if (!formData.real_name) return uni.$u.toast('请填写真实姓名'); if (!formData.mobile) return uni.$u.toast('请填写电话号码'); + uni.showLoading({ + title: '支付中...' + }); formData.store_id = STORE_INFO.id if (Role.value == 1) { uni.scanCode({ @@ -433,29 +436,10 @@ formData.recharge_type = 'INDUSTRYMEMBERS' formData.user_ship = 1 vipRechargeApi(formData).then(res => { - uni.showLoading({ - title: '支付中...' - }); timer = setTimeout(() => { uni.hideLoading(); uni.$u.toast('支付超时'); - // formData.real_name = '' - // formData.mobile = '' - // formData.address = '' - // formData.label_name = '' - // formData.city = '' - // formData.area = '' - // formData.street = '' - // formData.village = '' - // formData.brigade = '' - // currentAddressIndex.value = 0 - // tabsList.forEach(item => { - // item.name = '请选择' - // }) }, 30000) - - // uni.$u.toast('操作成功'); - }) getCount() getLists() diff --git a/pages/cart/cart.vue b/pages/cart/cart.vue index 13f6a8b..01e0222 100644 --- a/pages/cart/cart.vue +++ b/pages/cart/cart.vue @@ -109,14 +109,11 @@ - - + + 去结算({{checkAll}}) - - ¥500起订 - + @@ -206,22 +203,22 @@ // 购物车相关 const addCart = (id, cart_num) => { //加入购物车 - if (uni.getStorageSync('STORE_INFO').length) { - let data = JSON.parse(uni.getStorageSync('STORE_INFO')) - let STORE_INFO = {}; - for (let key in data) { - STORE_INFO[key] = data[key] - } - cartCreateApi({ - cart_num: +cart_num, - product_id: id, - store_id: STORE_INFO.id - // store_id: - }).then(res => { - getcartList(); - }) - } - + if (uni.getStorageSync('STORE_INFO').length) { + let data = JSON.parse(uni.getStorageSync('STORE_INFO')) + let STORE_INFO = {}; + for (let key in data) { + STORE_INFO[key] = data[key] + } + cartCreateApi({ + cart_num: +cart_num, + product_id: id, + store_id: STORE_INFO.id + // store_id: + }).then(res => { + getcartList(); + }) + } + } const isAdmin = ref(false); //是否管理 @@ -253,10 +250,10 @@ } else { checkAll.value = 0 } - res.data.lists = res.data.lists.map(item => { - if(!item.price) item.price = item.sell; // 兼容旧数据,新数据已经添加了price字段 - return item; - }) + res.data.lists = res.data.lists.map(item => { + if (!item.price) item.price = item.sell; // 兼容旧数据,新数据已经添加了price字段 + return item; + }) cartList.value = res.data.lists; cartInfo.value = { total_price: res.data?.extend.total_price || '0.00', diff --git a/pages/index/index.vue b/pages/index/index.vue index 749cef2..d247609 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -148,26 +148,24 @@ {{ item.store_name }} - - {{ item.spec }} + + + + + 活动价: ¥ {{ 66.65}} + + /{{ item.unit_name }} - - 起批量: {{ item.batch }}{{ item.unit_name }}起卖 + + 原价: {{ item.store_name }} + + + 规格: {{ item.price }}/{{ item.unit_name }} - - - ¥{{ item.price }}/{{ item.unit_name }} + 起批量: {{ item.batch }}{{ item.unit_name }}起卖 @@ -185,19 +183,14 @@ 合计 ¥{{ cartInfo.total_price }} - ¥{{ cartInfo.total_price }} - 优惠后 - {{ cartInfo.pay_price }} - + + {{cartInfo.msg }} + - - {{ cartInfo.total_price < 500 ? "¥500起订" : "结算" }} + 结算 @@ -557,7 +550,8 @@ const cartInfo = ref({ total_price: '0.00', pay_price: 0, - count: 0 + count: 0, + msg: '' }) const getCartList = (res) => { cartListApi({ @@ -567,6 +561,7 @@ cartInfo.value = { total_price: res.data?.extend?.total_price || '0.00', pay_price: res.data?.extend?.pay_price || '0.00', + msg: res.data?.extend?.msg || '', count: res.data?.count || 0 } cartStore.setCartList(res.data?.lists.map(item => item.id)) @@ -980,8 +975,8 @@ display: flex; .shop-img { - height: 120rpx; - width: 120rpx; + height: 164rpx; + width: 164rpx; margin-right: 20rpx; border-radius: 14rpx; overflow: hidden;