From f2ebcbc752ce7a0d3d04a1c02bb872165d403387 Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Sat, 21 Jun 2025 14:25:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=BB=84=E4=BB=B6=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在config.js中添加local环境配置,便于本地开发调试 - QuickOrderEntry组件增加事件监听,优化定时器间隔为30秒 - firmOrder页面添加key属性,完善商品选择和订单创建逻辑 - 订单创建和取消时触发事件更新快速订单信息 --- components/QuickOrderEntry.vue | 5 ++++- config.js | 5 ++++- pages_order/order/firmOrder.vue | 20 +++++++++++++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/components/QuickOrderEntry.vue b/components/QuickOrderEntry.vue index b8d99ca..393fb70 100644 --- a/components/QuickOrderEntry.vue +++ b/components/QuickOrderEntry.vue @@ -52,10 +52,13 @@ export default { this.getQuickOrderInfo() // 开启定时器,每30秒更新一次数据 this.startTimer() + + uni.$on('getQuickOrderInfo', this.getQuickOrderInfo) }, beforeDestroy() { // 组件销毁前清除定时器 this.clearTimer() + uni.$off('getQuickOrderInfo', this.getQuickOrderInfo) }, methods: { // 处理点击事件 @@ -190,7 +193,7 @@ export default { if (uni.getStorageSync('token')) { this.getQuickOrderInfo() } - }, 15000) + }, 30000) }, // 清除定时器 diff --git a/config.js b/config.js index 56cbd86..4c91149 100644 --- a/config.js +++ b/config.js @@ -7,11 +7,14 @@ import uvUI from '@/uni_modules/uv-ui-tools' Vue.use(uvUI); // 当前环境 -const type = 'prod' +const type = 'local' // 环境配置 const config = { + local : { + baseUrl : 'http://127.0.0.1:8002/building-admin', + }, dev : { baseUrl : 'http://h5.xzaiyp.top/building-admin', }, diff --git a/pages_order/order/firmOrder.vue b/pages_order/order/firmOrder.vue index a307017..1c93417 100644 --- a/pages_order/order/firmOrder.vue +++ b/pages_order/order/firmOrder.vue @@ -19,7 +19,8 @@ 商品信息 - + { if (res.code === 200 && res.result) { // 如果返回商品信息,则设置商品信息 commonShop - this.productInfo = res.result; - this.productInfo.commonShop.forEach(n => { + if(res.result.shopRecommends){ + res.result.shopRecommends = JSON.parse(res.result.shopRecommends) + } + + res.result.commonShop.forEach(n => { this.checkboxValue.push(n.id) + + if(typeof res.result.shopRecommends == 'object'){ + n.selectNum = res.result.shopRecommends[n.id] + } }) + + console.log(res.result); + + this.productInfo = res.result; } }); }, @@ -323,6 +335,7 @@ this.$api('createSumOrder', data, res => { uni.hideLoading(); if (res.code === 200) { + uni.$emit('getQuickOrderInfo') uni.requestPaymentWxPay(res) .then(e => { uni.showToast({ @@ -357,6 +370,7 @@ this.$api('cancelOrderFast', { orderId : this.orderId }).then(res => { + uni.$emit('getQuickOrderInfo') uni.showToast({ title: '取消成功', icon: 'none',