Commit 41fbb43fe6635ca894ba3209f07485ac0d4ef97b

Authored by zhiyangdu
1 parent 2b63a8c7

商品详情页样式优化

src/pages/goodDetails/goodDetails.vue
... ... @@ -44,7 +44,7 @@
44 44 </div>
45 45 <!-- 积分 -->
46 46 <div class="title-t">
47   - <div v-show="parseInt(goodsInfo.price)>0" class="goods_tip">
  47 + <div v-show="goodsInfo && parseInt(goodsInfo.price)>0" class="goods_tip">
48 48 积分+现金
49 49 </div>
50 50 <div>
... ... @@ -137,7 +137,7 @@
137 137 <!-- 商品信息 -->
138 138 <div class="goods_box">
139 139 <div class="item_pic_box">
140   - <img class="item_pic" :src="goodsInfo.simg" alt="" />
  140 + <img class="item_pic" :src="goodsInfo && goodsInfo.simg" alt="" />
141 141 </div>
142 142 <div class="right">
143 143 <!-- 标题 -->
... ... @@ -156,7 +156,7 @@
156 156 <div class="num_box">
157 157 <div class="num_tip">购买数量</div>
158 158 <div class="right">
159   - <van-stepper theme="round" input-width="40px" input-size="32px" button-size="32px" v-model="stepperValue" min="1" :max="(goodsInfo && goodsInfo.stock > -1) ?goodsInfo.stock :'999'" integer />
  159 + <van-stepper theme="round" input-width="40px" input-size="32px" button-size="32px" v-model="stepperValue" min="1" :max="(goodsInfo && goodsInfo.stock > -1) ?goodsInfo.stock :'999'" integer async-change @change="onChange"/>
160 160 <!-- <img src="static/img/reduce.png" alt="" />
161 161 <div class="num">1</div>
162 162 <img src="static/img/plus.png" alt="" /> -->
... ... @@ -552,6 +552,13 @@ export default {
552 552 }
553 553 }
554 554 },
  555 + // 判断值是否大于库存
  556 + onChange(value) {
  557 + if(this.goodsInfo.stock > -1 && value > this.goodsInfo.stock){
  558 + Toast("库存不足")
  559 + }
  560 +
  561 + },
555 562 },
556 563 //请求数据
557 564 created () {
... ...