商品详情BUG

main
syt 8 months ago
parent cea1269c26
commit edd752e499
  1. 1
      components/goods-sku-popup/index.vue
  2. 21
      pages/goods/components/SkuPopup.vue
  3. 15
      pages/goods/detail.vue
  4. 1
      pages/user/index.vue

@ -575,6 +575,7 @@
}
//
goodsCache[that.goodsId] = goodsInfo;
console.log("goodsCache",goodsCache[that.goodsId])
if (goodsInfo && typeof goodsInfo == 'object' && JSON.stringify(goodsInfo) != '{}') {
findGoodsInfoRun = false;
that.updateGoodsInfo(goodsInfo);

@ -1,5 +1,5 @@
<template>
<goods-sku-popup :modelValue="modelValue" @input="onChangeValue" border-radius="20" :localdata="goodsInfo" :mode="skuMode" :maskCloseAble="true"
<goods-sku-popup :modelValue="modelValue" @input="onChangeValue" border-radius="20" :localdata="goodsInfo" :mode="skuMode" :maskCloseAble="true"
:priceColor="appTheme.mainBg" :buyNowBackgroundColor="appTheme.mainBg" :addCartColor="appTheme.viceText"
:addCartBackgroundColor="appTheme.viceBg"
:activedStyle="{ color: appTheme.mainBg, borderColor: appTheme.mainBg, backgroundColor: activedBtnBackgroundColor }"
@ -50,8 +50,7 @@
},
mounted() {
const app = this
const { goods } = app
setTimeout(()=>{
const { goods } = app
app.goodsInfo = {
_id: goods.goods_id,
name: goods.goods_name,
@ -59,9 +58,9 @@
sku_list: app.getSkuList(),
spec_list: app.getSpecList()
}
console.log(111,app.goodsInfo)
console.log(111,app.goods)
console.log(111222,goods)
app.maxBuyNum = app.getMaxBuyNum()
},500)
},
methods: {
@ -98,12 +97,16 @@
getSkuNameArr(specValueIds) {
const app = this
const defaultData = ['默认']
const { goods: { specList } } = app
const skuNameArr = []
if (specValueIds) {
specValueIds.forEach((valueId, groupIndex) => {
const specValueName = app.getSpecValueName(valueId, groupIndex)
skuNameArr.push(specValueName)
})
if(specList && specList.length > 0){
specValueIds.forEach((valueId, groupIndex) => {
const specValueName = app.getSpecValueName(valueId, groupIndex)
skuNameArr.push(specValueName)
})
}
}
return skuNameArr.length ? skuNameArr : defaultData
},

@ -70,11 +70,11 @@
{{goods.goods_name}}
</view>
<view class="goodsOpera">
<view class="goodsNum" @click="copyNum(goods.skuList[0].goods_sku_id)"
<!-- <view class="goodsNum" @click="copyNum(goods.skuList[0].goods_sku_no)"
v-if="goods.specList && goods.specList.length>0">
<text>{{goods.skuList[0].goods_sku_id}}</text>
<text>{{goods.skuList[0].goods_sku_no}}</text>
<image :src="$picUrl+'/static/detail/copy.png'"></image>
</view>
</view> -->
<view v-if="goods.goods_no" class="goodsNum" @click="copyNum(goods.goods_no)">
<text>{{goods.goods_no}}</text>
<image :src="$picUrl+'/static/detail/copy.png'"></image>
@ -401,7 +401,7 @@
data() {
return {
goods_sku_no: "",
isTodo: true,
isTodo: false,
result: {},
max_price: "",
cost_price:'',
@ -728,7 +728,6 @@
this.getCartTotal()
},
choseSku(skuMode) {
console.log(this.goods)
if (!uni.getStorageSync("AccessToken")) {
uni.navigateTo({
url: "/pages/login/index"
@ -737,6 +736,7 @@
}
this.skuMode = skuMode
this.showSkuPopup = true
console.log("choseSku",this.goods)
},
copyNum(msg) {
uni.setClipboardData({
@ -775,6 +775,8 @@
this.$set(this.goods, item, info[item])
// that.goods[item] = info[item]
})
that.isTodo = true;
that.goods_sku_no =""
if(info.skuList && info.skuList.length > 0){
that.goods_sku_no = info.skuList[0].goods_sku_no
@ -786,6 +788,8 @@
that.markup_rate = ""
that.shareCancel();
}
console.log(result, 'getGoodsDetail')
})
.catch()
})
@ -795,7 +799,6 @@
const that = this
GoodsApi.recommended()
.then(result => {
console.log(result, '获取推荐商品列表')
let arr = result.data.goodsList
if (arr && arr.length > 0) {
arr.map(a => {

@ -600,6 +600,7 @@
},
onShow(options) {
if(uni.getStorageSync("userInfo").user_id){
this.isLogin = true
this.onRefreshPage()
}else{
this.userInfo = {}

Loading…
Cancel
Save