Authored by yyq

cart item tap

... ... @@ -119,7 +119,7 @@ Component({
touchStartAction(e) {
this._touchStart = false;
if(this.data.isEditing || e.target.id === 'del-btn'){
if (this.data.isEditing || e.target.id === 'del-btn') {
return;
}
... ... @@ -134,11 +134,10 @@ Component({
this._touchStart = e.changedTouches[0];
},
touchEndAction(e) {
if(this.data.isEditing || !this._touchStart){
if (this.data.isEditing || !this._touchStart) {
return;
}
let isShowDelete = this.data.isShowDelete;
let touchEnd = e.changedTouches[0];
let offsetX = this._touchStart.clientX - touchEnd.clientX;
... ... @@ -147,7 +146,7 @@ Component({
let show = false;
if (offsetX > this.data.slideWidth * 0.3) {
show = !show
show = !show;
}
this.toggleAnimation(show);
... ... @@ -174,7 +173,12 @@ Component({
this.setData({item});
},
removeItemAction(e) {
navToDetailAction() {
if (!this.data.isEditing) {
this.triggerEvent('navToDetailPage', this.data.item);
}
},
removeItemAction() {
this.triggerEvent('removeGoods', this.data.item);
},
editGoodsNum(e) {
... ...
... ... @@ -12,7 +12,7 @@
<view class="invalid-tag" wx:if="{{isInvalid}}">失效</view>
</view>
<image class="thumb" src="{{helper.image(item.goods_images || item.goods_image, 76, 100)}}">
<image class="thumb" src="{{helper.image(item.goods_images || item.goods_image, 76, 100)}}" bindtap="navToDetailAction">
<block wx:if="{{!isInvalid}}">
<view class="goods-type price-gift-tag" wx:if="{{item.goods_type === 'price_gift'}}">
<text>加价购</text>
... ... @@ -34,7 +34,7 @@
<view class="info">
<view class="info-wrap">
<view class="name">{{item.product_name}}</view>
<view class="name" bindtap="navToDetailAction">{{item.product_name}}</view>
<block wx:if="{{!isInvalid}}">
<view class="color-size">颜色:{{item.factory_goods_name}} 尺码:{{item.size_name}}</view>
<view class="price">
... ... @@ -42,9 +42,9 @@
<text wx:if="{{item.mark_price}}" class="mark-price">¥ {{helper.round(item.mark_price)}}</text>
<text class="vip-price-tig" wx:if="{{item.isVipPrice}}">VIP</text>
</view>
<view class="price-down" wx:if="{{item.price_down > 0}}">
<!-- <view class="price-down" wx:if="{{item.price_down > 0}}">
<text>已降¥{{item.price_down}}</text>
</view>
</view> -->
<view class="info-edit" wx:if="{{isEditing}}">
<view class="edit-block">
<cart-edit goods="{{item}}" bind:editGoodsNum="editGoodsNum" bind:editGoodsColorSize="editGoodsColorSize"></cart-edit>
... ...
... ... @@ -13,33 +13,5 @@ export default {
method: 'app.product.gift'
}, params)
});
},
/**
* queryPromotionGifts
* @param params
* @returns {*}
*/
getPromotionGifts(params) {
return api.get({
url: '',
data: Object.assign({
method: 'app.Shopping.queryPromotionGifts'
}, params)
});
},
/**
* 编辑赠品
* @param params
* @returns {*}
*/
editCartGiftGoods(params) {
return api.get({
url: '',
data: Object.assign(params, {
method: 'app.Shopping.swapGift'
})
});
}
};
... ...
... ... @@ -199,6 +199,15 @@ Page({
});
}
},
navToDetailPage(e) {
let item = e.detail;
if (item.product_skn) {
router.go('productDetail', {
productSkn: item.product_skn
});
}
},
chooseGoodsItem(e) {
let item = e.detail;
... ...
<template name="cartGoodsList">
<block wx:if="{{goodsList.length}}">
<block wx:for="{{goodsList}}" wx:key="unique">
<cart-item goods="{{item}}" index="{{index}}" isEditing="{{isEditing}}" isEditSelectAll="{{isEditSelectAll}}" isInvalid="{{isInvalid}}" touchKey="{{touchKey}}" bind:chooseGoodsItem="chooseGoodsItem" bind:removeGoodsListInEdit="removeGoodsListInEdit" bind:editGoodsNum="editGoodsNum" bind:editGoodsColorSize="editGoodsColorSize" bind:removeGoods="removeGoods" bind:goodsItemTouched="touchStartAction"></cart-item>
<cart-item goods="{{item}}" index="{{index}}" isEditing="{{isEditing}}" isEditSelectAll="{{isEditSelectAll}}" isInvalid="{{isInvalid}}" touchKey="{{touchKey}}" bind:chooseGoodsItem="chooseGoodsItem" bind:removeGoodsListInEdit="removeGoodsListInEdit" bind:editGoodsNum="editGoodsNum" bind:editGoodsColorSize="editGoodsColorSize" bind:removeGoods="removeGoods" bind:goodsItemTouched="touchStartAction" bind:navToDetailPage="navToDetailPage"></cart-item>
</block>
</block>
</template>
... ...