Commit 5169b7fa authored by 黄奎's avatar 黄奎

111

parent cf5e8a19
......@@ -17,7 +17,6 @@
</view>
</view>
<scroll-view scroll-y class="sku-box">
<!--
<view class="sku-item" v-for="(x, i) in g.attr_groups" :key="i" v-if="x.isdateformat==0">
<view class="sku-title">{{ x.attr_group_name }} </view>
<view>
......@@ -30,12 +29,25 @@
<text class="val">{{ y.attr_name }}</text>
</view>
</view>
</view> -->
<view class="sku-item" v-for="(x, i) in g.attr_groups" v-if="x.isdateformat==0">
</view>
<view class="sku-item" v-for="(x, i) in g.attr_groups" v-if="x.isdateformat==1">
<view class="sku-title">{{ x.attr_group_name }} </view>
<view>
<view class="sku-chi" :style="{
background: y.attr_id == x.checkId ? mc : '#eee',
color: y.attr_id == x.checkId ? '#FFF' : '#333'
}"
:class="{ disable: notStockGood.indexOf(y.attr_id) != -1 }" v-for="(y, yi) in x.attr_list" :key="yi" @click="clickSkuItemHandler(yi, i)">
<image :src="y.pic_url" class="img" v-if="i == 0 && y.pic_url"></image>
<text class="val">{{ y.attr_name }}</text>
</view>
</view>
</view>
<view class="sku-item" v-for="(x, i) in g.attr_groups" v-if="x.isdateformat==1">
<!--x.isdateformat=1 改成日历模式 -->
<view class="sku-title">{{ x.attr_group_name }} </view>
<view>
<calendar @finish="chosenDateResult" :immediately="true" :defaultDate="currentPrice.startDate" :priceList="x.attr_list"></calendar>
<calendar @finish="chosenDateResult" :immediately="true" :priceList="x.attr_list"></calendar>
</view>
</view>
</scroll-view>
......@@ -235,13 +247,13 @@
},
methods: {
chosenDateResult(result) {
console.log(result,'----result')
return
let price
this.g.attr_groups.forEach(x=>{
price = x.attr_list[result.priceObj]
})
this.currentPrice = price;
// console.log(result, '----result')
// return
// let price
// this.g.attr_groups.forEach(x => {
// price = x.attr_list[result.priceObj]
// })
// this.currentPrice = price;
},
getfu() {
let fucolor = this.colorRgb(this.fu);
......@@ -397,7 +409,6 @@
let chosen = '';
if (this.g.attr_groups && this.g.attr_groups.length > 0) {
this.g.attr_groups.forEach(x => {
// if (x.checkId != 0) {
if (x.checkId != -1) {
chosen += (chosen == '' ? '' : ',') + x.checkName;
} else {
......@@ -406,6 +417,7 @@
});
}
if (unchosen != '') {
this.sku = unchosen;
this.skuObj = null;
......@@ -466,13 +478,43 @@
},
formatSku() {
let sign = '';
let priceSign = '';
if (this.g.attr_groups && this.g.attr_groups.length > 0) {
this.g.attr_groups.forEach(x => {
if (x.checkId != -1) {
sign += (sign == '' ? '' : ':') + x.checkId;
}
if (x.isdateformat == 0 && x.checkId != -1) {
priceSign += (priceSign == '' ? '' : ':') + x.checkId;
}
});
}
console.log("priceSign", priceSign);
console.log("sign", sign);
if (this.g.attr_groups && this.g.attr_groups.length > 0) {
this.g.attr_groups.forEach((x, index) => {
if (x.isdateformat == 1) {
if (x.attr_list && x.attr_list.length > 0) {
x.attr_list.forEach((subItem,subIndex) => {
var newSign = (subIndex + 1) + ":" + priceSign;
console.log("subItem",subItem);
if (this.g.attr && this.g.attr.length) {
this.g.attr.forEach(y => {
if (y.sign_id == newSign) {
subItem.newPrice = y.price;
subItem.newStock = y.stock;
}
});
}
})
}
console.log("x", x)
}
});
}
console.log("this.g.attr_groups", this.g.attr_groups)
if (this.g.attr && this.g.attr.length) {
this.g.attr.forEach(x => {
if (x.sign_id == sign) {
......@@ -481,9 +523,11 @@
});
}
if (this.skuObj != null) {
this.goodimage = this.skuObj.pic_url || this.g.cover_pic;
this.goodprice = (parseFloat(this.skuObj.price) * parseFloat(this.gc)).toFixed(2);
console.log("this.goodprice2", this.goodprice);
this.goodamount = this.skuObj.stock;
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment