Authored by ccbikai

Merge branch 'develop' into release/1.0

... ... @@ -29,7 +29,7 @@ module.exports = {
return api.get('', {
method: 'app.brand.newBrandList',
yh_channel: yhChannel[params.channel].channel
});
}, {code: 200, cache: true});
},
/**
... ... @@ -39,6 +39,6 @@ module.exports = {
getCateListData(params) {
return api.get('', Object.assign(params, {
method: 'app.sort.get'
}));
}, {code: 200, cache: true}));
}
};
... ...
... ... @@ -55,10 +55,10 @@ const getBrandListData = params => {
let finalResult = {};
return brandApi.getBrandListOriginData(params).then(result => {
if (result.code === 200 && result.data) {
if (result.data) {
Object.assign(finalResult, handleBrandList(result.data.all_list));
} else {
logger.error('getBrandListOriginData api code no 200 or data is null');
logger.error('getBrandListOriginData api data is null');
}
return finalResult;
... ... @@ -72,11 +72,7 @@ const getBrandListData = params => {
*/
const getCateListData = params => {
return brandApi.getCateListData(params).then(result => {
if (result.code === 200) {
return camelCase(result);
} else {
logger.error('getCateListData api code no 200 or data is null');
}
return camelCase(result);
});
};
... ...
... ... @@ -22,8 +22,8 @@ module.exports = {
/* 获取资讯列表数据 */
getEditorialList: (req, res, next) => {
let params = {
page: req.body.page,
channel: req.body.channel,
page: req.query.page,
channel: req.query.channel,
uid: req.user.uid
};
... ...
... ... @@ -30,6 +30,6 @@ module.exports = {
uid: params.uid || '0',
page: params.page,
limit: '10'
});
}, {code: 200, cache: true});
}
};
... ...
... ... @@ -7,7 +7,6 @@
'use strict';
const logger = global.yoho.logger;
const api = global.yoho.API;
const editorialListApi = require('./list-api');
const camelCase = global.yoho.camelCase;
... ... @@ -19,19 +18,17 @@ const camelCase = global.yoho.camelCase;
const editorialList = params => {
let finalResult = {};
return api.all([
editorialListApi.getEditorialListData(params)
]).then(result => {
if (result[0].code === 200 && result[0].data.list) {
return editorialListApi.getEditorialListData(params).then(result => {
if (result.data && result.data.list) {
Object.assign(finalResult, {
data: {
list: result[0].data.list.artList,
totalPage: result[0].data.totalPage
list: result.data.list.artList,
totalPage: result.data.totalPage
},
code: 200
});
} else {
logger.error('getEitorialListData api code no 200');
logger.error('getEitorialListData api no data');
}
return camelCase(finalResult);
... ...
... ... @@ -13,7 +13,7 @@ const router = expressRouter();
const editorial = require(`${cRoot}/index`);
router.get('/list', editorial.index); // 首页
router.post('/list.json', editorial.getEditorialList); // 获取资讯数据
router.get('/list.json', editorial.getEditorialList); // 获取资讯数据
// 详情controller
const detail = require(`${cRoot}/detail`);
... ...
... ... @@ -5,3 +5,13 @@
</div>
{{/ suggestSub}}
</div>
<style>
html,
body {
height: 100%;
}
.main-wrap {
height: 100%;
}
</style>
... ...
<div class="order-wrapper" id="home-order-list">
<div id="home-order-list">
<Order></Order>
<input type="hidden" value="{{type}}" id="order-type">
</div>
... ...
<div class="order-wrapper return-goods" id="refund-order-list">
<div id="refund-order-list">
<refund-order></refund-order>
</div>
\ No newline at end of file
</div>
... ...
... ... @@ -30,7 +30,7 @@ module.exports = {
return api.get('', {
method: 'web.brand.byDomain',
domain: params.domain
});
}, {code: 200, cache: false});
},
/**
... ... @@ -49,7 +49,7 @@ module.exports = {
});
}
return api.get('', finalParams);
return api.get('', finalParams, {code: 200, cache: false});
},
/**
... ... @@ -61,7 +61,7 @@ module.exports = {
return api.get('', {
method: 'app.shopsdecorator.getList',
shop_id: params.shopId
});
}, {code: 200, cache: false});
},
/**
... ... @@ -93,7 +93,7 @@ module.exports = {
}
});
return api.get('', finalParams);
return api.get('', finalParams, {code: 200, cache: false});
},
/**
... ... @@ -118,6 +118,6 @@ module.exports = {
method: 'app.favorite.add'
});
}
return api.get('', finalParams);
return api.get('', finalParams, {code: 200, cache: false});
}
};
... ...
... ... @@ -22,7 +22,7 @@ const getShopData = params => {
return shopApi.getBrandInfoByDomain({domain: params.domain}).then(result => {
if (result.code === 200) {
if (result.data) {
/* 品牌名称 */
Object.assign(finalResult, {
... ... @@ -44,7 +44,8 @@ const getShopData = params => {
// uid: '8050882'
}).then(subResult => {
if (subResult.code === 200) {
if (subResult.data) {
/* 取店铺的基本信息 */
Object.assign(finalResult, {
... ... @@ -56,26 +57,24 @@ const getShopData = params => {
/* 取资源位店铺背景图 */
return shopApi.getShopsDecoratorList({shopId: result.data.shop_id}).then(thResult => {
if (thResult.code === 200) {
if (thResult.data) {
_.forEach(thResult.data.list, value => {
if (value.resource_name === 'shopTopBanner_app') {
Object.assign(finalResult, {
brandBg: JSON.parse(value.resource_data).shopSrc
shopBg: JSON.parse(value.resource_data).shopSrc
});
}
});
} else {
logger.info('getShopsDecoratorList api code no 200');
logger.error('getShopsDecoratorList api no data');
}
return finalResult;
});
} else {
logger.error('getShopInfoData api code no 200');
logger.error('getShopInfoData api no data');
}
return finalResult;
});
} else {
... ... @@ -87,8 +86,9 @@ const getShopData = params => {
logger.info('brand has no shop');
}
return finalResult;
} else {
logger.error('getBrandOriginData api code no 200');
logger.error('getBrandInfoByDomain api no data');
}
return finalResult;
... ... @@ -103,13 +103,14 @@ const getShopData = params => {
const getBrandShopGoodsData = params => {
let finalResult = {};
return shopApi.getBrandInfoByDomain({ domain: params.domain }).then(result => {
if (result.code === 200) {
return shopApi.getBrandInfoByDomain({domain: params.domain}).then(result => {
if (result.data) {
return shopApi.getBrandShopGoodsOriginData(Object.assign(params, {
brand: result.data.id,
shopId: result.data.shop_id
})).then(subResult => {
if (subResult.code === 200 && subResult.data) {
if (subResult.data) {
prettyFilter(subResult.data.filter);
finalResult = {
data: {
... ... @@ -121,15 +122,13 @@ const getBrandShopGoodsData = params => {
code: 200
};
} else {
logger.error('getBrandShopGoodsOriginData api code no 200');
logger.error('getBrandShopGoodsOriginData api no data');
}
return camelCase(finalResult);
});
} else {
logger.error('getBrandInfoByDomain api code no 200');
logger.error('getBrandInfoByDomain api no data');
}
return camelCase(finalResult);
});
};
... ...
... ... @@ -157,7 +157,6 @@ const matchHeader = (path, qs, titleMap) => {
if (/\/me\/order\/detail$/.test(path)) {
header = titleMap[2];
header.title.des = '订单详情';
header.title.right.action = origin + '/me/service';
return header;
}
... ... @@ -207,6 +206,13 @@ const matchHeader = (path, qs, titleMap) => {
return header;
}
// 处理 feature.yoho.cn 等域名下的站外链接
if (/^(https?:)?\/\//i.test(path) && !/yohoblk\.com/.test(path)) {
header = titleMap[1];
header.title.des = qs.title || '';
return header;
}
return header;
};
... ... @@ -271,6 +277,6 @@ const intercept = (url) => {
};
module.exports = {
defaultTitleMap: defaultTitleMap,
intercept: intercept
defaultTitleMap,
intercept
};
... ...
const yoho = require('yoho');
const getImgHost = function(url) {
let urlArr = url.split('/'),
num = urlArr[urlArr.length - 1].substr(1, 1),
... ... @@ -11,6 +13,16 @@ const getImgHost = function(url) {
}
};
const visibilitychange = function() {
document.addEventListener('visibilitychange', function() {
if (yoho.isApp && !document.hidden) {
yoho.showLoading(false);
}
});
};
module.exports = {
getImgHost: getImgHost
getImgHost,
visibilitychange
};
... ...
... ... @@ -164,7 +164,7 @@ const enDict = {
color: 'Color',
gender: 'Gender',
size: 'Size',
brand: 'Brand品牌',
brand: 'Brand',
priceRange: 'Price',
groupSort: 'Category',
discount: 'Sale',
... ...
... ... @@ -17,6 +17,7 @@
const $ = require('jquery');
const yoho = require('yoho');
const Vue = require('vue');
const util = require('common/util');
const interceptClick = require('common/intercept-click');
const bus = require('common/vue-bus');
... ... @@ -25,6 +26,7 @@ Vue.mixin({
ready() {
if (this === this.$root && location.pathname !== '/sidebar') {
yoho.showLoading(false);
util.visibilitychange();
}
}
});
... ... @@ -34,6 +36,7 @@ $(() => {
if ($body.hasClass('no-local-js')) {
yoho.showLoading(false); // 隐藏 App 默认显示的 loading
util.visibilitychange();
}
$body.on('click', 'a[href]', function() {
... ...
var yoho = require('yoho');
var $ = require('jquery');
const util = require('common/util');
if (!yoho.isLogin) {
$('.auth').addClass('no-intercept');
$('.auth').on('click', function() {
... ... @@ -8,7 +8,7 @@ if (!yoho.isLogin) {
return false;
});
} else {
// 地址管理
// 地址管理
$('#address').on('click', function() {
yoho.goAddress({
type: '2'
... ... @@ -25,4 +25,5 @@ $('#setting').on('click', function() {
$(() => {
yoho.showLoading(false);
util.visibilitychange();
});
... ...
... ... @@ -40,7 +40,7 @@ const yoho = {
* @param fail 调用失败的回调方法
*/
goTab(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.tab',
arguments: args
... ... @@ -57,7 +57,7 @@ const yoho = {
* @param fail 调用失败的回调方法
*/
goLogin(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.login',
arguments: args
... ... @@ -74,7 +74,7 @@ const yoho = {
* @param fail
*/
goLogout(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.loginout',
arguments: args
... ... @@ -92,7 +92,7 @@ const yoho = {
* @param fail 调用失败的回调方法
*/
goShopingKey(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.shoppingkey',
arguments: args
... ... @@ -110,7 +110,7 @@ const yoho = {
* @param fail 调用失败的回调方法
*/
goShopingCart(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.shopingCart',
arguments: args
... ... @@ -127,7 +127,7 @@ const yoho = {
* @param fail 调用失败的回调方法
*/
goAddress(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.address',
arguments: args
... ... @@ -144,7 +144,7 @@ const yoho = {
* @param fail 调用失败的回调方法
*/
goImageBrowser(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.imageBrowser',
arguments: args
... ... @@ -162,7 +162,7 @@ const yoho = {
* @param fail 调用失败的回调方法
*/
goNewPage(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.newPage',
arguments: args
... ... @@ -181,7 +181,7 @@ const yoho = {
* @param fail 调用失败的回调方法
*/
goPay(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.pay',
arguments: args
... ... @@ -198,7 +198,7 @@ const yoho = {
* @param fail
*/
goBack(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.back',
arguments: args
... ... @@ -215,7 +215,7 @@ const yoho = {
* @param fail
*/
goShare(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.share',
arguments: args
... ... @@ -232,7 +232,7 @@ const yoho = {
* @param fail
*/
goSearch(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.search',
arguments: args
... ... @@ -249,7 +249,7 @@ const yoho = {
* @param fail
*/
goSetting(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.setting',
arguments: args
... ... @@ -266,7 +266,7 @@ const yoho = {
* @param fail
*/
goSetAvatar(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.setAvatar',
arguments: args
... ... @@ -283,7 +283,7 @@ const yoho = {
* @param fail
*/
goPageView(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.pageView',
arguments: args
... ... @@ -300,7 +300,7 @@ const yoho = {
* @param fail
*/
showLoading(args, success, fail) {
if (this.isApp) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.loading',
arguments: {
... ...
... ... @@ -27,6 +27,7 @@
.blk-icon {
background: resolve("me/app-icon.png") no-repeat;
background-size: 100%;
width: 180px;
height: 180px;
left: 0;
... ...
... ... @@ -10,7 +10,7 @@
</ul>
<div class="sub-level-container">
<ul class="sub-level">
<li><a href="/list?sort={{rightAll.sortId}}&sort_name={{rightAll.categoryName}}&gender={{gender}}">全部{{rightAll.categoryName}}</a></li>
<li><a href="/list?sort={{rightAll.sortId}}&sort_name=全部{{rightAll.categoryName}}&gender={{gender}}">全部{{rightAll.categoryName}}</a></li>
</ul>
<ul class="sub-level">
<li v-for="sub in cateNavRightData">
... ... @@ -131,6 +131,7 @@
overflow: hidden;
text-overflow: ellipsis;
border-bottom: 1px solid #e6e6e6;
user-select: none;
&.focus {
background-color: #fff;
... ... @@ -177,6 +178,7 @@
line-height: 110px;
border-bottom: 1px solid #e6e6e6;
padding-left: 20px;
user-select: none;
&.highlight {
background: #eee;
... ...
... ... @@ -85,7 +85,8 @@
contentCode: contentCode.editorial.all,
editorialList: [],
page: 0,
scrollDisabled: false
scrollDisabled: false,
channel: qs.channel
};
},
watch: {
... ... @@ -97,11 +98,11 @@
/* 获取资讯列表数据 */
getNewsList() {
$.post({
$.get({
url: '/editorial/list.json',
data: {
page: this.page++,
channel: qs.channel || 'all'
channel: this.channel
}
}).done(result => {
if (result.code === 200) {
... ...
... ... @@ -222,7 +222,6 @@
.yoho-favorite-brand-page {
width: 100%;
height: auto;
margin-top: 20px;
.fav-content {
.fav-type {
... ... @@ -233,7 +232,6 @@
padding-left: 20px;
list-style: none;
overflow: hidden;
border-top: 1px solid #e0e0e0;
li {
position: relative;
... ...
... ... @@ -240,7 +240,6 @@
.yoho-favorite-page {
width: 100%;
height: auto;
margin-top: 20px;
.fav-content {
.fav-type {
... ... @@ -251,7 +250,6 @@
padding-left: 20px;
list-style: none;
overflow: hidden;
border-top: 1px solid #e0e0e0;
li {
position: relative;
... ...
... ... @@ -76,6 +76,11 @@
},
ready() {
this.getOrderData();
yohoAPI.addNativeMethod('goToService', () => {
interceptClick.intercept('/me/service');
return false;
});
},
methods: {
getOrderData() {
... ...
<template>
<ul id="order-list" v-infinite-scroll="getOrderData()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<li class="order-item" v-for="(index, order) in orderList">
<div class="order-detail">
<div class="order-code">
<p>订单号:{{order.orderCode}}</p>
<p>{{order.statusStr}}</p>
</div>
<div class="order-goods" >
<div class="goods-info" v-for="goods in order.orderGoods">
<div class="img-box">
<img v-bind:src="goods.goodsImage | resize 49 65">
<label v-if="goods.goodsType === 'gift'">赠品</label>
<label class="price-gift" v-if="goods.goodsType === 'price_gift'">加价购</label>
</div>
<div class="goods-detail">
<p class="name">{{goods.productName}}</p>
<p class="size">
<span>颜色:{{goods.colorName}}</span>
<span>尺码:{{goods.sizeName}}</span>
</p>
</div>
<div class="goods-price">
<p>&yen; {{goods.goodsPrice}}</p>
<p>×{{goods.buyNumber}}</p>
<div class="order-wrapper" v-if="orderList.length > 0">
<ul id="order-list" v-infinite-scroll="getOrderData()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<li class="order-item" v-for="(index, order) in orderList">
<div class="order-detail">
<div class="order-code">
<p>订单号:{{order.orderCode}}</p>
<p>{{order.statusStr}}</p>
</div>
<div class="order-goods" >
<div class="goods-info" v-for="goods in order.orderGoods">
<div class="img-box">
<img v-bind:src="goods.goodsImage | resize 49 65">
<label v-if="goods.goodsType === 'gift'">赠品</label>
<label class="price-gift" v-if="goods.goodsType === 'price_gift'">加价购</label>
</div>
<div class="goods-detail">
<p class="name">{{goods.productName}}</p>
<p class="size">
<span>颜色:{{goods.colorName}}</span>
<span>尺码:{{goods.sizeName}}</span>
</p>
</div>
<div class="goods-price">
<p>&yen; {{goods.goodsPrice}}</p>
<p>×{{goods.buyNumber}}</p>
</div>
<a href="/me/order/detail?orderCode={{order.orderCode}}"></a>
</div>
<a href="/me/order/detail?orderCode={{order.orderCode}}"></a>
</div>
</div>
<div class="order-option">
<div class="goods-total">合计: <b>&yen;{{order.amount}}</b></div>
<div class="options">
<button v-if="order.isCancel === 'Y'" @click="deleteOrder(order,index)" class="normal">删除订单</button>
<template v-else>
<button v-if="order.status === 0" @click="cancelOrder(order.orderCode)">取消订单</button>
<button v-if="order.status === 0 " class="countdown" @click="goBuy(order.orderCode)">去支付
<span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span>
</button>
<a v-if="order.status === 4 || order.status === 5 "
href="/me/logistic?order_code={{order.orderCode}}">查看物流</a>
<button v-if="order.status === 4 || order.status === 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button>
<button v-if="order.status === 6" @click="deleteOrder(order,index)" class="normal">删除订单</button>
</template>
<div class="order-option">
<div class="goods-total">合计: <b>&yen;{{order.amount}}</b></div>
<div class="options">
<button v-if="order.isCancel === 'Y'" @click="deleteOrder(order,index)" class="normal">删除订单</button>
<template v-else>
<button v-if="order.status === 0" @click="cancelOrder(order.orderCode)">取消订单</button>
<button v-if="order.status === 0 " class="countdown" @click="goBuy(order.orderCode)">去支付
<span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span>
</button>
<a v-if="order.status === 4 || order.status === 5 "
href="/me/logistic?order_code={{order.orderCode}}">查看物流</a>
<button v-if="order.status === 4 || order.status === 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button>
<button v-if="order.status === 6" @click="deleteOrder(order,index)" class="normal">删除订单</button>
</template>
</div>
</div>
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
<div class="order-empty {{emptybox}}">
<p>您暂时还没有订单</p>
<p>Your do not have an order <br>for the time being</p>
... ...
<template>
<ul v-infinite-scroll="getRefundData()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<li class="order-item" v-for="(index, order) in orderList">
<div class="order-detail">
<div class="order-code">
<div class="code-time">
<p>订单号:{{order.orderCode}}</p>
<p>申请时间:{{order.orderCreateTime}}</p>
</div>
<p>{{order.statusName}}</p>
</div>
<div class="order-goods">
<div class="goods-info" v-for="product in order.goods">
<div class="img-box">
<img v-bind:src="product.goodsImage | resize 49 65">
<label v-if="product.goodsType === 'gift'">赠品</label>
<label class="price-gift" v-if="product.goodsType === 'price_gift'">加价购</label>
<div class="order-wrapper return-goods" v-if="orderList.length > 0">
<ul v-infinite-scroll="getRefundData()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<li class="order-item" v-for="(index, order) in orderList">
<div class="order-detail">
<div class="order-code">
<div class="code-time">
<p>订单号:{{order.orderCode}}</p>
<p>申请时间:{{order.orderCreateTime}}</p>
</div>
<div class="goods-detail">
<p class="name">{{product.productName}}</p>
<p class="size">
<span>颜色: {{product.colorName}}</span>
<span>尺码: {{product.sizeName}}</span>
</p>
</div>
<div class="goods-price">
<p>&yen;{{product.salesPrice}}</p>
<p>×1</p>
<p>{{order.statusName}}</p>
</div>
<div class="order-goods">
<div class="goods-info" v-for="product in order.goods">
<div class="img-box">
<img v-bind:src="product.goodsImage | resize 49 65">
<label v-if="product.goodsType === 'gift'">赠品</label>
<label class="price-gift" v-if="product.goodsType === 'price_gift'">加价购</label>
</div>
<div class="goods-detail">
<p class="name">{{product.productName}}</p>
<p class="size">
<span>颜色: {{product.colorName}}</span>
<span>尺码: {{product.sizeName}}</span>
</p>
</div>
<div class="goods-price">
<p>&yen;{{product.salesPrice}}</p>
<p>×1</p>
</div>
<a v-if="order.refundType === 1" href="/me/return/refund/detail/{{order.id}}"></a>
<a v-if="order.refundType === 2" href="/me/return/exchange/detail/{{order.id}}"></a>
</div>
<a v-if="order.refundType === 1" href="/me/return/refund/detail/{{order.id}}"></a>
<a v-if="order.refundType === 2" href="/me/return/exchange/detail/{{order.id}}"></a>
</div>
</div>
<div class="order-option" v-show="order.canCancel == 'Y'">
<div class="goods-total"></div>
<div class="options">
<button class="normal" @click="cancelApply(order.id, order.refundType)">取消申请</button>
<div class="order-option" v-show="order.canCancel == 'Y'">
<div class="goods-total"></div>
<div class="options">
<button class="normal" @click="cancelApply(order.id, order.refundType)">取消申请</button>
</div>
</div>
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
<div class="order-empty {{emptybox}}">
<p>您暂时还没有订单</p>
<p>Your do not have an order <br>for the time being</p>
... ...
... ... @@ -3,7 +3,7 @@
<cheader :title="sortName" class="list-header">
<i class="icon icon-filter" slot="right" @click="openFilter"></i>
</cheader>
<order :config="orderConfig" :val="order" V-if="!empty"></order>
<order :config="orderConfig" :val="order" v-if="enableOrder"></order>
<List :data="productList" :empty="empty"></List>
<Filter :config="filterConfig" v-ref:filter></Filter>
</div>
... ... @@ -46,7 +46,8 @@
productList: [],
// state
inSearching: false // 请求中
inSearching: false, // 请求中
enableOrder: false
};
},
computed: {
... ... @@ -75,7 +76,7 @@
}
this.inSearching = true;
$.get(this.url, Object.assign({
return $.get(this.url, Object.assign({
order: this.order,
page: nextPage
}, this.filter, locationQuery))
... ... @@ -152,7 +153,12 @@
self.$refs.filter.isVisible = false;
});
this.search();
this.search()
.then(()=>{
if (self.productList.length) {
self.enableOrder = true;
}
});
}
};
... ...
... ... @@ -3,7 +3,7 @@
<cheader title="新品抢先看">
<i class="icon icon-filter" slot="right" @click="openFilter"></i>
</cheader>
<order :config="orderConfig" :val="order" v-if="!empty"></order>
<order :config="orderConfig" :val="order" v-if="enableOrder"></order>
<List :data="productList" :empty="empty"></List>
<Filter :config="filterConfig" action="/product/list.json" v-ref:filter></Filter>
</div>
... ... @@ -46,7 +46,8 @@
productList: [],
// state
inSearching: false // 请求中
inSearching: false, // 请求中
enableOrder: false
};
},
computed: {
... ... @@ -76,27 +77,27 @@
}
this.inSearching = true;
$.get(this.url, Object.assign({
return $.get(this.url, Object.assign({
order: this.order,
page: nextPage
}, this.filter, locationQuery))
.done(res => {
if (res.code === 200) {
self.page = res.data.page;
self.totalPage = res.data.pageTotal;
self.$set('productList', self.productList.concat(res.data.productList));
if (!self.filterConfig) {
self.$set('filterConfig', res.data.filter);
.done(res => {
if (res.code === 200) {
self.page = res.data.page;
self.totalPage = res.data.pageTotal;
self.$set('productList', self.productList.concat(res.data.productList));
if (!self.filterConfig) {
self.$set('filterConfig', res.data.filter);
}
}
}
})
.fail(error => {
tip('网络出错~');
})
.always(() => {
self.inSearching = false;
});
})
.fail(error => {
tip('网络出错~');
})
.always(() => {
self.inSearching = false;
});
},
openFilter() {
... ... @@ -157,7 +158,12 @@
self.$refs.filter.isVisible = false;
});
this.search();
this.search()
.then(()=>{
if (self.productList.length) {
self.enableOrder = true;
}
});
}
};
... ...
<template>
<div>
<Order :config="orderConfig" :val="order" v-if="!empty">
<Order :config="orderConfig" :val="order" v-if="enableOrder">
</Order>
<List :data="productList" :empty="empty"></List>
</div>
... ... @@ -40,7 +40,8 @@
productList: [],
// state
inSearching: false // 请求中
inSearching: false, // 请求中
enableOrder: false
};
},
computed: {
... ... @@ -69,24 +70,24 @@
this.inSearching = true;
console.log(nextPage);
$.get(this.url, {
return $.get(this.url, {
order: this.order, // 排序 信息
query: this.query,
page: nextPage
})
.done(res => {
if (res.code === 200) {
self.page = res.data.page;
self.totalPage = res.data.pageTotal;
self.$set('productList', self.productList.concat(res.data.productList));
}
})
.fail(error => {
tip('网络出错~');
})
.always(() => {
self.inSearching = false;
});
.done(res => {
if (res.code === 200) {
self.page = res.data.page;
self.totalPage = res.data.pageTotal;
self.$set('productList', self.productList.concat(res.data.productList));
}
})
.fail(error => {
tip('网络出错~');
})
.always(() => {
self.inSearching = false;
});
},
/**
... ... @@ -119,7 +120,12 @@
self.order = val;
});
this.search();
this.search()
.then(()=>{
if (self.productList.length) {
self.enableOrder = true;
}
});
}
};
... ...
... ... @@ -8,9 +8,12 @@ const _ = require('lodash');
/**
* 处理 以风格的数据
* 风格1:
* [
* {filter_attribute: value}
* ]
* 风格2:
* {filter_attribute: value}
*
* 处理结果
* [
... ... @@ -22,18 +25,32 @@ let verboseAttrHandler = (filterField, dataArr) => {
let result = [];
let re = new RegExp(`^${filterField}_`);
dataArr.forEach(obj => {
// 处理 {filter_attribute: value}
function handlerAttrObj(obj) {
let item = {};
let keys = Object.keys(obj);
keys.forEach(key=>{
keys.forEach(key => {
let newKey = key.replace(re, '');
item[newKey] = obj[key];
});
return item;
}
result.push(item);
});
if (_.isPlainObject(dataArr)) {
// 风格2
let attr = handlerAttrObj(dataArr);
result.push(attr);
} else {
// 风格1
dataArr.forEach(obj => {
let attr = handlerAttrObj(obj);
result.push(attr);
});
}
return result;
};
... ... @@ -60,7 +77,7 @@ let keyIdHandler = (filterField, obj) => {
const keys = Object.keys(obj);
keys.sort();
keys.forEach(key=> {
keys.forEach(key => {
let item = {};
item.id = key;
... ...