Authored by 郝肖肖

中人中心,修改订单改成post OK

... ... @@ -137,10 +137,9 @@ const getCancelOrderReason = (req, res, next) => {
const editOrder = (req, res, next) => {
const uid = req.user.uid;
const query = req.query;
const query = req.body;
query.uid = uid;
query.orderCode = crypto.decrypt(config.crypto.common, query.orderCode);
orderModel.editOrder(query).then(result => {
res.json(result);
... ...
... ... @@ -6,7 +6,7 @@
'use strict';
const router = require('express').Router(); // eslint-disable-line
const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const auth = require(`${global.middleware}/auth`);
const csurf = require('csurf');
... ... @@ -31,7 +31,7 @@ router.get('/deleteOrder', order.deleteOrder);
router.get('/cancelOrder', order.cancelOrder);
router.get('/getCancelOrderReason', order.getCancelOrderReason);
router.get('/getExpressInfo', order.getExpressInfo);
router.get('/editOrder', order.editOrder);
router.post('/editOrder', order.editOrder);
router.get('/reAdd', order.reAdd);
router.get('/confirmReceive', order.confirmReceive);
... ...
... ... @@ -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('codem');
var code = $this.closest('.order').data('code');
var areaCode = $userInfo.data('area');
var userName = $userInfo.find('.user-name-sel').data('name');
... ... @@ -64,6 +64,7 @@ if ($('.left-time').length) {
}
$('body').on('click', function(e) {
if ($(e.target).hasClass('show-package')) {
return false;
}
... ...
... ... @@ -8,6 +8,7 @@ var validate = require('./validation');
var addressReg = /^[\s\S]{2,100}$/;
var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
var updateAddressMobile = '';
var validateMap = {
name: {
... ... @@ -68,6 +69,12 @@ function validateData() {
var $phone = $('#user-phone');
var pass = true;
if (updateAddressMobile && updateAddressMobile !== '') {
validateMap.mobile.v = {
equal: updateAddressMobile,
errMsg: '您输入的联系电话格式不正确'
};
}
// 检查必填项
$inputs.each(function(idx, input) {
... ... @@ -154,6 +161,7 @@ function editOrder(onEdit) {
$.ajax({
url: '/me/editOrder',
type: 'post',
data: d
}).done(function(result) {
if (result.code === 200) {
... ...
... ... @@ -21,6 +21,9 @@ var makeValidate = {
addr: function(val) {
// 完整的地址应该是长度为三的数组
return val.split(',').length === 3;
},
equal: function(val, val2) {
return val === val2;
}
};
... ...
... ... @@ -20,6 +20,7 @@ var detailErr = '2-100字符。1个中文为2个字符';
var addressDialogTpl;
var addressTpl;
var updateAddressMobile = '';
require('yoho-jquery-placeholder');
require('yoho-jquery-dotdotdot');
... ... @@ -97,7 +98,11 @@ function validateAddress($el, isUpdate) {
field.mobile.push({
regx: /^\d{3}(\d|\*){4}\d{4}$/, // 验证正常数字或者****
err: '手机号码格式不正确'
});
},
{
equal: true,
err: '手机号码格式不正确'
});
} else {
field.mobile.push({
regx: /^\d{11}$/,
... ... @@ -115,7 +120,7 @@ function validateAddress($el, isUpdate) {
vaRegx = field[key][vaKey];
// 非空验证、非空下正则验证、其他正则验证
if ((vaRegx.noEmpty && cur === '') || (vaRegx.regx &&
if ((vaRegx.equal && updateAddressMobile !== cur) || (vaRegx.noEmpty && cur === '') || (vaRegx.regx &&
(vaRegx.skipWhenEmpty ? !(cur === '' || vaRegx.regx.test(cur)) : !vaRegx.regx.test(cur))
)) {
pass = false;
... ... @@ -193,7 +198,7 @@ function addressDialogFactory(opt, $the) {
address: detail,
mobile: mobile,
phone: phone,
'area_code': areaCode // eslint-disable-line
'area_code': areaCode // eslint-disable-line
}
}).then(function(data) {
var updated;
... ... @@ -204,7 +209,7 @@ function addressDialogFactory(opt, $the) {
address: detail,
mobile: mobile.replace(/^(\d{3}).*(\d{4})$/, '$1****$2'),
phone: phone,
area_code: data.data.area_code, // eslint-disable-line
area_code: data.data.area_code, // eslint-disable-line
address_id: opt.id,
focus: $the.hasClass('focus'),
area: $el.address.getAreaLabels().replace(/,/g, ' '),
... ... @@ -237,7 +242,7 @@ function addressDialogFactory(opt, $the) {
address: detail,
mobile: mobile,
phone: phone,
'area_code': areaCode, // eslint-disable-line
'area_code': areaCode, // eslint-disable-line
init: opt.init
}
}).then(function(data) {
... ... @@ -280,6 +285,7 @@ function addressDialogFactory(opt, $the) {
]
});
updateAddressMobile = opt.mobile || '';
return address;
}
... ...