Authored by htoooth

fix

... ... @@ -160,7 +160,10 @@ const refund = (req, res, next) => {
const refundReason = (req, res, next) => {
ordersService.refundReason().then((result) => {
return res.json(result);
return res.json({
code: 200,
data: result
});
}).catch(next);
};
... ...
... ... @@ -400,7 +400,7 @@ const getOrders = (uid, page, limit, type, isPage)=> {
}
newOrder.operation = _getOperateInfo(order.order_code, op);
console.log(newOrder.operation);
return newOrder;
};
... ...
<script id="cancel-dialog-tpl" type="text/html">
<header>申请退款</header>
<p class="tip">您取消订单的原因是:</p>
<ul class="cancel-reason clearfix">
{{# cancelReason}}
<header>申请退款</header>
<p class="tip">您取消订单的原因是:</p>
<ul class="cancel-reason clearfix">
{{# refundReason}}
<li {{#if @last}}style="width:100%;"{{/if}}>
<input id="cancel-radio-{{id}}" type="radio" name="cancel-reason" value="{{id}}">
<label for="cancel-radio-{{id}}">{{reason}}</label>
{{#if @last}}<input type="text" id="reason_other" placeholder="50字以内" maxlength="50">{{/if}}
</li>
{{/ cancelReason}}
</ul>
<p class="tip reminder">温馨提示:</p>
<ul class="info-prompt">
{{/refundReason}}
</ul>
<p class="tip reminder">温馨提示:</p>
<ul class="info-prompt">
<li><i>*</i>申请退款后,本单享有的优惠可能会一并取消。</li>
<li><i>*</i>该订单已付金额将原路返回,请您耐心等待。</li>
</ul>
<p class="cancel-tip"></p>
</script>
</ul>
<p class="cancel-tip"></p>
... ...

608 Bytes | W: | H:

42.6 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

13.9 KB | W: | H:

11.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -73,8 +73,8 @@ function cancelFactory(id) {
return new Dialog(options);
}
function shwoRefundDialog(orderId) {
var refundHtml = '';
function showRefundDialog(orderId) {
return ordersApi.refundReason().then(function(result) {
var options = {
mask: false,
btns: [
... ... @@ -110,12 +110,10 @@ function shwoRefundDialog(orderId) {
}
}
],
content: refundHtml,
content: refundDialogTpl(result),
className: 'cancel-dialog'
};
return ordersApi.refundReason(function(result) {
refundHtml = refundDialogTpl(result.data);
active = new Dialog(options);
active.show();
});
... ... @@ -157,7 +155,7 @@ function buyAgain(id) {
data: {orderCode: id}
}).then(function(d) {
if (d.code === 200) {
location.href = '/shopping/cart';
location.href = '/cart/cart';
} else {
new dialog.Alert(d.message).show();
}
... ... @@ -647,5 +645,5 @@ $('.check-logistics').click(function() {
});
$('.refund-apply').on('click', function() {
shwoRefundDialog($(this).closest('.order, .order-detail').data('id'));
showRefundDialog($(this).closest('.order, .order-detail').data('id'));
});
... ...
... ... @@ -21,11 +21,19 @@ exports.refund = function(orderId, reasonId, reason) {
};
exports.refundReason = function() {
return (function() {
if (__cacheReason) {
return $.resolve(__cacheReason);
}
return $.get('/home/orders/refundreason').then(function(result) {
if (result.code !== 200) {
return $.reject();
}
return (__cacheReason = result);
});
}()).then(function(result) {
return {refundReason: result.data};
});
};
... ...