Authored by 周少峰

Merge branch 'release/5.8' of git.yoho.cn:fe/yohobuy-node into release/5.8

... ... @@ -120,10 +120,6 @@ const getCartDelList = (req, res, addsStr, delSkuId) => {
const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analysis) => {
return _.map(cartGoods, (it) => {
it.last_vip_price = transPrice(it.last_vip_price);
it.sales_price = transPrice(it.sales_price);
it.last_price = transPrice(it.last_price);
let goods = {
id: it.product_sku,
skn: it.product_skn,
... ... @@ -134,7 +130,7 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
imgCover: it.goods_images ? helpers.image(it.goods_images, 64, 88) : '',
productColor: it.factory_goods_name,
productSize: it.size_name,
productPrice: it.sales_price,
productPrice: transPrice(it.sales_price),
productNum: Number(it.buy_number),
storageNum: Number(it.storage_number),
isSoldOut: parseInt(it.storage_number, 10) === 0 || parseInt(it.off_shelves, 10) === 1, // 已售罄
... ... @@ -149,8 +145,8 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
// 划线的价格
if (it.last_vip_price < it.sales_price) {
goods.productPrice = it.last_vip_price;
goods.linePrice = it.sales_price; // 划线的价格
goods.productPrice = transPrice(it.last_vip_price);
goods.linePrice = transPrice(it.sales_price); // 划线的价格
}
if (it.min_buy_number) {
... ... @@ -182,16 +178,16 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
goods.inValid = true;
} else if (it.goods_type === 'gift') { // gift=>是否赠品 && it.isAdvanceBuy
goods.isGift = true;
goods.productPrice = it.last_price;
goods.linePrice = it.sales_price; // 划线的价格
goods.productPrice = transPrice(it.last_price);
goods.linePrice = transPrice(it.sales_price); // 划线的价格
goods.productSubtotal = it.subtotal ? transPrice(it.subtotal) : goods.productPrice;
} else if (it.goods_type === 'price_gift') { // price_gift=>是否加价购
goods.isPriceGift = true;
goods.productPrice = it.last_price;
goods.linePrice = it.sales_price; // 划线的价格
goods.productPrice = transPrice(it.last_price);
goods.linePrice = transPrice(it.sales_price); // 划线的价格
goods.productSubtotal = it.subtotal ? transPrice(it.subtotal) : goods.productPrice;
} else if (it.real_price === 0) { // 免单
goods.productPrice = it.sales_price;
goods.productPrice = transPrice(it.sales_price);
goods.xForOne = true;
// 分析用: 商品ID列表
... ...
... ... @@ -63,11 +63,6 @@ const handlePaymentInfo = (d, address) => {
dd.default = true;
}
// 三级地址默认4级显示全部
if (dd.area_code && dd.area_code.length === 6) {
dd.area += ' 全部';
}
// 地址加密
let id = dd.address_id;
... ...
<script id="address-tpl" type="text/html">
<div class="title">\{{title}}</div>
<p class="prompt">\{{title}}、电话为选填项,其他均为必填项</p>
<p class="prompt">为提高配送时效,请您尽量准确填写四级地址。</p>
<ul class="info-wrap">
<li>
<span class="left-rd"><i class="red">*</i>收<i class="mg">货</i>人:</span>
... ...
... ... @@ -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;
... ...
... ... @@ -39,6 +39,16 @@ const getProductUrlBySkc = (skn) => {
return helpers.getUrlBySkc(skn);
};
/**
* 转换价格
*
* @param float|string $price 价格
* @return float|string 转换之后的价格
*/
const transPrice = (price) => {
return price ? (price * 1).toFixed(2) : '0.00';
};
const setDetailGoods = (list) => {
let resData = [];
let goods;
... ... @@ -52,15 +62,15 @@ const setDetailGoods = (list) => {
color: value.color_name,
size: value.size_name,
yoho_coin_cut_num: value.yoho_coin_cut_num,
real_pay_price: value.real_pay_price,
price: value.sales_price,
real_pay_price: transPrice(value.real_pay_price),
price: transPrice(value.sales_price),
goods_type: value.goods_type,
reason: value.reason_name
};
if (value.real_pay_price < value.sales_price) {
goods.price = value.real_pay_price;// 显示分摊价
goods.linePrice = value.sales_price; // 划线的价格
goods.price = transPrice(value.real_pay_price);// 显示分摊价
goods.linePrice = transPrice(value.sales_price); // 划线的价格
}
resData.push(goods);
... ... @@ -202,7 +212,7 @@ const getOrderRefund = (orderCode, uid) => {
color: value.factory_color_name,
size: value.size_name,
lastPrice: value.last_price,
price: value.real_pay_price,
price: transPrice(value.real_pay_price),
skn: value.product_skn,
skc: value.product_skc,
sku: value.product_sku,
... ...
... ... @@ -9,6 +9,7 @@
<h2 ></h2>
</div>
<div class="main">
<div class="address-tip"><p>为提高配送时效,请您尽量准确填写四级地址</p></div>
<ul class="address-list">
{{#each addressList}}
<li class="address-content {{#if isPreferred}}preferred{{/if}}" addressId={{id}}>
... ...
... ... @@ -224,7 +224,6 @@ var areaSelect = { // eslint-disable-line
setOptionList: function(type, data, select) {
var _h = '', className = '', i, j;
var selInfo = {};
var allStreet;
if (type === 'province') {
data = data || {};
... ... @@ -272,21 +271,6 @@ var areaSelect = { // eslint-disable-line
this.$areaList.html(_h);
} else {
this.town = selInfo;
allStreet = this.area.id || 0;
if (select && !selInfo.id) {
this.town = {
id: select,
text: '全部'
};
_h = '<span class="ai' + allStreet + ' all-town on" data-id="' + allStreet +
'" data-text="全部">全部</span>' + _h;
} else {
_h = '<span class="ai' + allStreet + ' all-town" data-id="' + allStreet +
'" data-text="全部">全部</span>' + _h;
}
this.$townList.html(_h);
}
}
... ...
... ... @@ -49,8 +49,7 @@ var address = {
var active,
val,
nId,
selecter,
selectAll;
selecter;
$toDom.empty();
... ... @@ -74,10 +73,6 @@ var address = {
}
$toDom.append('<option value="0">' + defaultValue + '</option>');
if (toDomId === the.streetsDomId) {
allCode === pCode ? selectAll = 'selected' : selectAll = '';
$toDom.append('<option value="' + pCode + '" ' + selectAll + '>全部</option>');
}
for (i in jsonData.options) {
if (jsonData.options[i]) {
val = jsonData.options[i];
... ...
... ... @@ -218,7 +218,7 @@ function deleteOrder(id, obj) {
}
// 构建select下拉选项
function structureOption($obj, data, selectId, countryId) {
function structureOption($obj, data, selectId) {
var i,
optionHtml = '',
... ... @@ -250,10 +250,6 @@ function structureOption($obj, data, selectId, countryId) {
defaultOption = '<option value="0">请选择区县</option>';
} else if ($obj.attr('name') === 'street') {
defaultOption = '<option value="0">请选择乡镇/街道</option>';
if (countryId) {
defaultOption += '<option value="' + countryId + '">全部</option>';
}
}
$obj.html(defaultOption + optionHtml);
... ... @@ -294,7 +290,7 @@ function getAddress(d, callback) {
}
}).then(function(result) {
structureOption($obj, result.data, selectId, d.id);
structureOption($obj, result.data, selectId);
if (typeof callback === 'function') {
return callback();
... ...
... ... @@ -111,6 +111,17 @@
border-radius: 2px;
}
.address-tip {
margin: 0 10px 6px;
> p {
padding: 4px 10px;
line-height: 1.5;
color: #999;
background-color: #f0f0f0;
}
}
.address-list {
width: 776px;
margin: 0 10px;
... ...