123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- const _Http = getApp().globalData.http;
- Component({
- properties: {
- list: {
- type: Array
- },
- userrole: {
- type: String
- }
- },
- options: {
- addGlobalClass: true
- },
- methods: {
- showTips() {
- wx.showToast({
- title: '请选择领域添加',
- icon: "none"
- })
- },
- addToCart(e) {
- let {
- item
- } = e.currentTarget.dataset;
- _Http.basic({
- "id": 20220924095102,
- "content": {
- "sa_brandid": item.brand[0].sa_brandid, //品牌id
- "itemid": item.itemid, //货品id
- "qty": item.orderminqty, //数量
- "itemno": item.itemno, //货品编号
- tradefield: item.tradefield[e.detail.value || 0].tradefield || ''
- },
- }).then(res => {
- console.log("加入购物车", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- });
- _Http.basic({
- "id": 20220927093202,
- "content": {}
- }, false).then(res => {
- console.log("购物车数量", res)
- getApp().globalData.num = res.data.num;
- if (this.data.userrole == '经销商') getCurrentPages()[getCurrentPages().length - 1].selectComponent("#Float").setNum(res.data.num)
- setTimeout(() => {
- wx.showToast({
- title: '加入成功',
- icon: "none",
- icon: "none"
- });
- }, 200);
- });
- })
- }
- }
- })
|