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}}
<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">
<li><i>*</i>申请退款后,本单享有的优惠可能会一并取消。</li>
<li><i>*</i>该订单已付金额将原路返回,请您耐心等待。</li>
</ul>
<p class="cancel-tip"></p>
</script>
<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>
{{/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>
... ...

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,49 +73,47 @@ function cancelFactory(id) {
return new Dialog(options);
}
function shwoRefundDialog(orderId) {
var refundHtml = '';
var options = {
mask: false,
btns: [
{
id: 'cancel-sure',
name: '确定并取消订单',
btnClass: ['cancel-sure'],
cb: function() {
var $checked = $('.cancel-dialog :checked');
var $tip = $('.cancel-dialog .cancel-tip');
function showRefundDialog(orderId) {
return ordersApi.refundReason().then(function(result) {
var options = {
mask: false,
btns: [
{
id: 'cancel-sure',
name: '确定并取消订单',
btnClass: ['cancel-sure'],
cb: function() {
var $checked = $('.cancel-dialog :checked');
var $tip = $('.cancel-dialog .cancel-tip');
if ($checked.length === 0) {
$tip.html('请选择要取消订单的原因');
return;
}
if ($checked.length === 0) {
$tip.html('请选择要取消订单的原因');
return;
ordersApi.refund(orderId, $checked.val()).then(function(data) {
if (data.code === 200) {
active.close();
history.go(0);
} else {
$tip.html(data.message);
}
});
}
},
{
id: 'cancel-no',
name: '取消',
btnClass: ['cancel-no'],
cb: function() {
active.close();
}
ordersApi.refund(orderId, $checked.val()).then(function(data) {
if (data.code === 200) {
active.close();
history.go(0);
} else {
$tip.html(data.message);
}
});
}
},
{
id: 'cancel-no',
name: '取消',
btnClass: ['cancel-no'],
cb: function() {
active.close();
}
}
],
content: refundHtml,
className: 'cancel-dialog'
};
],
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() {
if (__cacheReason) {
return $.resolve(__cacheReason);
}
return (function() {
if (__cacheReason) {
return $.resolve(__cacheReason);
}
return $.get('/home/orders/refundreason').then(function(result) {
return (__cacheReason = result);
return $.get('/home/orders/refundreason').then(function(result) {
if (result.code !== 200) {
return $.reject();
}
return (__cacheReason = result);
});
}()).then(function(result) {
return {refundReason: result.data};
});
};
... ...