Authored by 肖亚东

购物车功能 — review by 黄敬囿

Showing 64 changed files with 3460 additions and 11 deletions
import { getYHStorageSync } from './utils/util';
App({
globalData: {
selectedChannel: 'boy',
... ... @@ -37,9 +39,14 @@ App({
this.globalData.systemInfo = res;
},
isLogin: function () {
// return this.globalData.userInfo.uid > 0 ? true : false
return true;
},
getUid: function() {
let uid = '500031152';//this.globalData.userInfo.uid;
// let uid = '500031152';//this.globalData.userInfo.uid;
let uid = '9728165';//线上
// if (!uid || uid === 0) {
// this.getUserInfo();
// uid = this.globalData.userInfo.uid;
... ...
... ... @@ -21,6 +21,7 @@
"pages/orders/orderDetail/orderDetail",
"pages/goodsList/newArrival",
"pages/goodsDetail/goodsDetail"
],
"window":{
"navigationBarBackgroundColor": "#3a3a3a",
... ...
import { getYHStorageSync } from '../../../utils/util';
Component({
properties: {
data: {
... ...
Component({
properties: {
data: {
type: null,
},
onlyTextBrand: {//纯文本展示品牌 '0' 图文品牌 '1' 纯文字品牌
type: String,
value: '0'
}
},
data: {
textBrandKey:[],
textBrandData:[]
},
ready: function () {
//头条列表渲染不支持字典循环,故转换成数组 2018/12/7
if (this.properties.onlyTextBrand == '1') {
let textBrandKey = [];
let textBrandData = [];
for (const iterator of Object.keys(this.properties.data)) {
textBrandData.push(this.properties.data[iterator]);
textBrandKey.push(iterator);
}
this.setData({
textBrandData,
textBrandKey
})
}
},
methods: {
brandItemTapped: function(event) {
this.triggerEvent('brandItemTapped', event);
}
}
})
... ...
<!--赠品or加价购cell-->
<view class="piftOrPriceContainer">
<block tt:for="{{giftList}}" tt:key="item">
<view class="cellLine" tt:if="{{index > 0}}"></view>
<!-- 如果已抢光 则没有点击事件 -->
<view class="piftOrPriceCell" bindtap="{{item.showArrow ? 'navToGiftPage' : ''}}" data-promotion-item="{{item}}">
<view class='cellContainer'>
<image class="giftOrPriceIcon" src="../../../images/cart_gift_icon@2x.png" tt:if="{{item.isGift}}"></image>
<image class="giftOrPriceIcon" src="../../../images/cart_buyagain_icon@2x.png" tt:if="{{!item.isGift}}"></image>
<text class="giftOrPriceTitle">{{item.title}}</text>
</view>
<view class='cellContainer'>
<text class="{{item.showArrow ? 'giftOrPriceStatusString' : 'giftOrPriceInvalidStatusString'}}">{{item.statusString}}</text>
<!-- 如果已抢光 则不展示箭头 -->
<image tt:if="{{item.showArrow}}" class="giftOrPriceRightArrow" src='../../../images/goodslist_screen_right_icon@2x.png'></image>
</view>
</view>
</block>
<view class="bottonGray"></view>
</view>
\ No newline at end of file
... ...
.piftOrPriceContainer {
display:flex;
width: 100%;
flex-direction: column;
background-color: white;
}
.piftOrPriceCell {
width: 100%;
display: flex;
flex-direction:row;
height: 90rpx;
align-items: center;
align-content: center;
position: relative;
justify-content: space-between;
}
.piftOrPriceCell .cellContainer {
display: flex;
align-content: center;
align-items: center;
}
.giftOrPriceIcon{
width: 44rpx;
height: 44rpx;
margin-left: 30rpx;
}
.giftOrPriceTitle{
font-family: PingFangSC;
font-size: 32rpx;
color: #444444;
margin-left: 30rpx;
}
.giftOrPriceStatusString {
margin-right: 16rpx;
font-family: PingFangSC;
font-size: 28rpx;
color: #ff575c;
}
.giftOrPriceInvalidStatusString {
margin-right: 63rpx;
font-family: PingFangSC;
font-size: 28rpx;
color: #b0b0b0;
}
.giftOrPriceRightArrow {
margin-right: 30rpx;
width: 30rpx;
height: 30rpx;
}
\ No newline at end of file
... ...
Component({
properties: {
data: {
type: null,
},
onlyTextBrand: {//纯文本展示品牌 '0' 图文品牌 '1' 纯文字品牌
type: String,
value: '0'
}
},
data: {
textBrandKey:[],
textBrandData:[]
},
ready: function () {
//头条列表渲染不支持字典循环,故转换成数组 2018/12/7
if (this.properties.onlyTextBrand == '1') {
let textBrandKey = [];
let textBrandData = [];
for (const iterator of Object.keys(this.properties.data)) {
textBrandData.push(this.properties.data[iterator]);
textBrandKey.push(iterator);
}
this.setData({
textBrandData,
textBrandKey
})
}
},
methods: {
brandItemTapped: function(event) {
this.triggerEvent('brandItemTapped', event);
}
}
})
... ...
<!-- 无效商品cell -->
<view class="commonProductCellContainer">
<block tt:for="{{invalidGoodsList}}" tt:key="item">
<view class="poolGoodCellContainer">
<view tt:if="{{index > 0}}" class='cellLine'>
</view>
<view class="pollGoodContainer, infoContainer" bindtap='navtoProductDetailPage' data-item="{{item}}" bindtouchend="moveEnd" bindtouchstart="moveStart" animation="{{tempSku == item.unique_identifier ? deleteAnimation : ''}}">
<image src="../../../images/gwc_shixiao@2x.png" class="invalidBtn"></image>
<image src="{{item.goods_images}}" class="goodsImage" style="margin-left:9px;"></image>
<view class="goodsInfoContainer">
<view class="productNameContainer">
<text class="productName">{{item.product_name}}</text>
</view>
</view>
<view class="cellDeleteBtn" catchtap="deleteGoodsCell" data-type="{{item}}">
<text class="cellDeleteText">删除</text>
</view>
</view>
</view>
</block>
<view class='sepLineStyle'>
</view>
<view class="cleanInvalidContainer">
<text class="cleanInvalidText" bindtap='cleanInvalidAction'>清空无效商品</text>
</view>
<view class="bottonGray"></view>
</view>
\ No newline at end of file
... ...
.invalidBtn {
width: 32px;
height: 15px;
margin-left: 9px;
}
.cleanInvalidContainer{
height: 60px;
width: 100%;
align-items: center;
line-height: 60px;
text-align: center;
}
.cleanInvalidText{
width: 82px;
height: 13.5px;
font-family: STHeitiSC;
font-size: 14px;
font-weight: 300;
line-height: 0.93;
color: #444444;
border-radius: 2px;
border: solid 1px #b0b0b0;
padding-left: 16px;
padding-right: 16.5px;
padding-top: 7.5px;
padding-bottom: 9px;
}
.cellDeleteBtn {
position: absolute;
display: flex;
right: -140rpx;
top: 0rpx;
height: 240rpx;
line-height: 240rpx;
width: 140rpx;
background-color: #d0021b;
align-items: center;
justify-content: center;
}
.cellDeleteText{
font-family: PingFangSC;
font-size: 32rpx;
text-align: center;
color: #ffffff;
}
\ No newline at end of file
... ...
Component({
properties: {
data: {
type: null,
}
},
data: {
},
attached: function () {
console.log('======shoppingCartOneProductCell====');
console.log(this.properties.data);
console.log('====================================');
},
methods: {
}
})
... ...
<view class="pollGoodContainer" bindtap='{{data.isEditing ? "" : "navtoProductDetailPage"}}' data-item='{{data.goodsItem}}' data-type="{{data.goodsItem}}" bindtouchend="moveEnd" bindtouchstart="moveStart" animation="{{data.tempSku == data.goodsItem.unique_identifier ? data.deleteAnimation : ''}}">
<image tt:if="{{(data.goodsItem.goods_type != 'gift') && (!data.goodsItem.batch_no && !data.goodsItem.bundle_activity_id)}}" src="{{data.goodsItem.bSelected ? '../../../images/gwc_choose@2x.png' : '../../../images/gwc_n@2x.png'}}" class="selectBtn" catchtap="selectSingleGoodsAction" data-type="{{data.goodsItem}}"></image>
<image src="{{data.goodsItem.goods_images}}" class="goodsImage">
<image tt:if="{{data.goodsItem.bLackStorage}}" class='gift-tag-image' src='../../../images/kcbz-lab@2x.png'/>
<image tt:elif="{{data.goodsItem.goods_type == 'gift'}}" class='gift-tag-image' src='../../../images/zp-lab@2x.png'/>
<image tt:elif="{{data.goodsItem.goods_type == 'price_gift'}}" class='gift-tag-image' src='../../../images/jjg-lab@2x.png'/>
</image>
<view class="goodsInfoContainer" tt:if="{{!data.isEditing}}">
<text class="productName">{{data.goodsItem.product_name}}</text>
<text class="productColorSizeString">{{data.goodsItem.goodColorSizeString}}</text>
<view class="priceContainer">
<view class='current-old-price-container'>
<text class="goodsPriceString">{{data.goodsItem.priceString}}</text>
<block tt:if="{{data.goodsItem.isShowOldPrice}}">
<text class="oldPrice">{{data.goodsItem.oldPricString}}</text>
</block>
</view>
<view class="reduceStringontainer" tt:if="{{data.goodsItem.price_down > 0}}">
<text class="reduceString">已降¥{{data.goodsItem.price_down}}</text>
</view>
</view>
</view>
<view class='bundleGoodSizeInfoContainer' bindtap="chooseSizeColorAction" data-type="{{data.goodsItem}}" tt:if="{{data.isEditing && (data.goodsItem.batch_no && data.goodsItem.bundle_activity_id)}}">
<view class='bundleGoodSizeText'>{{data.goodsItem.goodColorSizeString}}</view>
<image class='bundleGoodArrowImage' src='../../../images/down-ic@2x.png'></image>
</view>
<view class="goodsInfoEditContainer" tt:elif="{{data.isEditing}}">
<view class="cutPlusContainer">
<view class="cutPlusView" tt:if="{{data.goodsItem.buy_number != 1}}" bindtap="cutDownBuyCountAction" data-type="{{data.goodsItem}}">
<image src="../../../images/jian_h@2x.png" class="cutImage"></image>
</view>
<view class="cutPlusView" tt:if="{{data.goodsItem.buy_number == 1}}">
<image src="../../../images/jian_disable@2x.png" class="cutImage"></image>
</view>
<view class="numberView">
<text class="numberText">{{data.goodsItem.buy_number}}</text>
</view>
<view class="cutPlusView" tt:if="{{!data.goodsItem.bLackStorage && data.goodsItem.buy_number != data.goodsItem.storage_number}}" bindtap="plusBuyCountAction" data-type="{{data.goodsItem}}">
<image src="../../../images/and_normal@2x.png" class="plusImage"></image>
</view>
<view class="cutPlusView" tt:if="{{data.goodsItem.bLackStorage || data.goodsItem.buy_number == data.goodsItem.storage_number}}" bindtap="plusReachedMaxAction">
<image src="../../../images/and_h@2x.png" class="plusImage"></image>
</view>
</view>
<view class="colorSizeContainer" bindtap="chooseSizeColorAction" data-type="{{data.goodsItem}}">
<view class="colorSizeView">
<text class="colorSizeText">{{data.goodsItem.goodColorSizeString}}</text>
</view>
<view class="cutPlusView">
<image class="arrowImage" src="../../../images/down-ic@2x.png"></image>
</view>
</view>
</view>
<text class="buyNumbText" tt:if="{{!data.isEditing}}">x {{data.goodsItem.buy_number}}</text>
<!-- <view class="lackStorageContainer" tt:if="{{data.goodsItem.bLackStorage && !data.isEditing}}">
<text class="lackStorageText">库存不足</text>
</view> -->
<view class="cellDeleteBtn" catchtap="deleteGoodsCell" data-type="{{data.goodsItem}}">
<text class="cellDeleteText">删除</text>
</view>
</view>
\ No newline at end of file
... ...
.pollGoodContainer {
position: relative;
display: flex;
flex-direction: row;
align-items: center;
}
.selectBtn {
width: 40rpx;
height: 40rpx;
margin-left: 30rpx;
}
.goodsImage {
width: 150rpx;
height: 200rpx;
margin-left: 30rpx;
margin-top: 20rpx;
}
.goodsInfoContainer {
direction: flex;
flex-direction: column;
height: 100%;
left: 280rpx;
margin-top: 0;
margin-left: 30rpx;
}
.productName {
font-family: PingFang SC;
margin-top: 36rpx;
width: 323rpx;
font-size: 26rpx;
text-align: left;
direction: flex;
color: #444;
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 34rpx;
}
.productColorSizeString {
font-family: PingFang SC;
height: 23rpx;
font-size: 24rpx;
line-height: 1.25;
text-align: left;
color: #b0b0b0;
margin-top: 20rpx;
overflow: hidden;
text-overflow: ellipsis;
}
.priceContainer {
display: flex;
flex-direction: row;
position: relative;
width: 100%;
margin-top: 20rpx;
align-items: center;
}
.current-old-price-container {
display: flex;
}
.goodsPriceString {
font-size: 26rpx;
color: #d0021b;
}
.oldPrice {
font-size: 26rpx;
margin-left: 10rpx;
color: #b0b0b0;
text-decoration: line-through;
}
.buyNumbText {
position:absolute;
right: 20rpx;
top: 80rpx;
height: 20rpx;
font-family: PingFang-HK;
font-size: 26rpx;
color: #b0b0b0;
}
.goodsInfoEditContainer {
position: absolute;
width: 350rpx;
height: 130rpx;
border-radius: 6rpx;
border: solid 1px #e0e0e0;
left: 280rpx;
}
.cutPlusContainer {
width: 350rpx;
height: 66rpx;
border-bottom: solid 1px #e0e0e0;
display: flex;
flex-direction: row;
}
.colorSizeContainer{
width: 350rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
}
.colorSizeText {
font-family: PingFang SC;
font-size: 24rpx;
color: #444444;
display:-webkit-box;
-webkit-line-clamp:1;
-webkit-box-orient:vertical;
overflow:hidden;
}
.cutPlusView {
width: 70rpx;
height: 66rpx;
display: flex;
align-items: center;
justify-content: center;
}
.cutImage {
width: 24rpx;
height: 4rpx;
}
.plusImage {
width: 24rpx;
height: 24rpx;
}
.numberView {
width: 210rpx;
height: 66rpx;
border-left: solid 1px #e0e0e0;
border-right: solid 1px #e0e0e0;
display: flex;
align-items: center;
justify-content: center;
}
.numberText {
font-family: Helvetica;
font-size: 28rpx;
color: #444444;
}
.colorSizeView{
width: 280rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
}
.arrowImage {
width: 28rpx;
height: 16rpx;
}
.cellDeleteBtn {
position: absolute;
display: flex;
right: -140rpx;
top: 0rpx;
height: 240rpx;
line-height: 240rpx;
width: 140rpx;
background-color: #d0021b;
align-items: center;
justify-content: center;
}
.cellDeleteText{
font-family: PingFangSC;
font-size: 32rpx;
text-align: center;
color: #ffffff;
}
.bundleGoodSizeInfoContainer {
width: 350rpx;
height: 64rpx;
margin-left: 280rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border: solid 1px #e0e0e0;
border-radius: 6rpx;
}
.bundleGoodSizeText {
font-family: PingFangSC;
font-size: 24rpx;
text-align: center;
width: 276rpx;
margin-left: 10rpx;
color: #444444;
display:-webkit-box;
-webkit-line-clamp:1;
-webkit-box-orient:vertical;
overflow:hidden;
}
.bundleGoodArrowImage {
width: 27rpx;
height: 16rpx;
margin-right: 20rpx;
}
.reduceStringontainer {
height: 28rpx;
border-radius: 3px;
margin-left: 10rpx;
background-color: #d0021b;
display: flex;
justify-content: center;
align-items: center;
}
.reduceString {
font-family: PingFang-HK;
font-size: 18rpx;
text-align: center;
color: white;
padding: 0 10rpx;
}
\ No newline at end of file
... ...
Component({
properties: {
data: {
type: null,
}
},
data: {
},
attached: function () {
console.log('====================================');
console.log(this.properties.data);
console.log('====================================');
},
methods: {
}
})
... ...
{
"component": true,
"usingComponents": {
"shoppingCartOneProductCell": "./shoppingCartOneProductCell"
}
}
... ...
<view class="commonProductCellContainer">
<block tt:if="{{data.item.promotion_list.length}}">
<view class="promotionViewContainer">
<block tt:for="{{item.promotion_list}}" tt:for-item="promotionItem" tt:for-index="promotionIndex" tt:key="promotion">
<view class="promotionCell" data-promotion-item="{{promotionItem}}" bindtap="navToPromotionPage" tt:if="{{promotionIndex == 0 || data.item.isPromotionExpanded}}">
<view class='promotionTitleContainer'>
<view class='viewCenterStyle'>
<image class="promotionIcon" src="../../../images/shoppingcart_promotion_icon@2x.png"></image>
</view>
<view class="promotionDesc">{{promotionItem.promotion_desc}}</view>
</view>
<view class='promotionRightContainer'>
<view class="{{subPromotionItem.seldoutStyle ? 'statuString' : 'statuStringSeldOut'}}" tt:if="{{promotionItem.statuString.length > 0}}">{{promotionItem.statuString}}</view>
<view class='viewCenterStyle'>
<image class="rightArrow" src="../../../images/goodslist_screen_right_icon@2x.png"></image>
</view>
</view>
</view>
</block>
<block tt:if="{{data.item.promotion_list.length > 1}}">
<view class="promotioMoreArrowContainer" bindtap="flexOrUnflexPromotion" data-type="{{data.index}}">
<image class="promotioMoreArrow" tt:if="{{!data.item.isPromotionExpanded}}" src="../../../images/promotionDown@2x.png"></image>
<image class="promotioMoreArrow" tt:if="{{data.item.isPromotionExpanded}}" src="../../../images/promotionUp@2x.png"></image>
</view>
</block>
</view>
<view class='sepLineStyle'>
</view>
</block>
<block tt:if="{{data.item.sub_pool.length}}">
<block tt:for="{{data.item.sub_pool}}" tt:for-item="subPoolItem" tt:for-index="subPoolIndex" tt:key="subPool">
<block tt:for="{{subPoolItem.promotion_list}}" tt:for-item="subPromotionItem" tt:for-index="subPromotionIndex" tt:key="subPromotion">
<view class='cellLine' tt:if="{{subPoolIndex > 0}}">
</view>
<view class="subPromotionCell" data-promotion-item="{{subPromotionItem}}" bindtap="navToPromotionPage" tt:if="{{subPromotionIndex == 0 || subPromotionItem.isPromotionExpanded}}">
<view class='promotionTitleContainer'>
<view style="flex-shrink: 0;">
<view class="subPromotionTypeString">{{subPromotionItem.typeString}}</view>
</view>
<view class="promotionDesc">{{subPromotionItem.promotion_desc}}</view>
</view>
<view class='promotionRightContainer'>
<view class="{{subPromotionItem.seldoutStyle ? 'statuString' : 'statuStringSeldOut'}}" tt:if="{{subPromotionItem.statuString.length > 0}}">{{subPromotionItem.statuString}}</view>
<view class='viewCenterStyle'>
<image class="rightArrow" src="../../../images/goodslist_screen_right_icon@2x.png"></image>
</view>
</view>
</view>
</block>
<block tt:for="{{subPoolItem.goods_list}}" tt:for-item="subPoolGoodsItem" tt:for-index="subPoolGoodsIndex" tt:key="subPoolGoods">
<view class="cellLine" tt:if="{{subPoolIndex > 0 || (subPoolItem.promotion_list.length > 0)}}">
</view>
<view class="poolGoodCellContainer">
<!--
<template is="shoppingCartOneProductCell" data="{{goodsItem:subPoolGoodsItem,isEditing,deleteAnimation,tempSku}}"></template>
<shoppingCartOneProductCell data="{{goodsItem:subPoolGoodsItem,data.isEditing,data.deleteAnimation,data.tempSku}}"></shoppingCartOneProductCell>
-->
</view>
</block>
</block>
</block>
<block tt:if="{{data.item.pool_type == 3 && data.item.pool_batch_no}}">
<view class='bundleHeaderView'>
<view class='titleContainer'>
<view class='leftTitleContainer'>
<image bindtap='tapBundleProductHeader' data-bundledata='{{item}}' class='selectStatusImage' src="{{data.item.selected == 'Y' ? '../../../images/gwc_choose@2x.png' : '../../../images/gwc_n@2x.png'}}"></image>
<view class='bundleFirstTitle'>优惠套装</view>
<view class='bundleTitle'>{{data.item.pool_title}}</view>
</view>
<view tt:if="{{!data.isEditing}}" class='bundleBuyNumbText'>x {{data.item.pool_buy_number}}</view>
</view>
<view tt:if="{{data.isEditing}}" class='editNumberContainer'>
<view class='bundleEidtLeftContainer'>
<view class='bundleNumber'>套餐数量</view>
<view class='bundleEidtView'>
<view class='reduceActionBtn' bindtap='{{data.item.int_pool_buy_number > 1 ? "bundleReduceTap" : ""}}' data-item='{{data.item}}'>
<image class='reduceImage' src='{{data.item.int_pool_buy_number > 1 ? "../../../images/jian_h@2x.png" : "../../../images/jian_disable@2x.png"}}'></image>
</view>
<view class='buyNumberActionText'>
<view class='currentNumber'>{{data.item.pool_buy_number}}</view>
</view>
<view class='addActionBtn' bindtap='{{data.item.int_pool_buy_number < data.item.int_pool_storage_number ? "bundleAddTap" : ""}}' data-item='{{data.item}}'>
<image class='addImage' src='{{data.item.int_pool_buy_number < data.item.int_pool_storage_number ? "../../../images/and_normal@2x.png" : "../../../images/and_h@2x.png"}}'></image>
</view>
</view>
</view>
</view>
</view>
<view class='sepLineStyle'>
</view>
</block>
<block tt:if="{{data.item.goods_list.length}}">
<block tt:for="{{data.item.goods_list}}" tt:for-item="goodsItem" tt:for-index="goodsIndex" tt:key="goodsitem">
<view class='cellLine' tt:if="{{goodsIndex> 0}}">
</view>
<view class="poolGoodCellContainer">
<!--
<template is="shoppingCartOneProductCell" data="{{goodsItem,data.isEditing,data.deleteAnimation,data.tempSku}}"></template>
-->
<shoppingCartOneProductCell data="{{goodsItem, isEditing,deleteAnimation,tempSku}}"></shoppingCartOneProductCell>
</view>
</block>
</block>
<view class="bottonGray"></view>
</view>
\ No newline at end of file
... ...
/* shoppingCartProductCell.wxss */
.commonProductCellContainer {
display: flex;
width: 100%;
flex-direction: column;
background-color: white;
}
.promotionViewContainer {
padding-top: 20rpx;
}
.promotionCell {
display: flex;
flex-direction: row;
position: relative;
margin-left: 30rpx;
margin-right: 30rpx;
margin-bottom: 20rpx;
align-items: center;
justify-content: space-between;
}
.promotionTitleContainer {
display: flex;
flex-direction: row;
align-items: center;
}
.viewCenterStyle {
align-items: center;
display: flex;
}
.promotionRightContainer {
display: flex;
flex-direction: row;
align-items: center;
flex-shrink: 0;
}
.subPromotionCell {
display: flex;
flex-direction: row;
position: relative;
margin: 20rpx 30rpx 20rpx 100rpx;
align-items: center;
justify-content: space-between;
}
.subPromotionTypeString {
font-size: 18rpx;
text-align: center;
color: #ff575c;
border: solid 1px #ff575c;
border-radius: 6rpx;
padding: 4rpx 16rpx;
}
.promotionIcon {
width: 30rpx;
height: 30rpx;
}
.promotionDesc {
font-size: 26rpx;
text-align: left;
color: #444;
margin-left: 9rpx;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
.statuString {
font-size: 24rpx;
text-align: right;
color: #ff575c;
}
.statuStringSeldOut {
font-size: 24rpx;
text-align: right;
color: #ff575c;
}
.rightArrow {
width: 30rpx;
height: 30rpx;
}
.promotioMoreArrowContainer {
width: 100%;
height: 12rpx;
align-items: center;
display: flex;
flex-direction: column;
padding-bottom: 20rpx;
}
.promotioMoreArrow {
width: 20rpx;
height: 12rpx;
}
.poolGoodCellContainer {
/* position: relative; */
width: 100%;
height: 240rpx;
background-color: white;
display: flex;
flex-direction: column;
}
.gift-tag-image {
width: 150rpx;
height: 24rpx;
position: absolute;
bottom: 0;
}
.infoContainer {
z-index: 5;
transition: left 0.2s ease-in-out;
text-overflow: ellipsis;
display: flex;
flex-direction: row;
align-items: center;
height: 240rpx;
background-color: white;
overflow: visible;
}
.deleteContainer {
z-index: 4;
}
.cellLine {
width: 650rpx;
height: 2rpx;
margin-left: 100rpx;
z-index: 999;
transform: scaleY(0.5);
background-color: #e0e0e0;
}
.bottonGray {
width: 100%;
height: 15rpx;
background-color: #f0f0f0;
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.bundleHeaderView {
display: flex;
flex-direction: column;
padding: 20rpx 30rpx;
}
.titleContainer {
flex-direction: row;
align-items: center;
height: 40rpx;
justify-content: space-between;
display: flex;
}
.leftTitleContainer {
flex-direction: row;
display: flex;
}
.selectStatusImage {
width: 40rpx;
height: 40rpx;
margin-left: 0;
margin-top: 0;
}
/* 优惠套装 */
.bundleFirstTitle {
font-size: 18rpx;
font-family: PingFang-SC;
padding: 6rpx 12rpx;
color: white;
background-color: #d0021b;
border-radius: 3px;
margin-left: 30rpx;
}
.bundleTitle {
font-size: 26rpx;
text-align: left;
color: #444;
margin-left: 16rpx;
align-self: center;
width: 420rpx;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
.bundleBuyNumbText {
font-family: PingFang-HK;
font-size: 26rpx;
color: #b0b0b0;
right: 0;
}
.editNumberContainer {
flex-direction: row;
align-items: center;
height: 65rpx;
justify-content: space-between;
display: flex;
margin-top: 10rpx;
}
.bundleEidtLeftContainer {
margin-left: 70rpx;
display: flex;
flex-direction: row;
}
.bundleNumber {
font-size: 26rpx;
text-align: left;
color: #444;
align-self: center;
}
.bundleEidtView {
margin-left: 78rpx;
width: 350rpx;
height: 65rpx;
border: solid 1px #e0e0e0;
border-radius: 4px;
display: flex;
flex-direction: row;
}
.reduceActionBtn {
width: 68rpx;
height: 65rpx;
display: flex;
align-items: center;
justify-content: center;
}
.addActionBtn {
width: 68rpx;
height: 65rpx;
display: flex;
align-items: center;
justify-content: center;
}
.buyNumberActionText {
width: 210rpx;
height: 65rpx;
border-left: solid 1px #e0e0e0;
border-right: solid 1px #e0e0e0;
display: flex;
justify-content: center;
align-items: center;
}
.buyNumberActionText .currentNumber {
font-size: 28rpx;
font-family: PingFang-SC;
text-align: center;
color: #444;
display: flex;
}
.reduceImage {
width: 24rpx;
height: 4rpx;
}
.addImage {
width: 24rpx;
height: 24rpx;
}
.sepLineStyle {
width: 100%;
height: 2rpx;
margin-left: 0;
z-index: 999;
transform: scaleY(0.5);
background-color: #e0e0e0;
}
... ...
Component({
properties: {
data: {
type: null,
},
onlyTextBrand: {//纯文本展示品牌 '0' 图文品牌 '1' 纯文字品牌
type: String,
value: '0'
}
},
data: {
textBrandKey:[],
textBrandData:[]
},
ready: function () {
//头条列表渲染不支持字典循环,故转换成数组 2018/12/7
if (this.properties.onlyTextBrand == '1') {
let textBrandKey = [];
let textBrandData = [];
for (const iterator of Object.keys(this.properties.data)) {
textBrandData.push(this.properties.data[iterator]);
textBrandKey.push(iterator);
}
this.setData({
textBrandData,
textBrandKey
})
}
},
methods: {
brandItemTapped: function(event) {
this.triggerEvent('brandItemTapped', event);
}
}
})
... ...
<!--促销标题cell-->
<view class="promotionContainer">
<text class="promotionHeader">已参与活动</text>
<block tt:for="{{promotionList}}" tt:key="item">
<text class="promotionTitle">• {{item.promotion_title}}</text>
</block>
<view class='sepLineStyle'>
</view>
</view>
\ No newline at end of file
... ...
.promotionContainer{
display:flex;
width: 100%;
flex-direction: column;
background-color: white;
}
.promotionHeader{
width: 100%;
height: 13.5px;
font-family: PingFang-SC;
font-size: 14px;
color: #444444;
margin-left: 15px;
margin-top: 14px;
margin-bottom: 10px;
}
.promotionTitle {
font-size: 13px;
color: #444444;
margin-bottom: 8px;
margin-left: 15px;
}
... ...
Component({
properties: {
data: {
type: null,
},
onlyTextBrand: {//纯文本展示品牌 '0' 图文品牌 '1' 纯文字品牌
type: String,
value: '0'
}
},
data: {
textBrandKey:[],
textBrandData:[]
},
ready: function () {
//头条列表渲染不支持字典循环,故转换成数组 2018/12/7
if (this.properties.onlyTextBrand == '1') {
let textBrandKey = [];
let textBrandData = [];
for (const iterator of Object.keys(this.properties.data)) {
textBrandData.push(this.properties.data[iterator]);
textBrandKey.push(iterator);
}
this.setData({
textBrandData,
textBrandKey
})
}
},
methods: {
brandItemTapped: function(event) {
this.triggerEvent('brandItemTapped', event);
}
}
})
... ...
<view tt:if="{{curShoppingCartData.shipping_cost_prompt.shipping_cost_tips != '' || curShoppingCartData.shipping_cost_prompt.price_down_tips != ''}}" class="floatHeaderContainer">
<text class="shippingCostTip">{{curShoppingCartData.shipping_cost_prompt.shipping_cost_tips}}</text>
<view tt:if="{{curShoppingCartData.shipping_cost_prompt.price_down_tips}}" class="priceDownTipsContainer">
<text class="shippingCostTip">{{curShoppingCartData.shipping_cost_prompt.price_down_tips}} haha</text>
<image class="priceDownTipsClose" src="../../../images/close_icon@2x.png"></image>
</view>
</view>
\ No newline at end of file
... ...
.floatHeaderContainer {
width: 100%;
height:35.5px;
background-color: #f0f0f0;
position: relative;
}
.shippingCostTip {
padding-left: 12.5px;
width: 80%;
color: #444444;
text-align: left;
font-size: 14px;
line-height: 35.5px;
height: 35.5px;
}
.priceDownTipsContainer {
display:flex;
flex-direction:row;
justify-content: center;
top: 0px;
left: 0px;
width: 100%;
height: 35.5px;
background-color: #f0f0f0;
}
.priceDownTipsClose {
width: 30px;
height: 30px;
}
\ No newline at end of file
... ...
Component({
properties: {
data: {
type: null,
},
onlyTextBrand: {//纯文本展示品牌 '0' 图文品牌 '1' 纯文字品牌
type: String,
value: '0'
}
},
data: {
textBrandKey:[],
textBrandData:[]
},
ready: function () {
//头条列表渲染不支持字典循环,故转换成数组 2018/12/7
if (this.properties.onlyTextBrand == '1') {
let textBrandKey = [];
let textBrandData = [];
for (const iterator of Object.keys(this.properties.data)) {
textBrandData.push(this.properties.data[iterator]);
textBrandKey.push(iterator);
}
this.setData({
textBrandData,
textBrandKey
})
}
},
methods: {
brandItemTapped: function(event) {
this.triggerEvent('brandItemTapped', event);
}
}
})
... ...
<view class="shoppingCartFooterContainer">
<view class="selectAllContainer">
<image src="../../../images/gwc_n@2x.png" class="selectBtn" tt:if="{{!isSelectAll}}" bindtap="selectAllGoodsAction" data-type="{{isSelectAll}}"></image>
<image src="../../../images/gwc_choose@2x.png" class="selectBtn" tt:if="{{isSelectAll}}" bindtap="selectAllGoodsAction" data-type="{{isSelectAll}}"></image>
<text class="selectAllText">全选</text>
</view>
<view class="settlementContainer" tt:if="{{!isEditing}}">
<view class="totalCostContainer">
<text class="totalCostText">总计{{item.last_order_amount}}({{item.selected_goods_count}})件</text>
<text class="freightTipText">不含运费</text>
</view>
<view class="paymentContainer" style='{{item.selected_goods_count > 0 ? "" : "background-color: #b0b0b0"}}'>
<text class="paymentText" bindtap='{{item.selected_goods_count > 0 ? "paymentAction" : ""}}'>结算</text>
</view>
</view>
<view class="settlementContainer" tt:if="{{isEditing}}">
<!-- <view class="moveToFavContainer" bindtap="mutilAddToFav">
<text class="paymentText">移入收藏夹</text>
</view> -->
<view class="deleteContainer" bindtap="mutilDeleteEditing">
<text class="paymentText">删除</text>
</view>
</view>
</view>
\ No newline at end of file
... ...
.shoppingCartFooterContainer {
position: fixed;
background-color:white;
width:100%;
height:64px;
display:flex;
flex-direction:row;
justify-content: space-between;
z-index: 99;
bottom: 0px;
align-items: center;
}
.selectAllContainer {
display:flex;
flex-direction:column;
}
.selectAllText {
height: 11.5px;
font-family: PingFang-SC;
font-size: 12px;
line-height: 1.67;
color: #444444;
margin-left: 15px;
margin-top: 3px;
}
.settlementContainer {
display:flex;
flex-direction:row;
align-items: center;
margin-top: 15px;
margin-bottom: 12px;
justify-content: flex-end;
width: 85%;
}
.totalCostContainer {
display:flex;
flex-direction:column;
align-items: flex-end;
}
.totalCostText {
height: 16.5px;
font-family: PingFang-SC;
font-size: 17px;
line-height: 1.18;
color: #d0021b;
}
.freightTipText {
height: 11.5px;
font-family: PingFang-SC;
font-size: 12px;
line-height: 1.67;
color: #b0b0b0;
}
.paymentContainer{
width: 84px;
height: 44px;
border-radius: 3px;
background-color: #d0021b;
text-align: center;
margin-right: 14px;
margin-left: 12px;
}
.paymentText{
font-family: PingFang-SC;
font-size: 14px;
color: #ffffff;
line-height: 44px;
}
.moveToFavContainer {
width: 84px;
height: 44px;
border-radius: 3px;
background-color: black;
text-align: center;
margin-right: 14px;
}
.deleteContainer {
width: 84px;
height: 44px;
border-radius: 3px;
background-color: #d0021b;
text-align: center;
margin-right: 14px;
}
\ No newline at end of file
... ...
... ... @@ -10,7 +10,7 @@ export default {
// api: 'http://apigray.yoho.cn',
// test
// api: 'http://api-test3.dev.yohocorp.com',
// api: 'http://api-test3.dev.yohocorp.com',
yasApi: 'https://analysis.yohobuy.com/yas_mobile',
app_report_host: 'https://app.yoho.cn/collect/v3',
... ...

481 Bytes | W: | H:

480 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin

344 Bytes | W: | H:

345 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
const app = getApp()
// shopCart.js
import api from '../../common/api.js';
import { curShoppingCartDataAddExpandedFlag, editInfoDicFromGoodsList, hasLackStorageGoodsInList, curPageDataAllSelectWhenEditing,
curPageDataSingleSelectWhenEditing, curPageDataSingleSelectBundleProductWhenEditing, editInfoOfAllGoods, editInfoSelectedGoodsList, editInfoDicFromBundleItem} from '../../utils/shopCartContent';
// var Picker = require('../goodsDetail/picker/picker.js')
import { getGoodInfo, getGoodSize, getGoodImages } from '../../utils/productDetail';
// import {
// logEvent,
// YB_MAIN_TAB_C,
// YB_PAGE_OPEN_L,
// } from '../../libs/analytics.js'
//获取应用实例
let app = getApp();
const screenHeight = app.globalData.systemInfo.screenHeight;
const screenWidth = app.globalData.systemInfo.screenWidth;
const pixelRatio = app.globalData.systemInfo.pixelRatio;
const DEVICE_WIDTH_RATIO = screenWidth / 375.0;
let imageWidth = Math.ceil(75 * DEVICE_WIDTH_RATIO * pixelRatio);
let imageHeight = Math.ceil(100 * DEVICE_WIDTH_RATIO * pixelRatio);
Page({
/**
* 页面的初始数据
*/
data: {
commonProductNaviTitle: '普通商品(0)',
commonShoppingCartData: {},
presellProductNavTitle: '预售商品(0)',
presellShoppingCartData: {},
isSelectCommonNavi: true,
curShoppingCartData: {},
scrollerViewTop: 0,
scrollerViewHeight: 0,
isEditing: false,
isReduceOrPlue: false,
current_page_name: 'shopcart',
has_close_price_down_tip: false, //是否已经关闭降价提示
touchX: 0,
touchY: 0,
tempSku: '',
AnimatingSku: '',
deleteAnimation: '', // 控制是否给相应的单元增加删除动画
enableScroll: true,
//picker 需要的数据
//选中的sku
selectedSKU: 0,
//选中sku的库存
storageNumber: 0,
//判断是否选择了颜色
colorSelected: false,
//当前操作的商品
curProcessGoodsItem: {},
pickerData: {
view: {
isShow: false,
isSoldOutSoon: false, //是否显示即将售罄
goodsList: [],
sizeList: [],
image: '',
goodPrice: '',
price: '',
buyNumber: 1,
minusButtonEnable: false,
plusButtonEnable: true,
buyButtonEnable: true,
should_hidden_number_view: false, //由于套餐不支持 修改数量 故弹窗需要隐藏
min_buy_number: 1,
},
sourceType: 'shopCart',
},
from_page: 'shopCart',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this
// Picker.init(that);
// new app.WeToast();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (app.isLogin()) {
this.queryShoppingcartData();
}
this.animation = tt.createAnimation({
duration: 300,
timingFunction: 'ease',
})
//埋点上报 页面加载
var pages = getCurrentPages()
var currentPage = pages[pages.length - 1]
var url = currentPage.route
// logEvent(YB_MAIN_TAB_C, { TAB_ID: 2 });
// let params = {
// PAGE_NAME: this.data.from_page,
// PAGE_PARAM: '',
// FROM_PAGE_NAME: '',
// FROM_PAGE_PARAM: '',
// PAGE_PATH: url
// };
// logEvent(YB_PAGE_OPEN_L, params);
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
if (this.data.isEditing) {
this.setData({
isEditing: false,
});
}
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
onLoad: function () {
console.log('头条小程序代码片段,可点击以下链接查看代码片段的详细文档')
/**
* 查询购物车数据,包括普通购物车和预售购物车
*/
queryShoppingcartData: function () {
let param = {
method: 'app.Shopping.queryCart',
uid: app.getUid()
};
api.post({data:param})
.then(json => {
if (json && json.code && json.code == 200) {
let data = json.data
this.processShopCartData(data);
}
})
.catch(error => {
});
},
navToGiftPage: function (event) {
let data = event.currentTarget.dataset;
let item = data.promotionItem;
// console.log(item);
tt.navigateTo({
url: './giftPage?promotion_id=' + item.promotion_ids + '&is_gift=' + item.isGift + '&status=10',
});
},
processShopCartData:function(data){
if (!data) {
return;
}
let commonShoppingCartData = data.ordinary_cart_data
let presellShoppingCartData = data.advance_cart_data
let commonProductNaviTitle = '普通商品(' + commonShoppingCartData.shopping_cart_data.goods_count + ')'
let presellProductNavTitle = '预售商品(' + presellShoppingCartData.shopping_cart_data.goods_count + ')'
commonShoppingCartData = curShoppingCartDataAddExpandedFlag(commonShoppingCartData);
// presellShoppingCartData = curShoppingCartDataAddExpandedFlag(presellShoppingCartData);
let curShoppingCartData = commonShoppingCartData;
// if (this.data.isSelectCommonNavi) {
// curShoppingCartData = commonShoppingCartData
// } else {
// curShoppingCartData = presellShoppingCartData
// }
const windowHeight = app.globalData.systemInfo.windowHeight;
let scrollerViewTop = 0;
if (curShoppingCartData.shipping_cost_prompt.shipping_cost_tips != '' || curShoppingCartData.shipping_cost_prompt.price_down_tips != '')
{
scrollerViewTop += 40;
}
let scrollerViewHeight = app.globalData.systemInfo.windowHeight - scrollerViewTop - 64;
console.log('=========curShoppingCartData========');
console.log(curShoppingCartData);
console.log(scrollerViewHeight);
console.log('====================================');
this.setData({
commonShoppingCartData,
presellShoppingCartData,
commonProductNaviTitle,
presellProductNavTitle,
curShoppingCartData,
scrollerViewTop,
scrollerViewHeight,
});
},
naviTabSelected:function(event) {
let selectedNaviType = event.currentTarget.dataset.type;
let isSelectCommonNavi = true;
let curShoppingCartData = this.data.commonShoppingCartData;
if (selectedNaviType == 'presellProduct') {
isSelectCommonNavi = false;
curShoppingCartData = this.data.presellShoppingCartData;
}
this.setData({
curShoppingCartData,
isSelectCommonNavi,
})
},
editBtnSelected:function(event) {
let isEditing = this.data.isEditing;
isEditing = !isEditing;
if (isEditing && this.data.AnimatingSku){
var tempAniamtion = this.animation.left('0px').step();
this.data.AnimatingSku = '';
this.setData({
AnimatingSku: '',
deleteAnimation: tempAniamtion.export(),
isEditing,
})
} else {
this.setData({
isEditing,
})
}
},
flexOrUnflexPromotion:function(poolItem) {
let index = poolItem.currentTarget.dataset.type;
let curShoppingCartData = this.data.curShoppingCartData;
let goodsPoolList = curShoppingCartData.goods_pool_list;
goodsPoolList[index].isPromotionExpanded = !goodsPoolList[index].isPromotionExpanded;
curShoppingCartData.goods_pool_list = goodsPoolList;
this.setData({
curShoppingCartData,
})
},
selectSingleGoodsAction:function(event) {
let goodsItem = event.currentTarget.dataset.type;
let isEditing = this.data.isEditing;
if (isEditing) {
let curShoppingCartData = this.data.curShoppingCartData;
curShoppingCartData = curPageDataSingleSelectWhenEditing(curShoppingCartData, goodsItem);
this.setData({
curShoppingCartData,
})
} else {
if (goodsItem.bLackStorage) {
this.wetoast.toast({
title: '您勾选的商品库存不足',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
let goodsEditInfoList = editInfoDicFromGoodsList([goodsItem], !goodsItem.bSelected);
this.queryShopCartGoodsWithSkuList(goodsEditInfoList);
}
},
selectAllGoodsAction:function(event){
let bSelectAll = event.currentTarget.dataset.type;
let isEditing = this.data.isEditing;
if(isEditing) {
let curShoppingCartData = this.data.curShoppingCartData;
curShoppingCartData = curPageDataAllSelectWhenEditing(curShoppingCartData, !bSelectAll);
curShoppingCartData.isValidGoodsSelectAll = !bSelectAll,
this.setData({
curShoppingCartData,
})
}else {
let allGoodsEditInfoList = editInfoDicFromGoodsList(this.data.curShoppingCartData.validGoodsList, !bSelectAll);
let allGoodsEditInfoJson = JSON.stringify(allGoodsEditInfoList);
let param = {
product_sku_list: allGoodsEditInfoJson,
method: 'app.Shopping.selectedAndQryCart',
is_support_mlp: 'Y',
shopping_key: '',
};
// console.log(param);
api.post({data:param})
.then(json => {
if (json && json.code && json.code == 200) {
let data = json.data;
this.processShopCartData(data);
if (hasLackStorageGoodsInList(this.data.curShoppingCartData.validGoodsList) && !bSelectAll) {
this.wetoast.toast({
title: '您全选的商品中存在库存不足商品,已帮您自动取消勾选成功',
titleClassName: 'wetoast-title',
duration: 1000
});
}
}
})
.catch(error => {
});
}
},
editCompletedAction:function(){
this.editBtnSelected(null);
let allGoodsEditInfoList = editInfoOfAllGoods(this.data.curShoppingCartData.validGoodsList);
this.queryShopCartGoodsWithSkuList(allGoodsEditInfoList);
},
})
moveStart: function (e) {
// console.log('moveStart');
let enableScroll = true;
let isEditing = this.data.isEditing;
if(isEditing){
return;
}
this.data.touchX = e.changedTouches[0].clientX;
this.data.touchY = e.changedTouches[0].clientY;
var tempAniamtion = this.animation.left('0px').step();
this.setData({
deleteAnimation: tempAniamtion.export(),
AnimatingSku: '',
enableScroll,
});
},
moveEnd: function (e) {
// console.log('moveEnd');
let isEditing = this.data.isEditing;
if (isEditing) {
return;
}
var X = e.changedTouches[0].clientX;
var Y = e.changedTouches[0].clientY;
var curGoods = e.currentTarget.dataset.type;
var data = null, tempAniamtion = null;
var angle = this.angle({ X: X, Y: Y }, { X: this.data.touchX, Y: this.data.touchY});
if (Math.abs(angle) > 30) return;
if (this.data.touchX - X > 3) {
// console.log('左滑动');
if (this.data.AnimatingSku) {
let enableScroll = false;
tempAniamtion = this.animation.left('0px').step();
this.setData({
AnimatingSku: '',
deleteAnimation: tempAniamtion.export(),
enableScroll,
})
} else {
let enableScroll = false;
tempAniamtion = this.animation.left('-70px').step();
this.setData({
AnimatingSku: curGoods && curGoods.product_sku?curGoods.product_sku:'',
deleteAnimation: tempAniamtion.export(),
tempSku: curGoods && curGoods.unique_identifier?curGoods.unique_identifier:'',
enableScroll,
})
}
} else if (this.data.touchX - X < -3) {
// console.log('右滑动');
let enableScroll = true;
tempAniamtion = this.animation.left('0px').step();
this.setData({
deleteAnimation: tempAniamtion.export(),
AnimatingSku: '',
enableScroll,
});
}
},
queryShopCartGoodsWithSkuList: function(skuListInfo){
let goodsEditInfoJson = JSON.stringify(skuListInfo);
let param = {
product_sku_list: goodsEditInfoJson,
method: 'app.Shopping.selectedAndQryCart',
is_support_mlp: 'Y',
shopping_key: '',
};
// console.log(param);
api.post({data:param})
.then(json => {
this.setData({
isReduceOrPlue: false,
});
if (json && json.code && json.code == 200) {
let data = json.data;
this.processShopCartData(data);
}
})
.catch(error => {
this.setData({
isReduceOrPlue: false,
});
});
},
deleteGoodsRequest:function(skuList){
let goodsInfoJson = JSON.stringify(skuList);
let param = {
product_sku_list: goodsInfoJson,
method: 'app.Shopping.removeAndQryCart',
is_support_mlp: 'Y',
uid: app.getUid(),
shopping_key: '',
};
api.post({data:param})
.then(json => {
if (json && json.code && json.code == 200) {
let data = json.data;
this.processShopCartData(data);
}
})
.catch(error => {
// console.log(error);
});
},
deleteGoodsCell:function(event){
let that = this;
tt.showModal({
title: '',
content: '是否确认删除此商品?',
cancelText: '取消',
confirmText: '确认',
confirmColor: "#d0021b",
success: function (res) {
if (res.confirm) {
let goodsItem = event.currentTarget.dataset.type;
if (that.data.AnimatingSku != '') {
var tempAniamtion = that.animation.left('0px').step();
that.setData({
AnimatingSku: '',
deleteAnimation: tempAniamtion.export(),
})
}
let goodsInfo = [{
buy_number: goodsItem.buy_number,
product_sku: goodsItem.product_sku,
promotion_id: goodsItem.promotion_id,
activity_id: goodsItem.bundle_activity_id ? goodsItem.bundle_activity_id : 0,
batch_no: goodsItem.batch_no ? goodsItem.batch_no : 0,
}];
that.deleteGoodsRequest(goodsInfo);
}
}
});
},
cutDownBuyCountAction:function(event){
let isReduceOrPlue = this.data.isReduceOrPlue;
if (isReduceOrPlue){
return;
}
let goodsItem = event.currentTarget.dataset.type;
let min_buy_number = goodsItem.min_buy_number > 0 ? goodsItem.min_buy_number : 1;
let current_buy_number = parseInt(goodsItem.buy_number);
if (current_buy_number > 0 && current_buy_number <= min_buy_number) {
this.wetoast.toast({
title: '最低' + min_buy_number + '件起',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
this.setData({
isReduceOrPlue: true,
});
let reduceBuyCountParam = {
product_sku: goodsItem.product_sku,
decrease_number: 1,
method: 'app.Shopping.decrease',//app.Shopping.incrBundle
uid: app.getUid(),
shopping_key: '',
};
api.post({data:reduceBuyCountParam})
.then(json => {
if (json && json.code && json.code == 200) {
let reduceBuyGoodsInfo = [{
buy_number: goodsItem.buy_number - 1,
goods_type: goodsItem.goods_type,
product_sku: goodsItem.product_sku,
promotion_id: goodsItem.promotion_id,
selected: 'Y',
activity_id: goodsItem.bundle_activity_id ? goodsItem.bundle_activity_id : 0,
batch_no: goodsItem.batch_no ? goodsItem.batch_no : 0,
}];
this.queryShopCartGoodsWithSkuList(reduceBuyGoodsInfo);
} else {
this.setData({
isReduceOrPlue: false,
});
}
})
.catch(error => {
this.setData({
isReduceOrPlue: false,
});
this.wetoast.toast({
title: error.code + error.message + '',
titleClassName: 'wetoast-title',
duration: 1000
});
});
},
plusBuyCountAction:function(event){
let isReduceOrPlue = this.data.isReduceOrPlue;
if (isReduceOrPlue) {
return;
}
this.setData({
isReduceOrPlue: true,
});
let goodsItem = event.currentTarget.dataset.type;
let increaseBuyCountParam = {
product_sku: goodsItem.product_sku,
increase_number: 1,
method: 'app.Shopping.increase',
uid: app.getUid(),
shopping_key: '',
};
api.post({data:increaseBuyCountParam})
.then(json => {
if (json && json.code && json.code == 200) {
let increaseBuyGoodsInfo = [{
buy_number: goodsItem.buy_number + 1,
goods_type: goodsItem.goods_type,
product_sku: goodsItem.product_sku,
promotion_id: goodsItem.promotion_id,
selected: 'Y',
activity_id: goodsItem.bundle_activity_id ? goodsItem.bundle_activity_id : 0,
batch_no: goodsItem.batch_no ? goodsItem.batch_no : 0,
}];
this.queryShopCartGoodsWithSkuList(increaseBuyGoodsInfo);
} else {
this.setData({
isReduceOrPlue: false,
});
}
})
.catch(error => {
this.setData({
isReduceOrPlue: false,
});
this.wetoast.toast({
title: error.code + error.message + '',
titleClassName: 'wetoast-title',
duration: 1000
});
});
},
plusReachedMaxAction:function(event){
this.wetoast.toast({
title: '对不起,没有更多库存了',
titleClassName: 'wetoast-title',
duration: 1000
});
},
chooseSizeColorAction:function(event){
var that = this
let goodsItem = event.currentTarget.dataset.type;
// console.log(goodsItem);
this.setData({
curProcessGoodsItem: goodsItem,
should_hidden_number_view: (goodsItem.bundle_activity_id && goodsItem.batch_no),
});
let min_buy_number = goodsItem.min_buy_number > 0 ? goodsItem.min_buy_number : 1;
this.data.pickerData.view.should_hidden_number_view = (goodsItem.bundle_activity_id && goodsItem.batch_no);
this.data.pickerData.view.min_buy_number = min_buy_number;
this.fetchGoodInfo(goodsItem.product_skn);
// Picker.pickerShow(event, that);
},
//获取商品基本信息(包括颜色、尺码)
fetchGoodInfo: function (productSKN) {
let param = {
method: 'app.product.data',
product_skn: productSKN
}
var that = this
api.get({data:param})
.then(function (data) {
if (!data || data.code != 200)
return
let color_length = 0;
if (data.data.goods_list) {
color_length = data.data.goods_list.length;
}
let ImgUrls = [];
data.data.goods_list && data.data.goods_list.map((item, index) => {
let images = getGoodImages(item.images_list, imageWidth, imageHeight)
ImgUrls = [...ImgUrls, ...images]
if (index == 0 && color_length == 1) {
item.selected = true;
that.data.colorSelected = true;
}
});
let isSoldOutSoon = false;
let tags = data.data.tags;
if (tags) {
tags.map((item) => {
if (item == "is_soon_sold_out") {
isSoldOutSoon = true;
}
});
}
//pickerData
var temData = that.data.pickerData;
temData.view.goodsList = data.data.goods_list;
temData.view.isSoldOutSoon = isSoldOutSoon;
//默认显示第一种颜色的尺码
temData.view.sizeList = data.data.goods_list.length > 0 ? data.data.goods_list[0].size_list : [];
let plusButtonEnable = false;
let minusButtonEnable = false;
//根据库存设置该尺码是否可以选择
let size_length = 0;
if (temData.view.sizeList) {
size_length = temData.view.sizeList.length;
}
temData.view.sizeList && temData.view.sizeList.map((item, index) => {
item.enable = item.storage_number > 0 ? true : false;
if (index == 0 && size_length == 1 && that.data.colorSelected) {
//当颜色被选中 并且只有一个size 时 才会自动 做选中尺码操作
temData.view.buyButtonEnable = item.enable;
if (item.enable) {
item.selected = true;
plusButtonEnable = item.storage_number > 1;
that.setData({
selectedSKU: item.product_sku,
storageNumber: item.storage_number,
});
}
}
});
temData.view.plusButtonEnable = plusButtonEnable;
temData.view.minusButtonEnable = minusButtonEnable;
temData.view.image = ImgUrls.length > 0 ? ImgUrls[0] : '';
temData.view.price = data.data.format_market_price;
temData.view.goodPrice = data.data.format_sales_price;
that.setData({
pickerData: temData,
});
})
.catch(function (error) {
this.wetoast.toast({
title: error.code + error.message + '',
titleClassName: 'wetoast-title',
duration: 1000
});
});
},
//减少购买数量
bindMinus: function (event) {
let pickerData = this.data.pickerData;
let buyNumber = parseInt(pickerData.view.buyNumber);
let min_buy_number = pickerData.view.min_buy_number > 0 ? pickerData.view.min_buy_number : 1;
if (buyNumber > 0 && buyNumber <= min_buy_number && min_buy_number != 1) {
this.wetoast.toast({
title: '最低' + min_buy_number + '件起',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
if (buyNumber > 1) {
buyNumber = buyNumber - 1;
}
pickerData.view.buyNumber = buyNumber;
if (buyNumber == 1) {
pickerData.view.minusButtonEnable = false;
} else {
pickerData.view.minusButtonEnable = true;
}
if (buyNumber < this.data.storageNumber) {
pickerData.view.plusButtonEnable = true;
}
this.setData({ pickerData });
},
//增加购买数量
bindPlus: function (event) {
if (!this.data.colorSelected) {
this.wetoast.toast({
title: '请选择颜色',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
if (!this.data.selectedSKU) {
this.wetoast.toast({
title: '请选择尺码',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
let pickerData = this.data.pickerData;
let buyNumber = pickerData.view.buyNumber;
if (buyNumber >= this.data.storageNumber) {
this.plusReachedMaxAction();
return;
}
if (buyNumber < this.data.storageNumber) {
pickerData.view.plusButtonEnable = true;
buyNumber = parseInt(buyNumber) + 1;
}
if (buyNumber >= this.data.storageNumber) {
pickerData.view.plusButtonEnable = false;
}
if (buyNumber > 1) {
pickerData.view.minusButtonEnable = true;
}
pickerData.view.buyNumber = buyNumber;
this.setData({ pickerData });
},
//点击背景,隐藏picker
pickerTap: function (event) {
if (event.target.id == "picker-bg") {
var that = this
// Picker.pickerHide(event, that);
this.resetPickerData();
}
},
//点击选择颜色
colorTap: function (event) {
//更新各个颜色的选中状态
var that = this
var tempData = that.data.pickerData;
//先遍历将所有颜色、尺码置为未选中状态
// console.log('color')
// console.log(tempData.view.goodsList)
tempData.view.goodsList && tempData.view.goodsList.map((item, index) => {
item.selected = false
item.size_list.map((subItem, index) => {
subItem.selected = false
subItem.enable = subItem.storage_number > 0 ? true : false
});
});
//将当前颜色置为选中状态
var tempItem = event.target.dataset.key
//遍历颜色尺码,根据库存切换显示状态
tempItem && tempItem.size_list && tempItem.size_list.map((item, index) => {
item.enable = item.storage_number > 0 ? true : false
})
tempItem.selected = true
//设置标志位,表示已经选择颜色
let colorSelected = true
//重置库存、当前选中sku的值
tempData.storageNumber = 0
tempData.selectedSKU = 0
tempData.view.goodsList[Number(event.target.id)] = tempItem
tempData.view.sizeList = tempItem.size_list
tempData.view.minusButtonEnable = false
//将购买数量设为初始状态
tempData.view.buyNumber = 1
this.setData({
colorSelected,
pickerData: tempData,
});
},
//点击选择尺码
sizeTap: function (event) {
var that = this
var tempData = that.data.pickerData
//现遍历将所有尺码置为未选中状态
tempData.view.sizeList && tempData.view.sizeList.map((item, index) => {
item.selected = false
});
//将当前尺码置为选中状态
var tempItem = event.currentTarget.dataset.key
tempItem.selected = true
tempData.view.sizeList[parseInt(event.currentTarget.id)] = tempItem
//设置数量加减按钮启用状态
tempData.view.plusButtonEnable = tempItem.storage_number > 1
tempData.view.minusButtonEnable = false
tempData.view.buyButtonEnable = true
//将购买数量设为初始状态
tempData.view.buyNumber = 1
// console.log(event)
if (tempItem.storage_number <= 0) {
this.wetoast.toast({
title: '该尺码已经售罄',
titleClassName: 'wetoast-title',
duration: 1000
});
tempData.view.buyButtonEnable = false
}
this.setData({
pickerData: tempData,
selectedSKU: tempItem.storage_number > 0 ? tempItem.product_sku : 0,
storageNumber: tempItem.storage_number,
});
},
chooseSizeColorCompleted:function(event){
if (!this.data.selectedSKU) {
this.wetoast.toast({
title: '请选择颜色或尺码',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
let buyNumber = this.data.pickerData.view.buyNumber;
let min_buy_number = this.data.pickerData.view.min_buy_number > 0 ? this.data.pickerData.view.min_buy_number : 1;
if (buyNumber > 0 && buyNumber < min_buy_number && min_buy_number != 1) {
this.wetoast.toast({
title: '最低' + min_buy_number + '件起',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
// Picker.pickerHide(event, this);
let processGoodsItem = this.data.curProcessGoodsItem;
let goodsInfo = [{
old_product_sku: processGoodsItem.product_sku,
new_product_sku: this.data.selectedSKU,
buy_number: this.data.pickerData.view.buyNumber,
activity_id: processGoodsItem.bundle_activity_id,
batch_no: processGoodsItem.batch_no,
selected: 'Y',
}];
let goodInfoJson = JSON.stringify(goodsInfo);
let swapParams ={
swap_data: goodInfoJson,
method: "app.Shopping.swap",
uid: app.getUid(),
};
api.post({data:swapParams})
.then(json => {
if (json && json.code && json.code == 200) {
let swapGoodsInfo = [{
buy_number: this.data.pickerData.view.buyNumber,
goods_type: processGoodsItem.goods_type,
product_sku: this.data.selectedSKU,
promotion_id: processGoodsItem.promotion_id,
selected: 'Y',
}];
this.queryShopCartGoodsWithSkuList(swapGoodsInfo);
this.resetPickerData();
}
})
.catch(error => {
this.resetPickerData();
});
},
resetPickerData:function(event){
let pickerData = this.data.pickerData;
pickerData.view.buyNumber = 1;
this.setData({
pickerData,
selectedSKU: 0,
storageNumber: 0,
colorSelected: false,
curProcessGoodsItem: {},
min_buy_number: 1,
})
},
mutilDeleteEditing:function(event){
let that = this;
tt.showModal({
title: '',
content: '是否删除选中的全部商品?',
cancelText: '取消',
confirmText: '确认',
confirmColor: "#d0021b",
success: function (res) {
if (res.confirm) {
let selectedGoodsInfo = editInfoSelectedGoodsList(that.data.curShoppingCartData.validGoodsList);
that.deleteGoodsRequest(selectedGoodsInfo);
}
}
});
},
mutilAddToFav:function(event){
let selectedGoodsInfo = editInfoSelectedGoodsList(this.data.curShoppingCartData.validGoodsList);
let selectedGoodsJson = JSON.stringify(selectedGoodsInfo);
let param = {
product_sku_list: selectedGoodsJson,
method: 'app.Shopping.addfavoriteAndQryCart',
is_support_mlp: 'Y',
uid: app.getUid(),
shopping_key: '',
};
api.post({data:param})
.then(json => {
if (json && json.code && json.code == 200) {
let data = json.data;
this.processShopCartData(data);
}
})
.catch(error => {
// console.log(error);
});
},
navtoProductDetailPage: function(event){
if (this.data.AnimatingSku) {
let tempAniamtion = this.animation.left('0px').step();
this.setData({
deleteAnimation: tempAniamtion.export(),
AnimatingSku: ''
});
return;
}
let data = event.currentTarget.dataset.item;
// console.log(data);
if (data.off_shelves) {
this.wetoast.toast({
title: '商品已下架',
titleClassName: 'wetoast-title',
duration: 1000,
});
return;
}
let productSkn = data.product_skn;
tt.navigateTo({
url: '../goodsDetail/goodsDetail?productSkn=' + productSkn + '&page_name=' + this.data.current_page_name,
});
},
navToPromotionPage: function(event) {
let promotionItem = event.currentTarget.dataset.promotionItem;
let promotion_type = promotionItem.promotion_type;
// console.log(promotionItem);
if (promotion_type == 'Gift' && (promotionItem.status == 10 || promotionItem.status == 30)) {
// console.log("跳转赠品页面");
tt.navigateTo({
url: './giftPage?promotion_id=' + promotionItem.promotion_id + '&is_gift=' + true + '&status=' + promotionItem.status,
});
} else if (promotion_type == 'Needpaygift' && (promotionItem.status == 10 || promotionItem.status == 30)) {
// console.log("跳转加价购页面");
tt.navigateTo({
url: './giftPage?promotion_id=' + promotionItem.promotion_id + '&is_gift=' + false + '&status=' + promotionItem.status,
});
} else {
// console.log("跳转促销商品列表页面");
let spliceUrl = "?title=优惠活动商品" + "&promotionTitle=以下商品参加【" + promotionItem.promotion_title + "】促销活动&promotion_id=" + promotionItem.promotion_id;
tt.navigateTo({
url: '../goodsList/PromotionList' + spliceUrl,
});
}
},
//清空所有失效商品
cleanInvalidAction: function(event){
let that = this;
tt.showModal({
title: '',
content: '是否确认清空所有失效商品?',
cancelText: '取消',
confirmText: '确认',
confirmColor: "#d0021b",
success: function (res) {
if (res.confirm) {
let currentShopCartInfo = that.data.curShoppingCartData;
var invalidList = [];
// console.log(currentShopCartInfo);
// 售罄商品列表
let sold_out_goods_sku_list = editInfoOfAllGoods(currentShopCartInfo.sold_out_goods_list);
invalidList.push.apply(invalidList, sold_out_goods_sku_list);
//下架商品列表
let off_shelves_goods_sku_list = editInfoOfAllGoods(currentShopCartInfo.off_shelves_goods_list);
invalidList.push.apply(invalidList, off_shelves_goods_sku_list);
// //失效商品池 (套餐)
// let sold_out_goods_pool = currentShopCartInfo.sold_out_goods_pool;
// for (var index in sold_out_goods_pool) {
// let pool = sold_out_goods_pool[index];
// if (pool.pool_type == 3) {
// let bundle_invalid_sku_list = editInfoOfAllGoods(pool.goods_list);
// invalidList.push.apply(invalidList, bundle_invalid_sku_list);
// }
// }
// console.log("失效商品sku列表:");
// console.log(invalidList);
let param = {
product_sku_list: JSON.stringify(invalidList),
method: "app.Shopping.removeAndQryCart",
is_support_mlp: "Y",
uid: app.getUid(),
};
// console.log(param);
api.post({data:param})
.then(json => {
// console.log(json);
if (json && json.code && json.code == 200) {
let data = json.data
that.processShopCartData(data);
}
})
.catch(error => {
});
}
}
});
},
//仅有点击结算时 如果没有选择赠品才会调用
navToChooseGiftPage: function() {
let promotionIds = '';
this.data.curShoppingCartData.match_gift_ids.map((item, index) => {
promotionIds = promotionIds + (index == 0 ? '' : ',') + item;
});
tt.navigateTo({
url: './giftPage?promotion_id=' + promotionIds + '&is_gift=' + true + '&status=10',
});
},
// 跳转结算页面
paymentAction: function() {
//如果没有选中商品则不能进入结算页
if (this.data.curShoppingCartData.shopping_cart_data.selected_goods_count <= 0) {
this.wetoast.toast({
title: '您还没有选择宝贝哦',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
if (this.data.curShoppingCartData.match_gift_ids.length > 0) {
let that = this;
tt.showModal({
title: '',
content: '您还未选择赠品,是否去选择赠品?',
cancelText: '不要赠品',
confirmText: '去选择',
confirmColor: "#444444",
cancelColor: "#444444",
success: function (res) {
if (res.confirm) {
//去选择赠品
that.navToChooseGiftPage();
} else if (res.cancel) {
//直接跳转 结算页面
that.navToPaymentAction();
}
}
});
return;
}
this.navToPaymentAction();
},
navToPaymentAction: function() {
let paramters = {
method: 'app.Shopping.enhancedPayment',
cart_type: 'ordinary',
yoho_coin_mode: 0,
};
let that = this;
api.post({data:paramters})
.then(json => {
if (json && json.code && json.code == 200) {
let keyValue = 'paymentdata';
tt.setStorage({
key: keyValue,
data: json,
success: function (res) {
tt.navigateTo({
url: '../statements/statements?timestamp=' + keyValue + '&page_name=' + that.data.from_page,
})
}
})
} else {
that.wetoast.toast({
title: json.message,
titleClassName: 'wetoast-title',
duration: 1000
});
}
})
.catch(error => {
that.wetoast.toast({
title: error.code + error.message + '',
titleClassName: 'wetoast-title',
duration: 1000
});
});
},
navToNewArriaval: function() {
tt.switchTab({
url: '../index/index' + '?page_name=' + this.data.current_page_name + '&page_param=' + '',
})
},
tapPriceDownTipsAction: function() {
this.setData({
has_close_price_down_tip: true,
});
},
tapBundleProductHeader: function(evevt) {
let bundleData = evevt.currentTarget.dataset.bundledata;
// console.log("点击套餐");
// console.log(bundleData);
let select = bundleData.selected;
if (select == 'N' && (bundleData.int_pool_buy_number > bundleData.int_pool_storage_number)) {
this.wetoast.toast({
title: '您勾选的商品库存不足',
titleClassName: 'wetoast-title',
duration: 1000
});
return;
}
bundleData.selected = (select == 'Y' ? 'N' : 'Y');
let that = this;
if (that.data.isEditing) {
let curShoppingCartData = curPageDataSingleSelectBundleProductWhenEditing(that.data.curShoppingCartData, bundleData);
that.setData({
curShoppingCartData,
})
} else {
let goodsEditInfoList = editInfoDicFromBundleItem(bundleData);
that.queryShopCartGoodsWithSkuList(goodsEditInfoList);
}
},
bundleReduceTap: function(event) {
let isReduceOrPlue = this.data.isReduceOrPlue;
if (isReduceOrPlue) {
return;
}
let bundleItem = event.currentTarget.dataset.item;
// console.log('套餐 -');
// console.log(bundleItem);
this.setData({
isReduceOrPlue: true,
});
let reduceBuyCountParam = {
activity_id: bundleItem.pool_id,
batch_no: bundleItem.pool_batch_no,
decrease_number: 1,
method: 'app.Shopping.decrBundle',
};
let that = this;
api.post({data:reduceBuyCountParam})
.then(json => {
if (json && json.code && json.code == 200) {
let reduceBuyGoodsInfo = editInfoDicFromGoodsList(bundleItem.goods_list, true);
that.queryShopCartGoodsWithSkuList(reduceBuyGoodsInfo);
} else {
that.setData({
isReduceOrPlue: false,
});
}
})
.catch(error => {
that.setData({
isReduceOrPlue: false,
});
that.wetoast.toast({
title: error.code + error.message + '',
titleClassName: 'wetoast-title',
duration: 1000
});
});
},
bundleAddTap: function(event) {
let isReduceOrPlue = this.data.isReduceOrPlue;
if (isReduceOrPlue) {
return;
}
let bundleItem = event.currentTarget.dataset.item;
// console.log('套餐 +');
// console.log(bundleItem);
this.setData({
isReduceOrPlue: true,
});
let reduceBuyCountParam = {
activity_id: bundleItem.pool_id,
batch_no: bundleItem.pool_batch_no,
increase_number: 1,
method: 'app.Shopping.incrBundle',
};
let that = this;
api.post({data:reduceBuyCountParam})
.then(json => {
if (json && json.code && json.code == 200) {
let reduceBuyGoodsInfo = editInfoDicFromGoodsList(bundleItem.goods_list, true);
that.queryShopCartGoodsWithSkuList(reduceBuyGoodsInfo);
} else {
that.setData({
isReduceOrPlue: false,
});
}
})
.catch(error => {
that.setData({
isReduceOrPlue: false,
});
that.wetoast.toast({
title: error.code + error.message + '',
titleClassName: 'wetoast-title',
duration: 1000
});
});
},
/**
* 计算滑动角度
* @param {Object} start 起点坐标
* @param {Object} end 终点坐标
*/
angle: function (start, end) {
var _X = end.X - start.X,
_Y = end.Y - start.Y
return 360 * Math.atan(_Y / _X) / (2 * Math.PI);
},
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "购物车",
"usingComponents": {
"shoppingCartFloatHeaderView": "../../components/shopCart/headerView/shoppingCartFloatHeaderView",
"shoppingCartFooterView": "../../components/shopCart/headerView/shoppingCartFooterView",
"shoppingCartProductCell": "../../components/shopCart/cells/shoppingCartProductCell",
"shoppingCartGiftOrPriceCell": "../../components/shopCart/cells/shoppingCartGiftOrPriceCell",
"shoppingCartInvalidProductCell": "../../components/shopCart/cells/shoppingCartInvalidProductCell",
"shoppingCartPromotionCell": "../../components/shopCart/cells/shoppingCartPromotionCell",
"shoppingCartOneProductCell": "../../components/shopCart/cells/shoppingCartOneProductCell"
}
}
\ No newline at end of file
... ...
<view class="intro">购物车</view>
\ No newline at end of file
<view tt:if="{{curShoppingCartData.has_product_in_shop_cart}}" class="container">
<view tt:if="{{curShoppingCartData.shipping_cost_prompt.shipping_cost_tips != '' || curShoppingCartData.price_down_prompt.price_down_tips != ''}}" class="floatHeaderContainer">
<view tt:if="{{curShoppingCartData.price_down_prompt.price_down_tips && !has_close_price_down_tip}}" class="priceDownTipsContainer">
<text class="shippingCostTip priceDownTitle">{{curShoppingCartData.price_down_prompt.price_down_tips}}</text>
<image class="priceDownTipsClose" bindtap='tapPriceDownTipsAction' src="../../images/close_icon@2x.png"></image>
</view>
<view tt:else class="shippingCostTip">{{curShoppingCartData.shipping_cost_prompt.shipping_cost_tips}}</view>
<view class="editBtn" bindtap="editBtnSelected" tt:if="{{!isEditing}}">编辑商品</view>
<view class="editBtn" bindtap="editCompletedAction" tt:if="{{isEditing}}">完成</view>
</view>
<scroll-view scroll-y="{{enableScroll}}" class="contentContainer" style="position: absolute;top:{{scrollerViewTop}}px;height:{{scrollerViewHeight}}px" enable-back-to-top="true">
<!--商品池 -->
<view tt:if="{{curShoppingCartData.goods_pool_list.length}}" class="goodsPoolListContainer">
<!--
<template is="shoppingCartProductCell" tt:for="{{curShoppingCartData.goods_pool_list}}" tt:key="goodsPoolItem" data="{{index,item,isEditing,deleteAnimation,tempSku}}"></template>
-->
<block wx:for="{{curShoppingCartData.goods_pool_list}}" tt:key="goodsPoolItem" tt:for-item="item">
<shoppingCartProductCell data="{{item, index,isEditing,deleteAnimation,tempSku}}"></shoppingCartProductCell>
</block>
</view>
</scroll-view>
<!-- footer -->
<!--
<template is="shoppingCartFooterView" data="{{item:curShoppingCartData.shopping_cart_data,isSelectAll:curShoppingCartData.isValidGoodsSelectAll,isEditing}}"></template>
<template is="Picker" data="{{pickerData}}"/>
-->
</view>
<view tt:else>
<view class='empty-view'>
<image src='../../images/shoppingcart_empty@2x.png' class='shoppingcart-empty-icon'></image>
<text class='shoppingcart-empty-title'>购物车空空如也\n去挑选中意的商品</text>
<view class='shoppingcart-empty-btn' bindtap='navToNewArriaval'>去逛逛</view>
</view>
</view>
... ...
.container {
background-color: #f0f0f0;
}
.navigator {
background-color:white;
width:100%;
height:88rpx;
display:flex;
flex-direction:row;
justify-content: center;
}
.productTab {
position: fixed;
background-color:white;
width:100%;
height:88rpx;
display:flex;
flex-direction:row;
justify-content: center;
z-index: 99;
align-items: center;
}
.leftTab {
margin-right: 30px;
}
.rightTab {
margin-left: 30px;
}
.navText {
color:#b0b0b0;
font-family: PingFang SC;
font-size: 14px;
/*background-color: red;*/
}
.default {
line-height:88rpx;
text-align:center;
flex:1;
color:#b0b0b0;
font-size:30rpx;
width: 25%;
}
.navTextSelected {
font-size:30rpx;
font-weight:bold;
color:#444444;
}
.naviLine {
height:30rpx;
margin-top: 30rpx;
margin-bottom: 18rpx;
background-color: #444444;
width: 2rpx;
}
.editBtn {
/* padding: 6rpx 16rpx; */
/* background-color: #444444; */
/* border-radius: 6rpx; */
margin-right: 30rpx;
z-index: 999;
flex-shrink: 0;
font-family: PingFang-SC-Regular;
font-size: 24rpx;
color: #D0021B;
letter-spacing: -0.33px;
}
.shoppingCartFloatHeaderView {
position: fixed;
top: 88px;
}
.floatHeaderContainer {
width: 100%;
height:40px;
background-color: #f0f0f0;
position: fixed;
display: flex;
align-items: center;
align-content: center;
justify-content: space-between;
margin-top: 0;
z-index: 99;
}
.shippingCostTip {
padding-left: 30rpx;
font-family: PingFangSC;
width: 600rpx;
color: #444444;
text-align: left;
font-size: 24rpx;
line-height: 35.5px;
height: 35.5px;
display:-webkit-box;
-webkit-line-clamp:1;
-webkit-box-orient:vertical;
overflow:hidden;
}
.priceDownTipsContainer {
display:flex;
flex-direction:row;
align-items: center;
justify-content: space-between;
top: 0px;
left: 0px;
width: 600rpx;
height: 35.5px;
background-color: #f0f0f0;
}
.priceDownTitle {
width: 500rpx;
}
.priceDownTipsClose {
width: 30px;
height: 30px;
}
.contentContainer{
width: 100%;
display:flex;
flex-direction:column;
background-color: white;
}
.totalCostContainer{
width: 100%;
}
.totalCost{
width: 258.5px;
font-family: PingFang-SC;
font-size: 13px;
line-height: 16px;
color: #444444;
display: -webkit-box;
overflow: hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-line-clamp:2;
-webkit-box-orient:vertical;
margin-left: 15px;
margin-top: 10px;
margin-bottom: 10px;
}
.empty-view {
width: 100%;
display: flex;
justify-content: center;
flex-direction: column;
}
.shoppingcart-empty-icon {
width: 205rpx;
height: 200rpx;
align-self: center;
margin-top: 300rpx;
}
.shoppingcart-empty-title {
margin-top: 10%;
font-family: PingFang-HK;
font-size: 26rpx;
line-height: 1.38;
color: #444444;
text-align: center;
}
.shoppingcart-empty-btn {
text-align: center;
font-size: 28rpx;
color: white;
background-color: #444444;
width: 360rpx;
margin-top: 10%;
align-self: center;
border-radius: 4px;
align-items: center;
padding: 30rpx;
}
.title{
padding: 20rpx 0rpx;
font-size: 30rpx;
font-weight: bold;
color: #444444;
}
\ No newline at end of file
... ...
'use strict'
import { getImageUrlWithWH } from './util';
function toDecimal2(x) {
var f = parseFloat(x);
if (isNaN(f)) {
return false;
}
var f = Math.round(x * 100) / 100;
var s = f.toString();
var rs = s.indexOf('.');
if (rs < 0) {
rs = s.length;
s += '.';
}
while (s.length <= rs + 2) {
s += '0';
}
return s;
}
function processGiftOrPriceGift(giftList, isGift) {
let selledOutGiftTypeCount = 0;
giftList.map((item, index) => {
let statusString = "";
if (item.status == 0) {
statusString = "去凑单";
} else if (item.status == 10) {
if (item.promotion_type == "Gift") {//Cashreduce,Degressdiscount,Cheapestfree,Discount,Gift,Needpaygift,SpecifiedAmount
statusString = "领赠品";
} else if (item.promotion_type == "Needpaygift") {
statusString = "去换购";
}
} else if (item.status == 20) {
selledOutGiftTypeCount++;
statusString = "已抢光";
} else if (item.status == 30) {
statusString = "更换";
}
item.statusString = statusString;
item.isGift = isGift;
});
if (selledOutGiftTypeCount == giftList.height) {
giftList.map((item, index) => {
item.statusString = "已抢光";
});
};
return giftList;
}
function processGoodsItem(goodsItem) {
let imagesUrl = getImageUrlWithWH(goodsItem.goods_images, 75, 100);
goodsItem.goods_images = imagesUrl;
goodsItem.goodColorSizeString = "颜色:" + goodsItem.factory_goods_name + " " + "尺码:" + goodsItem.size_name;
let isShowOldPrice = true;
let priceString = '';
let shoppingProductType = goodsItem.goods_type;
if (shoppingProductType == 'price_gift') {
priceString = goodsItem.last_price;
} else if (shoppingProductType == 'gift') {
priceString = '0.00';
} else {
if (goodsItem.last_vip_price < goodsItem.sales_price) {
priceString = goodsItem.last_vip_price;
} else {
priceString = goodsItem.sales_price;
}
isShowOldPrice = false;
}
priceString = '¥' + toDecimal2(priceString);
let oldPricString = goodsItem.sales_price;
oldPricString = '¥' + toDecimal2(oldPricString);
if (goodsItem.price_down > 0) {
goodsItem.price_down = toDecimal2(goodsItem.price_down);
}
if (parseInt(goodsItem.buy_number) > parseInt(goodsItem.storage_number)) {
goodsItem.bLackStorage = true;
}
if (goodsItem.selected == "Y") {
goodsItem.bSelected = true;
}
goodsItem.priceString = priceString;
goodsItem.oldPricString = oldPricString;
goodsItem.isShowOldPrice = isShowOldPrice;
var unique_identifier = goodsItem.product_sku + goodsItem.batch_no.toString() + goodsItem.bundle_activity_id.toString();
goodsItem.unique_identifier = unique_identifier;
return goodsItem;
}
function isGoodsSelectAll(goodsList) {
if (!goodsList || !goodsList.length) {
return false;
}
let allGoodsSelect = true;
goodsList.map((goodsItem, index) => {
if (!goodsItem.bLackStorage && goodsItem.goods_type !== 'gift') {
if (goodsItem.selected !== 'Y') {
allGoodsSelect = false;
}
}
});
return allGoodsSelect;
}
function processPromotionItem(promotionItem, isSubPromotion) {
let promotionStatusString = "";
if (promotionItem.status == 0) {
promotionStatusString = "去凑单";
} else if (promotionItem.status == 10) {
if (promotionItem.promotion_type == "Gift") {//Cashreduce,Degressdiscount,Cheapestfree,Discount,Gift,Needpaygift,SpecifiedAmount
promotionStatusString = "领赠品";
} else if (promotionItem.promotion_type == "Needpaygift") {
promotionStatusString = "去换购";
}
} else if (promotionItem.status == 20) {
promotionStatusString = "已抢光";
} else if (promotionItem.status == 30) {
promotionStatusString = "更换";
}
if (promotionStatusString == "已抢光") {
promotionItem.seldoutStyle = true;
}
promotionItem.statuString = promotionStatusString;
if (isSubPromotion) {
let typeString = '';
if (promotionItem.promotion_type == "Gift") {
typeString = '赠品';
} else if (promotionItem.promotion_type == 'Needpaygift') {
typeString = '加价购';
} else if (promotionItem.promotion_type == 'Cashreduce') {
typeString = '满减';
} else {
typeString = '折扣';
}
promotionItem.typeString = typeString;
}
return promotionItem;
}
function curShoppingCartDataAddExpandedFlag(curShoppingCartData) {
let goodsList = curShoppingCartData.goods_list;
let validGoodsList = [];
if (goodsList) {
goodsList.map((goodsItem, index) => {
goodsItem = processGoodsItem(goodsItem);
validGoodsList.push(goodsItem);
})
}
curShoppingCartData.goods_list = goodsList;
let goodsPoolList = curShoppingCartData.goods_pool_list;
if (goodsPoolList) {
goodsPoolList.map((item, index) => {
if (item.pool_batch_no && item.pool_id) {
//套餐商品参数转换
item.int_pool_buy_number = parseInt(item.pool_buy_number);
item.int_pool_storage_number = parseInt(item.pool_storage_number);
}
let goodsPoolGoodsList = item.goods_list;
if (goodsPoolGoodsList) {
goodsPoolGoodsList.map((goodsItem, index) => {
goodsItem = processGoodsItem(goodsItem);
validGoodsList.push(goodsItem);
})
}
item.isPromotionExpanded = false;
let promotionList = item.promotion_list;
if (promotionList) {
promotionList.map((promotionItem, promotionIndex) => {
promotionItem = processPromotionItem(promotionItem, false);
})
item.promotion_list = promotionList;
}
let subPool = item.sub_pool;
if (subPool) {
subPool.map((subPoolItem, index) => {
let promotionList = subPoolItem.promotion_list;
if (promotionList) {
promotionList.map((promotionItem, promotionIndex) => {
promotionItem = processPromotionItem(promotionItem, true);
})
subPoolItem.promotion_list = promotionList;
}
let subPoolGoodsList = subPoolItem.goods_list;
if (subPoolGoodsList) {
subPoolGoodsList.map((subPoolGoodsItem, index) => {
subPoolGoodsItem = processGoodsItem(subPoolGoodsItem);
validGoodsList.push(subPoolGoodsItem);
})
}
})
}
item.sub_pool = subPool;
});
}
curShoppingCartData.validGoodsList = validGoodsList;
curShoppingCartData.isValidGoodsSelectAll = isGoodsSelectAll(validGoodsList);
// let newgPriceGiftList = [];
let gPriceGiftList = curShoppingCartData.g_price_gift_list;
// if (gPriceGiftList && gPriceGiftList.length && canShowGiftEntrance(gPriceGiftList)) {
// newgPriceGiftList = processGiftOrPriceGift(gPriceGiftList, false);
// }
// curShoppingCartData.g_price_gift_list = newgPriceGiftList;
// let newgGiftList = [];
let gGiftList = curShoppingCartData.g_gift_list;
// if (gGiftList && gGiftList.length && canShowGiftEntrance(gGiftList)) {
// newgGiftList = processGiftOrPriceGift(gGiftList, true);
// }
// curShoppingCartData.g_gift_list = newgGiftList;
let gGiftAndPriceGiftList = [];
if (gGiftList && gGiftList.length) {
let giftItem = transformToGiftModelWithGiftList(gGiftList,true);
if (giftItem.canShow) {
gGiftAndPriceGiftList.push(giftItem);
}
}
if (gPriceGiftList && gPriceGiftList.length) {
let priceGiftItem = transformToGiftModelWithGiftList(gPriceGiftList,false);
if (priceGiftItem.canShow) {
gGiftAndPriceGiftList.push(priceGiftItem);
}
}
// if (newgPriceGiftList.length && newgGiftList.length) {
// gGiftAndPriceGiftList = [newgGiftList[0], newgPriceGiftList[0]];
// } else if (newgPriceGiftList.length) {
// gGiftAndPriceGiftList = [newgPriceGiftList[0]];
// } else if (newgGiftList.length) {
// gGiftAndPriceGiftList = [newgGiftList[0]];
// }
curShoppingCartData.gGiftAndPriceGiftList = gGiftAndPriceGiftList;
//失效商品
let offShelvesGoodsList = curShoppingCartData.off_shelves_goods_list;
let soldOutGoodsList = curShoppingCartData.sold_out_goods_list;
let invalidGoodsList = [...offShelvesGoodsList, ...soldOutGoodsList];
if (invalidGoodsList && invalidGoodsList.length) {
invalidGoodsList.map((invalidGoodsItem, index) => {
let imagesUrl = getImageUrlWithWH(invalidGoodsItem.goods_images, 75, 100);;
invalidGoodsItem.goods_images = imagesUrl;
})
}
let last_order_amount = curShoppingCartData.shopping_cart_data.last_order_amount;
last_order_amount = '¥' + toDecimal2(last_order_amount);
curShoppingCartData.shopping_cart_data.last_order_amount = last_order_amount;
curShoppingCartData.invalidGoodsList = invalidGoodsList;
let has_product_in_shop_cart = (curShoppingCartData.goods_list.length + curShoppingCartData.goods_pool_list.length + curShoppingCartData.off_shelves_goods_list.length + curShoppingCartData.sold_out_goods_list.length > 0);
curShoppingCartData.has_product_in_shop_cart = has_product_in_shop_cart;
return curShoppingCartData;
}
function canShowGiftEntrance(items) {
let result = false;
let statusCount_10 = 0;//已满足
let statusCount_20 = 0;//已售罄
items.map((item, index) => {
if (item.status == 10) {
statusCount_10++;
} else if (item.status == 20) {
statusCount_20++;
}
});
if (statusCount_10 > 0 || (items.length > 0 && statusCount_20 == items.length)) {
result = true;
}
return result;
}
function transformToGiftModelWithGiftList(list,isGift) {
let resultItem = {};
resultItem.isGift = isGift;
resultItem.title = isGift ? '赠品' : '全场加价购';
let promotion_ids = '';
list.map((item, index) => {
if (item.status == 10) {
promotion_ids = promotion_ids + (promotion_ids.length == 0 ? '' : ',') + item.promotion_id;
}
});
resultItem.promotion_ids = promotion_ids;
if (promotion_ids.length > 0) {
if (isGift) {
resultItem.statusString = '领赠品';
} else {
resultItem.statusString = '去换购';
}
resultItem.showArrow = true;
} else {
resultItem.statusString = '已抢光';
resultItem.showArrow = false;
}
resultItem.canShow = canShowGiftEntrance(list);
return resultItem;
}
function curPageDataAllSelectWhenEditing(curShoppingCartData,allSelect) {
let goodsList = curShoppingCartData.goods_list;
let validGoodsList = [];
if (goodsList) {
goodsList.map((goodsItem, index) => {
goodsItem = processGoodsItem(goodsItem);
if(allSelect){
goodsItem.selected = 'Y';
goodsItem.bSelected = true;
}else {
goodsItem.selected = 'N';
goodsItem.bSelected = false;
}
})
}
let goodsPoolList = curShoppingCartData.goods_pool_list;
if (goodsPoolList) {
goodsPoolList.map((item, index) => {
if (item.pool_type == '3' && item.pool_batch_no) {
item.selected = allSelect ? 'Y' : 'N';
}
let goodsPoolGoodsList = item.goods_list;
if (goodsPoolGoodsList) {
goodsPoolGoodsList.map((goodsItem, index) => {
goodsItem = processGoodsItem(goodsItem);
if (allSelect) {
goodsItem.selected = 'Y';
goodsItem.bSelected = true;
} else {
goodsItem.selected = 'N';
goodsItem.bSelected = false;
}
})
}
let subPool = item.sub_pool;
if (subPool) {
subPool.map((subPoolItem, index) => {
let subPoolGoodsList = subPoolItem.goods_list;
if (subPoolGoodsList) {
subPoolGoodsList.map((subPoolGoodsItem, index) => {
subPoolGoodsItem = processGoodsItem(subPoolGoodsItem);
if (allSelect) {
subPoolGoodsItem.selected = 'Y';
subPoolGoodsItem.bSelected = true;
} else {
subPoolGoodsItem.selected = 'N';
subPoolGoodsItem.bSelected = false;
}
})
}
})
}
item.sub_pool = subPool;
});
}
return curShoppingCartData;
}
function curPageDataSingleSelectWhenEditing(curShoppingCartData, selectItem) {
let isValidGoodsSelectAll = true;
let goodsList = curShoppingCartData.goods_list;
let validGoodsList = [];
if (goodsList) {
goodsList.map((goodsItem, index) => {
goodsItem = processGoodsItem(goodsItem);
if (goodsItem.unique_identifier == selectItem.unique_identifier) {
if (goodsItem.selected == 'Y'){
goodsItem.selected = 'N';
goodsItem.bSelected = false;
}else {
goodsItem.selected = 'Y';
goodsItem.bSelected = true;
}
}
if (isValidGoodsSelectAll && (!goodsItem.bSelected)) {
isValidGoodsSelectAll = false;
}
})
}
curShoppingCartData.goods_list = goodsList;
let goodsPoolList = curShoppingCartData.goods_pool_list;
if (goodsPoolList) {
goodsPoolList.map((item, index) => {
let goodsPoolGoodsList = item.goods_list;
if (goodsPoolGoodsList) {
goodsPoolGoodsList.map((goodsItem, index) => {
goodsItem = processGoodsItem(goodsItem);
if (goodsItem.unique_identifier == selectItem.unique_identifier) {
if (goodsItem.selected == 'Y') {
goodsItem.selected = 'N';
goodsItem.bSelected = false;
} else {
goodsItem.selected = 'Y';
goodsItem.bSelected = true;
}
}
if (isValidGoodsSelectAll && (!goodsItem.bSelected)) {
isValidGoodsSelectAll = false;
}
})
}
let subPool = item.sub_pool;
if (subPool) {
subPool.map((subPoolItem, index) => {
let subPoolGoodsList = subPoolItem.goods_list;
if (subPoolGoodsList) {
subPoolGoodsList.map((subPoolGoodsItem, index) => {
subPoolGoodsItem = processGoodsItem(subPoolGoodsItem);
if (subPoolGoodsItem.unique_identifier == selectItem.unique_identifier) {
if (subPoolGoodsItem.selected == 'Y') {
subPoolGoodsItem.selected = 'N';
subPoolGoodsItem.bSelected = false;
} else {
subPoolGoodsItem.selected = 'Y';
subPoolGoodsItem.bSelected = true;
}
}
if (isValidGoodsSelectAll && (!subPoolGoodsItem.bSelected)) {
isValidGoodsSelectAll = false;
}
})
}
})
}
item.sub_pool = subPool;
});
curShoppingCartData.goods_pool_list = goodsPoolList;
}
curShoppingCartData.isValidGoodsSelectAll = isValidGoodsSelectAll;
return curShoppingCartData;
}
function curPageDataSingleSelectBundleProductWhenEditing(curShoppingCartData, selectBundleItem) {
if (curShoppingCartData.goods_pool_list) {
curShoppingCartData.goods_pool_list.map((item, index) => {
if (item.pool_type == 3 && item.pool_batch_no) {
item.selected = selectBundleItem.selected;
let goodsPoolGoodsList = item.goods_list;
if (goodsPoolGoodsList) {
goodsPoolGoodsList.map((goodsItem, index) => {
goodsItem = processGoodsItem(goodsItem);
if (item.selected == 'Y') {
goodsItem.selected = 'Y';
goodsItem.bSelected = true;
} else {
goodsItem.selected = 'N';
goodsItem.bSelected = false;
}
})
}
}
});
}
return curShoppingCartData;
}
function editInfoDicFromGoodsList(goodsList, isSelectAll){
if (!goodsList || !goodsList.length) {
return [];
}
let editInfoDicArray = [];
goodsList.map((goodsItem, index) => {
if (!goodsItem.bLackStorage && goodsItem.goods_type !== 'gift') {
editInfoDicArray.push({
buy_number: goodsItem.buy_number ? goodsItem.buy_number : 0,
goods_type: goodsItem.goods_type ? goodsItem.goods_type : "",
product_sku: goodsItem.product_sku ? goodsItem.product_sku : "",
promotion_id: goodsItem.promotion_id ? goodsItem.promotion_id : 0,
selected: isSelectAll ? "Y" : "N",
activity_id: goodsItem.bundle_activity_id ? goodsItem.bundle_activity_id : 0,
batch_no: goodsItem.batch_no ? goodsItem.batch_no : 0,
})
}
});
return editInfoDicArray;
}
function editInfoDicFromBundleItem(bundleItem) {
if (!bundleItem || !bundleItem.goods_list.length) {
return [];
}
let editInfoDicArray = [];
bundleItem.goods_list.map((goodsItem, index) => {
editInfoDicArray.push({
buy_number: goodsItem.buy_number ? goodsItem.buy_number : 0,
goods_type: goodsItem.goods_type ? goodsItem.goods_type : "",
product_sku: goodsItem.product_sku ? goodsItem.product_sku : "",
promotion_id: goodsItem.promotion_id ? goodsItem.promotion_id : 0,
selected: bundleItem.selected,
activity_id: goodsItem.bundle_activity_id ? goodsItem.bundle_activity_id : 0,
batch_no: goodsItem.batch_no ? goodsItem.batch_no : 0,
})
});
return editInfoDicArray;
}
function editInfoSelectedGoodsList(goodsList) {
if (!goodsList || !goodsList.length) {
return [];
}
let editInfoDicArray = [];
goodsList.map((goodsItem, index) => {
if (!goodsItem.bLackStorage && goodsItem.goods_type !== 'gift') {
if (goodsItem.selected == 'Y') {
editInfoDicArray.push({
buy_number: goodsItem.buy_number ? goodsItem.buy_number : 0,
goods_type: goodsItem.goods_type ? goodsItem.goods_type : "",
product_sku: goodsItem.product_sku ? goodsItem.product_sku : "",
promotion_id: goodsItem.promotion_id ? goodsItem.promotion_id : 0,
selected: "Y",
activity_id: goodsItem.bundle_activity_id ? goodsItem.bundle_activity_id : 0,
batch_no: goodsItem.batch_no ? goodsItem.batch_no : 0,
})
}
}
});
return editInfoDicArray;
}
function editInfoOfAllGoods(goodsList) {
if (!goodsList || !goodsList.length) {
return [];
}
let editInfoDicArray = [];
goodsList.map((goodsItem, index) => {
editInfoDicArray.push({
buy_number: goodsItem.buy_number ? goodsItem.buy_number:0,
goods_type: goodsItem.goods_type ? goodsItem.goods_type:"",
product_sku: goodsItem.product_sku ? goodsItem.product_sku:"",
promotion_id: goodsItem.promotion_id ? goodsItem.promotion_id:0,
selected: goodsItem.selected,
activity_id: goodsItem.bundle_activity_id ? goodsItem.bundle_activity_id:0,
batch_no: goodsItem.batch_no ? goodsItem.batch_no:0,
})
});
return editInfoDicArray;
}
function hasLackStorageGoodsInList(goodsList) {
if (!goodsList || !goodsList.length) {
return false;
}
let hasLackStorageGoods = false;
goodsList.map((goodsItem, index) => {
if (goodsItem.bLackStorage) {
hasLackStorageGoods = true;
}
});
return hasLackStorageGoods;
}
module.exports = {
curShoppingCartDataAddExpandedFlag,
editInfoDicFromGoodsList,
hasLackStorageGoodsInList,
curPageDataAllSelectWhenEditing,
curPageDataSingleSelectWhenEditing,
editInfoOfAllGoods,
editInfoSelectedGoodsList,
curPageDataSingleSelectBundleProductWhenEditing,
editInfoDicFromBundleItem,
}
\ No newline at end of file
... ...