main
fanfan 1 year ago
parent c4afe65700
commit 5b4fbb4916
  1. 2
      pages/goods/detail.vue
  2. 74
      pages/sureOrder/index.vue

@ -569,7 +569,7 @@
data data
} = await GoodsApi.getGoodsStock(params); } = await GoodsApi.getGoodsStock(params);
if (status == 200) { if (status == 200) {
this.stockValue = data.stock this.stockValue = data[0].state
} }
}, },
async getProvinceAll() { async getProvinceAll() {

@ -124,28 +124,34 @@
<image :src="$picUrl+'/static/order/left.png'" mode="" class="leftIcon"></image> <image :src="$picUrl+'/static/order/left.png'" mode="" class="leftIcon"></image>
</view> </view>
<view class="goods" v-for="(item, index) in order.goodsList" :key="index"> <view class="goods" v-for="(item, index) in order.goodsList" :key="index">
<view class="goodsImg"> <view class="goodsBox" :style="{'opacity': item.stockValue=='有货'?1:0.6 }">
<image :src="item.goods_image" mode=""></image> <view class="goodsImg">
</view> <image :src="item.goods_image" mode=""></image>
<view class="goodsInfo">
<view class="goodsName">
{{ item.goods_name }}
</view> </view>
<!-- 商品规格 --> <view class="goodsInfo">
<view class="goods-props"> <view class="goodsName">
<view class="goods-props-item" v-for="(props, idx) in item.skuInfo.goods_props" :key="idx"> {{ item.goods_name }}
<text class="group-name">{{ props.group.name }}: </text> </view>
<text>{{ props.value.name }}</text> <!-- 商品规格 -->
<view class="goods-props">
<view class="goods-props-item" v-for="(props, idx) in item.skuInfo.goods_props" :key="idx">
<text class="group-name">{{ props.group.name }}: </text>
<text>{{ props.value.name }}</text>
</view>
</view>
<view class="goodsPrice">
<text>{{item.goods_price_min?Number(item.goods_price_min):item.goods_price_min}}</text>
</view> </view>
</view> </view>
<view class="goodsPrice"> <view class="goodsNum">
<text>{{item.goods_price_min?Number(item.goods_price_min):item.goods_price_min}}</text> x{{ item.total_num }}
</view> </view>
</view> </view>
<view class="goodsNum"> <view style="color: red;font-size: 24rpx;margin-left: 182rpx;" v-if="item.stockValue=='无货'">
x{{ item.total_num }} 该商品暂时无货
</view> </view>
</view> </view>
</view> </view>
<view class="timer"> <view class="timer">
<view class="youTime" style="width: 60rpx;"> <view class="youTime" style="width: 60rpx;">
@ -246,11 +252,11 @@
<text class="type"></text> <text class="type"></text>
<text class="price">{{order.orderPayPrice?Number(order.orderPayPrice):order.orderPayPrice}}</text> <text class="price">{{order.orderPayPrice?Number(order.orderPayPrice):order.orderPayPrice}}</text>
</view> </view>
<view class="btn" @click="onSubmitOrder()" v-if="stockValue=='有货'"> <view class="btn" @click="onSubmitOrder()" v-if="stockValue==true">
提交订单 提交订单
</view> </view>
<view class="btn" style="background: #cecece;" v-else> <view class="btn" style="background: #cecece;" v-else>
无货 提交订单
</view> </view>
</view> </view>
<!-- 优惠券弹出框 --> <!-- 优惠券弹出框 -->
@ -441,7 +447,7 @@
setting: {}, setting: {},
timer: "", timer: "",
distance_unit: "", distance_unit: "",
stockValue: '有货', stockValue: true,
addressResult: { addressResult: {
province: '江苏省', province: '江苏省',
city: '南京市', city: '南京市',
@ -485,8 +491,8 @@
methods: { methods: {
async getGoodsStockInfor(order) { async getGoodsStockInfor(order) {
console.log(order)
let that = this let that = this
let step = 0
let list = []; let list = [];
order.goodsList.forEach(item => { order.goodsList.forEach(item => {
list.push({ list.push({
@ -494,11 +500,11 @@
num: item.total_num 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.province = order.extractShop ? order.extractShop.region.province : '江苏省'
that.addressResult.city = order.extractShop ? order.extractShop.region.city : '南京市' that.addressResult.city = order.extractShop ? order.extractShop.region.city : '南京市'
that.addressResult.district = order.extractShop ? order.extractShop.region.region : '玄武区' that.addressResult.district = order.extractShop ? order.extractShop.region.region : '玄武区'
}else{ } else {
that.addressResult.province = order.address ? order.address.region.province : '江苏省' that.addressResult.province = order.address ? order.address.region.province : '江苏省'
that.addressResult.city = order.address ? order.address.region.city : '南京市' that.addressResult.city = order.address ? order.address.region.city : '南京市'
that.addressResult.district = order.address ? order.address.region.region : '玄武区' that.addressResult.district = order.address ? order.address.region.region : '玄武区'
@ -515,7 +521,22 @@
data data
} = await GoodsApi.getGoodsStock(params); } = await GoodsApi.getGoodsStock(params);
if (status == 200) { 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() { toStore() {
@ -1316,10 +1337,13 @@
} }
.goods { .goods {
display: flex;
align-items: center;
margin-top: 28rpx; margin-top: 28rpx;
justify-content: space-between;
.goodsBox {
display: flex;
align-items: center;
justify-content: space-between;
}
.goodsImg { .goodsImg {
width: 162rpx; width: 162rpx;

Loading…
Cancel
Save