diff --git a/pages/goods/detail.vue b/pages/goods/detail.vue index 4d4bc1a..19f3898 100644 --- a/pages/goods/detail.vue +++ b/pages/goods/detail.vue @@ -569,7 +569,7 @@ data } = await GoodsApi.getGoodsStock(params); if (status == 200) { - this.stockValue = data.stock + this.stockValue = data[0].state } }, async getProvinceAll() { diff --git a/pages/sureOrder/index.vue b/pages/sureOrder/index.vue index 68dd74d..326222f 100644 --- a/pages/sureOrder/index.vue +++ b/pages/sureOrder/index.vue @@ -124,28 +124,34 @@ - - - - - - {{ item.goods_name }} + + + - - - - {{ props.group.name }}: - {{ props.value.name }}; + + + {{ item.goods_name }} + + + + + {{ props.group.name }}: + {{ props.value.name }}; + + + + ¥ {{item.goods_price_min?Number(item.goods_price_min):item.goods_price_min}} - - ¥ {{item.goods_price_min?Number(item.goods_price_min):item.goods_price_min}} + + x{{ item.total_num }} - - x{{ item.total_num }} + + 该商品暂时无货 + @@ -246,11 +252,11 @@ {{order.orderPayPrice?Number(order.orderPayPrice):order.orderPayPrice}} - + 提交订单 - 无货 + 提交订单 @@ -441,7 +447,7 @@ setting: {}, timer: "", distance_unit: "", - stockValue: '有货', + stockValue: true, addressResult: { province: '江苏省', city: '南京市', @@ -485,8 +491,8 @@ methods: { async getGoodsStockInfor(order) { - console.log(order) let that = this + let step = 0 let list = []; order.goodsList.forEach(item => { list.push({ @@ -494,11 +500,11 @@ num: item.total_num }) }); - if(that.curDelivery == DeliveryTypeEnum.EXTRACT.value){ + if (that.curDelivery == DeliveryTypeEnum.EXTRACT.value) { that.addressResult.province = order.extractShop ? order.extractShop.region.province : '江苏省' that.addressResult.city = order.extractShop ? order.extractShop.region.city : '南京市' that.addressResult.district = order.extractShop ? order.extractShop.region.region : '玄武区' - }else{ + } else { that.addressResult.province = order.address ? order.address.region.province : '江苏省' that.addressResult.city = order.address ? order.address.region.city : '南京市' that.addressResult.district = order.address ? order.address.region.region : '玄武区' @@ -515,7 +521,22 @@ data } = await GoodsApi.getGoodsStock(params); if (status == 200) { - this.stockValue = data.stock + order.goodsList.forEach(item_1 => { + item_1.stockValue = '有货' + data.forEach(item_2 => { + if (item_1.goods_id == item_2.goods_id) { + item_1.stockValue = item_2.state + } + if (item_2.state == '无货') { + step++ + } + }); + }); + if(step>0){ + this.showToast('部分商品无货') + } + that.order = order + this.stockValue = step > 0 ? false : true } }, toStore() { @@ -1316,10 +1337,13 @@ } .goods { - display: flex; - align-items: center; margin-top: 28rpx; - justify-content: space-between; + + .goodsBox { + display: flex; + align-items: center; + justify-content: space-between; + } .goodsImg { width: 162rpx;