|
@@ -21,10 +21,10 @@ Page({
|
|
/* 获取详情 */
|
|
/* 获取详情 */
|
|
getDetail() {
|
|
getDetail() {
|
|
_Http.basic({
|
|
_Http.basic({
|
|
- "id": "20221223165503",
|
|
|
|
|
|
+ "id": "20220926142403",
|
|
"content": {
|
|
"content": {
|
|
"sa_itemgroupid": this.data.sa_itemgroupid,
|
|
"sa_itemgroupid": this.data.sa_itemgroupid,
|
|
- itemno: this.data.itemno
|
|
|
|
|
|
+ // itemno: this.data.itemno
|
|
}
|
|
}
|
|
}).then(res => {
|
|
}).then(res => {
|
|
console.log("商品详情", res)
|
|
console.log("商品详情", res)
|
|
@@ -32,10 +32,21 @@ Page({
|
|
title: res.msg,
|
|
title: res.msg,
|
|
icon: "none"
|
|
icon: "none"
|
|
})
|
|
})
|
|
- this.handleFiles(res.data.item[0].attinfos)
|
|
|
|
|
|
+ if (res.data.length == 0) {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '未查询到商品',
|
|
|
|
+ icon: "none",
|
|
|
|
+ mask: true
|
|
|
|
+ })
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ wx.navigateBack();
|
|
|
|
+ }, 500)
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.handleFiles(res.data[0].attinfos)
|
|
this.setData({
|
|
this.setData({
|
|
- detail: res.data.item[0],
|
|
|
|
- rows: res.data.rows,
|
|
|
|
|
|
+ detail: res.data[0],
|
|
|
|
+ rows: res.data,
|
|
loading: false
|
|
loading: false
|
|
})
|
|
})
|
|
})
|
|
})
|
|
@@ -93,10 +104,11 @@ Page({
|
|
item
|
|
item
|
|
} = e.currentTarget.dataset;
|
|
} = e.currentTarget.dataset;
|
|
if (item.itemno == this.data.itemno) return;
|
|
if (item.itemno == this.data.itemno) return;
|
|
|
|
+ this.handleFiles(item.attinfos)
|
|
this.setData({
|
|
this.setData({
|
|
|
|
+ detail: item,
|
|
itemno: item.itemno
|
|
itemno: item.itemno
|
|
- });
|
|
|
|
- this.getDetail();
|
|
|
|
|
|
+ })
|
|
},
|
|
},
|
|
clickBut() {
|
|
clickBut() {
|
|
this.data.detail.tradefield.length >= 2 ? wx.showToast({
|
|
this.data.detail.tradefield.length >= 2 ? wx.showToast({
|
|
@@ -114,7 +126,7 @@ Page({
|
|
_Http.basic({
|
|
_Http.basic({
|
|
"id": 20220924095102,
|
|
"id": 20220924095102,
|
|
"content": {
|
|
"content": {
|
|
- "sa_brandid": detail.brand[0].sa_brandid, //品牌id
|
|
|
|
|
|
+ "sa_brandid": detail.brand, //品牌id
|
|
"itemid": detail.itemid, //货品id
|
|
"itemid": detail.itemid, //货品id
|
|
"qty": 1, //数量
|
|
"qty": 1, //数量
|
|
"itemno": this.data.itemno, //货品编号
|
|
"itemno": this.data.itemno, //货品编号
|
|
@@ -122,7 +134,6 @@ Page({
|
|
},
|
|
},
|
|
}).then(res => {
|
|
}).then(res => {
|
|
console.log("加入购物车", res)
|
|
console.log("加入购物车", res)
|
|
-
|
|
|
|
if (res.msg != '成功') return wx.showToast({
|
|
if (res.msg != '成功') return wx.showToast({
|
|
title: res.msg,
|
|
title: res.msg,
|
|
icon: "none"
|
|
icon: "none"
|
|
@@ -133,7 +144,7 @@ Page({
|
|
}, false).then(res => {
|
|
}, false).then(res => {
|
|
console.log("购物车数量", res)
|
|
console.log("购物车数量", res)
|
|
getApp().globalData.num = res.data.num;
|
|
getApp().globalData.num = res.data.num;
|
|
- this.selectComponent("#Float").setNum(res.data.num)
|
|
|
|
|
|
+ if (this.data.userrole == '经销商') this.selectComponent("#Float").setNum(res.data.num)
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
wx.showToast({
|
|
wx.showToast({
|
|
title: '加入成功',
|
|
title: '加入成功',
|
|
@@ -145,6 +156,6 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
- this.selectComponent("#Float").setNum(getApp().globalData.num)
|
|
|
|
|
|
+ if (this.data.userrole == '经销商') this.selectComponent("#Float").setNum(getApp().globalData.num)
|
|
},
|
|
},
|
|
})
|
|
})
|