|
|
|
@ -1,43 +1,3 @@ |
|
|
|
function orderStatus(status) { |
|
|
|
if (status == 2) { |
|
|
|
return '已完成' |
|
|
|
} else if (status == 3) { |
|
|
|
return '已取消' |
|
|
|
} else if (status == 4) { |
|
|
|
return '待调度' |
|
|
|
} else if (status == 5) { |
|
|
|
return '待装货' |
|
|
|
} else if (status == 6) { |
|
|
|
return '待验货' |
|
|
|
} else if (status == 7) { |
|
|
|
return '待入库' |
|
|
|
} else if (status == 8) { |
|
|
|
return '已入库' |
|
|
|
} |
|
|
|
return '' |
|
|
|
} |
|
|
|
|
|
|
|
function customerType(type) { |
|
|
|
if (type == 0) { |
|
|
|
return 'A' |
|
|
|
} else if (type == 1) { |
|
|
|
return 'B' |
|
|
|
} else if (type == 2) { |
|
|
|
return 'C' |
|
|
|
} |
|
|
|
return '' |
|
|
|
} |
|
|
|
|
|
|
|
function colorType(type) { |
|
|
|
if (type == 0) { |
|
|
|
return 'blue' |
|
|
|
} else if (type == 1) { |
|
|
|
return 'green' |
|
|
|
} else if (type == 2) { |
|
|
|
return 'tree' |
|
|
|
} |
|
|
|
return '' |
|
|
|
} |
|
|
|
|
|
|
|
function formatePrice(price) { |
|
|
|
return Number(parseFloat(price) / 100).toFixed(2) |
|
|
|
@ -46,91 +6,12 @@ function formatePrice(price) { |
|
|
|
function formateWeight(weight) { |
|
|
|
return Number(parseFloat(weight) / 1000).toFixed(3) |
|
|
|
} |
|
|
|
|
|
|
|
function deductMoney(money) { |
|
|
|
if (money < 0) { |
|
|
|
return '待定' |
|
|
|
} else if (money === 0) { |
|
|
|
return money |
|
|
|
} |
|
|
|
return (money / 100).toFixed(2) |
|
|
|
} |
|
|
|
|
|
|
|
function deductStatus(deductionStatus) { |
|
|
|
switch (deductionStatus) { |
|
|
|
case 0: |
|
|
|
return '【待客户确认】' |
|
|
|
case 1: |
|
|
|
return '【客户同意】' |
|
|
|
case -1: |
|
|
|
return '【客户拒绝】' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function orderDate(order) { |
|
|
|
if (order.orderStatus == 4) { |
|
|
|
return '下单日期:' + order.orderDate |
|
|
|
} else if (order.orderStatus == 5) { |
|
|
|
return '调度日期' + order.schedulingCreateDate |
|
|
|
} else if (order.orderStatus == 6) { |
|
|
|
return '装货日期:' + order.shippingDate |
|
|
|
} else if (order.orderStatus == 7 || order.orderStatus == 8 || order.orderStatus == 2) { |
|
|
|
return '验货日期:' + order.inspectionDate |
|
|
|
} |
|
|
|
return '' |
|
|
|
} |
|
|
|
|
|
|
|
function isInspectable(order, centerId) { |
|
|
|
if (!order) { |
|
|
|
return false |
|
|
|
} |
|
|
|
if (order.orderStatus === 6) { |
|
|
|
if (centerId === 1) { |
|
|
|
return true |
|
|
|
} |
|
|
|
return Number(order.destinationOperationCenterId) === centerId |
|
|
|
} |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
function isStockinable(order, centerId) { |
|
|
|
if (!order) { |
|
|
|
return false |
|
|
|
} |
|
|
|
if (order.orderStatus === 7) { |
|
|
|
if (centerId === 1) { |
|
|
|
return true |
|
|
|
} |
|
|
|
return Number(order.destinationOperationCenterId) === centerId |
|
|
|
} |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
function canHandle(order, centerId) { |
|
|
|
if (order.inspectionId > 0 && order.deductMoney == -1) { |
|
|
|
if (centerId === 1) { |
|
|
|
return true |
|
|
|
} |
|
|
|
return Number(order.destinationOperationCenterId) === centerId |
|
|
|
} |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
function isAbnormalable(order, centerId) { |
|
|
|
if (order.orderStatus === 6) { |
|
|
|
if (centerId === 1) { |
|
|
|
return true |
|
|
|
} |
|
|
|
return Number(order.destinationOperationCenterId) === centerId |
|
|
|
} |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function isEmpty(val) { |
|
|
|
return typeof val === 'undefined' || val === '' || val === null |
|
|
|
} |
|
|
|
|
|
|
|
function formateOrderDate(datetime) { |
|
|
|
function formateDate(datetime) { |
|
|
|
if (isEmpty(datetime)) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
@ -156,86 +37,8 @@ function formateOrderDate(datetime) { |
|
|
|
return datetime + week |
|
|
|
} |
|
|
|
|
|
|
|
function getCateName(item) { |
|
|
|
if (!item.categoriesName){ |
|
|
|
return '' |
|
|
|
} |
|
|
|
if (item.categoriesName.toString().length < 10) { |
|
|
|
return item.categoriesName |
|
|
|
} |
|
|
|
return item.categoriesName.substring(0, 10) + '...' |
|
|
|
} |
|
|
|
|
|
|
|
function handleWeight(weight) { |
|
|
|
if (!weight) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
return '折算重量:' + Number(weight / 1000).toFixed(3) + '吨' |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 4: 'green', |
|
|
|
5: 'green', |
|
|
|
6: 'green', |
|
|
|
7: 'green', |
|
|
|
8: 'green', |
|
|
|
0: 'grey', |
|
|
|
1: 'green', |
|
|
|
2: 'grey', |
|
|
|
3: 'grey' |
|
|
|
*/ |
|
|
|
function orderStatusColor(status) { |
|
|
|
if (status == 4) { |
|
|
|
return 'yellow' |
|
|
|
} else if (status == 5) { |
|
|
|
return 'yellow' |
|
|
|
} else if (status == 6) { |
|
|
|
return 'yellow' |
|
|
|
} else if (status == 7) { |
|
|
|
return 'yellow' |
|
|
|
} else if (status == 8) { |
|
|
|
return 'yellow' |
|
|
|
} else if (status == 0) { |
|
|
|
return 'gray' |
|
|
|
} else if (status == 1) { |
|
|
|
return 'gray' |
|
|
|
} else if (status == 2) { |
|
|
|
return 'blue' |
|
|
|
} else if (status == 3) { |
|
|
|
return 'gray' |
|
|
|
} |
|
|
|
return '' |
|
|
|
} |
|
|
|
|
|
|
|
function getGuidePrice(cateId, cateList) { |
|
|
|
for (var i = 0; i < cateList.length; i++) { |
|
|
|
if (parseInt(cateId) == parseInt(cateList[i].value)) { |
|
|
|
return '今日指导价:¥' + formatePrice(cateList[i].price) + '元/kg' |
|
|
|
} |
|
|
|
} |
|
|
|
return '' |
|
|
|
} |
|
|
|
|
|
|
|
function offesWeight(offsetWeight, totalWeight) { |
|
|
|
return offsetWeight > 0.01 * totalWeight |
|
|
|
} |
|
|
|
|
|
|
|
module.exports = { |
|
|
|
orderStatus: orderStatus, |
|
|
|
customerType: customerType, |
|
|
|
colorType: colorType, |
|
|
|
formatePrice: formatePrice, |
|
|
|
deductMoney: deductMoney, |
|
|
|
deductStatus: deductStatus, |
|
|
|
orderDate: orderDate, |
|
|
|
isInspectable: isInspectable, |
|
|
|
canHandle: canHandle, |
|
|
|
formateWeight: formateWeight, |
|
|
|
formateOrderDate: formateOrderDate, |
|
|
|
getCateName: getCateName, |
|
|
|
handleWeight: handleWeight, |
|
|
|
orderStatusColor: orderStatusColor, |
|
|
|
getGuidePrice: getGuidePrice, |
|
|
|
isStockinable: isStockinable, |
|
|
|
offesWeight: offesWeight |
|
|
|
formateDate: formateDate |
|
|
|
} |