Authored by biao

update for fix empty msg bug

... ... @@ -15,7 +15,7 @@ const orderModel = require('../models/order');
const index = (req, res) => {
const type = req.query.type;
const page = req.query.page;
const uid = req.user.uid;
const uid = req.user.uid || '7394907';
orderModel.getOrderData(uid, type, page).then(result => {
res.display('index', {
... ... @@ -32,7 +32,7 @@ const index = (req, res) => {
const detail = (req, res) => {
const code = req.query.code;
const uid = req.user.uid;
const uid = req.user.uid || '7394907';
orderModel.getOrderDetail(uid, code).then(result => {
res.display('index', {
... ... @@ -58,9 +58,7 @@ const getOrderList = (req, res) => {
page: 'order',
isMe: true,
orderList: result.order.orderList,
paginationOpts: result.order.paginationOpts,
emptyMsg: result.order.emptyMsg,
showEmptyEn: result.order.showEmptyEn
orderData: result.order
});
});
};
... ...
... ... @@ -331,16 +331,22 @@ const getOrderData = (uid, type, page) => {
]
};
const emptyMsg = {
const emptyObject = {
1: {
text: '您暂时还没有订单',
showEmptyEn: true
emptyMsg: '暂时还没有订单哦~',
showEmptyEn: true,
btnText: '去首页看看',
url: '/'
},
2: {
text: '您暂时还没有待付款的订单'
emptyMsg: '没有待付款的订单哦~',
btnText: '查看全部订单',
url: '/me/'
},
3: {
text: '您暂时还没有待收货的订单'
emptyMsg: '没有待收货的订单哦~',
btnText: '查看全部订单',
url: '/me/'
}
};
... ... @@ -358,10 +364,7 @@ const getOrderData = (uid, type, page) => {
type: type
};
const empty = {
showEmptyEn: emptyMsg[type].showEmptyEn,
emptyMsg: emptyMsg[type].text
};
const empty = emptyObject[type];
navBar.tabs[typeActiveIndexMap[type]].isActive = true;
... ...
... ... @@ -56,12 +56,16 @@
{{/if}}
{{^}}
<div class="bg"></div>
{{#orderData}}
<div class="msg">
<p class="msg-zh bold">{{emptyMsg}}</p>
{{#if showEmptyEn}}
<p class="msg-en">You do not have an order for the time being</p>
{{/if}}
<span class="btn">去购物</span>
<a href="{{url}}">
<span class="btn">{{btnText}}</span>
</a>
</div>
{{/orderData}}
{{/if}}
</div>
... ...