|
@@ -248,6 +248,7 @@ export default {
|
|
|
openStoreTime: '',
|
|
openStoreTime: '',
|
|
|
MerchantInfo: uni.getStorageSync("MerchantItem"),
|
|
MerchantInfo: uni.getStorageSync("MerchantItem"),
|
|
|
mda: {},
|
|
mda: {},
|
|
|
|
|
+ accessoriesPrice: 0,
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onReady() {
|
|
onReady() {
|
|
@@ -305,7 +306,8 @@ export default {
|
|
|
let da = res.data.data
|
|
let da = res.data.data
|
|
|
this.goodsOneData = da;
|
|
this.goodsOneData = da;
|
|
|
this.goodShow = true;
|
|
this.goodShow = true;
|
|
|
-
|
|
|
|
|
|
|
+ this.accessoriesPrice = 0
|
|
|
|
|
+ this.childProductData.spec_price = 0
|
|
|
if(this.mda.brand_id == 2) this.naixueSpec()
|
|
if(this.mda.brand_id == 2) this.naixueSpec()
|
|
|
else if(this.mda.brand_id == 13) this.ruixinSpec()
|
|
else if(this.mda.brand_id == 13) this.ruixinSpec()
|
|
|
else if(this.mda.brand_id == 19) this.xichasSpec()
|
|
else if(this.mda.brand_id == 19) this.xichasSpec()
|
|
@@ -320,19 +322,36 @@ export default {
|
|
|
// 选择规格标签 奈雪
|
|
// 选择规格标签 奈雪
|
|
|
naixues(index, key) {
|
|
naixues(index, key) {
|
|
|
let da = this.goodsOneData.details.spu_specs;
|
|
let da = this.goodsOneData.details.spu_specs;
|
|
|
- da[index].values.forEach(value => this.$set(value, 'checked', 0))
|
|
|
|
|
- da[index].values[key].checked = 1
|
|
|
|
|
- this.naixueSpec();
|
|
|
|
|
|
|
+ if(da[index].values[key].checked != 1){
|
|
|
|
|
+ da[index].values.forEach(value => this.$set(value, 'checked', 0))
|
|
|
|
|
+ da[index].values[key].checked = 1
|
|
|
|
|
+ let price = 0
|
|
|
|
|
+ da.forEach(d=>{
|
|
|
|
|
+ d.values.forEach(dd=>{
|
|
|
|
|
+ if(dd.checked == 1){
|
|
|
|
|
+ price = price + dd.price
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ this.childProductData.spec_price = (this.accessoriesPrice>0?this.accessoriesPrice + price : price) || 0
|
|
|
|
|
+ this.naixueSpec();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
naixueSpec(){
|
|
naixueSpec(){
|
|
|
this.childProductData.product_details = []
|
|
this.childProductData.product_details = []
|
|
|
let da = this.goodsOneData.details.spu_specs;
|
|
let da = this.goodsOneData.details.spu_specs;
|
|
|
let arr = [], obj = this.childProductData.selectSpecification || {};
|
|
let arr = [], obj = this.childProductData.selectSpecification || {};
|
|
|
- let arrs = [];
|
|
|
|
|
|
|
+ let arrs = [], sku_code = [];
|
|
|
for (let it of da) {
|
|
for (let it of da) {
|
|
|
for (let i of it.values) {
|
|
for (let i of it.values) {
|
|
|
if(i.checked) {
|
|
if(i.checked) {
|
|
|
arr.push(i);
|
|
arr.push(i);
|
|
|
|
|
+ // sku_code = i.code + (sku_code? ","+ sku_code : "")
|
|
|
|
|
+ sku_code.push(i.code)
|
|
|
obj[it.name] = i.name
|
|
obj[it.name] = i.name
|
|
|
let arrb = []
|
|
let arrb = []
|
|
|
if(arr.length == 1) arrs = this.goodsOneData.details.sku_infos
|
|
if(arr.length == 1) arrs = this.goodsOneData.details.sku_infos
|
|
@@ -347,18 +366,33 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.childProductData.selectSpecArr = arr
|
|
this.childProductData.selectSpecArr = arr
|
|
|
this.childProductData.selectSpecification = obj
|
|
this.childProductData.selectSpecification = obj
|
|
|
- this.childProductData.product_details[0].sku_code = arrs[0].code
|
|
|
|
|
|
|
+ this.childProductData.product_details.push({sku_code:arrs[0].code})
|
|
|
|
|
+ // this.childProductData.product_details[0].sku_code = arrs[0].code
|
|
|
},
|
|
},
|
|
|
naixue(key,r) {
|
|
naixue(key,r) {
|
|
|
|
|
+ this.accessoriesPrice = 0
|
|
|
let selectSpecification = this.childProductData.selectSpecification || {};
|
|
let selectSpecification = this.childProductData.selectSpecification || {};
|
|
|
let da = this.goodsOneData.details.accessories;
|
|
let da = this.goodsOneData.details.accessories;
|
|
|
da.forEach(value => this.$set(value, 'checked', 0))
|
|
da.forEach(value => this.$set(value, 'checked', 0))
|
|
|
da[key].checked = r ? 0 : 1;
|
|
da[key].checked = r ? 0 : 1;
|
|
|
- this.childProductData.spec_price = !r ? da[key].price : 0
|
|
|
|
|
|
|
+ da[key].checked==1 ?this.accessoriesPrice = da[key].price:this.accessoriesPrice=0
|
|
|
|
|
+ let spu = this.goodsOneData.details.spu_specs;
|
|
|
|
|
+ let price = 0
|
|
|
|
|
+ spu.forEach(d=>{
|
|
|
|
|
+ d.values.forEach(dd=>{
|
|
|
|
|
+ if(dd.checked == 1){
|
|
|
|
|
+ price = price + dd.price
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ this.childProductData.spec_price = price + this.accessoriesPrice || 0
|
|
|
|
|
+ // this.childProductData.spec_price = !r ? (this.childProductData.spec_price || 0)+da[key].price : (this.childProductData.spec_price || 0) - da[key].price
|
|
|
|
|
+ // this.childProductData.spec_price = !r ? (this.childProductData.spec_price || 0) + da[key].price : this.childProductData.spec_price>0? this.childProductData.spec_price - da[key].price: 0
|
|
|
|
|
+
|
|
|
if(!r) selectSpecification['加料'] = da[key].name
|
|
if(!r) selectSpecification['加料'] = da[key].name
|
|
|
else delete selectSpecification['加料']
|
|
else delete selectSpecification['加料']
|
|
|
this.childProductData.selectSpecification = selectSpecification
|
|
this.childProductData.selectSpecification = selectSpecification
|
|
|
- this.childProductData.product_details[0].accessories_code = da[key].code
|
|
|
|
|
|
|
+ da[key].checked ==1?this.childProductData.product_details[0].accessories_code = da[key].code:this.childProductData.product_details[0].accessories_code=""
|
|
|
},
|
|
},
|
|
|
// 选择规格标签 瑞辛
|
|
// 选择规格标签 瑞辛
|
|
|
ruixins(index, key) {
|
|
ruixins(index, key) {
|