商品详情BUG

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

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

@ -1,5 +1,5 @@
<template> <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" :priceColor="appTheme.mainBg" :buyNowBackgroundColor="appTheme.mainBg" :addCartColor="appTheme.viceText"
:addCartBackgroundColor="appTheme.viceBg" :addCartBackgroundColor="appTheme.viceBg"
:activedStyle="{ color: appTheme.mainBg, borderColor: appTheme.mainBg, backgroundColor: activedBtnBackgroundColor }" :activedStyle="{ color: appTheme.mainBg, borderColor: appTheme.mainBg, backgroundColor: activedBtnBackgroundColor }"
@ -49,9 +49,8 @@
} }
}, },
mounted() { mounted() {
const app = this const app = this
const { goods } = app const { goods } = app
setTimeout(()=>{
app.goodsInfo = { app.goodsInfo = {
_id: goods.goods_id, _id: goods.goods_id,
name: goods.goods_name, name: goods.goods_name,
@ -59,9 +58,9 @@
sku_list: app.getSkuList(), sku_list: app.getSkuList(),
spec_list: app.getSpecList() spec_list: app.getSpecList()
} }
console.log(111,app.goodsInfo) console.log(111,app.goods)
app.maxBuyNum = app.getMaxBuyNum() console.log(111222,goods)
},500) app.maxBuyNum = app.getMaxBuyNum()
}, },
methods: { methods: {
@ -97,13 +96,17 @@
// sku // sku
getSkuNameArr(specValueIds) { getSkuNameArr(specValueIds) {
const app = this const app = this
const defaultData = ['默认'] const defaultData = ['默认']
const { goods: { specList } } = app
const skuNameArr = [] const skuNameArr = []
if (specValueIds) { if (specValueIds) {
specValueIds.forEach((valueId, groupIndex) => { if(specList && specList.length > 0){
const specValueName = app.getSpecValueName(valueId, groupIndex) specValueIds.forEach((valueId, groupIndex) => {
skuNameArr.push(specValueName) const specValueName = app.getSpecValueName(valueId, groupIndex)
}) skuNameArr.push(specValueName)
})
}
} }
return skuNameArr.length ? skuNameArr : defaultData return skuNameArr.length ? skuNameArr : defaultData
}, },

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

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

Loading…
Cancel
Save