goods default spec 8.14

This commit is contained in:
ghusermoon 2020-08-14 15:46:43 +08:00
parent 899b93fc4f
commit b266c9c775
3 changed files with 40 additions and 23 deletions

View File

@ -54,12 +54,30 @@ export default {
select: 0 select: 0
} }
}, },
props:['item','title'], props:['item','title', 'default'],
watch: { watch: {
select(){ select(){
// console.log(this.select) // console.log(this.select)
this.$emit("sel", this.select); this.$emit("sel", this.select);
} }
},
mounted() {
this.setDefaultValue();
},
methods: {
setDefaultValue() {
for (const ikey in this.item) {
if (this.item.hasOwnProperty(ikey)) {
const ielement = this.item[ikey];
for (const dkey in this.default) {
if (this.default.hasOwnProperty(dkey)) {
const delement = this.default[dkey];
if(ikey == dkey) this.select = ikey;
}
}
}
}
}
} }
} }
</script> </script>

View File

@ -135,7 +135,7 @@
<text v-else-if="type == 3">{{ groupbuyInfo.groupbuy_price }}</text> <text v-else-if="type == 3">{{ groupbuyInfo.groupbuy_price }}</text>
</view> </view>
</view> </view>
<guige @sel="self" ref="guige" v-for="(item,index) in goodsInfo.spec_value" :key="index" :title="goodsInfo.spec_name[index]" :item="item"></guige> <guige @sel="self" ref="guige" v-for="(item,index) in goodsInfo.spec_value" :key="index" :title="goodsInfo.spec_name[index]" :item="item" :default="goodsInfo.goods_spec"></guige>
<view class="num"> <view class="num">
<text>购买数量</text> <text>购买数量</text>
<u-number-box v-model="goodsNumber" :min="1"></u-number-box> <u-number-box v-model="goodsNumber" :min="1"></u-number-box>
@ -245,7 +245,7 @@ export default {
// this.type = 1; // this.type = 1;
this.id = option.id; this.id = option.id;
// //
this.ordinaryDetails(this.id); this.ordinaryDetails();
}, },
onShow() { onShow() {
this.debounce = true; this.debounce = true;
@ -381,10 +381,10 @@ export default {
purchase() { purchase() {
this.settlementOrder(); this.settlementOrder();
}, },
getGoodsDetails(id) { getGoodsDetails() {
switch (this.type) { switch (this.type) {
case 1: case 1:
this.ordinaryDetails(id); this.ordinaryDetails();
break; break;
case 2: case 2:
this.pinTuanDetails(); this.pinTuanDetails();
@ -397,8 +397,8 @@ export default {
} }
}, },
// //
ordinaryDetails(id) { ordinaryDetails() {
this.$u.api.getGoodsDetails({ id: id }).then(res => { this.$u.api.getGoodsDetails({ id: this.id }).then(res => {
if (res.errCode == 0) { if (res.errCode == 0) {
this.evaluate = res.data.goods_evaluate_info; this.evaluate = res.data.goods_evaluate_info;
this.goodsInfo = res.data.goods; this.goodsInfo = res.data.goods;
@ -424,6 +424,7 @@ export default {
}, },
// //
pinTuanDetails() { pinTuanDetails() {
console.log(this.id);
this.$u.api.getPinTuanDetails({ this.$u.api.getPinTuanDetails({
pintuan_id: this.pintuan_id, pintuan_id: this.pintuan_id,
goods_id: this.id, goods_id: this.id,
@ -574,6 +575,9 @@ export default {
} }
} }
// console.log(arr) // console.log(arr)
// spec
arr.sort((a, b) => a - b);
// console.log(arr)
if(arr.length == index){ if(arr.length == index){
this.sel = arr.join("|") this.sel = arr.join("|")
this.quanxuan = true; this.quanxuan = true;
@ -586,7 +590,9 @@ export default {
// type = 1 // type = 1
// this.type = 1; // this.type = 1;
// goods_id // goods_id
// console.log(this.glist);
this.id = this.glist[id]; this.id = this.glist[id];
// console.log(this.id);
this.getGoodsDetails(); this.getGoodsDetails();
}, },
// //

View File

@ -2,27 +2,21 @@
<view class="progress" v-if="memberInfo"> <view class="progress" v-if="memberInfo">
<view class="header"> <view class="header">
<view class="line-progress"> <view class="line-progress">
<view class="rank-value">lv{{ memberInfo.member_level }}</view> <view class="rank-value">lv{{ memberInfo.member_level || 0 }}</view>
<view class="line-box"> <view class="line-box">
<u-line-progress :percent="percent" :show-percent="false" inactive-color="#FFFFFF" active-color="#F1A36B" height="30" :striped="true" :striped-active="true"></u-line-progress> <u-line-progress :percent="percent" :show-percent="false" inactive-color="#FFFFFF" active-color="#F1A36B" height="30" :striped="true" :striped-active="true"></u-line-progress>
<text>{{ memberInfo.member_exppoints + '/' + memberInfo.next_member_level_exppoints }}</text> <text>{{ (memberInfo.member_exppoints || 0) + '/' + (memberInfo.next_member_level_exppoints || 0) }}</text>
</view> </view>
<view class="rank-value">lv{{ memberInfo.next_member_level }}</view> <view class="rank-value">lv{{ memberInfo.next_member_level || 0 }}</view>
</view> </view>
<view class="exp-value">经验值<span>{{ memberInfo.member_exppoints }}</span></view> <view class="exp-value">经验值<span>{{ memberInfo.member_exppoints || 0 }}</span></view>
<view class="distance">距离下一级还需要 {{ memberInfo.next_member_level_exppoints_diff }} 经验值</view> <view class="distance">距离下一级还需要 {{ memberInfo.next_member_level_exppoints_diff || '--' }} 经验值</view>
</view> </view>
<view class="body"> <view class="body">
<view class="title" v-if="memberInfo.level_rule"> <view class="title" v-if="memberInfo.level_rule">
<image src="/static/image/mine/34.png"></image> <image src="/static/image/mine/34.png"></image>
<text>{{ memberInfo.level_rule.document_title }}</text> <text>{{ memberInfo.level_rule.document_title || '' }}</text>
</view> </view>
<!-- <view class="rank-list">
<view v-for="(rank, index) in rank" :key="index" class="list-item">
<view class="rank-value">lv{{ rank.level }}</view>
<view class="rank-interval"><span>经验值:</span>{{ rank.max == '--' ? rank.min + '及以上' : rank.min + '~' + rank.max }}</view>
</view>
</view> -->
<view class="rich"> <view class="rich">
<rich-text :nodes="nodes"></rich-text> <rich-text :nodes="nodes"></rich-text>
</view> </view>
@ -41,7 +35,6 @@ export default {
}, },
filters: { filters: {
percentExp(value, next) { percentExp(value, next) {
// console.log(rank);
let result = '0 / 0'; let result = '0 / 0';
result = typeof(next) == 'Number' result = typeof(next) == 'Number'
? value + ' / ' + (value + next) ? value + ' / ' + (value + next)