diff --git a/pages/index/index.vue b/pages/index/index.vue index 41632d5..bbfe6f4 100644 --- a/pages/index/index.vue +++ b/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",