Commit f966fb03 by 王昆

gbs

parent ec2cffd0
......@@ -47,6 +47,7 @@ class OorderdeliverDao extends Dao {
async findOrders(params){
let sql = [];
sql.push(`SELECT a.id,b.created_at,a.service_items,a.status,b.deliver_divide,b.operator_id,b.completed_at,
a.desc, a.service_remark,
b.deliver_name FROM o_order_deliver b INNER JOIN o_order a on
b.order_id=a.id WHERE b.deliver_id = '${params.deliver_id}' `);
this.setOrderCount(sql,params);
......
......@@ -37,7 +37,7 @@ class OorderService extends ServiceBase {
order.product_id = Number(params.product_id);
order.source_id = Number(params.source_id);
order.source_no = this.trim(params.source_no);
order.notes = this.trim(params.notes);
order.desc = this.trim(params.notes);
order.contact_mobile = this.trim(params.contact_mobile);
// 验证订单是否存在
......
......@@ -63,6 +63,13 @@ class OorderdeliverService extends ServiceBase {
let rows = await this.dao.findOrders(where);
//格式化订单状态
await this.formateStatus(rows);
await this.formateServiceItems(rows);
for (var row of rows) {
this.handleDate(row, ["created_at"], "YYYY-MM-DD HH:mm:ss", -8);
}
let res = {
count,rows
};
......@@ -115,6 +122,28 @@ class OorderdeliverService extends ServiceBase {
console.log(orderList);
}
async formateServiceItems(orderList) {
let ids = [];
let statuses = [];
for (let item of orderList) {
let productIds = this.trim(item.service_items).split(",");
ids = ids.concat(productIds);
}
let productMap = await this.oproductDao.mapByIds(ids);
for (let item of orderList) {
let productIds = this.trim(item.service_items).split(",");
let names = [];
for (var productId of productIds) {
let product = productMap[productId];
if (product) {
names.push(product.name);
}
}
item.service_items_name = names.join(",");
}
}
}
......
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