Authored by ccbikai(👎🏻🍜)

Merge branch 'release/5.1' into grey

... ... @@ -42,6 +42,7 @@ router.get('/author/index', index.editor); // 编辑简介
router.get('/index/page', index.pageData); // 逛列表页面的资讯分页
router.post('/opt/praiseArticle', opt.praiseArticle); // 资讯文章点赞 (H5里显示点赞)
router.post('/opt/collectArticle', opt.collectArticle); // 资讯文章收藏 (H5里显示收藏)
router.post('/opt/favoriteBrand', opt.favoriteBrand); // 品牌收藏
router.get('/info/index', info.index); // 逛详情页
... ...
... ... @@ -26,14 +26,18 @@ const closeReasons = () => {
* 获取快递有关信息
* @private
*/
const _assignExpressInfo = (showLogistics, order, result) => {
if (showLogistics && order.express_company.caption && order.express_number) {
Object.assign(result, {
logisticsUrl: helpers.urlFormat('/home/logistic', {order_code: order.order_code}),
logisticsCompany: order.express_company.caption,
logisticsNum: order.express_number
});
const _assignExpressInfo = (showLogistics, order) => {
let data = {};
if (showLogistics && order.expressCompany.caption) {
data = {
logisticsUrl: helpers.urlFormat('/home/logistic', {order_code: order.orderCode}),
logisticsCompany: order.expressCompany.caption,
logisticsNum: order.expressNumber || ''
};
}
return data;
};
/**
... ... @@ -49,10 +53,12 @@ const _getOrderStatus = (order, showLogistics) => {
};
}
order.status = parseInt(order.status, 10);
// 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
// 支付方式为非货到付款时,计算订单状态。
if (parseInt(order.paymentType, 10) !== 2) {
switch (parseInt(order.status, 10)) {
switch (order.status) {
case 0:
/* 待付款 */
... ... @@ -84,7 +90,7 @@ const _getOrderStatus = (order, showLogistics) => {
qrcode: helpers.urlFormat(`/home/QRcode/${order.order_code}`)
});
} else {
_assignExpressInfo(showLogistics, order, result);
Object.assign(result, _assignExpressInfo(showLogistics, order));
}
break;
case 6:
... ... @@ -100,7 +106,7 @@ const _getOrderStatus = (order, showLogistics) => {
qrcode: helpers.urlFormat(`/home/QRcode/${order.order_code}`)
});
} else {
_assignExpressInfo(showLogistics, order, result);
Object.assign(result, _assignExpressInfo(showLogistics, order));
}
break;
default:
... ... @@ -109,7 +115,7 @@ const _getOrderStatus = (order, showLogistics) => {
} else {
/* 订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态) */
switch (parseInt(order.status, 10)) {
switch (order.status) {
case 0:
/* 备货中 */
... ... @@ -133,7 +139,7 @@ const _getOrderStatus = (order, showLogistics) => {
Object.assign(result, {
unreceived: true
});
_assignExpressInfo(showLogistics, order, result);
Object.assign(result, _assignExpressInfo(showLogistics, order));
break;
case 6:
... ... @@ -141,7 +147,7 @@ const _getOrderStatus = (order, showLogistics) => {
Object.assign(result, {
completed: true
});
_assignExpressInfo(showLogistics, order, result);
Object.assign(result, _assignExpressInfo(showLogistics, order));
break;
default:
break;
... ... @@ -163,11 +169,9 @@ const orderDetailData = (uid, orderCode) => {
if (result && result.code === 200) {
let orderDetail = camelCase(result.data);
let goods = [];
let status = _getOrderStatus(orderDetail);
let status = _getOrderStatus(orderDetail, true);
orderDetail = _.assign(orderDetail, status);
orderDetail.useLimitCode = orderDetail.useLimitCode === 'Y';
if (orderDetail.virtualType && orderDetail.virtualType === 3) {
orderDetail = _.assign(orderDetail, {
... ... @@ -251,13 +255,6 @@ const orderDetailData = (uid, orderCode) => {
});
}
// 定金预售
if (orderDetail.attribute * 1 === 9) {
orderDetail = _.assign(orderDetail, {
isDepositAdvance: true
});
}
// 判断是否有关联订单
if (orderDetail.relateOrderCode === 'Y') {
orderDetail = _.assign(orderDetail, {
... ... @@ -269,6 +266,13 @@ const orderDetailData = (uid, orderCode) => {
});
}
// 定金预售
if (orderDetail.attribute * 1 === 9) {
orderDetail = _.assign(orderDetail, {
isDepositAdvance: true
});
}
orderDetail = _.assign(orderDetail, {
goodsAmount: orderDetail.paymentAmount,
url: '/home/addressModify?orderCode=' + orderCode + '&relation=' + orderDetail.relation
... ...
... ... @@ -171,6 +171,8 @@ function initInfosEvt($container) {
// 切换收藏状态
$btn.toggleClass('collected');
} else {
tip.show(data.message);
}
},
error: function() {
... ...
... ... @@ -149,7 +149,7 @@ var jQuery = require('yoho-jquery');
}
} else {
for (var n = 0; n < limit; n++) {
file = this.files[n];
var file = this.files[n];
$data.addQueueItem(file);
}
$data.inputs[inputName] = this;
... ... @@ -252,10 +252,10 @@ var jQuery = require('yoho-jquery');
// Remove an existing file in the queue
$data.removeExistingFile = function(file) {
for (var key in $data.inputs) {
input = $data.inputs[key];
limit = input.files.length;
var input = $data.inputs[key];
var limit = input.files.length;
for (var n = 0; n < limit; n++) {
existingFile = input.files[n];
var existingFile = input.files[n];
// Check if the filename matches
if (existingFile.name == file.name && !existingFile.complete) {
... ... @@ -324,7 +324,7 @@ var jQuery = require('yoho-jquery');
// Remove an item from the queue
$data.removeQueueItem = function(file, instant, delay) {
// Set the default delay
if (!delay) delay = 0;
if (!delay) { delay = 0; }
var fadeTime = instant ? 0 : 500;
if (file.queueItem) {
if (file.queueItem.find('.fileinfo').html() != ' - Completed') {
... ... @@ -343,10 +343,10 @@ var jQuery = require('yoho-jquery');
$data.filesToUpload = function() {
var filesToUpload = 0;
for (var key in $data.inputs) {
input = $data.inputs[key];
limit = input.files.length;
var input = $data.inputs[key];
var limit = input.files.length;
for (var n = 0; n < limit; n++) {
file = input.files[n];
var file = input.files[n];
if (!file.skip && !file.complete) {
filesToUpload++;
}
... ... @@ -392,7 +392,7 @@ var jQuery = require('yoho-jquery');
$data.uploads.attempted++;
// Create a new AJAX request
xhr = file.xhr = new XMLHttpRequest();
var xhr = file.xhr = new XMLHttpRequest();
// Start the upload
// Use the faster FormData if it exists
... ... @@ -405,7 +405,7 @@ var jQuery = require('yoho-jquery');
formData.append(settings.fileObjName, file);
// Add the rest of the formData
for (i in settings.formData) {
for (var i in settings.formData) {
formData.append(i, settings.formData[i]);
}
... ... @@ -625,7 +625,7 @@ var jQuery = require('yoho-jquery');
// Wrap the file input in a div with overflow set to hidden
$data.button = $('<div id="' + settings.id + '" class="uploadifive-button">' + settings.buttonText + '</div>');
if (settings.buttonClass) $data.button.addClass(settings.buttonClass);
if (settings.buttonClass) { $data.button.addClass(settings.buttonClass); }
// Style the button wrapper
$data.button.css({
... ... @@ -819,7 +819,7 @@ var jQuery = require('yoho-jquery');
// Loop through the files
$('#' + settings.queueID).find('.uploadifive-queue-item').not('.error, .complete').each(function() {
_file = $(this).data('file');
var _file = $(this).data('file');
// Check if the simUpload limit was reached
if (($data.uploads.current >= settings.simUploadLimit && settings.simUploadLimit !== 0) || ($data.uploads.current >= settings.uploadLimit && settings.uploadLimit !== 0) || ($data.uploads.count >= settings.uploadLimit && settings.uploadLimit !== 0)) {
... ... @@ -874,7 +874,7 @@ var jQuery = require('yoho-jquery');
methods.clearQueue.call($this);
// Destroy the queue if it was created
if (!settings.queueID) $('#' + settings.queueID).remove();
if (!settings.queueID) { $('#' + settings.queueID).remove(); }
// Remove extra inputs
$this.siblings('input').remove();
... ... @@ -911,4 +911,4 @@ var jQuery = require('yoho-jquery');
};
})(jQuery);
}(jQuery));
... ...
... ... @@ -78,9 +78,9 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQueryStr
// 收藏
if (isApp) {
result.collect = [];
result.collect = {};
result.collect.isCollected = articleData.isFavor === true;
let originUrl = helpers.urlFormat('/author/index', null, 'guang') + reqQueryString; // 跳转回的链接
let originUrl = helpers.urlFormat('/author/index', null, 'guang'); // 跳转回的链接
let collectUrl = 'javascript:;'; // 根据用户是否登录做处理的链接
if (!uid) {
... ...