Browse Source

feat: 添加本地环境配置并优化订单组件交互

- 在config.js中添加local环境配置,便于本地开发调试
- QuickOrderEntry组件增加事件监听,优化定时器间隔为30秒
- firmOrder页面添加key属性,完善商品选择和订单创建逻辑
- 订单创建和取消时触发事件更新快速订单信息
master
前端-胡立永 2 weeks ago
parent
commit
f2ebcbc752
3 changed files with 25 additions and 5 deletions
  1. +4
    -1
      components/QuickOrderEntry.vue
  2. +4
    -1
      config.js
  3. +17
    -3
      pages_order/order/firmOrder.vue

+ 4
- 1
components/QuickOrderEntry.vue View File

@ -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)
},
//


+ 4
- 1
config.js View File

@ -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',
},


+ 17
- 3
pages_order/order/firmOrder.vue View File

@ -19,7 +19,8 @@
<text>商品信息</text>
</view>
<view class="product-card" v-for="(info, index) in productInfo.commonShop">
<view class="product-card" v-for="(info, index) in productInfo.commonShop"
:key="index">
<view class="checkbox">
<uv-checkbox
@ -180,11 +181,22 @@
}, res => {
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',


Loading…
Cancel
Save