|
@@ -28,35 +28,30 @@
|
|
|
<view class="choiceShow-wrap">
|
|
|
<view class="flex goods">
|
|
|
<view class="flex image-wrap">
|
|
|
- <image src="../../static/logo.png" mode="aspectFill"></image>
|
|
|
+ <image :src="picUrlArr[0]" mode="aspectFill"></image>
|
|
|
</view>
|
|
|
<view class="info">
|
|
|
- <view class="info-title">Apple iPhone 13 (A2634) 128GB 星光色 支持移动联通电信5G 双卡双待手机</view>
|
|
|
+ <view class="info-title">{{ info.title }}</view>
|
|
|
<view class="info-coin">
|
|
|
<image src="../../static/logo.png" mode=""></image>
|
|
|
- <view>x 6800</view>
|
|
|
+ <view>x {{ info.value }}</view>
|
|
|
</view>
|
|
|
- <view class="info-stock">库存:234</view>
|
|
|
+ <view class="info-stock">库存:{{ info.quantity }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="sku">
|
|
|
- <view class="sku-title">颜色</view>
|
|
|
+ <view class="sku" v-for="(item, index) in skuList" :key="index">
|
|
|
+ <view class="sku-title">{{ item.name }}</view>
|
|
|
<view class="flex sku-list">
|
|
|
- <view class="sku-list-item">红色</view>
|
|
|
- <view class="sku-list-item">黑色</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="sku">
|
|
|
- <view class="sku-title">颜色</view>
|
|
|
- <view class="flex sku-list">
|
|
|
- <view class="sku-list-item">红色</view>
|
|
|
- <view class="sku-list-item">黑色</view>
|
|
|
+ <view
|
|
|
+ :class="{'action': item.actionIndex == indexs, 'sku-list-item': item.actionIndex != indexs}"
|
|
|
+ v-for="(ele, indexs) in item.vals" :key="indexs" @click="getSku(ele, item, indexs)">
|
|
|
+ {{ ele }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="flex quantity">
|
|
|
<view class="quantity-title">兑换数量</view>
|
|
|
<view class="quantity-title">
|
|
|
- <u-number-box v-model="value" :min="1" @change="valChange"></u-number-box>
|
|
|
+ <u-number-box v-model="value" :min="1" :disabledInput="true" @change="valChange"></u-number-box>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="flex btn">
|
|
@@ -64,7 +59,7 @@
|
|
|
<view class="title">应付:</view>
|
|
|
<view class="flex coin">
|
|
|
<image src="../../static/logo.png" mode=""></image>
|
|
|
- <view>x 6800</view>
|
|
|
+ <view>x {{ info.value }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="btn-right">
|
|
@@ -88,9 +83,8 @@
|
|
|
prizeList: [],
|
|
|
description: '',
|
|
|
choiceShow: false,
|
|
|
-
|
|
|
value: 1,
|
|
|
-
|
|
|
+ skuList: []
|
|
|
};
|
|
|
},
|
|
|
onLoad(opthios) {
|
|
@@ -109,6 +103,30 @@
|
|
|
})
|
|
|
// 处理富文本
|
|
|
this.description = this.formatRichText(res.data.description);
|
|
|
+
|
|
|
+ let specObj = {}
|
|
|
+ res.data.skuList.forEach(item => {
|
|
|
+ item.properties.split(';').forEach(p => {
|
|
|
+ const key = p.split(':')[0]
|
|
|
+ // console.log(specObj[key] instanceof Array)
|
|
|
+ if (!specObj[key]) {
|
|
|
+ specObj[key] = []
|
|
|
+ // console.log(specObj[key])
|
|
|
+ }
|
|
|
+ specObj[key].push(p.split(':')[1])
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.skuList = Object.keys(specObj).map(key => {
|
|
|
+ return {
|
|
|
+ name: key,
|
|
|
+ vals: [...new Set(specObj[key])],
|
|
|
+ actionVals: false,
|
|
|
+ actionIndex: 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log(this.skuList);
|
|
|
+ // console.log(this.info);
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -124,7 +142,15 @@
|
|
|
valChange(e) {
|
|
|
console.log(e);
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
+ getSku(e, item, indexs) {
|
|
|
+ this.$set(item, 'txt', `${item.name}:${e}`)
|
|
|
+ this.$set(item, 'actionIndex', indexs)
|
|
|
+ console.log(e);
|
|
|
+ console.log(item);
|
|
|
+ console.log(indexs);
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* 处理富文本里的图片宽度自适应
|
|
|
* 1.去掉img标签里的style、width、height属性
|
|
@@ -206,9 +232,9 @@
|
|
|
font-weight: bold;
|
|
|
background-color: #FFFFFF;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
&-description {
|
|
|
- image{
|
|
|
+ image {
|
|
|
width: 100%;
|
|
|
}
|
|
|
}
|
|
@@ -240,6 +266,7 @@
|
|
|
flex-direction: column;
|
|
|
justify-content: space-between;
|
|
|
padding-left: 26rpx;
|
|
|
+ height: 220rpx;
|
|
|
|
|
|
&-title {
|
|
|
font-size: 32rpx;
|
|
@@ -285,9 +312,16 @@
|
|
|
margin-left: 36rpx;
|
|
|
}
|
|
|
|
|
|
- &-item:first-child {
|
|
|
- margin-left: 0;
|
|
|
+ .action {
|
|
|
+ line-height: 44rpx;
|
|
|
+ padding: 0 20rpx;
|
|
|
+ margin-left: 36rpx;
|
|
|
+ border: 1px solid $uni-bg-color;
|
|
|
}
|
|
|
+
|
|
|
+ // &-item:first-child {
|
|
|
+ // margin-left: 0;
|
|
|
+ // }
|
|
|
}
|
|
|
}
|
|
|
|