From 6ba1ec7b23454fcf616a7eb30f547395b3278236 Mon Sep 17 00:00:00 2001 From: liaoanqi <1776106376@qq.com> Date: Tue, 29 Mar 2022 09:23:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=8A=A0=E5=85=A5=E8=B4=AD=E7=89=A9=E8=BD=A6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mall4m/pages/order-detail/order-detail.js | 41 +++++++++++++++++++++ mall4m/pages/order-detail/order-detail.wxml | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/mall4m/pages/order-detail/order-detail.js b/mall4m/pages/order-detail/order-detail.js index 358e938..36fe8a0 100644 --- a/mall4m/pages/order-detail/order-detail.js +++ b/mall4m/pages/order-detail/order-detail.js @@ -18,6 +18,8 @@ Page({ transfee: '', reduceAmount: '', actualTotal: '', + prodid: '', + shopId: '', prodid: '' }, @@ -62,6 +64,7 @@ Page({ transfee: res.transfee, reduceAmount: res.reduceAmount, actualTotal: res.actualTotal, + shopId: res.shopId }); wx.hideLoading(); } @@ -70,6 +73,44 @@ Page({ }, + /** + * 加入购物车 + */ + addToCart: function(event) { + let index = event.currentTarget.dataset.index + // if (!this.orderItemDtos) { + // console.log(1213) + // return; + // } + var ths = this; + wx.showLoading({ + mask: true + }); + var params = { + url: "/p/shopCart/changeItem", + method: "POST", + data: { + basketId: 0, + count: this.data.orderItemDtos[index].prodCount, + prodId: this.data.orderItemDtos[index].prodId, + shopId: this.data.shopId, + skuId: this.data.orderItemDtos[index].skuId + }, + callBack: function(res) { + //console.log(res); + wx.hideLoading(); + wx.showToast({ + title: "加入购物车成功", + icon: "none" + }) + wx.switchTab({ + url: '/pages/basket/basket', + }) + } + }; + http.request(params); + }, + /** * 生命周期函数--监听页面初次渲染完成 diff --git a/mall4m/pages/order-detail/order-detail.wxml b/mall4m/pages/order-detail/order-detail.wxml index 446ced8..fde9fb1 100644 --- a/mall4m/pages/order-detail/order-detail.wxml +++ b/mall4m/pages/order-detail/order-detail.wxml @@ -39,7 +39,7 @@ .{{wxs.parsePrice(item.price)[1]}} 申请售后 - 加购物车 + 加购物车