Commit 41fbb43fe6635ca894ba3209f07485ac0d4ef97b
1 parent
2b63a8c7
商品详情页样式优化
Showing
1 changed file
with
10 additions
and
3 deletions
src/pages/goodDetails/goodDetails.vue
| @@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
| 44 | </div> | 44 | </div> |
| 45 | <!-- 积分 --> | 45 | <!-- 积分 --> |
| 46 | <div class="title-t"> | 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 | </div> | 49 | </div> |
| 50 | <div> | 50 | <div> |
| @@ -137,7 +137,7 @@ | @@ -137,7 +137,7 @@ | ||
| 137 | <!-- 商品信息 --> | 137 | <!-- 商品信息 --> |
| 138 | <div class="goods_box"> | 138 | <div class="goods_box"> |
| 139 | <div class="item_pic_box"> | 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 | </div> | 141 | </div> |
| 142 | <div class="right"> | 142 | <div class="right"> |
| 143 | <!-- 标题 --> | 143 | <!-- 标题 --> |
| @@ -156,7 +156,7 @@ | @@ -156,7 +156,7 @@ | ||
| 156 | <div class="num_box"> | 156 | <div class="num_box"> |
| 157 | <div class="num_tip">购买数量</div> | 157 | <div class="num_tip">购买数量</div> |
| 158 | <div class="right"> | 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 | <!-- <img src="static/img/reduce.png" alt="" /> | 160 | <!-- <img src="static/img/reduce.png" alt="" /> |
| 161 | <div class="num">1</div> | 161 | <div class="num">1</div> |
| 162 | <img src="static/img/plus.png" alt="" /> --> | 162 | <img src="static/img/plus.png" alt="" /> --> |
| @@ -552,6 +552,13 @@ export default { | @@ -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 | created () { | 564 | created () { |