Authored by biao

Merge branch 'feature/my-order' into develop

... ... @@ -9,12 +9,12 @@
const mcHandler = require('../models/menu-crumb-handler');
const orderModel = require('../models/order');
// fakeuid = '10931021',
/**
* 订单
*/
const index = (req, res) => {
const orderData = orderModel.getOrderData();
orderModel.getOrderData().then(result => {
res.render('index', {
page: 'order',
isMe: true,
... ... @@ -22,7 +22,8 @@ const index = (req, res) => {
nav: mcHandler.getMeCrumb(),
navigation: mcHandler.getSideMenu('我的订单'),
banner: 'http://placehold.it/{width}x{height}'
}, orderData)
}, result)
});
});
};
... ...
const api = global.yoho.API;
const camelCase = global.yoho.camelCase;
const _getUserOrder = () => {
return api.get('', {
method: 'app.SpaceOrders.get',
uid: '10931021',
type: 1,
page: 1,
limit: 10
}).then(result => {
const orderList = result && result.data && result.data.order_list || [];
return camelCase(orderList);
});
};
const getOrderData = () => {
return {
order: {
return _getUserOrder().then(result => {
const fakeData = {
title: '我的订单',
tabs: [
{
... ... @@ -17,85 +34,17 @@ const getOrderData = () => {
type: 'delivering'
}
],
showSearch: true,
orders: [
{
orderTime: '2016-07-10 12:30:11',
validLeftTime: '1时35分',
serialNumber: '887625272',
showMobile: true,
cost: '1200.00',
status: '待付款',
showPayButton: true,
showEditOption: true,
payVia: '在线支付',
goods: [
{
img: '//placehold.it/{width}x{height}',
name: '一件非常非常潮的衣服,因为刚从洗衣机里拿出来',
price: '32000.00',
color: '雪白',
size: '39码',
quantity: 5
}
]
},
{
orderTime: '2016-07-10 12:30:11',
serialNumber: '887625272',
showMobile: true,
cost: '1200.00',
status: '交易完成',
payVia: '在线支付',
goods: [
{
img: '//placehold.it/{width}x{height}',
name: '一件非常非常潮的衣服,因为刚从洗衣机里拿出来',
price: '32000.00',
color: '雪白',
size: '39码',
quantity: 5
}
]
},
{
showEditOption: true,
orderTime: '2016-07-10 12:30:11',
serialNumber: '887625272',
showMobile: true,
cost: '1200.00',
status: '备货中',
payVia: '在线支付',
goods: [
{
img: '//placehold.it/{width}x{height}',
name: '一件非常非常潮的衣服,因为刚从洗衣机里拿出来',
price: '32000.00',
color: '雪白',
size: '39码',
quantity: 5
},
{
img: '//placehold.it/{width}x{height}',
name: '一件非常非常潮的衣服,因为刚从洗衣机里拿出来',
price: '32000.00',
color: '雪白',
size: '39码',
quantity: 5
},
{
img: '//placehold.it/{width}x{height}',
name: '一件非常非常潮的衣服,因为刚从洗衣机里拿出来',
price: '32000.00',
color: '雪白',
size: '39码',
quantity: 5
}
]
}
]
}
showSearch: true
};
const order = Object.assign(fakeData, {
orderList: result
});
return {
order: order
};
});
};
module.exports = {
... ...
... ... @@ -3,7 +3,7 @@
{{> common/subtitle}}
{{> order/nav}}
{{> order/table-header}}
{{#if orders}}
{{#if orderList}}
{{> order/table-body}}
{{/if}}
{{/order}}
... ...
{{#orders}}
{{#orderList}}
<div class="table">
<ul class="header">
<li class="content">下单时间:{{orderTime}}</li>
<li class="content">订单编号:{{serialNumber}}</li>
<li class="content">下单时间:{{createTime}}</li>
<li class="content">订单编号:{{orderCode}}</li>
{{#if showMobile}}
<li class="content">手机订单</li>
{{/if}}
</ul>
<div class="table-body">
<div class="goods-container special-border">
{{#goods}}
{{#orderGoods}}
<div class="good-info {{#if @last}}last{{/if}}">
<img src="{{image img 65 90}}">
<img src="{{image goodsImage 65 90}}">
<div class="detail">
<p class="with-bottom-space">{{name}}</p>
<span class="with-space">颜色:{{color}}</span>
<p class="with-bottom-space">{{productName}}</p>
<span class="with-space">颜色:{{colorName}}</span>
<span>尺码:
<span class="bold">{{size}}</span>
<span class="bold">{{sizeName}}</span>
</span>
<p class="bold">{{> icon/error-round}}{{quantity}}</p>
<p class="bold">{{> icon/error-round}}{{buyNumber}}</p>
</div>
</div>
<div class="price bold">
<p>{{price}}</p>
<p>{{goodsAmount}}</p>
</div>
{{/goods}}
{{/orderGoods}}
</div>
<div class="common-column special-border">
<p class="bold">{{cost}}</p>
<p class="subtext">{{payVia}}</p>
<p class="bold">{{amount}}</p>
<p class="subtext">{{paymentTypeStr}}</p>
</div>
<div class="common-column special-border">
<p>{{status}}</p>
<p>{{statusStr}}</p>
<p class="subtext">查看详情</p>
</div>
<div class="common-column special-border">
{{#if validLeftTime}}
<p class="left-time">剩余{{validLeftTime}}</p>
{{#if payLeftTime}}
<p class="left-time">剩余{{payLeftTime}}</p>
{{/if}}
{{#if showPayButton}}
<button>立即付款</button>
... ... @@ -51,4 +51,4 @@
</div>
</div>
</div>
{{/orders}}
{{/orderList}}
... ...
... ... @@ -19,7 +19,9 @@ module.exports = {
},
cookieDomain: 'yohoblk.com',
domains: {
api: 'http://api.yoho.yohoops.org/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
// api: 'http://api.yoho.yohoops.org/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
// api: 'http://testapi.yoho.cn:28078/',
api: 'http://api.yoho.yohoops.org/',
service: 'http://devservice.yoho.cn:28077/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077
search: 'http://192.168.102.216:8080/yohosearch/'
},
... ...
... ... @@ -24,6 +24,8 @@ order: {
cost: '', // 订单花费
status: '', // 订单状态
payVia: '', // 支付方式
showPayButton: true/false, // 是否显示立即付款按钮
showEditOption: true/false // 是否显示编辑项
// 订单中的商品
goods: [
... ...
... ... @@ -148,7 +148,7 @@
background-color: #d1021c;
color: #fff;
cursor: pointer;
margin-bottom: $space;
margin-bottom: 14px;
}
p {
... ...