goods default spec 8.14
This commit is contained in:
parent
899b93fc4f
commit
b266c9c775
@ -54,12 +54,30 @@ export default {
|
||||
select: 0
|
||||
}
|
||||
},
|
||||
props:['item','title'],
|
||||
watch:{
|
||||
props:['item','title', 'default'],
|
||||
watch: {
|
||||
select(){
|
||||
// console.log(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>
|
@ -135,7 +135,7 @@
|
||||
<text v-else-if="type == 3">¥{{ groupbuyInfo.groupbuy_price }}</text>
|
||||
</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">
|
||||
<text>购买数量</text>
|
||||
<u-number-box v-model="goodsNumber" :min="1"></u-number-box>
|
||||
@ -245,7 +245,7 @@ export default {
|
||||
// this.type = 1;
|
||||
this.id = option.id;
|
||||
// 先请求普通商品详情获取商品类型再渲染页面
|
||||
this.ordinaryDetails(this.id);
|
||||
this.ordinaryDetails();
|
||||
},
|
||||
onShow() {
|
||||
this.debounce = true;
|
||||
@ -381,10 +381,10 @@ export default {
|
||||
purchase() {
|
||||
this.settlementOrder();
|
||||
},
|
||||
getGoodsDetails(id) {
|
||||
getGoodsDetails() {
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
this.ordinaryDetails(id);
|
||||
this.ordinaryDetails();
|
||||
break;
|
||||
case 2:
|
||||
this.pinTuanDetails();
|
||||
@ -397,8 +397,8 @@ export default {
|
||||
}
|
||||
},
|
||||
// 普通商品详情
|
||||
ordinaryDetails(id) {
|
||||
this.$u.api.getGoodsDetails({ id: id }).then(res => {
|
||||
ordinaryDetails() {
|
||||
this.$u.api.getGoodsDetails({ id: this.id }).then(res => {
|
||||
if (res.errCode == 0) {
|
||||
this.evaluate = res.data.goods_evaluate_info;
|
||||
this.goodsInfo = res.data.goods;
|
||||
@ -424,6 +424,7 @@ export default {
|
||||
},
|
||||
// 拼团详情
|
||||
pinTuanDetails() {
|
||||
console.log(this.id);
|
||||
this.$u.api.getPinTuanDetails({
|
||||
pintuan_id: this.pintuan_id,
|
||||
goods_id: this.id,
|
||||
@ -572,7 +573,10 @@ export default {
|
||||
if(sel != 0){
|
||||
arr.push(sel)
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log(arr)
|
||||
// 后台的 spec 是按升序排的
|
||||
arr.sort((a, b) => a - b);
|
||||
// console.log(arr)
|
||||
if(arr.length == index){
|
||||
this.sel = arr.join("|")
|
||||
@ -586,7 +590,9 @@ export default {
|
||||
// 选择完规格后设商品type = 1
|
||||
// this.type = 1;
|
||||
// 改变 goods_id
|
||||
// console.log(this.glist);
|
||||
this.id = this.glist[id];
|
||||
// console.log(this.id);
|
||||
this.getGoodsDetails();
|
||||
},
|
||||
// 设置页面标题
|
||||
|
@ -2,27 +2,21 @@
|
||||
<view class="progress" v-if="memberInfo">
|
||||
<view class="header">
|
||||
<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">
|
||||
<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 class="rank-value">lv{{ memberInfo.next_member_level }}</view>
|
||||
<view class="rank-value">lv{{ memberInfo.next_member_level || 0 }}</view>
|
||||
</view>
|
||||
<view class="exp-value">经验值<span>{{ memberInfo.member_exppoints }}</span></view>
|
||||
<view class="distance">距离下一级还需要 {{ memberInfo.next_member_level_exppoints_diff }} 经验值</view>
|
||||
<view class="exp-value">经验值<span>{{ memberInfo.member_exppoints || 0 }}</span></view>
|
||||
<view class="distance">距离下一级还需要 {{ memberInfo.next_member_level_exppoints_diff || '--' }} 经验值</view>
|
||||
</view>
|
||||
<view class="body">
|
||||
<view class="title" v-if="memberInfo.level_rule">
|
||||
<image src="/static/image/mine/34.png"></image>
|
||||
<text>{{ memberInfo.level_rule.document_title }}</text>
|
||||
<text>{{ memberInfo.level_rule.document_title || '' }}</text>
|
||||
</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">
|
||||
<rich-text :nodes="nodes"></rich-text>
|
||||
</view>
|
||||
@ -41,7 +35,6 @@ export default {
|
||||
},
|
||||
filters: {
|
||||
percentExp(value, next) {
|
||||
// console.log(rank);
|
||||
let result = '0 / 0';
|
||||
result = typeof(next) == 'Number'
|
||||
? value + ' / ' + (value + next)
|
||||
|
Loading…
Reference in New Issue
Block a user