Authored by 郝肖肖

YH-5164

@@ -13,11 +13,13 @@ const _ = require('lodash'); @@ -13,11 +13,13 @@ const _ = require('lodash');
13 function tranformPayment(data, orderInfo) { 13 function tranformPayment(data, orderInfo) {
14 orderInfo = orderInfo || {}; 14 orderInfo = orderInfo || {};
15 let result = {}; 15 let result = {};
  16 + let isSunfengSupport;
16 17
17 // delivery_address 中 提取信息 18 // delivery_address 中 提取信息
18 if (data.hasOwnProperty('delivery_address') && !_.isEmpty(data.delivery_address)) { 19 if (data.hasOwnProperty('delivery_address') && !_.isEmpty(data.delivery_address)) {
19 let cookieAddress = orderInfo.address; 20 let cookieAddress = orderInfo.address;
20 let addressData = data.delivery_address; 21 let addressData = data.delivery_address;
  22 + let isSupport = cookieAddress ? cookieAddress.is_support : addressData.is_support;
21 23
22 result.name = cookieAddress ? cookieAddress.consignee : addressData.consignee; 24 result.name = cookieAddress ? cookieAddress.consignee : addressData.consignee;
23 result.phoneNum = cookieAddress ? cookieAddress.mobile : addressData.mobile; 25 result.phoneNum = cookieAddress ? cookieAddress.mobile : addressData.mobile;
@@ -25,18 +27,23 @@ function tranformPayment(data, orderInfo) { @@ -25,18 +27,23 @@ function tranformPayment(data, orderInfo) {
25 result.addressInfo = cookieAddress ? cookieAddress.address_info : [addressData.area, addressData.address].join(' '); 27 result.addressInfo = cookieAddress ? cookieAddress.address_info : [addressData.area, addressData.address].join(' ');
26 28
27 result.addressId = crypto.encryption(null, result.addressId + ''); 29 result.addressId = crypto.encryption(null, result.addressId + '');
  30 + isSunfengSupport = isSupport === 'Y';
  31 +
28 } 32 }
29 33
30 // delivery_way 配送信息 34 // delivery_way 配送信息
31 if (data.delivery_way) { 35 if (data.delivery_way) {
  36 + let arr = [];
32 let cookieWayId = orderInfo.deliveryId; 37 let cookieWayId = orderInfo.deliveryId;
33 let deliveryWay = data.delivery_way; 38 let deliveryWay = data.delivery_way;
34 let isDeliveryId = true; 39 let isDeliveryId = true;
35 let defaultKey = 0; 40 let defaultKey = 0;
36 41
37 - deliveryWay = deliveryWay  
38 - .filter(obj => obj.is_support === 'Y')  
39 - .map((way, index) => { 42 + deliveryWay.forEach((way, index) => {
  43 + if (way.delivery_way_name === '顺丰速运' && !isSunfengSupport) {
  44 + return;
  45 + }
  46 +
40 let obj = {}; 47 let obj = {};
41 48
42 (way.default === 'Y') && (defaultKey = index); 49 (way.default === 'Y') && (defaultKey = index);
@@ -46,18 +53,20 @@ function tranformPayment(data, orderInfo) { @@ -46,18 +53,20 @@ function tranformPayment(data, orderInfo) {
46 isDeliveryId = false; 53 isDeliveryId = false;
47 } 54 }
48 55
49 - return Object.assign({  
50 - id: way.delivery_way_id,  
51 - name: way.delivery_way_name,  
52 - cost: way.delivery_way_cost,  
53 - }, obj); 56 + arr.push(
  57 + Object.assign({
  58 + id: way.delivery_way_id,
  59 + name: way.delivery_way_name,
  60 + cost: way.delivery_way_cost,
  61 + }, obj)
  62 + );
54 }); 63 });
55 64
56 if (isDeliveryId) { 65 if (isDeliveryId) {
57 - deliveryWay[defaultKey].isSelected = true; 66 + arr[defaultKey].isSelected = true;
58 } 67 }
59 68
60 - result.dispatchMode = deliveryWay; 69 + result.dispatchMode = arr;
61 } 70 }
62 71
63 // delivery_time 配送时间 72 // delivery_time 配送时间