Authored by yyq

fill

... ... @@ -12,7 +12,7 @@ function AllGoodsSelect() {
// 购物车商品唯一key
item.indexKey = `${item.product_sku}_${index++}`;
if (item.buy_number - item.storage_number > 0 ) {
if (item.buy_number - item.storage_number > 0) {
lowStorage = true;
} else if (item.goods_type !== 'gift' && item.selected !== 'Y') {
isSelectAll = false;
... ... @@ -26,11 +26,11 @@ function AllGoodsSelect() {
this.hasLowStorage = function() {
return lowStorage;
}
};
this.getAllGoodsList = function() {
return goodsList;
}
};
return this;
}
... ... @@ -48,9 +48,10 @@ function _processPromotion(promotionList, isSub) {
statuString = '去凑单';
break;
case 10:
if (promotion.promotion_type == 'Gift') { //Cashreduce, Degressdiscount, Cheapestfree, Discount,Gift,Needpaygift,SpecifiedAmount
// Cashreduce, Degressdiscount, Cheapestfree, Discount,Gift,Needpaygift,SpecifiedAmount
if (promotion.promotion_type === 'Gift') {
statuString = '领赠品';
} else if (promotion.promotion_type == 'Needpaygift') {
} else if (promotion.promotion_type === 'Needpaygift') {
statuString = '去换购';
}
break;
... ... @@ -104,9 +105,10 @@ function _processGiftList(list, isGift) {
return false;
}
let statusCount10 = 0;//已满足
let statusCount20 = 0;//已售罄
let statusCount10 = 0;// 已满足
let statusCount20 = 0;// 已售罄
let promotionArr = [];
list.map(item => {
switch (+item.status) {
case 10:
... ... @@ -165,10 +167,11 @@ const formatOrdinaryCartData = (data, needAllGoods) => {
// 商品池
let goodsPoolList = data.goods_pool_list;
if (goodsPoolList && goodsPoolList.length) {
goodsPoolList.map(item => {
if (item.pool_batch_no && item.pool_id) {
//套餐商品参数转换
// 套餐商品参数转换
item.int_pool_buy_number = parseInt(item.pool_buy_number, 10);
item.int_pool_storage_number = parseInt(item.pool_storage_number, 10);
}
... ... @@ -179,11 +182,11 @@ const formatOrdinaryCartData = (data, needAllGoods) => {
item.promotionMapId = pid++;
if (item.sub_pool && item.sub_pool.length) {
item.sub_pool.map(spItem => {
item.sub_pool.map(spItem => {
spItem.goods_list && allGoodsSelect.check(spItem.goods_list);
spItem.promotion_list = _processPromotion(spItem.promotion_list, true);
spItem.promotionMapId = pid++;
})
});
}
});
... ... @@ -193,6 +196,7 @@ const formatOrdinaryCartData = (data, needAllGoods) => {
// 商品列表
let goodsList = data.goods_list;
if (goodsList && goodsList.length) {
isEmptyCart = false;
allGoodsSelect.check(goodsList);
... ... @@ -208,7 +212,7 @@ const formatOrdinaryCartData = (data, needAllGoods) => {
priceGiftItem && gGiftAndPriceGiftList.push(priceGiftItem);
ordinaryCart.gGiftAndPriceGiftList = gGiftAndPriceGiftList;
//失效商品
// 失效商品
ordinaryCart.invalidGoodsList = [...(data.off_shelves_goods_list || []), ...(data.sold_out_goods_list || [])];
if (ordinaryCart.invalidGoodsList.length) {
isEmptyCart = false;
... ... @@ -226,10 +230,9 @@ const formatOrdinaryCartData = (data, needAllGoods) => {
return {
isEmptyCart,
// eslint-disable-next-line
...ordinaryCart
};
}
};
const changeGoodsListData = (list, selected) => {
let glist = [];
... ... @@ -253,7 +256,7 @@ const changeGoodsListData = (list, selected) => {
});
return glist;
}
};
export default {
formatOrdinaryCartData,
... ...
... ... @@ -6,9 +6,9 @@
<text class="{{item.showArrow ? '' : 'disable-text'}}">{{item.statusString}}</text>
<text class="iconfont icon-right" wx:if="{{item.showArrow}}"></text>
</view>
<text class="iconfont icon-right" wx:if="{{item.isGift}}"></text>
<text class="iconfont icon-right" wx:else></text>
<text class="giftOrPriceTitle">{{item.title}}</text>
<image src="https://img12.static.yhbimg.com/sns/2018/07/03/16/0262ef3b8c6fb54d49b2cac5a97ae05193.png?imageView/1/w/24/h/24" class="img-icon" wx:if="{{item.isGift}}"></image>
<image src="https://img11.static.yhbimg.com/sns/2018/07/03/16/010c781087b51cdde0b1855d4d5fa51acd.png?imageView/1/w/24/h/24" class="img-icon" wx:else></image>
<text class="giftOrPriceTitle">32131231{{item.title}}</text>
</view>
<view class="split-line"></view>
</view>
... ...
... ... @@ -16,3 +16,14 @@
.gift-wrap .right-option {
float: right;
}
.gift-wrap .img-icon {
width: 44rpx;
height: 44rpx;
display: inline-block;
vertical-align: middle;
margin-right: 12rpx;
position: relative;
top: -4rpx;
left: -6rpx;
}
... ...
... ... @@ -9,7 +9,7 @@
</view>
<view class="left-text">
<view class="promotion-type" wx:if="{{isSub && item.typeString}}">{{item.typeString}}</view>
<text class="iconfont icon-warn-fill" wx:if="{{!isSub}}"></text>
<image src="./images/promotion-icon.png" class="promotion-icon" wx:if="{{!isSub}}"></image>
<text class="promotion-desc">{{item.promotion_desc}}</text>
</view>
</view>
... ...
... ... @@ -55,6 +55,15 @@
float: right;
}
.promotion-item .promotion-icon {
width: 30rpx;
height: 30rpx;
display: inline-block;
vertical-align: middle;
position: relative;
top: -2rpx;
}
.promotion-item .promotion-status {
color: #ff575c;
}
... ...
... ... @@ -46,7 +46,7 @@
<view class="stepper">
<view bindtap="bindMinus" class='reduceNumberBtn'>
<image class='reduceImage'
src='{{pickerData.view.minusButtonEnable ? "../../static/images/jian_h@2x.png" : "../../static/images/jian_disable@2x.png"}}'></image>
src='{{pickerData.view.minusButtonEnable ? "/static/images/jian_h@2x.png" : "/static/images/jian_disable@2x.png"}}'></image>
</view>
<view class='buyNumberText'>
{{pickerData.view.buyNumber}}
... ...