Authored by zhangxiaoru

订单详情页地址修改

@@ -166,7 +166,8 @@ exports.addressModify = (req, res, next) => { @@ -166,7 +166,8 @@ exports.addressModify = (req, res, next) => {
166 navTitle: '选择地址', 166 navTitle: '选择地址',
167 navBtn: false 167 navBtn: false
168 }), 168 }),
169 - title: '选择地址' 169 + title: '选择地址',
  170 + pageFooter: true
170 }; 171 };
171 172
172 addressModel.address({ 173 addressModel.address({
@@ -197,3 +198,28 @@ exports.locationList = (req, res, next) => { @@ -197,3 +198,28 @@ exports.locationList = (req, res, next) => {
197 res.render('address/location-list', Object.assign(result, {layout: false})); 198 res.render('address/location-list', Object.assign(result, {layout: false}));
198 }).catch(next); 199 }).catch(next);
199 }; 200 };
  201 +
  202 +/**
  203 + * 订单详情页修改地址
  204 + * @param req
  205 + * @param res
  206 + * @param next
  207 + */
  208 +exports.chooseAddress = (req, res, next) => {
  209 + let uid = req.user.uid;
  210 + let orderCode = req.query.orderCode;
  211 + let addressId = decodeURIComponent(req.query.addressId);
  212 +
  213 + if (!addressId || !orderCode) {
  214 + return res.json({
  215 + code: 400,
  216 + message: '缺失必填项',
  217 + data: ''
  218 + });
  219 + }
  220 +
  221 + addressModel.chooseAddress(orderCode, addressId, uid).then(result => {
  222 + res.json(result);
  223 + }).catch(next);
  224 +};
  225 +
@@ -176,10 +176,26 @@ const locationList = (params) => { @@ -176,10 +176,26 @@ const locationList = (params) => {
176 }); 176 });
177 }; 177 };
178 178
  179 +/**
  180 + * 订单详情选择地址
  181 + * @param params
  182 + */
  183 +const chooseAddress = (orderCode, addressId, uid) => {
  184 + return api.get('', {
  185 + method: 'app.SpaceOrders.updateDeliveryAddress',
  186 + uid: uid,
  187 + order_code: orderCode,
  188 + address_id: crypto.decrypt(null, addressId)
  189 + }).then((result) => {
  190 + return result;
  191 + });
  192 +};
  193 +
179 module.exports = { 194 module.exports = {
180 address, 195 address,
181 saveAddress, 196 saveAddress,
182 delAddress, 197 delAddress,
183 setDefaultAddress, 198 setDefaultAddress,
184 - locationList 199 + locationList,
  200 + chooseAddress
185 }; 201 };
@@ -44,6 +44,8 @@ router.post('/saveAddress', addressController.saveAddress); // 新增或者保 @@ -44,6 +44,8 @@ router.post('/saveAddress', addressController.saveAddress); // 新增或者保
44 router.post('/defaultAddress', addressController.defaultAddress); // 设置默认地址 44 router.post('/defaultAddress', addressController.defaultAddress); // 设置默认地址
45 router.post('/delAddress', addressController.delAddress); // 删除地址 45 router.post('/delAddress', addressController.delAddress); // 删除地址
46 router.get('/locationList', auth, addressController.locationList); // 异步获取三级地址数据 46 router.get('/locationList', auth, addressController.locationList); // 异步获取三级地址数据
  47 +router.get('/addressModify', auth, addressController.addressModify); // 订单详情地址列表
  48 +router.get('/chooseAddress', auth, addressController.chooseAddress); // 订单详情地址修改
47 49
48 /* 个人中心订单相关路由 */ 50 /* 个人中心订单相关路由 */
49 router.get('/orders', auth, orderController.order); // 订单列表 51 router.get('/orders', auth, orderController.order); // 订单列表
@@ -96,7 +98,6 @@ router.post('/pickCoupon', auth, message.pickCoupon); @@ -96,7 +98,6 @@ router.post('/pickCoupon', auth, message.pickCoupon);
96 router.get('/onlineservice', onlineService.getOnlineServiceInfo); 98 router.get('/onlineservice', onlineService.getOnlineServiceInfo);
97 router.get('/onlineservicedetail', onlineService.getOnlineServiceDetail); 99 router.get('/onlineservicedetail', onlineService.getOnlineServiceDetail);
98 100
99 -  
100 // 分期付款 101 // 分期付款
101 router.get('/installment/index', installment.index); // 开通分期首页 102 router.get('/installment/index', installment.index); // 开通分期首页
102 router.get('/installment/review', installment.review); // 开通分期首页 103 router.get('/installment/review', installment.review); // 开通分期首页
1 -<div class="my-address-page modify-address-page select-address-page yoho-page">  
2 - <div class="page-wrap clearfix modifyAdd" data-rel="{{relation}}" data-order-code="{{orderCode}}">  
3 - {{# address}}  
4 - <div class="address-item" data-address-id="{{address_id}}" >  
5 - <span class="name">{{consignee}}</span>  
6 - <span class="tel">{{mobile}}</span>  
7 - <p class="address-info">{{area}} {{address}}</p>  
8 - </div>  
9 - {{/ address}}  
10 -  
11 - <a class="add-address" data-href="/home/addressAct?refer=modify">  
12 - 添加新地址  
13 - </a>  
14 -  
15 - <div class="confim-modify-mask hide">  
16 - <div class="confim-box">  
17 - <div class="content">  
18 - 关联订单的收货地址将一起修改且不可修改第二次,请确认是否修改?  
19 - </div>  
20 - <div class="action">  
21 - <span class="cancel">  
22 - 取消  
23 - </span>  
24 - <span class="confim buriedpoint">  
25 - 确认  
26 - </span>  
27 - </div>  
28 - </div>  
29 - </div>  
30 - </div>  
31 -</div> 1 +<div class="my-address-page modify-address-page select-address-page yoho-page">
  2 + <div class="page-wrap clearfix modifyAdd" data-rel="{{relation}}" data-order-code="{{orderCode}}">
  3 + {{# address}}
  4 + <div class="address-item" data-address-id="{{addressId}}" >
  5 + <span class="name">{{consignee}}</span>
  6 + <span class="tel">{{mobile}}</span>
  7 + <p class="address-info">{{area}} {{address}}</p>
  8 + </div>
  9 + {{/ address}}
  10 +
  11 + <a class="add-address" data-href="/home/addressAct?refer=modify" href='/home/addressAct?refer=modify'>
  12 + 添加新地址
  13 + </a>
  14 +
  15 + <div class="confim-modify-mask hide">
  16 + <div class="confim-box">
  17 + <div class="modify-content">
  18 + 关联订单的收货地址将一起修改且不可修改第二次,请确认是否修改?
  19 + </div>
  20 + <div class="action">
  21 + <span class="cancel">
  22 + 取消
  23 + </span>
  24 + <span class="confim buriedpoint">
  25 + 确认
  26 + </span>
  27 + </div>
  28 + </div>
  29 + </div>
  30 + </div>
  31 +</div>
@@ -10,18 +10,25 @@ var $ = require('yoho-jquery'), @@ -10,18 +10,25 @@ var $ = require('yoho-jquery'),
10 var $confimMod = $('.confim-modify-mask'), 10 var $confimMod = $('.confim-modify-mask'),
11 $modifyAdd = $('.modifyAdd'), 11 $modifyAdd = $('.modifyAdd'),
12 orderCode = $modifyAdd.data('orderCode'), 12 orderCode = $modifyAdd.data('orderCode'),
  13 + $pageWrap = $('.page-wrap'),
  14 + $footer = $('#yoho-footer'),
13 selectId; 15 selectId;
14 16
15 require('../common'); 17 require('../common');
16 18
  19 +$pageWrap.first().css('min-height', function() {
  20 + return $(window).height() - $('#yoho-header').height() - $footer.height();
  21 +});
  22 +window.rePosFooter();
  23 +
17 $('.address-item').on('touchend', function() { 24 $('.address-item').on('touchend', function() {
18 selectId = $(this).data('addressId'); 25 selectId = $(this).data('addressId');
19 26
20 if ($modifyAdd.data('rel') === true) { 27 if ($modifyAdd.data('rel') === true) {
21 - $confimMod.find('.content').text('关联订单的收货地址将会一起修改且不可修改第二次,请确认是否修改?'); 28 + $confimMod.find('.modify-content').text('关联订单的收货地址将会一起修改且不可修改第二次,请确认是否修改?');
22 $confimMod.fadeIn(); 29 $confimMod.fadeIn();
23 } else { 30 } else {
24 - $confimMod.find('.content').text('收货地址仅且只能修改一次,请确认是否修改?'); 31 + $confimMod.find('.modify-content').text('收货地址仅且只能修改一次,请确认是否修改?');
25 $confimMod.fadeIn(); 32 $confimMod.fadeIn();
26 } 33 }
27 }); 34 });
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 font-weight: bold; 23 font-weight: bold;
24 border-radius: 10px; 24 border-radius: 10px;
25 25
26 - .content { 26 + .modify-content {
27 text-align: left; 27 text-align: left;
28 padding: 30px 20px; 28 padding: 30px 20px;
29 line-height: 80px; 29 line-height: 80px;