|
@@ -41,11 +41,19 @@
|
|
|
</view>
|
|
|
<van-viewider customStyle="font-width: 3rpx;" />
|
|
|
<!-- 类别 -->
|
|
|
- <view class="other">
|
|
|
+ <view class="other" @click="showMsg">
|
|
|
<text class="choose">已选:<text class="name">{{defaultSku.skuName}}</text></text>
|
|
|
<text class="space">...</text>
|
|
|
</view>
|
|
|
<van-viewider customStyle="font-width: 3rpx;" />
|
|
|
+ <van-cell title-style="cell-title" center value="共0条" is-link>
|
|
|
+ <template #title>
|
|
|
+ <text>评价:</text>
|
|
|
+ <text class="total">
|
|
|
+ 好评{{commData.positiveRating}}%
|
|
|
+ </text>
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
<view class="word">
|
|
|
<view>
|
|
|
<van-tag type="warning">全部({{ commData.number }})</van-tag>
|
|
@@ -66,15 +74,13 @@
|
|
|
<!-- 内容页 -->
|
|
|
<view v-html="formatHtml(prodData.content)"></view>
|
|
|
<!-- 购物框提示 -->
|
|
|
- <van-action-sheet :show="showDesc" class="tips">
|
|
|
+ <van-action-sheet :show="showDesc" class="tips" @click-overlay="cancelDesc">
|
|
|
<!-- 商品提示信息 -->
|
|
|
<van-card :num="confirm.orderItem.prodCount" :price="defaultSku.price ? defaultSku.price : prodData.price"
|
|
|
:desc="prodData.brief" :title="defaultSku.skuName ? defaultSku.skuName : prodData.prodName"
|
|
|
:thumb="defaultSku.pic ? defaultSku.pic : prodData.pic">
|
|
|
- <template #tags>
|
|
|
- </template>
|
|
|
<template #footer>
|
|
|
- <van-stepper v-model="confirm.orderItem.prodCount" integer />
|
|
|
+ <van-stepper :value="confirm.orderItem.prodCount" integer />
|
|
|
</template>
|
|
|
</van-card>
|
|
|
<!-- 型号 -->
|
|
@@ -82,19 +88,12 @@
|
|
|
<view>
|
|
|
<!-- {{tags}} -->
|
|
|
<view v-for="(item, idx) in tags" :key="idx">
|
|
|
- <view style="text-align: left;">
|
|
|
- {{ idx }}
|
|
|
- <view class="right" v-for="(item1, index) in item" :key="index">
|
|
|
- 11111
|
|
|
- {{item1}}
|
|
|
+ <text style="text-align: left;">
|
|
|
+ {{item.label}}
|
|
|
+ </text>
|
|
|
+ <view class="right" v-for="(news, index) in item.options" :key="index">
|
|
|
+ {{news.value}}
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <!-- <view class="right" v-for="(a,b) in item" :key="b">
|
|
|
- aaaa{{a}}
|
|
|
- </view> -->
|
|
|
- <!-- <van-tag @click="selectTag(idx, t)"
|
|
|
- :class="{ 'prop-selected': selectedTag[idx] === t ? true : false }" plain
|
|
|
- v-for="(t, index) in tag" :key="index" type="danger">{{ t }}</van-tag> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
<view style="margin-top: 2rem;"></view>
|
|
@@ -107,6 +106,25 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</van-action-sheet>
|
|
|
+ </van-action-sheet>
|
|
|
+ <!-- 型号选择 -->
|
|
|
+ <van-action-sheet :show="showMain" @click-overlay="cancelMain">
|
|
|
+ <view class="action-sheet-content">
|
|
|
+ <view>
|
|
|
+ <view v-for="(tag, idx) in tags" :key="idx">
|
|
|
+ <view style="text-align: left;">
|
|
|
+ {{ tag.label }}
|
|
|
+ </view>
|
|
|
+ <van-tag @click="selectTag(idx, t)"
|
|
|
+ :class="{ 'prop-selected': selectedTag[idx] === t ? true : false }" plain
|
|
|
+ v-for="(t, index) in tag.options" :key="index" type="danger">{{ t.value }}</van-tag>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view style="margin-top: 2rem;"></view>
|
|
|
+ <van-button :disabled="defaultSku.skuName ? false : true" type="danger" block
|
|
|
+ @click="showMain = false">确定</van-button>
|
|
|
+ </view>
|
|
|
+ </van-action-sheet>
|
|
|
<!-- 导航栏 -->
|
|
|
<van-goods-action>
|
|
|
<van-goods-action-icon icon="cart-o" text="购物车" @click="onClickShop" />
|
|
@@ -138,6 +156,7 @@
|
|
|
selectedTag: {},
|
|
|
showDesc: false,
|
|
|
isCollection: false,
|
|
|
+ showMain:false,
|
|
|
tags: {},
|
|
|
commData: {
|
|
|
positiveRating: 0,
|
|
@@ -159,6 +178,7 @@
|
|
|
addrId: 0,
|
|
|
userChangeCoupon: 0,
|
|
|
couponIds: [],
|
|
|
+ skuList: [],
|
|
|
shopcart: {
|
|
|
basketId: 0,
|
|
|
prodId: 0,
|
|
@@ -175,8 +195,9 @@
|
|
|
let result = await prodInfo({
|
|
|
prodId: 71
|
|
|
})
|
|
|
- console.log(result)
|
|
|
+ console.log(result,'99')
|
|
|
this.bannerList = result.skuList;
|
|
|
+ this.skuList = result.skuList;
|
|
|
this.prodList = result;
|
|
|
this.prodData = result;
|
|
|
this.init(result.skuList)
|
|
@@ -190,41 +211,56 @@
|
|
|
methods: {
|
|
|
init(sku) {
|
|
|
const properties = []
|
|
|
- const propObject = {}
|
|
|
- let defaultArr = []
|
|
|
- for (let i = 0; i < sku.length; i++) {
|
|
|
- properties.push(sku[i].properties)
|
|
|
- }
|
|
|
- for (let i = 0; i < properties.length; i++) {
|
|
|
- const propStr = properties[i]
|
|
|
- const propArr = propStr.split(";")
|
|
|
- if (defaultArr.length === 0) {
|
|
|
- defaultArr = propArr
|
|
|
- this.defaultSku = sku[i]
|
|
|
- if (sku.length === 1) return;
|
|
|
- }
|
|
|
- for (let n = 0; n < propArr.length; n++) {
|
|
|
- const valueStr = propArr[n];
|
|
|
- const valueArr = valueStr.split(":")
|
|
|
- if (!propObject[valueArr[0]]) {
|
|
|
- propObject[valueArr[0]] = new Set()
|
|
|
- }
|
|
|
- propObject[valueArr[0]].add(valueArr[1])
|
|
|
- }
|
|
|
- }
|
|
|
- this.tags = propObject;
|
|
|
- console.log(this.tags, 'this.tags')
|
|
|
+ const propObject = {}
|
|
|
+ let defaultArr = []
|
|
|
+ for (let i = 0; i < sku.length; i++) {
|
|
|
+ properties.push(sku[i].properties)
|
|
|
+ }
|
|
|
+ for (let i = 0; i < properties.length; i++) {
|
|
|
+ const propStr = properties[i]
|
|
|
+ const propArr = propStr.split(";")
|
|
|
+ if (defaultArr.length === 0) {
|
|
|
+ defaultArr = propArr
|
|
|
+ this.defaultSku = sku[i]
|
|
|
+ if (sku.length === 1) return;
|
|
|
+ }
|
|
|
+ for (let n = 0; n < propArr.length; n++) {
|
|
|
+ const valueStr = propArr[n];
|
|
|
+ const valueArr = valueStr.split(":")
|
|
|
+ if (!propObject[valueArr[0]]) {
|
|
|
+ propObject[valueArr[0]] = new Set()
|
|
|
+ }
|
|
|
+ propObject[valueArr[0]].add(valueArr[1])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const processedData = Object.entries(propObject).map(([key, values]) => {
|
|
|
+ return {
|
|
|
+ label: key,
|
|
|
+ options: Array.from(values).map(value => {
|
|
|
+ return {
|
|
|
+ label: value,
|
|
|
+ value: value
|
|
|
+ };
|
|
|
+ })
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ this.tags = processedData;
|
|
|
+ console.log(this.tags, 'this.tags')
|
|
|
for (let i = defaultArr.length - 1; i >= 0; i--) {
|
|
|
const valueStr = defaultArr[i];
|
|
|
const valueArr = valueStr.split(":")
|
|
|
this.$set(this.selectedTag, valueArr[0], valueArr[1])
|
|
|
}
|
|
|
},
|
|
|
- async addOrCancel() {
|
|
|
- addOrCancel(71).then(res => {console.log(res,'收藏')})
|
|
|
- // await addOrCancel(this.prodData.prodId)
|
|
|
- // await addOrCancel({prodId:this.prodData.prodId})
|
|
|
- this.isCollection = await isCollection({ prodId: this.prodData.prodId })
|
|
|
+ showMsg() {
|
|
|
+ this.showMain = true;
|
|
|
+ },
|
|
|
+ cancelMain() {
|
|
|
+ this.showMain = false;
|
|
|
+ },
|
|
|
+ addOrCancel() {
|
|
|
+ this.isCollection = !this.isCollection
|
|
|
},
|
|
|
shopcartAdd() {
|
|
|
this.shopcart.basketId = 0
|
|
@@ -260,7 +296,10 @@
|
|
|
return formatHtml(t)
|
|
|
},
|
|
|
onClickButton() {
|
|
|
- this.showDesc = !this.showDesc;
|
|
|
+ this.showDesc = true;
|
|
|
+ },
|
|
|
+ cancelDesc() {
|
|
|
+ this.showDesc = false;
|
|
|
},
|
|
|
onClickShop() {
|
|
|
uni.switchTab({
|