Authored by 郝肖肖

修改订单,手机号不修改不校验

... ... @@ -45,8 +45,9 @@ const detail = (req, res, next) => {
const pageData = result[0];
const thumb = result[1];
if (_.has(pageData, 'orderDetail.orderCode')) {
pageData.orderDetail.orderCodeM = crypto.encryption(config.crypto.common, pageData.orderDetail.orderCode);
if (_.has(pageData, 'orderDetail.order_code')) {
pageData.orderDetail.orderCodeM =
crypto.encryption(config.crypto.common, (pageData.orderDetail.order_code).toString());
}
// 转译
... ... @@ -137,13 +138,21 @@ const getCancelOrderReason = (req, res, next) => {
const editOrder = (req, res, next) => {
const uid = req.user.uid;
const query = req.body;
const parameter = req.body;
query.uid = uid;
parameter.uid = uid;
parameter.orderCode = crypto.decrypt(config.crypto.common, parameter.orderCode);
if (!parameter.uid || !parameter.orderCode) {
res.json({
code: '401',
message: '请输入合法订单号'
});
} else {
orderModel.editOrder(query).then(result => {
orderModel.editOrder(parameter).then(result => {
res.json(result);
}).catch(next);
}
};
const reAdd = (req, res, next) => {
... ...
... ... @@ -26,7 +26,7 @@ $('.order .cancel-btn').on('click', function() {
$('.order .edit-btn').on('click', function() {
var $this = $(this);
var $userInfo = $('.user-info.info-box');
var code = $this.closest('.order').data('code');
var code = $this.closest('.order').data('codem');
var areaCode = $userInfo.data('area');
var userName = $userInfo.find('.user-name-sel').data('name');
... ...
... ... @@ -67,21 +67,16 @@ function getValidateKey(id) {
function validateData() {
var $inputs = $('.edit-dialog .input-row.necessary .validate');
var $phone = $('#user-phone');
var pass = true;
if (updateAddressMobile && updateAddressMobile !== '') {
validateMap.mobile.v = {
equal: updateAddressMobile,
errMsg: '您输入的联系电话格式不正确'
};
}
// 检查必填项
$inputs.each(function(idx, input) {
var k = getValidateKey(input.id);
if (k && validateMap[k]) {
if (!validate.start(validateMap[k].sl, validateMap[k].v)) {
if (k === 'mobile' && updateAddressMobile !== '' && updateAddressMobile === $(this).val()) {
return true;
} else if (!validate.start(validateMap[k].sl, validateMap[k].v)) {
pass = false;
}
}
... ... @@ -158,7 +153,6 @@ function editOrder(onEdit) {
phone: phone
};
$.ajax({
url: '/me/editOrder',
type: 'post',
... ... @@ -194,6 +188,7 @@ function showDiaglog(tpl, onEdit) {
btnClass: ['cancel-btn'],
name: '取消',
cb: function() {
updateAddressMobile = '';
tip.close();
}
}
... ... @@ -214,6 +209,8 @@ function showDiaglog(tpl, onEdit) {
validate.start(v.sl, v.v);
}
});
updateAddressMobile = $('#user-mobile').val();
}
function start(tplData, onEdit) {
... ...