Merge branch 'feature/cart' into 'release/5.4.1'
代码格式化,JSON字符串处理 See merge request !287
Showing
4 changed files
with
34 additions
and
35 deletions
@@ -131,13 +131,15 @@ exports.orderCompute = (req, res, next) => { | @@ -131,13 +131,15 @@ exports.orderCompute = (req, res, next) => { | ||
131 | if (req.body.cartType === 'bundle') { | 131 | if (req.body.cartType === 'bundle') { |
132 | let activityInfo = JSON.parse(req.cookies['activity-info']); | 132 | let activityInfo = JSON.parse(req.cookies['activity-info']); |
133 | 133 | ||
134 | - cartModel.orderCompute(uid, cartType, deliveryId, paymentType, couponCode, yohoCoin, null, activityInfo).then(result => { | ||
135 | - res.json(result); | ||
136 | - }).catch(next); | 134 | + cartModel.orderCompute(uid, cartType, deliveryId, paymentType, |
135 | + couponCode, yohoCoin, null, activityInfo).then(result => { | ||
136 | + res.json(result); | ||
137 | + }).catch(next); | ||
137 | } else { | 138 | } else { |
138 | - cartModel.orderCompute(uid, cartType, deliveryId, paymentType, couponCode, yohoCoin, skuList).then(result => { | ||
139 | - res.json(result); | ||
140 | - }).catch(next); | 139 | + cartModel.orderCompute(uid, cartType, deliveryId, paymentType, |
140 | + couponCode, yohoCoin, skuList).then(result => { | ||
141 | + res.json(result); | ||
142 | + }).catch(next); | ||
141 | } | 143 | } |
142 | } else { | 144 | } else { |
143 | cartModel.ticketsOrderCompute(uid, productSku, buyNumber, yohoCoin).then(result => { | 145 | cartModel.ticketsOrderCompute(uid, productSku, buyNumber, yohoCoin).then(result => { |
@@ -190,11 +192,6 @@ exports.orderSub = (req, res, next) => { | @@ -190,11 +192,6 @@ exports.orderSub = (req, res, next) => { | ||
190 | let unionInfo = {}; | 192 | let unionInfo = {}; |
191 | 193 | ||
192 | if (req.cookies.mkt_code || req.cookies._QYH_UNION) { | 194 | if (req.cookies.mkt_code || req.cookies._QYH_UNION) { |
193 | - /* | ||
194 | - *1、http://union.yohobuy.com/go?client_id=3415&aid=0118&channel=3415&cid=3601&wi=NDgwMDB8dGVzdA==&target=http://m.yohobuy.com/ | ||
195 | - *2、http://union.yoho.cn/union/jump?channel_id=51fanli&u_id=6&tracking_code=fanli123&target_url=http%3a%2f%2fm.yohobuy.com%3funion_type%3d3063%26utm_source%3dmfanli%26utm_medium%3dcps%26utm_campaign%3dmpfanli | ||
196 | - *3、union.yohobuy.com/go/proxy?utm_medium=none&utm_campaign=none&client_id=991002&ads_code=&go_url=https%253A%252F%252Fm.yohobuy.com%252F%253Futm_source%253Dhyyx%2526utm_medium%253Dnone%2526utm_campaign%253Dnone%2526union_type%253D991002&channel_code=hyyx&append=&mbr_name=&u_id=&aid=&channel=cps&cid=&wi= | ||
197 | - **/ | ||
198 | /* tar modified 161108 添加新的联盟数据处理逻辑,兼容原有联盟数据处理, | 195 | /* tar modified 161108 添加新的联盟数据处理逻辑,兼容原有联盟数据处理, |
199 | 区别是旧的北京写 cookie 加密过来,新的 node 写 cookie,没有加密 */ | 196 | 区别是旧的北京写 cookie 加密过来,新的 node 写 cookie,没有加密 */ |
200 | if (req.cookies._QYH_UNION) { | 197 | if (req.cookies._QYH_UNION) { |
@@ -239,7 +236,8 @@ exports.orderSub = (req, res, next) => { | @@ -239,7 +236,8 @@ exports.orderSub = (req, res, next) => { | ||
239 | if (unionInfo && result.data) { | 236 | if (unionInfo && result.data) { |
240 | result.data.unionCookie = unionInfo; | 237 | result.data.unionCookie = unionInfo; |
241 | } else { | 238 | } else { |
242 | - logger.info(`orderEnsure: unionInfo:${JSON.stringify(unionInfo)}, result data:${JSON.stringify(result.data)}`); | 239 | + logger.info(`orderEnsure: unionInfo:${JSON.stringify(unionInfo)}, |
240 | + result data:${JSON.stringify(result.data)}`); | ||
243 | } | 241 | } |
244 | 242 | ||
245 | // 提交成功清除Cookie | 243 | // 提交成功清除Cookie |
@@ -320,7 +318,9 @@ exports.selectAddress = (req, res, next) => { | @@ -320,7 +318,9 @@ exports.selectAddress = (req, res, next) => { | ||
320 | 318 | ||
321 | let moreUrl = (req.get('Referer') && !/\/home\/addressAct/.test(req.get('Referer')) && | 319 | let moreUrl = (req.get('Referer') && !/\/home\/addressAct/.test(req.get('Referer')) && |
322 | !/selectAddress/.test(req.get('Referer'))) ? | 320 | !/selectAddress/.test(req.get('Referer'))) ? |
323 | - req.get('Referer') : helpers.urlFormat('/cart/index/new/orderEnsure', {cartType: req.cookies._cartType}); // 取跳过来的url | 321 | + req.get('Referer') : helpers.urlFormat('/cart/index/new/orderEnsure', { |
322 | + cartType: req.cookies._cartType | ||
323 | + }); // 取跳过来的url | ||
324 | 324 | ||
325 | address = address.data; | 325 | address = address.data; |
326 | 326 |
@@ -133,15 +133,16 @@ exports.cartPay = (uid, cartType, orderInfo, limitProductCode, sku, skn, buyNumb | @@ -133,15 +133,16 @@ exports.cartPay = (uid, cartType, orderInfo, limitProductCode, sku, skn, buyNumb | ||
133 | * @return array 接口返回的数据 | 133 | * @return array 接口返回的数据 |
134 | */ | 134 | */ |
135 | exports.orderCompute = (uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList, activityInfo) => { | 135 | exports.orderCompute = (uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList, activityInfo) => { |
136 | - return shoppingAPI.orderComputeAPI(uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList, activityInfo).then(result => { | ||
137 | - if (result && result.data) { | ||
138 | - result.data.use_yoho_coin = transPrice(result.data.use_yoho_coin); | ||
139 | - result.data.yohoCoinCompute = paymentProcess.yohoCoinCompute(result.data); | ||
140 | - return result.data; | ||
141 | - } else { | ||
142 | - return {}; | ||
143 | - } | ||
144 | - }); | 136 | + return shoppingAPI.orderComputeAPI(uid, cartType, deliveryWay, paymentType, |
137 | + couponCode, yohoCoin, skuList, activityInfo).then(result => { | ||
138 | + if (result && result.data) { | ||
139 | + result.data.use_yoho_coin = transPrice(result.data.use_yoho_coin); | ||
140 | + result.data.yohoCoinCompute = paymentProcess.yohoCoinCompute(result.data); | ||
141 | + return result.data; | ||
142 | + } else { | ||
143 | + return {}; | ||
144 | + } | ||
145 | + }); | ||
145 | }; | 146 | }; |
146 | 147 | ||
147 | 148 |
@@ -34,7 +34,7 @@ exports.cartPayAPI = (uid, cartType, isUseYohoCoin, skuList, activityInfo) => { | @@ -34,7 +34,7 @@ exports.cartPayAPI = (uid, cartType, isUseYohoCoin, skuList, activityInfo) => { | ||
34 | 34 | ||
35 | // 购买限购商品时需要传递product_sku_list参数 | 35 | // 购买限购商品时需要传递product_sku_list参数 |
36 | if (!_.isEmpty(skuList)) { | 36 | if (!_.isEmpty(skuList)) { |
37 | - param.product_sku_list = skuList; | 37 | + param.product_sku_list = JSON.stringify(skuList); |
38 | } | 38 | } |
39 | 39 | ||
40 | // 购买套装和量贩商品时数据处理 | 40 | // 购买套装和量贩商品时数据处理 |
@@ -86,7 +86,7 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo | @@ -86,7 +86,7 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo | ||
86 | } | 86 | } |
87 | 87 | ||
88 | if (!_.isEmpty(skuList) && !activityInfo) { | 88 | if (!_.isEmpty(skuList) && !activityInfo) { |
89 | - param.product_sku_list = skuList; | 89 | + param.product_sku_list = JSON.stringify(skuList); |
90 | } | 90 | } |
91 | 91 | ||
92 | // 购买套餐商品需要的数据 | 92 | // 购买套餐商品需要的数据 |
@@ -213,13 +213,13 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | @@ -213,13 +213,13 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | ||
213 | 213 | ||
214 | // 购买限购商品时需要传递product_sku_list参数 | 214 | // 购买限购商品时需要传递product_sku_list参数 |
215 | if (skuList && !activityInfo) { | 215 | if (skuList && !activityInfo) { |
216 | - params.product_sku_list = skuList; | 216 | + params.product_sku_list = JSON.stringify(skuList); |
217 | } | 217 | } |
218 | 218 | ||
219 | // 购买套餐商品需要的数据 | 219 | // 购买套餐商品需要的数据 |
220 | if (activityInfo) { | 220 | if (activityInfo) { |
221 | params.activity_id = activityInfo.activity_id; | 221 | params.activity_id = activityInfo.activity_id; |
222 | - params.product_sku_list = JSON.stringify(activityInfo.product_sku_list); | 222 | + params.product_sku_list = JSON.stringify(activityInfo.product_sku_list); // TODO 检查 JSON 是否正常 |
223 | } | 223 | } |
224 | 224 | ||
225 | // 友盟有关信息的传递 | 225 | // 友盟有关信息的传递 |
@@ -316,10 +316,9 @@ function submitOrder() { | @@ -316,10 +316,9 @@ function submitOrder() { | ||
316 | op: 'YB_SC_TOPAY_CLICK', | 316 | op: 'YB_SC_TOPAY_CLICK', |
317 | param: JSON.stringify({ | 317 | param: JSON.stringify({ |
318 | C_ID: window._ChannelVary[cookie.get('_Channel')], | 318 | C_ID: window._ChannelVary[cookie.get('_Channel')], |
319 | - ORDER_CODE: res.data.order_code, | 319 | + ORDER_CODE: res.data.order_code + '', |
320 | PRD_NUM: $('#goods-num').val(), | 320 | PRD_NUM: $('#goods-num').val(), |
321 | - ORDER_AMOUNT: res.data.order_amount, | ||
322 | - UNIONCOOKIE: res.data.unionCookie || '', | 321 | + ORDER_AMOUNT: res.data.order_amount |
323 | }) | 322 | }) |
324 | }, true); | 323 | }, true); |
325 | } | 324 | } |
@@ -499,12 +498,6 @@ if (orderInfo('address') && orderInfo('address').is_support === 'N') { | @@ -499,12 +498,6 @@ if (orderInfo('address') && orderInfo('address').is_support === 'N') { | ||
499 | 498 | ||
500 | // 电子票下单 | 499 | // 电子票下单 |
501 | function ticketsConfirm() { | 500 | function ticketsConfirm() { |
502 | - | ||
503 | - if (!$ticketsMobile.val()) { | ||
504 | - tip.show('手机号必填'); | ||
505 | - return; | ||
506 | - } | ||
507 | - | ||
508 | var data = { | 501 | var data = { |
509 | productSku: productSku, | 502 | productSku: productSku, |
510 | buyNumber: buyNumber, | 503 | buyNumber: buyNumber, |
@@ -512,6 +505,11 @@ function ticketsConfirm() { | @@ -512,6 +505,11 @@ function ticketsConfirm() { | ||
512 | useYohoCoin: orderInfo('yohoCoin') | 505 | useYohoCoin: orderInfo('yohoCoin') |
513 | }; | 506 | }; |
514 | 507 | ||
508 | + if (!$ticketsMobile.val()) { | ||
509 | + tip.show('手机号必填'); | ||
510 | + return; | ||
511 | + } | ||
512 | + | ||
515 | $.ajax({ | 513 | $.ajax({ |
516 | url: '/cart/index/submitTicket', | 514 | url: '/cart/index/submitTicket', |
517 | type: 'POST', | 515 | type: 'POST', |
-
Please register or login to post a comment