...
|
...
|
@@ -2,6 +2,8 @@ var dialog = require('../../plugins/dialog'); |
|
|
var _dialog = dialog.Dialog;
|
|
|
var _alert = dialog.Alert;
|
|
|
|
|
|
var validate = require('../../me/order/validation');
|
|
|
|
|
|
|
|
|
require('../../common/foreach-polyfill');
|
|
|
|
...
|
...
|
@@ -29,10 +31,26 @@ function getTpl(data) { |
|
|
}
|
|
|
|
|
|
// 取消订单
|
|
|
function cancelOrder(code, onCancel) {
|
|
|
function cancelOrder(code, onCancel, w) {
|
|
|
var $checked = $('.reason .row .checked');
|
|
|
var reason = $checked.next('.reason-text').text();
|
|
|
var reasonId = $checked.parent().data('value');
|
|
|
var pass = true;
|
|
|
|
|
|
if (reason === '其它' || reason === '其他') {
|
|
|
reason = $checked.siblings('.input').val();
|
|
|
|
|
|
pass = validate.start('#other-reason', {
|
|
|
maxLength: 50,
|
|
|
errMsg: '原因最多50个字符'
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (!pass) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
w.close();
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/me/cancelOrder',
|
...
|
...
|
@@ -82,8 +100,7 @@ function showDiaglog(tpl, code, onCancel) { |
|
|
btnClass: ['confirm'],
|
|
|
name: '确定并取消订单',
|
|
|
cb: function() {
|
|
|
cancelOrder(code, onCancel);
|
|
|
tip.close();
|
|
|
cancelOrder(code, onCancel, tip);
|
|
|
}
|
|
|
},
|
|
|
{
|
...
|
...
|
@@ -104,7 +121,7 @@ function showDiaglog(tpl, code, onCancel) { |
|
|
var $ele = $(ele);
|
|
|
var $input = $('.cancel-dialog .reason input');
|
|
|
|
|
|
if (checked && $ele.parent('.other').length) {
|
|
|
if (checked && $ele.hasClass('other')) {
|
|
|
$input.prop('disabled', false);
|
|
|
$input.focus();
|
|
|
} else {
|
...
|
...
|
@@ -131,6 +148,13 @@ function getCancelReason(code, onCancel) { |
|
|
if (idx === 0) {
|
|
|
d[0].checked = true;
|
|
|
}
|
|
|
|
|
|
d.forEach(function(r) {
|
|
|
if (r.reason === '其他' || r.reason === '其它') {
|
|
|
r.isOther = true;
|
|
|
}
|
|
|
})
|
|
|
|
|
|
reasons.push({
|
|
|
subReasons: d
|
|
|
});
|
...
|
...
|
|