From 3cb4dc104c88a2d6f9b0272ad7d88794ce139d0b Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Sun, 26 Feb 2023 11:23:36 +0800 Subject: [PATCH] confirm_order loading --- src/pages/confirm_order/confirm_order.vue | 46 +++++++++++++---------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/pages/confirm_order/confirm_order.vue b/src/pages/confirm_order/confirm_order.vue index ac6587b..c85dd5c 100644 --- a/src/pages/confirm_order/confirm_order.vue +++ b/src/pages/confirm_order/confirm_order.vue @@ -179,7 +179,13 @@ addressId: '', couponId: '', goodsList: [], - orderInfo: {}, + orderInfo: { + products_total_amount: '', + shipping_fee: '', + coupon_discount_amount: '', + vip_discount_amount: '', + total_amount: '', + }, addressList: [], remarks: '', tempCouponId: '', @@ -194,7 +200,7 @@ mid: '', }; }, - onLoad(options) { + async onLoad(options) { let data = {} if (options.data) { data = JSON.parse(decodeURIComponent(options.data)); @@ -206,25 +212,25 @@ else if (options.store_cart) { // 桌号 id let desk = uni.getStorageSync('desk') - this.$api.get(`/v1/store/desk/${desk}`).then(res => { - this.desk = res - this.type = 'desk' - this.remarks = '桌号:' + this.desk.name - // 商户 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() - }) + uni.showLoading() + let res = await this.$api.get(`/v1/store/desk/${desk}`) + this.desk = res + this.type = 'desk' + this.remarks = '桌号:' + this.desk.name + // 商户 id + this.mid = options.mid + // 购物车商品 id + let ids = options.store_cart.split(',').map(value => parseInt(value)) + res = await this.$store.dispatch('storeCart/getCart') + 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() + uni.hideLoading() } else { this.type = data.type; this.goods = data?.goods ?? [];