Showing
1 changed file
with
20 additions
and
7 deletions
@@ -53,7 +53,10 @@ class BuyNowController { | @@ -53,7 +53,10 @@ class BuyNowController { | ||
53 | } | 53 | } |
54 | 54 | ||
55 | co(function * () { | 55 | co(function * () { |
56 | - let [result, computeData, validCouponCount, validGiftCardCount] = yield Promise.all([ | 56 | + let [userProfile, address, result, computeData, validCouponCount, validGiftCardCount] = |
57 | + yield Promise.all([ | ||
58 | + userModel.queryProfile(uid), | ||
59 | + addressModel.addressData(uid), | ||
57 | req.ctx(BuyNowModel).payment({ | 60 | req.ctx(BuyNowModel).payment({ |
58 | uid: uid, | 61 | uid: uid, |
59 | product_sku: product_sku, | 62 | product_sku: product_sku, |
@@ -82,9 +85,16 @@ class BuyNowController { | @@ -82,9 +85,16 @@ class BuyNowController { | ||
82 | shoppingAPI.countUsableGiftCard(uid) // 可用礼品卡数量 | 85 | shoppingAPI.countUsableGiftCard(uid) // 可用礼品卡数量 |
83 | ]); | 86 | ]); |
84 | 87 | ||
85 | - let headerData = headerModel.setNav({ | ||
86 | - navTitle: '确认订单', | ||
87 | - navBtn: false | 88 | + // 获取用户完整手机号 |
89 | + let mobile = _.get(userProfile, 'data.mobile', ''); | ||
90 | + let orderAddress = _.get(result, 'address', []); | ||
91 | + let addressList = _.get(address, 'data', []); | ||
92 | + | ||
93 | + orderAddress.length && _.forEach(addressList, address => { //eslint-disable-line | ||
94 | + if (address.address_id === orderAddress.address_id) { | ||
95 | + mobile = address.mobile; | ||
96 | + return false; | ||
97 | + } | ||
88 | }); | 98 | }); |
89 | 99 | ||
90 | // 兼容原有的数据格式 | 100 | // 兼容原有的数据格式 |
@@ -95,7 +105,7 @@ class BuyNowController { | @@ -95,7 +105,7 @@ class BuyNowController { | ||
95 | orderInfo.paymentType = orderInfo.payment_type; | 105 | orderInfo.paymentType = orderInfo.payment_type; |
96 | 106 | ||
97 | let orderEnsure = _.assign( | 107 | let orderEnsure = _.assign( |
98 | - paymentProcess.tranformPayment(result.data, orderInfo, null, null, computeData.data), | 108 | + paymentProcess.tranformPayment(_.get(result, 'data', {}), orderInfo, null, null, computeData.data), |
99 | { | 109 | { |
100 | coupon: paymentProcess.coupon( | 110 | coupon: paymentProcess.coupon( |
101 | _.get(validCouponCount, 'data.count', 0), | 111 | _.get(validCouponCount, 'data.count', 0), |
@@ -120,7 +130,10 @@ class BuyNowController { | @@ -120,7 +130,10 @@ class BuyNowController { | ||
120 | ); | 130 | ); |
121 | 131 | ||
122 | return res.render('buynow/order-ensure', { | 132 | return res.render('buynow/order-ensure', { |
123 | - pageHeader: headerData, | 133 | + pageHeader: headerModel.setNav({ |
134 | + navTitle: '确认订单', | ||
135 | + navBtn: false | ||
136 | + }), | ||
124 | module: 'cart', | 137 | module: 'cart', |
125 | page: 'buynow-order-ensure', | 138 | page: 'buynow-order-ensure', |
126 | title: '确认订单', | 139 | title: '确认订单', |
@@ -128,7 +141,7 @@ class BuyNowController { | @@ -128,7 +141,7 @@ class BuyNowController { | ||
128 | localCss: true, | 141 | localCss: true, |
129 | product_sku: product_sku, | 142 | product_sku: product_sku, |
130 | orderEnsure: orderEnsure, | 143 | orderEnsure: orderEnsure, |
131 | - userMobile: _.get(orderEnsure, 'phoneNum', '') | 144 | + userMobile: mobile |
132 | }); | 145 | }); |
133 | 146 | ||
134 | })().catch(next); | 147 | })().catch(next); |
-
Please register or login to post a comment