From d55719eec286a17c17deea4871b6edb29d9fa10b Mon Sep 17 00:00:00 2001 From: shengliang Date: Sun, 1 Dec 2019 14:57:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4goods=5Ftype=E7=9A=84?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods/goods.js | 31 ++++++++++--------------------- pages/goods/goods.wxml | 7 ++----- pages/goods/goods.wxss | 7 +++++++ pages/index/index.wxss | 2 +- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/pages/goods/goods.js b/pages/goods/goods.js index d018c85..ac2307b 100644 --- a/pages/goods/goods.js +++ b/pages/goods/goods.js @@ -76,8 +76,7 @@ Page({ imageUrl: image } }, - onUnload: function() { - }, + onUnload: function() {}, handleTap: function(event) { //阻止冒泡 }, getGoodsInfo: function() { @@ -89,7 +88,6 @@ Page({ id: that.data.id }).then(function(res) { if (res.errno === 0) { - let goods_type = res.data.info.goods_type; let _specificationList = res.data.specificationList; // 如果仅仅存在一种货品,那么商品页面初始化时默认checked if (_specificationList.valueList.length == 1) { @@ -392,7 +390,6 @@ Page({ }); return false; } - let type = that.data.goods.goods_type; util.request(api.CartAdd, { addType: 0, goodsId: this.data.id, @@ -402,25 +399,18 @@ Page({ .then(function(res) { let _res = res; if (_res.errno == 0) { - if (type == 2) { - wx.switchTab({ - url: '/pages/cart/cart', + wx.showToast({ + title: '添加成功', + }); + if (productLength != 1 || that.data.openAttr == true) { + that.setData({ + openAttr: !that.data.openAttr, + cartGoodsCount: _res.data.cartTotal.goodsCount }); } else { - wx.showToast({ - title: '添加成功', + that.setData({ + cartGoodsCount: _res.data.cartTotal.goodsCount }); - if (productLength != 1 || that.data.openAttr == true) { - that.setData({ - openAttr: !that.data.openAttr, - cartGoodsCount: _res.data.cartTotal.goodsCount - }); - } else { - that.setData({ - cartGoodsCount: _res.data.cartTotal.goodsCount - }); - } - } } else { wx.showToast({ @@ -477,7 +467,6 @@ Page({ }); return false; } - let type = that.data.goods.goods_type; //添加到购物车 util.request(api.CartAdd, { addType: 1, // 0:正常加入购物车,1:立即购买,2:再来一单 diff --git a/pages/goods/goods.wxml b/pages/goods/goods.wxml index c31bab6..5c10045 100644 --- a/pages/goods/goods.wxml +++ b/pages/goods/goods.wxml @@ -91,11 +91,8 @@ {{specificationList.name}} - - {{item.value}} - - - {{item.value}} + + {{item.value}} diff --git a/pages/goods/goods.wxss b/pages/goods/goods.wxss index 04713b7..05f97fe 100644 --- a/pages/goods/goods.wxss +++ b/pages/goods/goods.wxss @@ -835,6 +835,13 @@ color: #ff3456; } +.spec-con .value.out-stock { + border: 1px solid #a3a3a3; + color: #696969; + background: #dbdbdb; +} + + .number-item .selnum { width: 280rpx; height: 62rpx; diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 011970f..4bb0161 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -199,7 +199,7 @@ .catalog-wrap .icon-navi { width: 100rpx; - height: 160rpx; + /* height: 160rpx; */ display: flex; flex-direction: column; align-items: center;