商品详情BUG

main
syt 8 months ago
parent cea1269c26
commit edd752e499
  1. 1
      components/goods-sku-popup/index.vue
  2. 9
      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; 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);

@ -51,7 +51,6 @@
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)
console.log(111222,goods)
app.maxBuyNum = app.getMaxBuyNum() app.maxBuyNum = app.getMaxBuyNum()
},500)
}, },
methods: { methods: {
@ -98,13 +97,17 @@
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) {
if(specList && specList.length > 0){
specValueIds.forEach((valueId, groupIndex) => { specValueIds.forEach((valueId, groupIndex) => {
const specValueName = app.getSpecValueName(valueId, groupIndex) const specValueName = app.getSpecValueName(valueId, groupIndex)
skuNameArr.push(specValueName) 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 => {

@ -600,6 +600,7 @@
}, },
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