去除goods_type的样式

This commit is contained in:
shengliang 2019-12-01 14:57:59 +08:00
parent 1a114ff060
commit d55719eec2
4 changed files with 20 additions and 27 deletions

View File

@ -76,8 +76,7 @@ Page({
imageUrl: image imageUrl: image
} }
}, },
onUnload: function() { onUnload: function() {},
},
handleTap: function(event) { //阻止冒泡 handleTap: function(event) { //阻止冒泡
}, },
getGoodsInfo: function() { getGoodsInfo: function() {
@ -89,7 +88,6 @@ Page({
id: that.data.id id: that.data.id
}).then(function(res) { }).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
let goods_type = res.data.info.goods_type;
let _specificationList = res.data.specificationList; let _specificationList = res.data.specificationList;
// 如果仅仅存在一种货品那么商品页面初始化时默认checked // 如果仅仅存在一种货品那么商品页面初始化时默认checked
if (_specificationList.valueList.length == 1) { if (_specificationList.valueList.length == 1) {
@ -392,7 +390,6 @@ Page({
}); });
return false; return false;
} }
let type = that.data.goods.goods_type;
util.request(api.CartAdd, { util.request(api.CartAdd, {
addType: 0, addType: 0,
goodsId: this.data.id, goodsId: this.data.id,
@ -402,25 +399,18 @@ Page({
.then(function(res) { .then(function(res) {
let _res = res; let _res = res;
if (_res.errno == 0) { if (_res.errno == 0) {
if (type == 2) { wx.showToast({
wx.switchTab({ title: '添加成功',
url: '/pages/cart/cart', });
if (productLength != 1 || that.data.openAttr == true) {
that.setData({
openAttr: !that.data.openAttr,
cartGoodsCount: _res.data.cartTotal.goodsCount
}); });
} else { } else {
wx.showToast({ that.setData({
title: '添加成功', 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 { } else {
wx.showToast({ wx.showToast({
@ -477,7 +467,6 @@ Page({
}); });
return false; return false;
} }
let type = that.data.goods.goods_type;
//添加到购物车 //添加到购物车
util.request(api.CartAdd, { util.request(api.CartAdd, {
addType: 1, // 0正常加入购物车1:立即购买2:再来一单 addType: 1, // 0正常加入购物车1:立即购买2:再来一单

View File

@ -91,11 +91,8 @@
<view class="spec-con"> <view class="spec-con">
<view class='spec-item'> <view class='spec-item'>
<view class='name'>{{specificationList.name}}</view> <view class='name'>{{specificationList.name}}</view>
<view wx:if="{{goods.goods_type == 2}}" class="values"> <view class="values">
<view class="value {{item.checked ? 'selected' : ''}}" wx:for="{{specificationList.valueList}}" wx:key="{{item.id}}" data-value-id="{{item.id}}" data-name-id="{{item.specification_id}}">{{item.value}}</view> <view class="value {{item.checked ? 'selected' : ''}} {{item.goods_number <=0?'out-stock':''}}" bindtap="{{item.goods_number <=0?'':'clickSkuValue'}}" wx:for="{{specificationList.valueList}}" wx:key="{{item.id}}" data-value-id="{{item.id}}" data-index="{{index}}" data-name-id="{{item.specification_id}}">{{item.value}}</view>
</view>
<view wx:else class="values">
<view class="value {{item.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{specificationList.valueList}}" wx:key="{{item.id}}" data-value-id="{{item.id}}" data-index="{{index}}" data-name-id="{{item.specification_id}}">{{item.value}}</view>
</view> </view>
</view> </view>
<view class="number-item"> <view class="number-item">

View File

@ -835,6 +835,13 @@
color: #ff3456; color: #ff3456;
} }
.spec-con .value.out-stock {
border: 1px solid #a3a3a3;
color: #696969;
background: #dbdbdb;
}
.number-item .selnum { .number-item .selnum {
width: 280rpx; width: 280rpx;
height: 62rpx; height: 62rpx;

View File

@ -199,7 +199,7 @@
.catalog-wrap .icon-navi { .catalog-wrap .icon-navi {
width: 100rpx; width: 100rpx;
height: 160rpx; /* height: 160rpx; */
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;