Authored by 郭成尧

address-modify

... ... @@ -319,6 +319,29 @@ const getOrders = (params) => {
/* 是否是虚拟商品 */
let isTickets = order.virtual_type && parseInt(order.virtual_type, 10) === 3;
/* 修改地址按钮控制 */
let modifyAddress = {
modifyAddress: false,
modifyAddressUrl: ''
};
if (_.find(value.links, o => {
return o === 'modifyAddress';
})) {
modifyAddress.modifyAddress = true;
modifyAddress.modifyAddressUrl = helpers.urlFormat('/home/orders/addressModify', {
orderCode: value.order_code,
areaCode: _.get(value, 'delivery_address.area_code', '')
});
// 如果不允许修改省
if (value.is_support_change_province !== 'Y' &&
!_.get(value, 'delivery_address.province_area_code', false)) {
modifyAddress.modifyAddressUrl += '&provinceAreaCode=' +
_.get(value, 'delivery_address.province_area_code', '');
}
}
Object.assign(perOrder, {
orderNum: value.order_code,
orderStatus: value.status_str,
... ... @@ -327,7 +350,8 @@ const getOrders = (params) => {
detailUrl: helpers.urlFormat('/home/orderdetail', {order_code: value.order_code}),
count: value.buy_total,
isVirtual: isTickets,
isDepositAdvance: value.attribute * 1 === 9// 定金预售
isDepositAdvance: value.attribute * 1 === 9, // 定金预售
modifyAddress: modifyAddress
});
/* 如果运费大于0,会显示运费 */
... ...
... ... @@ -286,14 +286,18 @@ const orderDetailData = (uid, orderCode) => {
orderDetail = _.assign(orderDetail, {
goodsAmount: orderDetail.paymentAmount,
newUrl: '/home/orders/addressModify?orderCode=' + orderCode +
'&areaCode=' + orderDetail.areaCode,
url: '/home/addressModify?orderCode=' + orderCode +
'&areaCode=' + orderDetail.areaCode
newUrl: helpers.urlFormat('/home/orders/addressModify', {
orderCode: orderCode,
areaCode: orderDetail.areaCode
}),
url: helpers.urlFormat('/home/addressModify', {
orderCode: orderCode,
areaCode: orderDetail.areaCode
})
});
// 如果允许修改省
if (orderDetail.isSupportChangeProvince === 'Y' && orderDetail.provinceAreaCode) {
// 如果不允许修改省
if (orderDetail.isSupportChangeProvince !== 'Y' && orderDetail.provinceAreaCode) {
orderDetail.newUrl = orderDetail.newUrl + '&provinceAreaCode=' + orderDetail.provinceAreaCode;
}
... ...
... ... @@ -42,6 +42,13 @@
{{#if refundApply}}
<span class="btn refund">申请退款</span>
{{/if}}
{{!-- 修改地址 --}}
{{#if modifyAddress.modifyAddress}}
<a class="btn" href="{{modifyAddress.modifyAddressUrl}}">
<span>修改地址</span>
</a>
{{/if}}
</div>
{{/unless}}
{{/unless}}
... ...