From 0a7e7ef725290cae539914967c61ab54b3056733 Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Fri, 24 Feb 2023 17:07:25 +0800 Subject: [PATCH] config --- .env.production | 4 +- src/pageB/select_product/cart.vue | 2 +- src/pageB/select_product/search.vue | 5 +- src/pages/confirm_order/confirm_order.vue | 76 ++++++++++++----------- 4 files changed, 47 insertions(+), 40 deletions(-) diff --git a/.env.production b/.env.production index 98c2cae..bea88e8 100644 --- a/.env.production +++ b/.env.production @@ -1,6 +1,6 @@ ENV = 'production' -VUE_APP_BASE_API = 'https://jiqu-library.peidikeji.cn/api' -#VUE_APP_BASE_API = 'https://jiqu-library.abcdefg.fun/api' +#VUE_APP_BASE_API = 'https://jiqu-library.peidikeji.cn/api' +VUE_APP_BASE_API = 'https://jiqu-library.abcdefg.fun/api' diff --git a/src/pageB/select_product/cart.vue b/src/pageB/select_product/cart.vue index c0f8755..08a5c5f 100644 --- a/src/pageB/select_product/cart.vue +++ b/src/pageB/select_product/cart.vue @@ -128,7 +128,7 @@ export default { }, }, selectedLength() { - return this.cartList.length; + return this.selectedCart.length; }, height() { diff --git a/src/pageB/select_product/search.vue b/src/pageB/select_product/search.vue index 16826e1..8dd767d 100644 --- a/src/pageB/select_product/search.vue +++ b/src/pageB/select_product/search.vue @@ -121,7 +121,9 @@ export default { }, onLoad(e) { this.searchText = e.keywords; - this.category = e.cid; + if (e.cid && e.cid != 0) { + this.category = e.cid + } this.mid = e.mid; }, methods: { @@ -129,7 +131,6 @@ export default { if (e == '') uni.navigateBack(); }, Search() { - this.category = ''; this.downCallback(); }, onChangeNumber(e) { diff --git a/src/pages/confirm_order/confirm_order.vue b/src/pages/confirm_order/confirm_order.vue index 3fa0c52..0787777 100644 --- a/src/pages/confirm_order/confirm_order.vue +++ b/src/pages/confirm_order/confirm_order.vue @@ -198,6 +198,10 @@ let data = {} if (options.data) { data = JSON.parse(decodeURIComponent(options.data)); + this.type = data.type; + this.goods = data?.goods ?? []; + this.cards = data?.cards ?? []; + this.cuId = data?.cuId } else if (options.store_cart) { // 桌号 id @@ -205,29 +209,28 @@ this.$api.get(`/v1/store/desk/${desk}`).then(res => { this.desk = res this.type = 'desk' - }) - // 商户 id - this.mid = options.mid - // 购物车商品 id - let ids = options.store_cart.split(',').map(value => parseInt(value)) - this.$store.dispatch('storeCart/getCart').then(res => { - const goods = res.filter(item => ids.indexOf(item.id) >= 0) - this.goods = goods.map(item => { - return { - sku_id: item.id, - num: item.number - } + // 商户 id + this.mid = options.mid + // 购物车商品 id + let ids = options.store_cart.split(',').map(value => parseInt(value)) + this.$store.dispatch('storeCart/getCart').then(res => { + const goods = res.filter(item => ids.indexOf(item.id) >= 0) + this.goods = goods.map(item => { + return { + sku_id: item.id, + num: item.number + } + }) + this.getDetail() }) - this.getDetail() }) + } else { + this.type = data.type; + this.goods = data?.goods ?? []; + this.cards = data?.cards ?? []; + this.cuId = data?.cuId } - uni.$on('address:select', this.addressUpdate); - - this.type = data.type; - this.goods = data?.goods ?? []; - this.cards = data?.cards ?? []; - this.cuId = data?.cuId }, computed: { @@ -299,7 +302,7 @@ params.cuId = this.cuId } else if (this.type == 'cart') { params.shopping_cart = this.cards; - } else { + } else if (this.type == 'desk') { params.products = this.goods.map(item => { return { sku_id: item.sku_id, @@ -307,6 +310,10 @@ } }) } + else { + const {num, sku_id } = this.goods[0]; + params.product = { sku_id: sku_id, quantity: num } + } if (btnLoading) return; btnLoading = true; @@ -323,6 +330,8 @@ params.desk = this.desk.id params.store_id = this.mid order = await this.$api.post(`/v1/order/orders`, params) + // 清空桌号 + uni.clearStorageSync('desk') } else { order = await this.$api.post('/v1/order/orders', params); @@ -369,9 +378,7 @@ this.couponShow = true }, //地址更换 - addressUpdate({ - id - }) { + addressUpdate({id}) { this.addressId = id; }, //确认订单详情 @@ -386,22 +393,21 @@ params.quantity= num } else if(this.type == 'bargains'){ params.bargain_order_id = this.cuId - const { - num, - sku_id - } = this.goods[0]; - params.product = { - sku_id: sku_id, - quantity: num, - }; + const { num, sku_id } = this.goods[0]; + params.product = { sku_id: sku_id, quantity: num }; }else if (this.type == 'cart') { params.shopping_cart = this.cards; + } else if (this.type == 'desk') { + params.store_id = this.mid + params.products = this.goods.map(item => { + return { + sku_id: item.sku_id, + quantity: item.num, + } + }) } else { const { num, sku_id } = this.goods[0]; - params.product = { - sku_id: sku_id, - quantity: num, - }; + params.product = {sku_id: sku_id,quantity: num}; } try { let orderInfo