Authored by 郭成尧

address-modify

@@ -319,6 +319,29 @@ const getOrders = (params) => { @@ -319,6 +319,29 @@ const getOrders = (params) => {
319 /* 是否是虚拟商品 */ 319 /* 是否是虚拟商品 */
320 let isTickets = order.virtual_type && parseInt(order.virtual_type, 10) === 3; 320 let isTickets = order.virtual_type && parseInt(order.virtual_type, 10) === 3;
321 321
  322 + /* 修改地址按钮控制 */
  323 + let modifyAddress = {
  324 + modifyAddress: false,
  325 + modifyAddressUrl: ''
  326 + };
  327 +
  328 + if (_.find(value.links, o => {
  329 + return o === 'modifyAddress';
  330 + })) {
  331 + modifyAddress.modifyAddress = true;
  332 + modifyAddress.modifyAddressUrl = helpers.urlFormat('/home/orders/addressModify', {
  333 + orderCode: value.order_code,
  334 + areaCode: _.get(value, 'delivery_address.area_code', '')
  335 + });
  336 +
  337 + // 如果不允许修改省
  338 + if (value.is_support_change_province !== 'Y' &&
  339 + !_.get(value, 'delivery_address.province_area_code', false)) {
  340 + modifyAddress.modifyAddressUrl += '&provinceAreaCode=' +
  341 + _.get(value, 'delivery_address.province_area_code', '');
  342 + }
  343 + }
  344 +
322 Object.assign(perOrder, { 345 Object.assign(perOrder, {
323 orderNum: value.order_code, 346 orderNum: value.order_code,
324 orderStatus: value.status_str, 347 orderStatus: value.status_str,
@@ -327,7 +350,8 @@ const getOrders = (params) => { @@ -327,7 +350,8 @@ const getOrders = (params) => {
327 detailUrl: helpers.urlFormat('/home/orderdetail', {order_code: value.order_code}), 350 detailUrl: helpers.urlFormat('/home/orderdetail', {order_code: value.order_code}),
328 count: value.buy_total, 351 count: value.buy_total,
329 isVirtual: isTickets, 352 isVirtual: isTickets,
330 - isDepositAdvance: value.attribute * 1 === 9// 定金预售 353 + isDepositAdvance: value.attribute * 1 === 9, // 定金预售
  354 + modifyAddress: modifyAddress
331 }); 355 });
332 356
333 /* 如果运费大于0,会显示运费 */ 357 /* 如果运费大于0,会显示运费 */
@@ -286,14 +286,18 @@ const orderDetailData = (uid, orderCode) => { @@ -286,14 +286,18 @@ const orderDetailData = (uid, orderCode) => {
286 286
287 orderDetail = _.assign(orderDetail, { 287 orderDetail = _.assign(orderDetail, {
288 goodsAmount: orderDetail.paymentAmount, 288 goodsAmount: orderDetail.paymentAmount,
289 - newUrl: '/home/orders/addressModify?orderCode=' + orderCode +  
290 - '&areaCode=' + orderDetail.areaCode,  
291 - url: '/home/addressModify?orderCode=' + orderCode +  
292 - '&areaCode=' + orderDetail.areaCode 289 + newUrl: helpers.urlFormat('/home/orders/addressModify', {
  290 + orderCode: orderCode,
  291 + areaCode: orderDetail.areaCode
  292 + }),
  293 + url: helpers.urlFormat('/home/addressModify', {
  294 + orderCode: orderCode,
  295 + areaCode: orderDetail.areaCode
  296 + })
293 }); 297 });
294 298
295 - // 如果允许修改省  
296 - if (orderDetail.isSupportChangeProvince === 'Y' && orderDetail.provinceAreaCode) { 299 + // 如果不允许修改省
  300 + if (orderDetail.isSupportChangeProvince !== 'Y' && orderDetail.provinceAreaCode) {
297 orderDetail.newUrl = orderDetail.newUrl + '&provinceAreaCode=' + orderDetail.provinceAreaCode; 301 orderDetail.newUrl = orderDetail.newUrl + '&provinceAreaCode=' + orderDetail.provinceAreaCode;
298 } 302 }
299 303
@@ -42,6 +42,13 @@ @@ -42,6 +42,13 @@
42 {{#if refundApply}} 42 {{#if refundApply}}
43 <span class="btn refund">申请退款</span> 43 <span class="btn refund">申请退款</span>
44 {{/if}} 44 {{/if}}
  45 +
  46 + {{!-- 修改地址 --}}
  47 + {{#if modifyAddress.modifyAddress}}
  48 + <a class="btn" href="{{modifyAddress.modifyAddressUrl}}">
  49 + <span>修改地址</span>
  50 + </a>
  51 + {{/if}}
45 </div> 52 </div>
46 {{/unless}} 53 {{/unless}}
47 {{/unless}} 54 {{/unless}}