Authored by 黄敬囿

Merge branch 'develop' of http://git.yoho.cn/mobile/tt-yoho-app into develop

import { getYHStorageSync } from './utils/util';
import {WeToast} from './vendors/toast/wetoast';
App({
globalData: {
... ... @@ -66,4 +67,5 @@ App({
}
return sessionKey || '';
},
WeToast
})
... ...
@import "./vendors/toast/wetoast.ttss";
... ...
... ... @@ -2,11 +2,11 @@
<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="shoppingCartProductItemAction" data-identifier="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>
<image src="{{data.goodsItem.goods_images}}" class="goodsImage"></image>
<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'/>
<view class="goodsInfoContainer" tt:if="{{!data.isEditing}}">
<text class="productName">{{data.goodsItem.product_name}}</text>
<text class="productColorSizeString">{{data.goodsItem.goodColorSizeString}}</text>
... ...
... ... @@ -4,6 +4,9 @@
display: flex;
flex-direction: row;
align-items: center;
top: 0;
width: 100%;
height: 240rpx;
}
.selectBtn {
... ... @@ -13,26 +16,28 @@
}
.goodsImage {
position: absolute;
width: 150rpx;
height: 200rpx;
margin-left: 30rpx;
margin-top: 20rpx;
left: 100rpx;
top: 20rpx;
}
.gift-tag-image {
width: 150rpx;
height: 24rpx;
position: absolute;
bottom: 0;
left: 100rpx;
bottom: 20rpx;
}
.goodsInfoContainer {
position: absolute;
direction: flex;
flex-direction: column;
height: 100%;
left: 280rpx;
margin-top: 0;
margin-left: 30rpx;
top: 0;
}
.productName {
... ... @@ -89,13 +94,13 @@
}
.buyNumbText {
position:absolute;
right: 20rpx;
top: 80rpx;
position: absolute;
top: 66rpx;
height: 20rpx;
font-family: PingFang-HK;
font-family: PingFang HK;
font-size: 26rpx;
color: #b0b0b0;
right: 28rpx;
}
.goodsInfoEditContainer {
... ... @@ -242,7 +247,7 @@
}
.reduceString {
font-family: PingFang-HK;
font-family: PingFang HK;
font-size: 18rpx;
text-align: center;
color: white;
... ...
... ... @@ -204,7 +204,7 @@
}
.bundleBuyNumbText {
font-family: PingFang-HK;
font-family: PingFang HK;
font-size: 26rpx;
color: #b0b0b0;
right: 0;
... ...
Component({
properties: {
data: {
type: null,
}
},
data: {
},
ready: function () {
},
methods: {
}
})
<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
... ... @@ -49,12 +49,12 @@ Page({
onLoad: function (option) {
try{
if(option){
let categoryId = option.categoryId;
let firstProductSkn = option.firstProductSkn ? option.firstProductSkn : '';
let categoryId = option.categoryId || '';
let firstProductSkn = option.firstProductSkn || '';
let sort = option.sort ? option.sort : '';
let subCategoryId = option.subCategoryId ? option.subCategoryId : '';
let title = option.title ? option.title : '';
let gender = option.gender ? option.gender : '';
let subCategoryId = option.subCategoryId || '';
let title = option.title || '';
let gender = option.gender || '';
console.log("categoryId:"+categoryId+"==subCategoryId:"+subCategoryId+"==sort:"+sort+"==firstProductSkn:"+firstProductSkn);
this.data.categoryId = categoryId;
... ... @@ -124,11 +124,11 @@ Page({
if(tabData && tabData.page){
page = tabData.page;
}
this.fechProductList(tab,page);
this.fechProductList(tab, page);
}
},
fechProductList: function (tab,currentPage) {
fechProductList: function (tab, currentPage) {
let filterParams = this.data.filterParams;
let id = tab.id;
let orderType = tab.iconType;
... ... @@ -167,6 +167,7 @@ Page({
let param = {
method: "app.search.category",
firstProductSkn: firstProductSkn,
order,
gender,
limit: 60,
page: currentPage,
... ... @@ -207,6 +208,9 @@ Page({
// tablist[id].iconUrl = iconUrl;
// console.log("id:"+id)
console.log('====================================');
console.log(tabs);
console.log('====================================');
that.setData({
tabs: tabs,
activeIndex: id,
... ...
... ... @@ -2,8 +2,8 @@
<tabCell id="tabCell" tabs="{{tabs}}" bind:onTabClick="onTabClick"/>
<view style="position: absolute;top: 92rpx;width: {{contentWidth}}px;height:{{contentHeight}}px;">
<swiper current="{{activeIndex}}">
<swiper-item tt:for="{{tabs}}" tt:for-item="tab" tt:key="{{tabs[activeIndex].id}}" catchtouchmove='catchTouchMove'>
<block tt:if="{{tab && tab.data && tab.data.product_list && tab.data.product_list.length >0}}">
<swiper-item tt:for="{{tabs}}" tt:for-item="tab" tt:key="{{index}}" catchtouchmove='catchTouchMove'>
<block tt:if="{{tab && tab.data && tab.data.product_list && tab.data.product_list .length > 0}}">
<scroll-view style="height:{{contentHeight}}px" scroll-y="true" bindscrolltolower="onLoadMore">
<view class="scroll-content">
<block tt:for="{{tab.data.product_list}}" tt:for-item="product" tt:key="{{index}}">
... ...
... ... @@ -6,22 +6,22 @@
<scroll-view class="scrollContainer" scroll-y="true" enable-back-to-top="true">
<block tt:for="{{promotion_data_ary}}"
tt:for-item="promotionItem"
tt:key="promotionItem">
tt:key="{{index}}">
<view class="realHeader">
<text class="headerText">{{promotionItem.promotion_title}}</text>
</view>
<block tt:for="{{promotionItem.goods_list}}"
tt:for-item="goodsItem"
tt:key="index">
tt:for-index="goodIndex"
tt:key="{{goodIndex}}">
<view class="cellContainer"
data-product-skn="{{goodsItem.product_skn}}"
data-product-sku="{{goodsItem.product_sku}}"
data-item='{{promotionItem}}'
bindtap="onPressProduct">
<view class="imageContainer">
<image class="image" src="{{goodsItem.goods_images}}">
<image class='tag-image' src="{{is_gift ? '../../images/zp-lab@2x.png' : '../../images/jjg-lab@2x.png'}}"/>
</image>
<image class="image" src="{{goodsItem.goods_images}}"></image>
<image class='tag-image' src="{{is_gift ? '../../images/zp-lab@2x.png' : '../../images/jjg-lab@2x.png'}}"/>
</view>
<!-- 商品名称 价格 加入购物车按钮 -->
... ... @@ -32,7 +32,7 @@
</view>
<image class='add-shop-btn-image' src='../../images/jrgwc@2x.png'/>
</view>
<view tt:if="{{index!=0}}" class="separator"></view>
<view tt:if="{{goodIndex!=0}}" class="separator"></view>
</view>
</block>
</block>
... ...
... ... @@ -7,6 +7,7 @@
}
.title{
font-family: PingFang SC;
padding: 20rpx 0rpx;
font-size: 30rpx;
font-weight: bold;
... ... @@ -69,15 +70,13 @@
width: 150rpx;
height: 200rpx;
position: absolute;
z-index: 99;
}
.tag-image {
width: 150rpx;
height: 24rpx;
position: absolute;
bottom: 0;
z-index: 100;
margin-top: 176rpx;
}
.product-info-container {
... ... @@ -89,6 +88,7 @@
}
.product-info-container .titleText {
font-family: PingFang SC;
margin-top: 38rpx;
font-size: 26rpx;
line-height: 1.38;
... ... @@ -101,7 +101,7 @@
}
.product-info-container .price-title {
font-family: PingFang-HK;
font-family: PingFang HK;
font-size: 26rpx;
margin-top: 30rpx;
color: #d0021b;
... ...
... ... @@ -82,7 +82,7 @@ Page({
onLoad: function (options) {
var that = this
// Picker.init(that);
// new app.WeToast();
new app.WeToast();
},
/**
... ... @@ -177,14 +177,53 @@ Page({
});
},
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;
this.setData({
commonShoppingCartData,
presellShoppingCartData,
commonProductNaviTitle,
presellProductNavTitle,
curShoppingCartData,
scrollerViewTop,
scrollerViewHeight,
});
},
onShoppingCartProductAction: function(event) {
let dataset = event.detail.detail.currentTarget.dataset;
if (!dataset) {
dataset = event.detail.currentTarget.dataset;
console.log(event);
let dataset = event.detail.currentTarget.dataset;
console.log(dataset);
if (Object.keys(dataset).length === 0) {
dataset = event.detail.detail.currentTarget.dataset;
}
let identifier = dataset.identifier;
console.log('===onShoppingCartProductAction====');
console.log(event);
console.log(dataset);
console.log('====================================');
... ... @@ -208,8 +247,12 @@ Page({
this.plusBuyCountAction(dataset);
break;
case "plusReachedMaxAction":
this.plusReachedMaxAction(dataset);
this.plusReachedMaxAction();
break;
case "navToPromotionPage":
this.navToPromotionPage(dataset);
break;
default:
break;
}
... ... @@ -225,45 +268,6 @@ Page({
});
},
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;
... ... @@ -332,9 +336,6 @@ Page({
},
selectAllGoodsAction:function(event){
console.log('====================================');
console.log(event);
console.log('====================================');
let bSelectAll = event.detail.currentTarget.dataset.type;
let isEditing = this.data.isEditing;
if(isEditing) {
... ... @@ -538,13 +539,13 @@ Page({
});
},
cutDownBuyCountAction:function(event){
cutDownBuyCountAction:function(dataset){
let isReduceOrPlue = this.data.isReduceOrPlue;
if (isReduceOrPlue){
return;
}
let goodsItem = event.currentTarget.dataset.type;
let goodsItem = dataset.type;
let min_buy_number = goodsItem.min_buy_number > 0 ? goodsItem.min_buy_number : 1;
let current_buy_number = parseInt(goodsItem.buy_number);
... ... @@ -598,7 +599,7 @@ Page({
});
});
},
plusBuyCountAction:function(event){
plusBuyCountAction:function(dataset){
let isReduceOrPlue = this.data.isReduceOrPlue;
if (isReduceOrPlue) {
return;
... ... @@ -606,7 +607,7 @@ Page({
this.setData({
isReduceOrPlue: true,
});
let goodsItem = event.currentTarget.dataset.type;
let goodsItem = dataset.type;
let increaseBuyCountParam = {
product_sku: goodsItem.product_sku,
increase_number: 1,
... ... @@ -644,16 +645,16 @@ Page({
});
});
},
plusReachedMaxAction:function(event){
plusReachedMaxAction:function(){
this.wetoast.toast({
title: '对不起,没有更多库存了',
titleClassName: 'wetoast-title',
duration: 1000
});
},
chooseSizeColorAction:function(event){
chooseSizeColorAction:function(dataset){
var that = this
let goodsItem = event.currentTarget.dataset.type;
let goodsItem = dataset.type;
// console.log(goodsItem);
this.setData({
curProcessGoodsItem: goodsItem,
... ... @@ -1065,8 +1066,8 @@ Page({
});
},
navToPromotionPage: function(event) {
let promotionItem = event.currentTarget.dataset.promotionItem;
navToPromotionPage: function(dataset) {
let promotionItem = dataset.promotionItem;
let promotion_type = promotionItem.promotion_type;
// console.log(promotionItem);
... ...
{
"navigationBarTitleText": "购物车",
"usingComponents": {
"shoppingCartFloatHeaderView": "../../components/shopCart/headerView/shoppingCartFloatHeaderView",
"shoppingCartFooterView": "../../components/shopCart/headerView/shoppingCartFooterView",
"shoppingCartFooterView": "../../components/shopCart/footerView/shoppingCartFooterView",
"shoppingCartProductCell": "../../components/shopCart/cells/shoppingCartProductCell",
"shoppingCartGiftOrPriceCell": "../../components/shopCart/cells/shoppingCartGiftOrPriceCell",
"shoppingCartInvalidProductCell": "../../components/shopCart/cells/shoppingCartInvalidProductCell",
... ...
... ... @@ -58,6 +58,9 @@
<!--
<template is="Picker" data="{{pickerData}}"/>
-->
<import src="../../vendors/toast/wetoast.ttml"/>
<template is="wetoast" data="{{...__wetoast__}}"/>
</view>
<view tt:else>
... ...
... ... @@ -34,7 +34,6 @@
color:#b0b0b0;
font-family: PingFang SC;
font-size: 14px;
/*background-color: red;*/
}
.default {
... ... @@ -72,10 +71,6 @@
color: #D0021B;
letter-spacing: -0.33px;
}
.shoppingCartFloatHeaderView {
position: fixed;
top: 88px;
}
.floatHeaderContainer {
width: 100%;
... ... @@ -169,7 +164,7 @@
.shoppingcart-empty-title {
margin-top: 10%;
font-family: PingFang-HK;
font-family: PingFang HK;
font-size: 26rpx;
line-height: 1.38;
color: #444444;
... ...
"use strict";function WeToastClass(){function t(){var t=getCurrentPages(),e=t[t.length-1];return this.__page=e,this.__timeout=null,e.wetoast=this}return t.prototype.toast=function(e){try{e?this.show(e):this.hide()}catch(t){e&&"function"==typeof e.fail&&e.fail(e)}finally{e&&"function"==typeof e.complete&&e.complete(e)}},t.prototype.show=function(e){var t=this,o=this.__page;clearTimeout(this.__timeout),o.setData({"__wetoast__.reveal":!0}),setTimeout(function(){var t=wx.createAnimation();t.opacity(1).step(),e.animationData=t.export(),e.reveal=!0,o.setData({__wetoast__:e})},30),0===e.duration?setTimeout(function(){"function"==typeof e.success&&e.success(e)},430):this.__timeout=setTimeout(function(){t.toast(),"function"==typeof e.success&&e.success(e)},(e.duration||1500)+400)},t.prototype.hide=function(){var t=this.__page;if(clearTimeout(this.__timeout),t.data.__wetoast__.reveal){var e=wx.createAnimation();e.opacity(0).step(),t.setData({"__wetoast__.animationData":e.export()}),setTimeout(function(){t.setData({__wetoast__:{reveal:!1}})},400)}},new t}module.exports={WeToast:WeToastClass};
\ No newline at end of file
... ...
<!-- wetoast.wxml -->
<template name="wetoast">
<view class="wetoast {{reveal ? 'wetoast_show' : ''}}">
<view class="wetoast__mask"></view>
<view class="wetoast__bd" animation="{{animationData}}">
<block wx:if="{{img}}">
<view class="wetoast__bd__img {{imgClassName || ''}}">
<image class="wetoast__bd__img_desc" src="{{img}}" mode="{{imgMode || 'scaleToFill'}}"></image>
</view>
</block>
<block wx:if="{{title}}">
<view class="wetoast__bd__title {{titleClassName || ''}}">{{title}}</view>
</block>
</view>
</view>
</template>
\ No newline at end of file
... ...
/**toast.wxss**/
.wetoast {
display: none;
}
.wetoast_show {
display: block;
}
.wetoast__mask {
position: fixed;
z-index: 1000;
top: 0;
right: 0;
left: 0;
bottom: 0;
}
.wetoast__bd {
opacity: 0;
display: flex;
flex-direction: column;
position: fixed;
z-index: 5000;
/*min-width: 8.4em;
min-height: 8.4em;*/
max-width: 70%;
top: 40%;
left: 50%;
padding: 15px;
box-sizing: border-box;
transform: translateX(-50%);
background: rgba(40, 40, 40, 0.75);
border-radius: 5px;
color: #FFFFFF;
word-wrap: break-word;
word-break: break-all;
align-items: center;
justify-content: space-around;
}
.wetoast__bd__img {
margin-top: 3px;
}
.wetoast__bd__img_desc {
width: 55px;
height: 55px;
vertical-align: middle;
}
.wetoast__bd__title {
margin: 3px 0;
font-size: 1.2em;
text-align: center;
}
.wetoast-title {
font-size: 28rpx;
}
\ No newline at end of file
... ...