|
@@ -117,10 +117,11 @@
|
|
|
<view class="right">
|
|
|
<text class="price" style="font-size: 36upx;color: #303133">¥{{totalprice==0?datalist.goods_price:totalprice}}</text>
|
|
|
<view v-if="datalist.spec_list.length > 0 ">
|
|
|
- <view class="selected" v-if="specSelected.length > 0 ">
|
|
|
- <text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">
|
|
|
- {{sItem.value_name}}X {{shopnumber}}
|
|
|
+ <view class="selected" v-if="chosename.length > 0 ">
|
|
|
+ <text class="selected-text" v-for="(sItem, sIndex) in chosename" :key="sIndex">
|
|
|
+ {{sItem.value_name}}
|
|
|
</text>
|
|
|
+ X {{shopnumber}}
|
|
|
</view>
|
|
|
<view class="selected" v-else>
|
|
|
<text class="selected-text">
|
|
@@ -144,7 +145,7 @@
|
|
|
v-for="(childItem, childIndex) in item.value_list"
|
|
|
:key="childIndex" class="tit"
|
|
|
:class="{selected: childItem.selected, disabled: childItem.goods_storage==0}"
|
|
|
- @click="selectSpec(index, childItem.value_id, childItem.value_name, childItem.goods_storage)"
|
|
|
+ @click="selectSpec(index, childItem.value_id, childItem, item,childItem.goods_storage)"
|
|
|
>
|
|
|
{{childItem.value_name}}
|
|
|
</text>
|
|
@@ -203,6 +204,7 @@
|
|
|
data() {
|
|
|
return {
|
|
|
isTop: false,
|
|
|
+ chosename: [],
|
|
|
arrayId:[],
|
|
|
bottomtop: '55upx',
|
|
|
scopemapId: 0,
|
|
@@ -506,11 +508,19 @@
|
|
|
this.specClass = 'none';
|
|
|
},
|
|
|
//选择规格
|
|
|
- selectSpec(index, pid,value_name,goods_storage){
|
|
|
+ selectSpec(index, pid,chose,first,goods_storage){
|
|
|
if(goods_storage == 0) {
|
|
|
this.$msg("商品没库存啦");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ let obj = {};
|
|
|
+ obj.spec_id = first.spec_id;
|
|
|
+ obj.value_name = chose.value_name;
|
|
|
+ if(this.datalist.spec_list.length == this.chosename.length) {
|
|
|
+ }else {
|
|
|
+ this.chosename.push(obj);
|
|
|
+ }
|
|
|
this.specSelected = [];
|
|
|
let list = this.datalist.spec_list[index].value_list;
|
|
|
this.datalist.spec_list[index].value_list.forEach(item=>{
|
|
@@ -520,9 +530,13 @@
|
|
|
this.$set(item, 'selected', false);
|
|
|
}
|
|
|
})
|
|
|
- if(goods_storage == 0) {
|
|
|
- this.$msg("商品没库存啦")
|
|
|
- }
|
|
|
+ this.chosename.forEach(items => {
|
|
|
+ if(items.spec_id == first.spec_id) {
|
|
|
+ items.value_name = chose.value_name
|
|
|
+ };
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
let array = [];
|
|
|
for(let i = 0; i < this.datalist.spec_list.length; i++) {
|
|
|
for(let j = 0; j<this.datalist.spec_list[i].value_list.length;j++) {
|
|
@@ -536,7 +550,7 @@
|
|
|
this.scopemapId = array.join("_");
|
|
|
let goodId = this.datalist.spec_map[this.scopemapId]; //
|
|
|
let items = this.datalist.goods_list[goodId]
|
|
|
- items.value_name = value_name;
|
|
|
+ items.value_name = chose.value_name;
|
|
|
this.nuberImg = items.spec_img;
|
|
|
this.specSelected.push(items)
|
|
|
this.goods_storage = items.goods_storage;
|