From 77bd8bc0ae47b9f4a654744eb2d1591b6fe85c13 Mon Sep 17 00:00:00 2001 From: liaoanqi <1776106376@qq.com> Date: Mon, 26 Sep 2022 09:40:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8A=A0=E5=85=A5=E8=B4=AD?= =?UTF-8?q?=E7=89=A9=E8=BD=A6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mall4uni/pages/index/index.vue | 40 ++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/mall4uni/pages/index/index.vue b/mall4uni/pages/index/index.vue index 3375dc2..bbfe6f4 100644 --- a/mall4uni/pages/index/index.vue +++ b/mall4uni/pages/index/index.vue @@ -141,7 +141,7 @@ .{{wxs.parsePrice(prod.price)[1]}} - + @@ -251,6 +251,42 @@ export default { }); } }, + // 加入购物车 + addToCart: function (item) { + uni.showLoading({ + mask: true + }); + var params = { + url: "/prod/prodInfo", + method: "GET", + data: { + prodId: item.prodId + }, + callBack: res => { + var params1 = { + url: "/p/shopCart/changeItem", + method: "POST", + data: { + basketId: 0, + count: 1, + prodId: res.prodId, + shopId: res.shopId, + skuId: res.skuList[0].skuId + }, + callBack: res => { + //console.log(res); + uni.hideLoading(); + uni.showToast({ + title: "加入购物车成功", + icon: "none" + }); + } + }; + http.request(params1); + } + }; + http.request(params); + }, toCouponCenter: function () { uni.showToast({ icon: "none", @@ -334,12 +370,12 @@ export default { this.setData({ taglist: res }); + for (var i = 0; i < res.length; i++) { this.updata = false this.updata = true this.getTagProd(res[i].id, i); } - console.log('taglist:', this.taglist) } }; http.request(params);