|
@@ -1,3 +1,4 @@
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
Component({
|
|
|
properties: {
|
|
|
list: {
|
|
@@ -7,6 +8,9 @@ Component({
|
|
|
type: Number
|
|
|
}
|
|
|
},
|
|
|
+ options: {
|
|
|
+ addGlobalClass: true
|
|
|
+ },
|
|
|
methods: {
|
|
|
toDetail(e) {
|
|
|
const {
|
|
@@ -18,6 +22,37 @@ Component({
|
|
|
sa_brandid:item.sa_brandid
|
|
|
})}`,
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+ buyMore(e) {
|
|
|
+ const item = e.currentTarget.dataset.item.item[0];
|
|
|
+ const item1 = e.currentTarget.dataset.item;
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否确定将“${item.itemname}”加入到购物车`,
|
|
|
+ complete: (res) => {
|
|
|
+ if (res.confirm) _Http.basic({
|
|
|
+ "id": 20220924095102,
|
|
|
+ "content": {
|
|
|
+ sa_brandid: item1.sa_brandid,
|
|
|
+ "itemid": item.itemid, //货品id
|
|
|
+ "qty": item.orderminqty, //数量
|
|
|
+ itemno: item.itemno, //货品编号
|
|
|
+ tradefield: item1.tradefield,
|
|
|
+ width: item.width,
|
|
|
+ length: item.length
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("加入购物车", res)
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg == '成功' ? '加入成功' : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.msg == '成功') getApp().globalData.getCollectCount().then(badge => this.setData({
|
|
|
+ badge
|
|
|
+ }))
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
})
|