Authored by zhangxiaoru

订单详情页地址修改

... ... @@ -166,7 +166,8 @@ exports.addressModify = (req, res, next) => {
navTitle: '选择地址',
navBtn: false
}),
title: '选择地址'
title: '选择地址',
pageFooter: true
};
addressModel.address({
... ... @@ -197,3 +198,28 @@ exports.locationList = (req, res, next) => {
res.render('address/location-list', Object.assign(result, {layout: false}));
}).catch(next);
};
/**
* 订单详情页修改地址
* @param req
* @param res
* @param next
*/
exports.chooseAddress = (req, res, next) => {
let uid = req.user.uid;
let orderCode = req.query.orderCode;
let addressId = decodeURIComponent(req.query.addressId);
if (!addressId || !orderCode) {
return res.json({
code: 400,
message: '缺失必填项',
data: ''
});
}
addressModel.chooseAddress(orderCode, addressId, uid).then(result => {
res.json(result);
}).catch(next);
};
... ...
... ... @@ -176,10 +176,26 @@ const locationList = (params) => {
});
};
/**
* 订单详情选择地址
* @param params
*/
const chooseAddress = (orderCode, addressId, uid) => {
return api.get('', {
method: 'app.SpaceOrders.updateDeliveryAddress',
uid: uid,
order_code: orderCode,
address_id: crypto.decrypt(null, addressId)
}).then((result) => {
return result;
});
};
module.exports = {
address,
saveAddress,
delAddress,
setDefaultAddress,
locationList
locationList,
chooseAddress
};
... ...
... ... @@ -44,6 +44,8 @@ router.post('/saveAddress', addressController.saveAddress); // 新增或者保
router.post('/defaultAddress', addressController.defaultAddress); // 设置默认地址
router.post('/delAddress', addressController.delAddress); // 删除地址
router.get('/locationList', auth, addressController.locationList); // 异步获取三级地址数据
router.get('/addressModify', auth, addressController.addressModify); // 订单详情地址列表
router.get('/chooseAddress', auth, addressController.chooseAddress); // 订单详情地址修改
/* 个人中心订单相关路由 */
router.get('/orders', auth, orderController.order); // 订单列表
... ... @@ -96,7 +98,6 @@ router.post('/pickCoupon', auth, message.pickCoupon);
router.get('/onlineservice', onlineService.getOnlineServiceInfo);
router.get('/onlineservicedetail', onlineService.getOnlineServiceDetail);
// 分期付款
router.get('/installment/index', installment.index); // 开通分期首页
router.get('/installment/review', installment.review); // 开通分期首页
... ...
<div class="my-address-page modify-address-page select-address-page yoho-page">
<div class="page-wrap clearfix modifyAdd" data-rel="{{relation}}" data-order-code="{{orderCode}}">
{{# address}}
<div class="address-item" data-address-id="{{address_id}}" >
<span class="name">{{consignee}}</span>
<span class="tel">{{mobile}}</span>
<p class="address-info">{{area}} {{address}}</p>
</div>
{{/ address}}
<a class="add-address" data-href="/home/addressAct?refer=modify">
添加新地址
</a>
<div class="confim-modify-mask hide">
<div class="confim-box">
<div class="content">
关联订单的收货地址将一起修改且不可修改第二次,请确认是否修改?
</div>
<div class="action">
<span class="cancel">
取消
</span>
<span class="confim buriedpoint">
确认
</span>
</div>
</div>
</div>
</div>
</div>
<div class="my-address-page modify-address-page select-address-page yoho-page">
<div class="page-wrap clearfix modifyAdd" data-rel="{{relation}}" data-order-code="{{orderCode}}">
{{# address}}
<div class="address-item" data-address-id="{{addressId}}" >
<span class="name">{{consignee}}</span>
<span class="tel">{{mobile}}</span>
<p class="address-info">{{area}} {{address}}</p>
</div>
{{/ address}}
<a class="add-address" data-href="/home/addressAct?refer=modify" href='/home/addressAct?refer=modify'>
添加新地址
</a>
<div class="confim-modify-mask hide">
<div class="confim-box">
<div class="modify-content">
关联订单的收货地址将一起修改且不可修改第二次,请确认是否修改?
</div>
<div class="action">
<span class="cancel">
取消
</span>
<span class="confim buriedpoint">
确认
</span>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -10,18 +10,25 @@ var $ = require('yoho-jquery'),
var $confimMod = $('.confim-modify-mask'),
$modifyAdd = $('.modifyAdd'),
orderCode = $modifyAdd.data('orderCode'),
$pageWrap = $('.page-wrap'),
$footer = $('#yoho-footer'),
selectId;
require('../common');
$pageWrap.first().css('min-height', function() {
return $(window).height() - $('#yoho-header').height() - $footer.height();
});
window.rePosFooter();
$('.address-item').on('touchend', function() {
selectId = $(this).data('addressId');
if ($modifyAdd.data('rel') === true) {
$confimMod.find('.content').text('关联订单的收货地址将会一起修改且不可修改第二次,请确认是否修改?');
$confimMod.find('.modify-content').text('关联订单的收货地址将会一起修改且不可修改第二次,请确认是否修改?');
$confimMod.fadeIn();
} else {
$confimMod.find('.content').text('收货地址仅且只能修改一次,请确认是否修改?');
$confimMod.find('.modify-content').text('收货地址仅且只能修改一次,请确认是否修改?');
$confimMod.fadeIn();
}
});
... ...
... ... @@ -23,7 +23,7 @@
font-weight: bold;
border-radius: 10px;
.content {
.modify-content {
text-align: left;
padding: 30px 20px;
line-height: 80px;
... ...