...
|
...
|
@@ -10,6 +10,16 @@ const pager = require('./pager').handlePagerData; |
|
|
const orderApi = require('./orders-api');
|
|
|
const ChannelConfig = require('./channel-config');
|
|
|
|
|
|
/**
|
|
|
* 转换价格
|
|
|
*
|
|
|
* @param float|string $price 价格
|
|
|
* @return float|string 转换之后的价格
|
|
|
*/
|
|
|
const transPrice = (price) => {
|
|
|
return price ? (price * 1).toFixed(2) : '0.00';
|
|
|
};
|
|
|
|
|
|
const ORDER_TYPE = {
|
|
|
all: 1, // 全部
|
|
|
waitingForPay: 2, // 待付款
|
...
|
...
|
@@ -365,28 +375,26 @@ const getOrders = (uid, page, limit, type, isPage)=> { |
|
|
newOrder.goods = _.get(order, 'order_goods', []).map((good) => {
|
|
|
let newGood = {};
|
|
|
|
|
|
good.real_pay_price = good.real_pay_price && Number(good.real_pay_price).toFixed(2) || '';
|
|
|
good.sales_price = good.sales_price && Number(good.sales_price).toFixed(2) || '';
|
|
|
newGood.href = helpers.getUrlBySkc(good.product_skn);
|
|
|
newGood.thumb = helpers.image(good.goods_image, 100, 100);
|
|
|
newGood.name = good.product_name;
|
|
|
newGood.color = good.factory_color_name;
|
|
|
newGood.size = good.size_name;
|
|
|
|
|
|
newGood.price = good.sales_price;// 默认显示销售价
|
|
|
newGood.price = transPrice(good.sales_price);// 默认显示销售价
|
|
|
newGood.isVipPrice = good.discount_tag === 'V';
|
|
|
newGood.isStuPrice = good.discount_tag === 'S';
|
|
|
|
|
|
// 划线的价格
|
|
|
if (good.real_pay_price < good.sales_price) {
|
|
|
newGood.price = good.real_pay_price;// 显示分摊价
|
|
|
newGood.linePrice = good.sales_price; // 划线的价格
|
|
|
newGood.price = transPrice(good.real_pay_price);// 显示分摊价
|
|
|
newGood.linePrice = transPrice(good.sales_price); // 划线的价格
|
|
|
}
|
|
|
|
|
|
// 赠品、加价购
|
|
|
if (good.goods_type === 'gift' || good.goods_type === 'price_gift') {
|
|
|
newGood.price = good.real_pay_price;// 显示分摊价
|
|
|
newGood.linePrice = good.sales_price; // 划线的价格
|
|
|
newGood.price = transPrice(good.real_pay_price);// 显示分摊价
|
|
|
newGood.linePrice = transPrice(good.sales_price); // 划线的价格
|
|
|
}
|
|
|
|
|
|
let buyNum = _.parseInt(good.buy_number);
|
...
|
...
|
@@ -776,16 +784,13 @@ const _getOrderDetail = co(function * (uid, orderId) { |
|
|
// 商品信息
|
|
|
if (orderDetail.order_goods) {
|
|
|
detail.goods = _.get(orderDetail, 'order_goods', []).map((good) => {
|
|
|
good.real_pay_price = good.real_pay_price && Number(good.real_pay_price).toFixed(2) || '';
|
|
|
good.sales_price = good.sales_price && Number(good.sales_price).toFixed(2) || '';
|
|
|
|
|
|
let newGood = {
|
|
|
url: helpers.getUrlBySkc(good.product_skn),
|
|
|
img: helpers.image(good.goods_image, 60, 60),
|
|
|
name: good.product_name,
|
|
|
color: good.factory_color_name,
|
|
|
size: good.size_name,
|
|
|
price: good.sales_price, // 默认显示销售价
|
|
|
price: transPrice(good.sales_price), // 默认显示销售价
|
|
|
isVipPrice: good.discount_tag === 'V',
|
|
|
isStuPrice: good.discount_tag === 'S',
|
|
|
coin: good.yoho_give_coin,
|
...
|
...
|
@@ -797,14 +802,14 @@ const _getOrderDetail = co(function * (uid, orderId) { |
|
|
|
|
|
// 划线的价格
|
|
|
if (good.real_pay_price < good.sales_price) {
|
|
|
newGood.price = good.real_pay_price;// 显示分摊价
|
|
|
newGood.linePrice = good.sales_price; // 划线的价格
|
|
|
newGood.price = transPrice(good.real_pay_price);// 显示分摊价
|
|
|
newGood.linePrice = transPrice(good.sales_price); // 划线的价格
|
|
|
}
|
|
|
|
|
|
// 赠品、加价购
|
|
|
if (good.goods_type === 'gift' || good.goods_type === 'price_gift') {
|
|
|
newGood.price = good.real_pay_price;// 显示分摊价
|
|
|
newGood.linePrice = good.sales_price; // 划线的价格
|
|
|
newGood.price = transPrice(good.real_pay_price);// 显示分摊价
|
|
|
newGood.linePrice = transPrice(good.sales_price); // 划线的价格
|
|
|
}
|
|
|
|
|
|
return newGood;
|
...
|
...
|
|