Showing
6 changed files
with
29 additions
and
11 deletions
@@ -60,7 +60,17 @@ const modifyAddress = (req, res, next) => { | @@ -60,7 +60,17 @@ const modifyAddress = (req, res, next) => { | ||
60 | let mobile = req.body.mobile || ''; // 手机号码 | 60 | let mobile = req.body.mobile || ''; // 手机号码 |
61 | let phoneNum = req.body.phoneNum || ''; // 固定电话 | 61 | let phoneNum = req.body.phoneNum || ''; // 固定电话 |
62 | let phoneCode = req.body.phoneCode || ''; // 电话编号 | 62 | let phoneCode = req.body.phoneCode || ''; // 电话编号 |
63 | - let phone = phoneNum ? `${phoneCode}-${phoneNum}` : ''; | 63 | + let phone = (function() { |
64 | + if (phoneNum) { | ||
65 | + if (phoneCode) { | ||
66 | + return `${phoneCode}-${phoneNum}`; | ||
67 | + } else { | ||
68 | + return phoneNum; | ||
69 | + } | ||
70 | + } else { | ||
71 | + return ''; | ||
72 | + } | ||
73 | + }()); | ||
64 | 74 | ||
65 | if (!orderId || !userName || !areaCode || !address) { | 75 | if (!orderId || !userName || !areaCode || !address) { |
66 | return res.json({ | 76 | return res.json({ |
@@ -158,13 +158,17 @@ exports.updateDeliveryAddress = (orderId, userName, areaCode, address, mobile, p | @@ -158,13 +158,17 @@ exports.updateDeliveryAddress = (orderId, userName, areaCode, address, mobile, p | ||
158 | user_name: userName, | 158 | user_name: userName, |
159 | area_code: areaCode, | 159 | area_code: areaCode, |
160 | address: address, | 160 | address: address, |
161 | - mobile: mobile, | ||
162 | uid: uid | 161 | uid: uid |
163 | }; | 162 | }; |
164 | 163 | ||
164 | + if (mobile) { | ||
165 | + Object.assign(options, {mobile: mobile}); | ||
166 | + } | ||
167 | + | ||
165 | if (phone) { | 168 | if (phone) { |
166 | Object.assign(options, {phone: phone}); | 169 | Object.assign(options, {phone: phone}); |
167 | } | 170 | } |
171 | + | ||
168 | return api.get('', options); | 172 | return api.get('', options); |
169 | }; | 173 | }; |
170 | 174 |
@@ -78,7 +78,7 @@ const ORDER_OP_ALL = [ | @@ -78,7 +78,7 @@ const ORDER_OP_ALL = [ | ||
78 | type: 'exchange', | 78 | type: 'exchange', |
79 | name: '申请换货', | 79 | name: '申请换货', |
80 | optDis: true, | 80 | optDis: true, |
81 | - hrefFun: it => helpers.urlFormat('/home/returns/exchangeRequest', {orderCode: it}) | 81 | + hrefFun: it => helpers.urlFormat('/home/returns/exchangerequest', {orderCode: it}) |
82 | }, | 82 | }, |
83 | { | 83 | { |
84 | type: 'refund', | 84 | type: 'refund', |
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | {{#unless virtualGoods}} | 20 | {{#unless virtualGoods}} |
21 | <!--虚拟商品--> | 21 | <!--虚拟商品--> |
22 | {{#if changeable}} | 22 | {{#if changeable}} |
23 | - <span class="edit-order oo-btn">修改订单</span> | 23 | + <span class="edit-order oo-btn">修改地址</span> |
24 | {{/if}} | 24 | {{/if}} |
25 | {{/unless}} | 25 | {{/unless}} |
26 | {{#if operation.cancelOrder}} | 26 | {{#if operation.cancelOrder}} |
1 | <script id="edit-dialog-tpl" type="text/html"> | 1 | <script id="edit-dialog-tpl" type="text/html"> |
2 | - <header>订单修改</header> | 2 | + <header>修改地址</header> |
3 | <p class="tip">修改收货信息:</p> | 3 | <p class="tip">修改收货信息:</p> |
4 | <ul class="edit-order-info"> | 4 | <ul class="edit-order-info"> |
5 | <li> | 5 | <li> |
@@ -27,6 +27,7 @@ | @@ -27,6 +27,7 @@ | ||
27 | <li> | 27 | <li> |
28 | <label><i class="form-required">*</i>手机号码:</label> | 28 | <label><i class="form-required">*</i>手机号码:</label> |
29 | <input type="text" class="inp" placeholder="请输入手机号码(重要必填)" name="phone" maxlength="11" value="{{editInfo.mobile}}"> | 29 | <input type="text" class="inp" placeholder="请输入手机号码(重要必填)" name="phone" maxlength="11" value="{{editInfo.mobile}}"> |
30 | + <input type="hidden" class="origin-user-mobile" value="{{editInfo.mobile}}"> | ||
30 | <span class="error"><i class="order-icon icon-error"></i><b>请输入手机号码(重要必填)</b></span> | 31 | <span class="error"><i class="order-icon icon-error"></i><b>请输入手机号码(重要必填)</b></span> |
31 | </li> | 32 | </li> |
32 | <li> | 33 | <li> |
@@ -357,6 +357,11 @@ function validateForm() { | @@ -357,6 +357,11 @@ function validateForm() { | ||
357 | }, | 357 | }, |
358 | mobile: function(phone) { | 358 | mobile: function(phone) { |
359 | var message = ''; | 359 | var message = ''; |
360 | + var originMobile = $('.origin-user-mobile').val(); | ||
361 | + | ||
362 | + if (originMobile === phone) { | ||
363 | + return true; | ||
364 | + } | ||
360 | 365 | ||
361 | if (!phoneReg.test(phone)) { | 366 | if (!phoneReg.test(phone)) { |
362 | message = '手机号码不能为空'; | 367 | message = '手机号码不能为空'; |
@@ -404,12 +409,6 @@ function saveAddress(id) { | @@ -404,12 +409,6 @@ function saveAddress(id) { | ||
404 | telCode = $telCode.val(), | 409 | telCode = $telCode.val(), |
405 | tel = $tel.val(); | 410 | tel = $tel.val(); |
406 | 411 | ||
407 | - // var $err_name = $name.siblings('.error'), | ||
408 | - // $err_province = $province.siblings('.error'), | ||
409 | - // $err_address = $address.siblings('.error'), | ||
410 | - // $err_phone = $phone.siblings('.error'), | ||
411 | - // $err_tel = $tel.siblings('.error'); | ||
412 | - | ||
413 | var postData = { | 412 | var postData = { |
414 | orderCode: id, | 413 | orderCode: id, |
415 | userName: name, | 414 | userName: name, |
@@ -429,6 +428,10 @@ function saveAddress(id) { | @@ -429,6 +428,10 @@ function saveAddress(id) { | ||
429 | return; | 428 | return; |
430 | } | 429 | } |
431 | 430 | ||
431 | + if (postData.mobile === $('.origin-user-mobile').val()) { | ||
432 | + delete postData.mobile; | ||
433 | + } | ||
434 | + | ||
432 | $.ajax({ | 435 | $.ajax({ |
433 | type: 'post', | 436 | type: 'post', |
434 | url: '/home/orders/modifyAddress', | 437 | url: '/home/orders/modifyAddress', |
-
Please register or login to post a comment