|
@@ -83,9 +83,11 @@
|
|
|
<view class="product_attr" v-for="(spec,spec_index) in productInfo.product_attr" :key="spec_index">
|
|
|
<view class="spec_name">{{ spec.spec_name }}</view>
|
|
|
<view class="arrt_list">
|
|
|
- <view class="arrt_option" :class="option.active?'active':''" v-for="(option,attr_index) in spec.attr_list" :key="attr_index" @click="attrChange(spec_index,attr_index)">
|
|
|
- {{option.name}}
|
|
|
- </view>
|
|
|
+ <scroll-view scroll-y="true" class="scroll_y" >
|
|
|
+ <view class="arrt_option" :class="option.active?'active':''" v-for="(option,attr_index) in spec.attr_list" :key="attr_index" @click="attrChange(spec_index,attr_index)">
|
|
|
+ {{option.name}}
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -244,7 +246,14 @@
|
|
|
uni.$on('addr_list_change',function(data){
|
|
|
// 地址列表
|
|
|
that.addrList = data.list;
|
|
|
+ });
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ //分享按钮
|
|
|
+ uni.showShareMenu({
|
|
|
+ withShareTicket: true,
|
|
|
+ menus: ['shareAppMessage', 'shareTimeline']
|
|
|
})
|
|
|
+ // #endif
|
|
|
},
|
|
|
onShow() {
|
|
|
// 没有添加客服就不显示
|
|
@@ -351,6 +360,15 @@
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
+ // 如果大于库存设置为库存
|
|
|
+ if( this.productInfo.stock < this.quantity ) {
|
|
|
+ this.quantity = this.productInfo.stock;
|
|
|
+ uni.showToast({
|
|
|
+ title:"库存不足",
|
|
|
+ icon:"none"
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
// 地址未填
|
|
|
if( !this.checkedAddr.id ) {
|
|
|
uni.showToast({
|
|
@@ -396,7 +414,7 @@
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
- // 如果大于库存设置为库存
|
|
|
+ // 如果库存不足
|
|
|
if( this.productInfo.stock < 1 ) {
|
|
|
uni.showToast({
|
|
|
title:"库存不足",
|
|
@@ -404,6 +422,15 @@
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
+ // 如果大于库存设置为库存
|
|
|
+ if( this.productInfo.stock < this.quantity ) {
|
|
|
+ this.quantity = this.productInfo.stock;
|
|
|
+ uni.showToast({
|
|
|
+ title:"库存不足",
|
|
|
+ icon:"none"
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
// 商品信息
|
|
|
let data = {product_id:this.productInfo.id,buy_num:this.quantity,skuid:this.sku_id};
|
|
|
// 请求接口
|
|
@@ -721,7 +748,7 @@
|
|
|
// 设置有SKU
|
|
|
haveSku = 1;
|
|
|
// 获取当前匹配到的SKU的状态
|
|
|
- currentSKUStatus = this.productInfo.product_sku[i].status;
|
|
|
+ currentSKUStatus = this.productInfo.product_sku[i].status;
|
|
|
// 如果商品已经下架(status等于1),则恢复当前规格下所有属性原来的active状态
|
|
|
if(currentSKUStatus === 1){
|
|
|
uni.showToast({title:"该规格已下架",icon:"none"});
|
|
@@ -730,6 +757,14 @@
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
+ // 如果商品没有库存
|
|
|
+ if( this.productInfo.product_sku[i].stock <= 0 ){
|
|
|
+ uni.showToast({title:"该规格库存不足",icon:"none"});
|
|
|
+ for (let k in originalActiveStates) {
|
|
|
+ this.productInfo.product_attr[spec_index].attr_list[k].active = originalActiveStates[k];
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
// 产品价格修改
|
|
|
this.productInfo.price = this.productInfo.product_sku[i].price;
|
|
|
// 产品规格修改
|
|
@@ -1148,20 +1183,23 @@
|
|
|
.arrt_list{
|
|
|
display: block;
|
|
|
overflow: hidden;
|
|
|
- .arrt_option{
|
|
|
- float: left;
|
|
|
- height: 40rpx;
|
|
|
- font-size: 28rpx;
|
|
|
- line-height: 40rpx;
|
|
|
- text-align: center;
|
|
|
- border-radius: 6rpx;
|
|
|
- padding: 10rpx 30rpx;
|
|
|
- margin: 20rpx;
|
|
|
- background-color: #EEEEEE;
|
|
|
- }
|
|
|
- .arrt_option.active {
|
|
|
- color: #FFFFFF;
|
|
|
- background-color: #fE6000;
|
|
|
+ .scroll_y{
|
|
|
+ height: 240rpx;
|
|
|
+ .arrt_option{
|
|
|
+ float: left;
|
|
|
+ height: 40rpx;
|
|
|
+ font-size: 28rpx;
|
|
|
+ line-height: 40rpx;
|
|
|
+ text-align: center;
|
|
|
+ border-radius: 6rpx;
|
|
|
+ padding: 10rpx 30rpx;
|
|
|
+ margin: 20rpx;
|
|
|
+ background-color: #EEEEEE;
|
|
|
+ }
|
|
|
+ .arrt_option.active {
|
|
|
+ color: #FFFFFF;
|
|
|
+ background-color: #fE6000;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|