|
@@ -54,7 +54,7 @@
|
|
|
<view class="gg-box flex-index-css">
|
|
<view class="gg-box flex-index-css">
|
|
|
<view class="flex-justify-space box-border-box p-32">
|
|
<view class="flex-justify-space box-border-box p-32">
|
|
|
<view class="fs-32 fw-500 fc-0">商品详情规格</view>
|
|
<view class="fs-32 fw-500 fc-0">商品详情规格</view>
|
|
|
- <view class="" @click="addred(4)">
|
|
|
|
|
|
|
+ <view class="" @click="gbPop">
|
|
|
<uni-icons type="closeempty" size="20"></uni-icons>
|
|
<uni-icons type="closeempty" size="20"></uni-icons>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -164,10 +164,10 @@
|
|
|
line_price: '',
|
|
line_price: '',
|
|
|
num: 0,
|
|
num: 0,
|
|
|
goods_id: '',
|
|
goods_id: '',
|
|
|
- is_quota: 0,
|
|
|
|
|
- is_infinite: 0,
|
|
|
|
|
- quota_num: 0,
|
|
|
|
|
- stock: 0,
|
|
|
|
|
|
|
+ is_quota: 0,
|
|
|
|
|
+ is_infinite: 0,
|
|
|
|
|
+ quota_num: 0,
|
|
|
|
|
+ stock: 0,
|
|
|
spec_key: '',
|
|
spec_key: '',
|
|
|
goods_spec_id: '',
|
|
goods_spec_id: '',
|
|
|
spec_name: [],
|
|
spec_name: [],
|
|
@@ -205,13 +205,13 @@
|
|
|
} else {
|
|
} else {
|
|
|
// 加
|
|
// 加
|
|
|
++this.popData.num;
|
|
++this.popData.num;
|
|
|
- if(this.popData.is_infinite>0 && this.popData.num >this.popData.stock){
|
|
|
|
|
- tools.error('最多购买'+this.popData.quota_num+'件')
|
|
|
|
|
- this.popData.num=this.popData.stock
|
|
|
|
|
- }else if(this.popData.is_quota>0 && this.popData.num >this.popData.quota_num){
|
|
|
|
|
- tools.error('限购'+this.popData.quota_num+'件')
|
|
|
|
|
- this.popData.num=this.popData.quota_num
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (this.popData.is_infinite > 0 && this.popData.num > this.popData.stock) {
|
|
|
|
|
+ tools.error('最多购买' + this.popData.quota_num + '件')
|
|
|
|
|
+ this.popData.num = this.popData.stock
|
|
|
|
|
+ } else if (this.popData.is_quota > 0 && this.popData.num > this.popData.quota_num) {
|
|
|
|
|
+ tools.error('限购' + this.popData.quota_num + '件')
|
|
|
|
|
+ this.popData.num = this.popData.quota_num
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -251,38 +251,38 @@
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
setGoodsSpecPrice() {
|
|
setGoodsSpecPrice() {
|
|
|
- console.log(this.popData.spec_ids)
|
|
|
|
|
|
|
+ console.log(this.popData.spec_ids)
|
|
|
if (this.popData.spec_ids.length > 0) {
|
|
if (this.popData.spec_ids.length > 0) {
|
|
|
let spec_ids = JSON.parse(JSON.stringify(this.popData.spec_ids))
|
|
let spec_ids = JSON.parse(JSON.stringify(this.popData.spec_ids))
|
|
|
spec_ids.sort((a, b) => a - b);
|
|
spec_ids.sort((a, b) => a - b);
|
|
|
let spec_key = spec_ids.join('_')
|
|
let spec_key = spec_ids.join('_')
|
|
|
this.popData.spec_key = spec_key
|
|
this.popData.spec_key = spec_key
|
|
|
- console.log('this.popData.spec_list[spec_key]',this.popData.spec_list[spec_key])
|
|
|
|
|
|
|
+ console.log('this.popData.spec_list[spec_key]', this.popData.spec_list[spec_key])
|
|
|
if (this.popData.spec_list[spec_key] !== undefined) {
|
|
if (this.popData.spec_list[spec_key] !== undefined) {
|
|
|
this.popData.price = this.popData.spec_list[spec_key].seckill_money > 0 ? this.popData.spec_list[
|
|
this.popData.price = this.popData.spec_list[spec_key].seckill_money > 0 ? this.popData.spec_list[
|
|
|
spec_key].seckill_money : this.popData.spec_list[spec_key].price
|
|
spec_key].seckill_money : this.popData.spec_list[spec_key].price
|
|
|
this.popData.line_price = this.popData.spec_list[spec_key].line_price
|
|
this.popData.line_price = this.popData.spec_list[spec_key].line_price
|
|
|
- if(this.popData.goods_spec_id!==this.popData.spec_list[spec_key].goods_spec_id + ''){
|
|
|
|
|
- this.popData.num =1
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (this.popData.goods_spec_id !== this.popData.spec_list[spec_key].goods_spec_id + '') {
|
|
|
|
|
+ this.popData.num = 1
|
|
|
|
|
+ }
|
|
|
this.popData.goods_spec_id = this.popData.spec_list[spec_key].goods_spec_id + ''
|
|
this.popData.goods_spec_id = this.popData.spec_list[spec_key].goods_spec_id + ''
|
|
|
let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id * 1 === row
|
|
let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id * 1 === row
|
|
|
.goods_spec_id * 1)
|
|
.goods_spec_id * 1)
|
|
|
if (cartKey >= 0) {
|
|
if (cartKey >= 0) {
|
|
|
this.popData.num = this.cartData.goods_list[cartKey].goods_number
|
|
this.popData.num = this.cartData.goods_list[cartKey].goods_number
|
|
|
}
|
|
}
|
|
|
- }else {
|
|
|
|
|
- this.popData.line_price ='0.00'
|
|
|
|
|
- this.popData.price ='0.00'
|
|
|
|
|
- this.popData.num =0
|
|
|
|
|
- this.popData.goods_spec_id =''
|
|
|
|
|
- }
|
|
|
|
|
- }else {
|
|
|
|
|
- this.popData.price ='0.00'
|
|
|
|
|
- this.popData.line_price ='0.00'
|
|
|
|
|
- this.popData.num =0
|
|
|
|
|
- this.popData.goods_spec_id =''
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.popData.line_price = '0.00'
|
|
|
|
|
+ this.popData.price = '0.00'
|
|
|
|
|
+ this.popData.num = 0
|
|
|
|
|
+ this.popData.goods_spec_id = ''
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.popData.price = '0.00'
|
|
|
|
|
+ this.popData.line_price = '0.00'
|
|
|
|
|
+ this.popData.num = 0
|
|
|
|
|
+ this.popData.goods_spec_id = ''
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
setShopIngList(cartData) {
|
|
setShopIngList(cartData) {
|
|
|
this.cartData = cartData
|
|
this.cartData = cartData
|
|
@@ -302,22 +302,22 @@
|
|
|
setGoodsNum() {
|
|
setGoodsNum() {
|
|
|
|
|
|
|
|
if (this.cartData.goods_list.length > 0) {
|
|
if (this.cartData.goods_list.length > 0) {
|
|
|
- let goodsIds = []
|
|
|
|
|
- this.categoryData.forEach(categoryItem => {
|
|
|
|
|
- categoryItem.list.forEach(goodsItem => {
|
|
|
|
|
- goodsItem.num =0
|
|
|
|
|
- this.cartData.goods_list.forEach(item => {
|
|
|
|
|
- if (item.goods_id === goodsItem.goods_id){
|
|
|
|
|
- if (goodsIds.indexOf(item.goods_id) < 0) {
|
|
|
|
|
- goodsIds.push(item.goods_id)
|
|
|
|
|
- goodsItem.num = item.goods_number * 1
|
|
|
|
|
- } else {
|
|
|
|
|
- goodsItem.num += item.goods_number * 1
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ let goodsIds = []
|
|
|
|
|
+ this.categoryData.forEach(categoryItem => {
|
|
|
|
|
+ categoryItem.list.forEach(goodsItem => {
|
|
|
|
|
+ goodsItem.num = 0
|
|
|
|
|
+ this.cartData.goods_list.forEach(item => {
|
|
|
|
|
+ if (item.goods_id === goodsItem.goods_id) {
|
|
|
|
|
+ if (goodsIds.indexOf(item.goods_id) < 0) {
|
|
|
|
|
+ goodsIds.push(item.goods_id)
|
|
|
|
|
+ goodsItem.num = item.goods_number * 1
|
|
|
|
|
+ } else {
|
|
|
|
|
+ goodsItem.num += item.goods_number * 1
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
//购物车数据清除
|
|
//购物车数据清除
|
|
@@ -395,27 +395,27 @@
|
|
|
} else if (type === 2) {
|
|
} else if (type === 2) {
|
|
|
// 加
|
|
// 加
|
|
|
|
|
|
|
|
- if(item.is_infinite>0 && item.num >=item.stock){
|
|
|
|
|
- tools.error('最多购买'+item.quota_num+'件')
|
|
|
|
|
- this.isAjax = false
|
|
|
|
|
- }else if(item.is_quota>0 && item.num >=item.quota_num){
|
|
|
|
|
- tools.error('限购'+item.quota_num+'件')
|
|
|
|
|
- this.isAjax = false
|
|
|
|
|
- }else {
|
|
|
|
|
- this.setSub(item, type);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (item.is_infinite > 0 && item.num >= item.stock) {
|
|
|
|
|
+ tools.error('最多购买' + item.quota_num + '件')
|
|
|
|
|
+ this.isAjax = false
|
|
|
|
|
+ } else if (item.is_quota > 0 && item.num >= item.quota_num) {
|
|
|
|
|
+ tools.error('限购' + item.quota_num + '件')
|
|
|
|
|
+ this.isAjax = false
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.setSub(item, type);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
} else if (type === 3) {
|
|
} else if (type === 3) {
|
|
|
// 选规格
|
|
// 选规格
|
|
|
- this.popData.is_quota=item.is_quota
|
|
|
|
|
- this.popData.quota_num=item.quota_num
|
|
|
|
|
- this.popData.is_infinite=item.is_infinite
|
|
|
|
|
- this.popData.stock=item.stock
|
|
|
|
|
- this.getShopGoodsSpec(item)
|
|
|
|
|
|
|
+ this.popData.is_quota = item.is_quota
|
|
|
|
|
+ this.popData.quota_num = item.quota_num
|
|
|
|
|
+ this.popData.is_infinite = item.is_infinite
|
|
|
|
|
+ this.popData.stock = item.stock
|
|
|
|
|
+ this.getShopGoodsSpec(item)
|
|
|
} else {
|
|
} else {
|
|
|
this.$refs.popupGG.close();
|
|
this.$refs.popupGG.close();
|
|
|
- console.log('this.popData.goods_spec_id')
|
|
|
|
|
- console.log(this.popData.goods_spec_id)
|
|
|
|
|
|
|
+ console.log('this.popData.goods_spec_id')
|
|
|
|
|
+ console.log(this.popData.goods_spec_id)
|
|
|
if (this.popData.goods_spec_id) {
|
|
if (this.popData.goods_spec_id) {
|
|
|
let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id === row
|
|
let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id === row
|
|
|
.goods_spec_id)
|
|
.goods_spec_id)
|
|
@@ -430,12 +430,15 @@
|
|
|
.popData
|
|
.popData
|
|
|
.goods_spec_id, this.popData.num)
|
|
.goods_spec_id, this.popData.num)
|
|
|
}
|
|
}
|
|
|
- }else {
|
|
|
|
|
- console.log('无规格信息')
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log('无规格信息')
|
|
|
|
|
+ }
|
|
|
this.isAjax = false
|
|
this.isAjax = false
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ gbPop() {
|
|
|
|
|
+ this.$refs.popupGG.close();
|
|
|
|
|
+ },
|
|
|
setSub(item, type) {
|
|
setSub(item, type) {
|
|
|
let cartKey = this.cartData.goods_list.findIndex(row => row.goods_id === item.goods_id)
|
|
let cartKey = this.cartData.goods_list.findIndex(row => row.goods_id === item.goods_id)
|
|
|
if (type === 2 && cartKey < 0) {
|
|
if (type === 2 && cartKey < 0) {
|
|
@@ -722,4 +725,4 @@
|
|
|
.goods-name {
|
|
.goods-name {
|
|
|
max-width: 310rpx;
|
|
max-width: 310rpx;
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|