Authored by htoooth

fix order address

... ... @@ -60,7 +60,17 @@ const modifyAddress = (req, res, next) => {
let mobile = req.body.mobile || ''; // 手机号码
let phoneNum = req.body.phoneNum || ''; // 固定电话
let phoneCode = req.body.phoneCode || ''; // 电话编号
let phone = phoneNum ? `${phoneCode}-${phoneNum}` : '';
let phone = (function() {
if (phoneNum) {
if (phoneCode) {
return `${phoneCode}-${phoneNum}`;
} else {
return phoneNum;
}
} else {
return '';
}
}());
if (!orderId || !userName || !areaCode || !address) {
return res.json({
... ...
... ... @@ -158,13 +158,17 @@ exports.updateDeliveryAddress = (orderId, userName, areaCode, address, mobile, p
user_name: userName,
area_code: areaCode,
address: address,
mobile: mobile,
uid: uid
};
if (mobile) {
Object.assign(options, {mobile: mobile});
}
if (phone) {
Object.assign(options, {phone: phone});
}
return api.get('', options);
};
... ...
... ... @@ -78,7 +78,7 @@ const ORDER_OP_ALL = [
type: 'exchange',
name: '申请换货',
optDis: true,
hrefFun: it => helpers.urlFormat('/home/returns/exchangeRequest', {orderCode: it})
hrefFun: it => helpers.urlFormat('/home/returns/exchangerequest', {orderCode: it})
},
{
type: 'refund',
... ...
... ... @@ -20,7 +20,7 @@
{{#unless virtualGoods}}
<!--虚拟商品-->
{{#if changeable}}
<span class="edit-order oo-btn">修改订单</span>
<span class="edit-order oo-btn">修改地址</span>
{{/if}}
{{/unless}}
{{#if operation.cancelOrder}}
... ...
<script id="edit-dialog-tpl" type="text/html">
<header>订单修改</header>
<header>修改地址</header>
<p class="tip">修改收货信息:</p>
<ul class="edit-order-info">
<li>
... ... @@ -27,6 +27,7 @@
<li>
<label><i class="form-required">*</i>手机号码:</label>
<input type="text" class="inp" placeholder="请输入手机号码(重要必填)" name="phone" maxlength="11" value="{{editInfo.mobile}}">
<input type="hidden" class="origin-user-mobile" value="{{editInfo.mobile}}">
<span class="error"><i class="order-icon icon-error"></i><b>请输入手机号码(重要必填)</b></span>
</li>
<li>
... ...
... ... @@ -357,6 +357,11 @@ function validateForm() {
},
mobile: function(phone) {
var message = '';
var originMobile = $('.origin-user-mobile').val();
if (originMobile === phone) {
return true;
}
if (!phoneReg.test(phone)) {
message = '手机号码不能为空';
... ... @@ -404,12 +409,6 @@ function saveAddress(id) {
telCode = $telCode.val(),
tel = $tel.val();
// var $err_name = $name.siblings('.error'),
// $err_province = $province.siblings('.error'),
// $err_address = $address.siblings('.error'),
// $err_phone = $phone.siblings('.error'),
// $err_tel = $tel.siblings('.error');
var postData = {
orderCode: id,
userName: name,
... ... @@ -429,6 +428,10 @@ function saveAddress(id) {
return;
}
if (postData.mobile === $('.origin-user-mobile').val()) {
delete postData.mobile;
}
$.ajax({
type: 'post',
url: '/home/orders/modifyAddress',
... ...