Authored by yyq

限购结算价格处理

... ... @@ -12,6 +12,20 @@ const crypto = global.yoho.crypto;
const easypayApi = require('./easypay-api');
const handelViewPrice = list => {
if (list) {
_.forEach(list, val => {
if (val.promotion === '商品金额') {
val.promotion = '商品总价';
val.promotion_amount = `+ ${val.promotion_amount}`;
} else {
val.promotion_amount = _.replace(val.promotion_amount, '+', '+ ');
val.promotion_amount = _.replace(val.promotion_amount, '-', '- ');
}
});
}
};
const _handelPaymentInfo = (d) => {
let resData = {};
... ... @@ -66,6 +80,10 @@ const _handelPaymentInfo = (d) => {
contractMe: false
};
if (d.shopping_cart_data && d.shopping_cart_data.promotion_formula_list) {
handelViewPrice(d.shopping_cart_data.promotion_formula_list);
}
Object.assign(resData, {
paymentWay: d.payment_way,
deliveryTime: d.delivery_time,
... ... @@ -119,8 +137,14 @@ const getOrderComputeData = (uid, cartType, params) => {
return easypayApi.getEasypayComputeAsync(uid, cartType, params.paymentType, params.deliveryWay, params).then(result => { // eslint-disable-line
if (result.code === 200) {
if (_.has(result, 'data.last_order_amount')) {
result.data.last_order_amount = _.round(result.data.last_order_amount, 2);
}
if (_.has(result, 'data.promotion_formula_list')) {
handelViewPrice(result.data.promotion_formula_list);
}
}
return result;
});
};
... ...