Commit 64902374 by 王昆

gsb

parent dcf89da0
...@@ -53,7 +53,7 @@ class ActionAPI extends APIBase { ...@@ -53,7 +53,7 @@ class ActionAPI extends APIBase {
opResult = await this.oorderSve.info(action_body); opResult = await this.oorderSve.info(action_body);
break; break;
case "orderInfoAll": // 查订单信息 case "orderInfoAll": // 查订单信息
opResult = await this.oorderSve.info(action_body); opResult = await this.oorderSve.infoAll(action_body);
break; break;
case "orders": //订单管理(平台) case "orders": //订单管理(平台)
......
...@@ -11,6 +11,8 @@ class OorderService extends ServiceBase { ...@@ -11,6 +11,8 @@ class OorderService extends ServiceBase {
this.oorderinforegDao = system.getObject("db.order.oorderinforegDao"); this.oorderinforegDao = system.getObject("db.order.oorderinforegDao");
this.oorderdeliverDao = system.getObject("db.order.oorderdeliverDao"); this.oorderdeliverDao = system.getObject("db.order.oorderdeliverDao");
this.oorderprocessDao = system.getObject("db.order.oorderprocessDao"); this.oorderprocessDao = system.getObject("db.order.oorderprocessDao");
this.obusinessmenDao = system.getObject("db.order.obusinessmenDao");
this.oorderdeliverDao = system.getObject("db.order.oorderdeliverDao");
this.osourceDao = system.getObject("db.common.osourceDao"); this.osourceDao = system.getObject("db.common.osourceDao");
...@@ -39,7 +41,7 @@ class OorderService extends ServiceBase { ...@@ -39,7 +41,7 @@ class OorderService extends ServiceBase {
order.contact_mobile = this.trim(params.contact_mobile); order.contact_mobile = this.trim(params.contact_mobile);
// 验证订单是否存在 // 验证订单是否存在
let exists = await this.dao.findOne({ source_id: order.source_id, source_no: order.source_no }); let exists = await this.dao.findOne({source_id: order.source_id, source_no: order.source_no});
if (exists) { if (exists) {
return system.getResult(null, `订单号${order.source_no}已存在`); return system.getResult(null, `订单号${order.source_no}已存在`);
} }
...@@ -74,6 +76,12 @@ class OorderService extends ServiceBase { ...@@ -74,6 +76,12 @@ class OorderService extends ServiceBase {
op.order_id = order.id; op.order_id = order.id;
} }
await self.oorderprocessDao.bulkCreate(orderProcessList, t); await self.oorderprocessDao.bulkCreate(orderProcessList, t);
let orderReg = {
id: order.id,
legal_mobile: order.contact_mobile,
}
await self.oorderinforegDao.create(orderReg, t);
return order; return order;
}); });
...@@ -83,7 +91,7 @@ class OorderService extends ServiceBase { ...@@ -83,7 +91,7 @@ class OorderService extends ServiceBase {
/** /**
* 查询订单信息 * 查询订单信息
* @param {*} params * @param {*} params
*/ */
async info(params) { async info(params) {
let row = await this.dao.getById(params.id); let row = await this.dao.getById(params.id);
...@@ -93,26 +101,34 @@ class OorderService extends ServiceBase { ...@@ -93,26 +101,34 @@ class OorderService extends ServiceBase {
await this.dao.setRowCodeName(row, "status"); await this.dao.setRowCodeName(row, "status");
let statusObj = await this.getOrderProcessStatus(row.id, row.status); let statusObj = await this.getOrderProcessStatus(row.id, row.status);
row.next_status = statusObj.next_status || {}; row.next_status = JSON.parse(statusObj.next_status || "[]");
row.status_name = statusObj.name; row.status_name = statusObj.name;
this.handleDate(row, ["created_at", "assign_time"], null, -8); this.handleDate(row, ["created_at", "assign_time"], null, -8);
return system.getResultSuccess(row); return system.getResultSuccess(row);
} }
/** async infoAll(params) {
* 新建进度 let result = {};
* @param params let order = await this.dao.getById(params.id);
* @returns {Promise<void>} let orderInfo = await this.oorderinforegDao.getById(params.id);
*/ let businessmen = {};
async createProcess(params) { if (order.busi_type == 1) {
// 整理参数 变成这个格式,id, status, params businessmen = await this.obusinessmenDao.getById(order.busi_id) || {};
}
// 查询订单 let orderDeliver = await this.oorderdeliverDao.getById(order.deliver_id) || {};
// 找出订单下个状态,于参数订单状态匹配 // 处理订单字段
await this.formateStatus([order]);
// 调用状态func(order, nextObj, params) await this.formateSource([order]);
await this.formateProduct([order]);
this.handleDate(order, ["created_at", "sign_time"], "YYYY-MM-DD HH:mm:ss", -8);
result.order = order;
result.regInfo = orderInfo;
result.businessmen = businessmen;
result.orderDeliver = orderDeliver;
return system.getResultSuccess(result);
} }
/** /**
...@@ -165,7 +181,7 @@ class OorderService extends ServiceBase { ...@@ -165,7 +181,7 @@ class OorderService extends ServiceBase {
if (!nextObj) { if (!nextObj) {
continue; continue;
} }
nextStatus.push({ next_status: nextObj.status, next_name: nextObj.name }); nextStatus.push({next_status: nextObj.status, next_name: nextObj.name});
} }
let orderProcess = { let orderProcess = {
...@@ -185,7 +201,7 @@ class OorderService extends ServiceBase { ...@@ -185,7 +201,7 @@ class OorderService extends ServiceBase {
if (idx == 0 && orderProcessList.length > 0) { if (idx == 0 && orderProcessList.length > 0) {
let lastProcess = orderProcessList[orderProcessList.length - 1]; let lastProcess = orderProcessList[orderProcessList.length - 1];
let nextObj = processMap[productProcess.process_id]; let nextObj = processMap[productProcess.process_id];
lastProcess.next_status = JSON.stringify([{ next_status: nextObj.status, next_name: nextObj.name }]); lastProcess.next_status = JSON.stringify([{next_status: nextObj.status, next_name: nextObj.name}]);
} }
orderProcessList.push(orderProcess); orderProcessList.push(orderProcess);
} }
...@@ -232,8 +248,8 @@ class OorderService extends ServiceBase { ...@@ -232,8 +248,8 @@ class OorderService extends ServiceBase {
//格式化业务员 //格式化业务员
await this.formateStatus(page.rows); await this.formateStatus(page.rows);
for(let item of page.rows) { for (let item of page.rows) {
this.handleDate(item, ["created_at","sign_time"], "YYYY-MM-DD HH:mm:ss", -8); this.handleDate(item, ["created_at", "sign_time"], "YYYY-MM-DD HH:mm:ss", -8);
} }
return system.getResult(page); return system.getResult(page);
...@@ -317,6 +333,7 @@ class OorderService extends ServiceBase { ...@@ -317,6 +333,7 @@ class OorderService extends ServiceBase {
let key = item.id + "_" + item.status; let key = item.id + "_" + item.status;
let v = map[key] || {}; let v = map[key] || {};
item.statusName = v.name; item.statusName = v.name;
item.status_name = v.name;
item.next_status = JSON.parse(v.next_status || "[]"); item.next_status = JSON.parse(v.next_status || "[]");
} }
console.log(orderList); console.log(orderList);
...@@ -435,8 +452,6 @@ class OorderService extends ServiceBase { ...@@ -435,8 +452,6 @@ class OorderService extends ServiceBase {
} }
} }
module.exports = OorderService; module.exports = OorderService;
\ No newline at end of file
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