Authored by yyq

Merge branch 'develop' of git.yoho.cn:fe/yoho-brand-shop into develop

... ... @@ -19,10 +19,10 @@
"pages/product/category/category"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle": "black",
"backgroundColor": "#f0f0f0"
"backgroundColor": "#f0f0f0",
"backgroundTextStyle": "dark"
},
"tabBar": {
"borderStyle": "#e0e0e0",
... ...
... ... @@ -9,6 +9,10 @@ import gominiapp from './gominiapp';
// 跳转到小程序外
// router.go('https://miniapp.yohobuy.com/pages/index/index?app=yohobuy&xxxx=ghh&ytty=444');
const GO_LIST = 'go.list';
const GO_DETAIL = 'go.productDetail';
const miniAppDomain = 'miniapp.yohobuy.com';
export default {
... ... @@ -20,18 +24,28 @@ export default {
const path = uri.split(miniAppDomain)[1];
const qs = parse(search);
if (!path) {
return Promise.reject('error path');
}
if (qs.app) {
if (qs.app && path) {
return gominiapp({
app: qs.app,
path: `${path}?${stringify(qs)}`
});
} else {
return wx.navigateTo({
url: `${path}?${stringify(qs)}`
}
let openBy = JSON.parse(qs['openby:yohobuy'] || {});
if (openBy.action) {
let url;
switch (openBy.action) {
case GO_LIST:
url = `/pages/product/list/list?${stringify(openBy.params)}`;
break;
case GO_DETAIL:
url = `/pages/product/detail/detail?productSkn=${openBy.params.product_skn}`;
break;
break;
}
url && wx.navigateTo({
url
});
}
}
... ...
... ... @@ -27,11 +27,15 @@
</li>
</ul>
<view wx:if="{{showSubDefault}}" class="sub-default" bindtap="selectDefaultTap">
<view class="default-item {{curDiscount == '' ? 'active' : ''}}" data-dis="">默认</view>
<view class="default-item {{curDiscount == '' ? 'active' : ''}}" data-dis="">
默认<text wx:if="{{curDiscount == ''}}" class="iconfont icon-duihao"></text>
</view>
<view class="separator"></view>
<view class="default-item {{curDiscount == 'p_d_desc' ? 'active' : ''}}" data-dis="p_d_desc">折扣从高到低</view>
<view class="default-item {{curDiscount == 'p_d_desc' ? 'active' : ''}}" data-dis="p_d_desc">
折扣从高到低<text wx:if="{{curDiscount == 'p_d_desc'}}" class="iconfont icon-duihao"></text></view>
<view class="separator"></view>
<view class="default-item {{curDiscount == 'p_d_asc' ? 'active' : ''}}" data-dis="p_d_asc">折扣从低到高</view>
<view class="default-item {{curDiscount == 'p_d_asc' ? 'active' : ''}}" data-dis="p_d_asc">
折扣从低到高<text wx:if="{{curDiscount == 'p_d_asc'}}" class="iconfont icon-duihao"></text></view>
</view>
<view wx:if="{{showSubGender}}" class="sub-gender" bindtap="selectGenderTap">
<view class="gender-item {{curGender == '' ? 'active' : ''}}" data-gender="">全部</view>
... ...
@import "../../iconfont.wxss";
.product-list-filter {
position: relative;
font-size: 0;
... ... @@ -104,6 +107,13 @@
border-bottom: 1px solid #eee;
}
.product-list-filter .default-item .iconfont {
position: absolute;
right: 20rpx;
top: 0rpx;
font-size: 38rpx;
line-height: 90rpx;
}
.product-list-filter .sub-default .separator {
margin-left: 46rpx;
... ... @@ -118,6 +128,10 @@
position: relative;
}
.product-list-filter .sub-default .default-item:first-child {
border-top: 1rpx solid #eee;
}
.product-list-filter .sub-default .default-item.active {
color: #444;
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,11 @@ import resourcesModel from '../../models/resources/index';
Component({
properties: {
refresh: {
type: Boolean,
value: false,
observer: '_refreshChange'
},
contentCode: {
type: String,
value: '',
... ... @@ -12,6 +17,16 @@ Component({
floors: []
},
methods: {
_refreshChange: function(refresh) {
if (refresh) {
resourcesModel.getContent(this.data.contentCode)
.then(floors => {
this.setData({
floors
});
});
}
},
_contentCodeChange: function(code) {
resourcesModel.getContent(code)
.then(floors => {
... ...
... ... @@ -37,15 +37,17 @@ Page({
this.chooseForYouList();
},
getInfoNum:function(){
homeModel.infoNum()
.then(res => {
if (res.code === 200) {
this.data.infoNum = res.data;
this.setData({
infoNum: this.data.infoNum,
});
}
});
if (app.getUid()) {
homeModel.infoNum()
.then(res => {
if (res.code === 200) {
this.data.infoNum = res.data;
this.setData({
infoNum: this.data.infoNum,
});
}
});
}
},
chooseForYouList: function () {
homeModel.productList({
... ...
... ... @@ -336,5 +336,5 @@ page {
.product-list {
background-color: #fff;
padding: 60rpx 0;
padding: 0 0 60rpx 0;
}
\ No newline at end of file
... ...
... ... @@ -39,7 +39,7 @@ Page({
wx.showModal({
content: '已复制到剪贴板!',
showCancel: false,
confirmText: "ok",
confirmText: "确定",
});
});
},
... ...
... ... @@ -28,7 +28,7 @@
<block wx:if="{{index == 0}}">
<view class="cellLeft">
<view class="HLine">
<image class="dot" src="{{dot1}}"></image>
<image class="dot" src="../../../../static/icons/exp-dot1@2x.png"></image>
</view>
</view>
<view class="cellRight" style='color: black'>
... ... @@ -39,7 +39,7 @@
<block wx:else>
<view class="cellLeft">
<view class="HLine">
<image class="dot" src="{{dot2}}"></image>
<image class="dot" src="../../../../static/icons/exp-dot1@2x.png"></image>
</view>
</view>
<view class="cellRight" style='color: #e0e0e0'>
... ...
... ... @@ -56,7 +56,7 @@
<block wx:for="{{item.links}}" wx:for-item="link" wx:key="order_code">
<block wx:if="{{link == 'closeOrder'}}">
<view class="btn" formType="submit" type="default" size="{{defaultSize}}" plain='true'
catchtap="cancelOrder" data-order_code="{{item.order_code}}">取消订单</view>
catchtap="cancelOrder" data-code="{{item.order_code}}">取消订单</view>
</block>
<block wx:if="{{link == 'buyNow'}}">
<view class="btn pay" catchtap="payNow" data-code="{{item.order_code}}"
... ... @@ -64,7 +64,7 @@
</view>
</block>
<block wx:if="{{link == 'delOrder'}}">
<view class="btn cancel" catchtap="delOrder" data-order_code="{{item.order_code}}">删除订单</view>
<view class="btn cancel" catchtap="delOrder" data-code="{{item.order_code}}">删除订单</view>
</block>
<block wx:if="{{link == 'getExpress'}}">
<view class="btn cancel" catchtap="expressDetail" data-code="{{item.order_code}}">查看物流</view>
... ...
... ... @@ -192,6 +192,7 @@ image {
text-align: center;
border: 1px solid #444444;
color: #444444;
border-radius: 2rpx;
}
.button {
... ...
import wx from '../../../utils/wx';
import orderModel from '../../../models/home/order';
import { wechatPay } from '../../../utils/wechat-pay';
let app = getApp();
export default {
deleteOrder(orderCode, callback) {
if (!orderCode) {
... ... @@ -33,7 +36,7 @@ export default {
confirmColor: '#FF0000'
}).then(res => {
if (res.confirm) {
orderModel.confirmReceive({order_code: orderCode}).then(json => {
orderModel.confirmReceive({order_code: orderCode, miniapp_type: app.getMiniappType()}).then(json => {
callback(json);
});
}
... ...
import wx from '../../../utils/wx';
import event from '../../../common/event';
import orderHandle from './order-handle';
import orderModel from '../../../models/home/order';
import formatImage from '../../../utils/formatImage';
import { wechatPay } from '../../../utils/wechat-pay';
... ... @@ -136,104 +137,36 @@ Page({
});
},
delOrder: function(e) {
const code = e.target.dataset.order_code;
wx.showModal({
title: '确认删除该订单吗?删除了的订单不可恢复!',
cancelText: '取消',
confirmText: '确定',
confirmColor: '#FF0000'
}).then(res => {
if (res.confirm) {
const params = {
order_code: code,
uid: app.getUid()
};
orderModel.delOrder(params)
.then((json) => {
if (json.code === 200) {
this.getOrders(this.data.orderType);
}
});
}
})
const code = e.target.dataset.code;
orderHandle.deleteOrder(code, () => {
this.getOrders(this.data.orderType);
});
},
confirmReceive: function(e) {
let code = e.currentTarget.dataset.code;
this.setData({
orderCode: code,
});
wx.showModal({
title: '确认收货',
content: '请您收到货后再点击“确认”!',
cancelText: '取消',
confirmText: '确定',
confirmColor: '#FF0000'
})
.then(res => {
if (res.confirm) {
let params = {
order_code: code,
uid: app.getUid(),
miniapp_type: app.getMiniappType(),
};
orderModel.confirmReceive(params)
.then((json) => {
if (json.code === 200) {
this.getOrders(this.data.orderType);
}
});
}
orderHandle.confirmReceive(code, () => {
this.getOrders(this.data.orderType);
});
},
cancelOrder: function(e) {
let code = e.currentTarget.dataset.order_code;
this.setData({
orderCode: code,
});
let code = e.currentTarget.dataset.code;
wx.showModal({
title: '取消订单',
content: '确认取消该订单吗?',
cancelText: '返回',
confirmText: '取消订单',
confirmColor: '#000000'
})
.then(res => {
if (res.confirm) {
let params = {
order_code: code,
uid: app.getUid(),
miniapp_type: app.getMiniappType(),
};
orderModel.cancelOrder(params)
.then((json) => {
if (json.code === 200) {
this.getOrders(this.data.orderType);
}
else if (json.code !== 200){
wx.showModal({title: json.message, showCancel: false})
}
});
}
orderHandle.cancelOrder(code, () => {
this.getOrders(this.data.orderType);
});
},
expressDetail: function(e){
let code = e.currentTarget.dataset.code;
wx.navigateTo({
url: `/pages/home/order/express/express?order_code=${code}`,
});
orderHandle.expressDetail(code);
},
payNow: function(e) {
let code = e.target.dataset.code;
let amount = e.target.dataset.amount;
wechatPay({ order_code: code, order_amount: amount})
orderHandle.payNow({ order_code: code, order_amount: amount});
},
goShopping: function () {
wx.reLaunch({url: '/pages/index/index'});
... ...
... ... @@ -2,7 +2,7 @@
.page-container {
padding-top: 100rpx;
background-color: #f2f2f2;
background-color: #fff;
}
... ... @@ -46,7 +46,6 @@
position: relative;
display: block;
background: #fff;
/* margin: 10rpx 0; */
margin-bottom: 20rpx;
border-top: 1rpx solid #e0e0e0;
border-bottom: 1rpx solid #e0e0e0;
... ...
... ... @@ -18,7 +18,8 @@ Page({
isLoading: false,
currentPage: 1,
totalPage: 0
totalPage: 0,
pullRefresh: false
},
onLoad: function () {
this.productList({ page: 1, limit: 20});
... ... @@ -37,15 +38,15 @@ Page({
})
}, 1000)
},
onShow: function () {
},
onPullDownRefresh: function () {
// wx.stopPullDownRefresh();
// this.getLastChannel();
// this.fetchNewHomeData(true);
this.setData({
pullRefresh: true
});
this.productList({ page: 1, limit: 20});
},
onReachBottom: function () {
if (this.data.currentPage < this.data.totalPage) {
... ... @@ -91,6 +92,7 @@ Page({
if (this.data.isLoading) return;
this.data.isLoading = true;
wx.showLoading({title: '加载中'});
indexModel.productList(params).then(res => {
if (res.code === 200) {
const keyAdapter = {
... ... @@ -111,6 +113,7 @@ Page({
});
this.data.isLoading = false;
wx.hideLoading();
this.setData({
showLoading: false,
productList: this.data.productList.concat(list),
... ... @@ -118,16 +121,30 @@ Page({
totalPage: res.data.page_total
});
// // 浮动筛选时重置列表滚动位置
// if (this.data.floatFilter) {
// wx.pageScrollTo({
// scrollTop: this.data.resetListScrollPos,
// duration: 10
// });
// }
// 浮动筛选时滚动位置
if (this.data.floatFilter) {
wx.pageScrollTo({
scrollTop: this.data.resetListScrollPos,
duration: 10
});
}
if (this.data.pullRefresh) {
this.setData({
pullRefresh: false
});
wx.stopPullDownRefresh();
}
}
}).catch(() => {
wx.hideLoading();
this.data.isLoading = false;
if (this.data.pullRefresh) {
this.setData({
pullRefresh: false
});
wx.stopPullDownRefresh();
}
});
},
toSearch: function () {
... ...
... ... @@ -8,7 +8,7 @@
</view>
</view>
</view>
<resources content-code="{{resource.home.top}}"></resources>
<resources content-code="{{resource.home.top}}" refresh="{{pullRefresh}}"></resources>
<view class="separator"></view>
<view class="recommend-product">
<view-title title="推荐商品" height="88"></view-title>
... ...
import wx from '../../../utils/wx';
import {tapToLogin} from '../../../common/login';
import formatImage from '../../../utils/formatImage';
import listModel from '../../../models/product/list';
import detailModel from '../../../models/product/detail';
import config from '../../../common/config';
import {getGoodInfo, getGoodSize} from '../../../utils/productDetail';
... ... @@ -74,7 +75,10 @@ Page({
loading: false
}
]
}
},
shopRecList: [],
preferList: []
},
onLoad: function (options) {
let productSkn = options.productSkn ? options.productSkn : '';
... ... @@ -83,27 +87,11 @@ Page({
productSkn = options.product_skn ? options.product_skn : '';
}
// if (options.q && options.q.length >0){
// let urlstring = decodeURIComponent(options.q)
// let skn = this.getParameterByName('skn', urlstring)
// if (skn.length > 0) productSkn= skn;
// }
//
// if (options && options.scene && options.scene.length>0){
// var scene = decodeURIComponent(options.scene)
// if (scene.length > 0) productSkn = scene;
// }
// let from_page_name = options.page_name ? options.page_name : '';
// let from_page_param = options.page_param ? options.page_param : '';
// let current_page_param = productSkn;
// let uid = app.globalData.userInfo.uid>0?app.globalData.userInfo.uid:0;
// Picker.init(this);
this.setData({productSkn});
this.productInfo();
this.supportService();
this.productIntro();
this.preferList();
},
onShareAppMessage: function (res) {
let param = {
... ... @@ -151,6 +139,63 @@ Page({
showSnapshootShare: false
})
},
shopRecList: function (shopId) {
listModel.productList({
page: 1,
limit: 20,
shop_id: shopId
}).then(res => {
if (res.code === 200) {
const keyAdapter = {
skn: 'product_skn',
salePriceStr: 'sales_price',
productName: 'product_name',
defaultImages: 'default_images'
};
let list = [];
(res.data.product_list || []).forEach(product => {
let item = {};
Object.keys(keyAdapter).forEach(key => {
item[key] = product[keyAdapter[key]]
});
list.push(item);
});
this.setData({
shopRecList: list
});
}
});
},
preferList: function () {
listModel.productList({
page: 1,
limit: 20
}).then(res => {
if (res.code === 200) {
const keyAdapter = {
skn: 'product_skn',
salePriceStr: 'sales_price',
productName: 'product_name',
defaultImages: 'default_images'
};
let list = [];
(res.data.product_list || []).forEach(product => {
let item = {};
Object.keys(keyAdapter).forEach(key => {
item[key] = product[keyAdapter[key]]
});
list.push(item);
});
this.setData({
preferList: list
});
}
});
},
productInfo: function () {
detailModel.productInfo(this.data.productSkn)
.then(res => {
... ... @@ -253,9 +298,11 @@ Page({
// productOnlyProvideByYohoAPP: res.data.is_secKill === 'Y' || res.data.is_advance === 'Y' || res.data.attribute === 3 || res.data.attribute === 4 || res.data.isLimitBuy || res.data.is_deposit_advance==='Y',
// productOnlyProvideByYohoStore: res.data.store_show_status === 3 || res.data.store_show_status === 4,
// productNotForSale: res.data.attribute===2,
shop_id: res.data.shop_id
shopId: res.data.shop_id
// brand_id: res.data.brand_id
});
this.shopRecList(res.data.shop_id);
}
})
.catch(function (error) {
... ...
... ... @@ -2,6 +2,7 @@
"navigationBarTitleText": "商品详情",
"usingComponents": {
"product-banner": "/components/product/detail/banner",
"product-list": "/components/product/list",
"snapshot": "/components/product/detail/snapshot",
"view-title": "/components/layout/view-title/view-title"
}
... ...
... ... @@ -45,7 +45,7 @@
</view>
<view class="goodsInfo" style="display:{{productSizeContent.length>0?'block':'none'}}">
<view class="module-title">
<text class="text">尺码信息 <text class="sub-text">SIZE INFO</text></text>
<text class="text">尺码信息 <text class="sub-text">INFORMATION</text></text>
</view>
<scroll-view class="table">
<view class="tr">
... ... @@ -59,20 +59,17 @@
<view class="goodsInfo" style="display:{{productMeasurementImage?'block':'none'}}">
<view class="module-title">
<text class="text">测量方式 <text class="sub-text">MEASUREMENT METHOD</text></text>
<text class="text">测量信息 <text class="sub-text">DESCRIPTION</text></text>
</view>
<image src="{{productMeasurementImage}}" mode="widthFix"></image>
</view>
<view class="goodsInfo" style="display:{{productMaterialList[0].remark?'block':'none'}}">
<view class="module-title">
<text class="text">商品材质 <text class="sub-text">MATERIALS</text></text>
<text class="text">商品材质 <text class="sub-text">DESCRIPTION</text></text>
</view>
<view class="seperator"></view>
<view class="goodsInfoDescription">
<text class="lightGrayFont">{{productMaterialList[0].remark}}</text>
</view>
<view class="seperator"></view>
<view class="goodsTexture" wx:for="{{productWashTipsBoList}}" wx:key="unique">
<view class="texture">
<image class="img" src= "{{item.img}}" mode="widthFix"/>
... ... @@ -83,21 +80,39 @@
</view>
</view>
<view class="goodsInfo" style="display:{{productIntroImageList.length>0?'block':'none'}}">
<view class="goodsInfo img" style="display:{{productIntroImageList.length>0?'block':'none'}}">
<view class="module-title">
<text class="text">商品详情 <text class="sub-text">DETAILS</text></text>
<text class="text">商品详情 <text class="sub-text">DESCRIPTION</text></text>
</view>
<view wx:for="{{productIntroImageList}}" wx:key="introImage" style="text-align:center">
<image src="{{item}}" mode="widthFix"></image>
<image class="intro-image" src="{{item}}" mode="widthFix"></image>
</view>
</view>
<view class="seperator"></view>
<block wx:if="{{shopRecList.length}}">
<view class="gap"></view>
<view class='titleContainer'>
<view class='titleLine'></view>
<view class='titleDesc'> 店铺推荐商品</view>
</view>
<view class="product-list">
<product-list list="{{shopRecList}}"></product-list>
</view>
</block>
<block wx:if="{{preferList.length}}">
<view class="gap"></view>
<view class='titleContainer'>
<view class='titleLine'></view>
<view class='titleDesc'> 你可能喜欢</view>
</view>
<view class="product-list">
<product-list list="{{preferList}}"></product-list>
</view>
</block>
<view class='bottom-tip-view' style="display:{{storage_sum===0?'flex':'none'}}">
<text class="bottom-tip-view-title" style="display:{{is_supplyed?'flex':'none'}}">此商品已售罄,请等待后续备货!</text>
<text class="bottom-tip-view-title" style="display:{{is_supplyed?'none':'flex'}}">已售罄</text>
</view>
<view class="gap"></view>
</scroll-view>
<view class="bottom-action">
<view class='buy-btn' bindtap="buyImmediate">立即购买</view>
... ...
... ... @@ -302,7 +302,7 @@
}
.goodsInfo{
margin: 30rpx 30rpx 60rpx 30rpx;
margin: 0 30rpx;
}
.title{
... ... @@ -739,6 +739,8 @@
}
.module-title {
height: 100rpx;
line-height: 100rpx;
text-align: center;
}
... ... @@ -758,7 +760,6 @@
content: '';
height: 2rpx;
width: 100rpx;
line-height: 40rpx;
background-color: #444;
}
... ... @@ -770,7 +771,6 @@
content: '';
height: 2rpx;
width: 100rpx;
line-height: 40rpx;
background-color: #444;
}
... ... @@ -783,3 +783,35 @@
line-height: 20rpx;
}
.titleContainer{
background-color: white;
border-bottom: 0.5rpx solid #e0e0e0;
display: flex;
flex-direction: row;
height: 80rpx;
align-items:center;
}
.titleLine{
width: 4rpx;
height: 30rpx;
background-color: #444444;
margin-left: 20rpx;
}
.titleDesc{
flex: 1;
text-align: left;
font-family: PingFang SC;
font-size: 30rpx;
margin-left: 16rpx;
font-weight: 600;
color: #444444;
}
.intro-image {
width: 690rpx;
margin-bottom: 30rpx;
}
.goodsInfo.img {
font-size: 0;
}
... ...
import wx from '../../../utils/wx';
import listModel from '../../../models/product/list';
import {parse} from '../../../vendors/query-stringify';
let app = getApp();
... ... @@ -11,7 +12,7 @@ Page({
productList: []
},
onLoad:function (options) {
let title = options.title || '默认标题';
let title = parse(options.title) || '默认标题';
wx.setNavigationBarTitle({
title
... ...
... ... @@ -12,52 +12,4 @@
.list-container .list-view {
padding-top: 88rpx;
padding-bottom: 65rpx;
}
.list-container {
}
.list-container {
}
.list-container {
}
.list-container {
}
.list-container {
}
.list-container {
}
.list-container {
}
.list-container {
}
.list-container {
}
.list-container {
}
.list-container {
}
.list-container {
}
\ No newline at end of file
... ...
... ... @@ -53,8 +53,8 @@
.fixed-filter {
position: fixed;
top: 108rpx;
left: 0 rx;
height: 90rpx;
left: 0;
right: 0;
width: 100%;
background-color: white;
z-index: 999;
... ... @@ -88,6 +88,6 @@
}
.product-list {
padding-top: 256rpx;
padding-top: 196rpx;
padding-bottom: 60rpx;
}
\ No newline at end of file
... ...
'use strict'
function parseBrandListData(data, listImageWidth, listImageHeight) {
let newData = [];
data && data.map((item, index) => {
let salePrice = 0; // 售卖价
let originPrice = 0; // 原价
let salePriceStr = ''; // 拼接的售卖价
let originPriceStr = ''; // 拼接的原价
let showOriginPrice = true; // 是否显示原价
let isGlobalProduct = item.is_global && item.is_global == 'Y'; // 是否全球购商品
if (isGlobalProduct) {
salePrice = parseFloat(item.final_price);
originPrice = parseFloat(item.orign_price);
salePriceStr = item.formart_final_price;
originPriceStr = item.formart_orign_price;
} else {
salePrice = parseFloat(item.sales_price);
originPrice = parseFloat(item.market_price);
salePriceStr = '¥' + salePrice.toFixed(2);
originPriceStr = '¥' + originPrice.toFixed(2);
}
if (!originPrice || (salePrice == originPrice)) {
showOriginPrice = false;
}
item.showOriginPrice = showOriginPrice;
item.salePriceStr = salePriceStr;
item.originPriceStr = originPriceStr;
let default_images = item.default_images.replace(/{width}/g, listImageWidth*2).replace(/{height}/g, listImageHeight*2).replace('{mode}',2);
let newItem = {
product_skn: item.product_skn,
default_images,
product_name: item.product_name,
showOriginPrice,
salePriceStr,
originPriceStr,
is_shop_cart_add: item.is_shop_cart_add,//是否应该展示右侧的加入购物车按钮 默认不展示
};
newData.push(newItem);
});
return newData;
}
function cancelFilterSelectState(filters, exceptKey) {
let newFilters = {};
for (let itemKey in filters) {
if (filters.hasOwnProperty(itemKey)) {
if (itemKey != exceptKey) {
let newFilter = filters[itemKey];
newFilter.selected = false;
newFilters[itemKey] = newFilter;
}
}
}
return newFilters;
}
module.exports = {
parseBrandListData,
cancelFilterSelectState,
}