Authored by biao

update for order cancel reason and fix some bugs

... ... @@ -58,7 +58,9 @@ const getOrderList = (req, res, next) => {
page: 'order',
isMe: true,
orderList: result.order.orderList,
paginationOpts: result.order.paginationOpts
paginationOpts: result.order.paginationOpts,
emptyMsg: result.order.emptyMsg,
showEmptyEn: result.order.showEmptyEn
});
}).catch(next);
};
... ... @@ -79,9 +81,9 @@ const getOrderTotal = (req, res, next) => {
const cancelOrder = (req, res, next) => {
const uid = global.yoho.uid || '7394907';
const code = req.query.orderCode;
const data = req.query;
orderModel.cancelOrder(uid, code).then(result => {
orderModel.cancelOrder(uid, data).then(result => {
res.json(result);
}).catch(next);
};
... ...
... ... @@ -72,6 +72,7 @@ const invoiceText = {
2: '电子'
};
// 订单状态
const statusMap = {
0: {
... ... @@ -282,11 +283,13 @@ const deleteOrder = (uid, code) => {
});
};
const cancelOrder = (uid, code) => {
const cancelOrder = (uid, data) => {
return api.get('', {
method: 'app.SpaceOrders.close',
uid: uid,
order_code: code
order_code: data.orderCode,
reason_id: data.reasonId,
reason: data.reason
}, {
cache: true
});
... ... @@ -328,6 +331,19 @@ const getOrderData = (uid, type, page) => {
]
};
const emptyMsg = {
1: {
text: '您暂时还没有订单',
showEmptyEn: true
},
2: {
text: '您暂时还没有待付款的订单'
},
3: {
text: '您暂时还没有待收货的订单'
}
}
type = parseInt(type, 10);
type = type < 4 ? type : 1;
... ... @@ -342,6 +358,13 @@ const getOrderData = (uid, type, page) => {
type: type
};
const empty = {
showEmptyEn: emptyMsg[type].showEmptyEn,
emptyMsg: emptyMsg[type].text
}
console.log(empty);
navBar.tabs[typeActiveIndexMap[type]].isActive = true;
const order = Object.assign(basicData, {
... ... @@ -357,7 +380,7 @@ const getOrderData = (uid, type, page) => {
} : false;
return {
order: Object.assign(order, paginationOpts)
order: Object.assign(order, paginationOpts, empty)
};
});
};
... ...
... ... @@ -57,8 +57,10 @@
{{^}}
<div class="bg"></div>
<div class="msg">
<p class="msg-zh bold">您暂时还没有订单</p>
<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>
</div>
{{/if}}
... ...
... ... @@ -26,10 +26,16 @@ function getTpl(data) {
// 取消订单
function cancelOrder(code, onCancel) {
var $checked = $('.reason .row .checked');
var reason = $checked.next('.reason-text').text();
var reasonId = $checked.parent().data('value');
$.ajax({
url: '/me/cancelOrder',
data: {
orderCode: code
orderCode: code,
reasonId: reasonId,
reason: reason
}
}).done(function() {
var tip = new _dialog({
... ...
... ... @@ -6,7 +6,7 @@
{{# subReasons}}
<p data-value="{{id}}">
<span class="iconfont raido {{#if checked}}checked{{/if}}">{{#if checked}}&#xe603;{{^}}&#xe604;{{/if}}</span>
{{reason}}
<span class="reason-text">{{reason}}</span>
</p>
{{/ subReasons}}
</div>
... ...