Commit d4659c55 by 王昆

gsb

parent e7dddb14
......@@ -56,6 +56,7 @@ module.exports = (db, DataTypes) => {
deliverNo: DataTypes.STRING,
deliverImg: DataTypes.STRING,
productItems: DataTypes.STRING,
completeFile: DataTypes.STRING,
}, {
paranoid: true, //假的删除
underscored: true,
......
......@@ -879,6 +879,7 @@ class IborderService extends ServiceBase {
deliverType: self.trim(params.deliverType),
deliverNo: self.trim(params.deliverNo),
deliverImg: self.trim(params.deliverImg),
completeFile: self.trim(params.completeFile),
}
await self.dao.update(orderFields, t);
await self.businessmenDao.update({
......
......@@ -272,21 +272,85 @@ class IborderdeliverService extends ServiceBase {
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd);
var page = await this.getPageList(currentPage, pageSize, where, orderby);
if (page && page.rows) {
await this.setOrder(page.rows, "`id`, `legalName`, `legalMobile`, `price`, `idcard`, `productItems` ");
for (var row of page.rows) {
await this.dao.setRowCodeName(row, "status");
// 下一个状态
var nextObj = await this.orderBusinessStatus.findOrderNextBusinessStatus(row.status);
row.nextStatus = nextObj.status;
row.nextStatusName = nextObj.name;
await this.setNextStatus(row);
// var nextObj = await this.orderBusinessStatus.findOrderNextBusinessStatus(row.status);
// row.nextStatus = nextObj.status;
// row.nextStatusName = nextObj.name;
this.handleDate(row, ["created_at"], null, -8);
}
await this.setOrder(page.rows, "`id`, `legalName`, `legalMobile`, `price`, `idcard`");
}
return system.getResultSuccess(page);
}
async setNextStatus(row) {
if (!row) {
return;
}
let items = this.trim(row.productItems);
if (items) {
let itemArr = items.split(",");
// 当前订单状态
let curStatus = row.status;
let nextStatus = "";
if (curStatus == "1030") {
if(itemArr.indexOf("1050") != -1) {
nextStatus = "1050";
} else if (itemArr.indexOf("1070") != -1) {
nextStatus = "1070";
} else if (itemArr.indexOf("1090") != -1) {
nextStatus = "1090";
} else if (itemArr.indexOf("1110") != -1) {
nextStatus = "1110";
} else {
nextStatus = await this.orderBusinessStatus.findOrderNextBusinessStatus(curStatus);
}
} else if(curStatus == "1050") {
if (itemArr.indexOf("1070") != -1) {
nextStatus = "1070";
} else if (itemArr.indexOf("1090") != -1) {
nextStatus = "1090";
} else if (itemArr.indexOf("1110") != -1) {
nextStatus = "1110";
} else {
nextStatus = await this.orderBusinessStatus.findOrderNextBusinessStatus(curStatus);
}
} else if (curStatus == "1070") {
if (itemArr.indexOf("1090") != -1) {
nextStatus = "1090";
} else if (itemArr.indexOf("1110") != -1) {
nextStatus = "1110";
} else {
nextStatus = await this.orderBusinessStatus.findOrderNextBusinessStatus(curStatus);
}
} else if (curStatus == "1090") {
if (itemArr.indexOf("1110") != -1) {
nextStatus = "1110";
} else {
nextStatus = await this.orderBusinessStatus.findOrderNextBusinessStatus(curStatus);
}
} else {
nextStatus = await this.orderBusinessStatus.findOrderNextBusinessStatus(curStatus);
}
var nextObj = await this.orderBusinessStatus.findOrderBusinessStatus(nextStatus);
row.nextStatus = nextObj.status;
row.nextStatusName = nextObj.name;
return;
}
var nextObj = await this.orderBusinessStatus.findOrderNextBusinessStatus(row.status);
row.nextStatus = nextObj.status;
row.nextStatusName = nextObj.name;
}
async setOrder(rows, attrs) {
if (!rows || rows.length == 0) {
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment