Commit 483f03c8 by 宋毅

tj

parent 3b14823f
...@@ -27,6 +27,10 @@ class OrderAPI extends APIBase { ...@@ -27,6 +27,10 @@ class OrderAPI extends APIBase {
switch (action_type) { switch (action_type) {
case "addOrder"://创建订单 case "addOrder"://创建订单
opResult = await this.addOrder(pobj, pobj.actionBody); opResult = await this.addOrder(pobj, pobj.actionBody);
await this.pushOrder(opResult, pobj, pobj.actionBody);
break;
case "getOrderList"://创建订单
opResult = await this.orderinfoSve.getOrderList(pobj, pobj.actionBody);
break; break;
case "getPayOrderInfo"://获取付款订单信息 case "getPayOrderInfo"://获取付款订单信息
opResult = await this.orderinfoSve.getPayOrderInfo(pobj, pobj.actionBody); opResult = await this.orderinfoSve.getPayOrderInfo(pobj, pobj.actionBody);
...@@ -44,7 +48,22 @@ class OrderAPI extends APIBase { ...@@ -44,7 +48,22 @@ class OrderAPI extends APIBase {
if (!actionBody.product_info) { if (!actionBody.product_info) {
return system.getResult(null, "产品信息有误,20010"); return system.getResult(null, "产品信息有误,20010");
} }
var interface_info = actionBody.product_info.interface_info; var interface_info = null;
var interface_list = actionBody.product_info.interface_info;
if (interface_list) {
var interface_list_temp = interface_list.filter(f => f.op_type == "addOrder")
if (interface_list_temp && interface_list_temp.length > 0) {
interface_info = interface_list_temp[0];
}
}
if (!interface_list) {
interface_info = {
interface_type: "bd",
interface_url: "service.dbcorder.orderinfoSve",
params: "createOtherOrder"
};
}//使用默认的其他订单
if (!interface_info) { if (!interface_info) {
return system.getResult(null, "产品接口信息有误,20030"); return system.getResult(null, "产品接口信息有误,20030");
} }
...@@ -71,6 +90,23 @@ class OrderAPI extends APIBase { ...@@ -71,6 +90,23 @@ class OrderAPI extends APIBase {
} }
return opResult; return opResult;
} }
async pushOrder(opResult, pobj, actionBody) {
if (opResult.status != 0) {
return "";
}
var interface_info = null;
var interface_list = actionBody.product_info.interface_info;
if (interface_list) {
var interface_list_temp = interface_list.filter(f => f.op_type == "pushOrder")
if (interface_list_temp && interface_list_temp.length > 0) {
interface_info = interface_list_temp[0];
}
}
if (!interface_info) {
return "";
}
//TODO:推送订单
}
} }
module.exports = OrderAPI; module.exports = OrderAPI;
\ No newline at end of file
...@@ -28,9 +28,9 @@ class OrderInfoService extends ServiceBase { ...@@ -28,9 +28,9 @@ class OrderInfoService extends ServiceBase {
uapp_id: pobj.appInfo.uapp_id,//int(11) // uapp_id: pobj.appInfo.uapp_id,//int(11) //
orderNo: orderNo,//varchar(64) //订单号 orderNo: orderNo,//varchar(64) //订单号
channelServiceNo: channelOrder.channelServiceNo || "",//varchar(64) //渠道服务单号 channelServiceNo: channelOrder.channelServiceNo || "",//varchar(64) //渠道服务单号
channelOrderNo: channelOrder.channelOrderNo || "",//varchar(1024) //渠道订单号列表,多个以,隔开 channelOrderNo: channelOrder.channelOrderNo.length > 0 ? string.join(channelOrder.channelOrderNo, ",") : "",//varchar(1024) //渠道订单号列表,多个以,隔开
channelUserId: pobj.userInfo.channel_userId,//varchar(64) // channelUserId: pobj.userInfo.channel_userid,//varchar(64) //
ownerUserId: pobj.userInfo.channel_userId,//varchar(20) // ownerUserId: pobj.userInfo.channel_userid,//varchar(20) //
payTime: channelOrder.orderStatus && channelOrder.orderStatus == 1 ? payTime : null,//datetime // payTime: channelOrder.orderStatus && channelOrder.orderStatus == 1 ? payTime : null,//datetime //
quantity: actionBody.quantity,//int(11) //项目订单数量(即服务项目的倍数,默认值为1) quantity: actionBody.quantity,//int(11) //项目订单数量(即服务项目的倍数,默认值为1)
serviceQuantity: 0,//int(11) //项目订单交付数量(即与项目订单数量相对应) serviceQuantity: 0,//int(11) //项目订单交付数量(即与项目订单数量相对应)
...@@ -89,8 +89,8 @@ class OrderInfoService extends ServiceBase { ...@@ -89,8 +89,8 @@ class OrderInfoService extends ServiceBase {
var moneyObj = { var moneyObj = {
uapp_id: pobj.appInfo.uapp_id, uapp_id: pobj.appInfo.uapp_id,
sourceOrderNo: orderNo, // 来源单号 sourceOrderNo: orderNo, // 来源单号
channelUserId: pobj.userInfo.channel_userId, channelUserId: pobj.userInfo.channel_userid,
ownerUserId: pobj.userInfo.channel_userId, ownerUserId: pobj.userInfo.channel_userid,
accountType: "other",//帐户类型( 支付类型):"cash": "现金", "bank": "银行" ,"wx":"微信","alipay":"支付宝","other":"其它" accountType: "other",//帐户类型( 支付类型):"cash": "现金", "bank": "银行" ,"wx":"微信","alipay":"支付宝","other":"其它"
directionType: "sr",//凭单类型,"sr": "收","zc": "支" directionType: "sr",//凭单类型,"sr": "收","zc": "支"
voucherDate: payTime,//凭单时间 voucherDate: payTime,//凭单时间
...@@ -191,5 +191,37 @@ class OrderInfoService extends ServiceBase { ...@@ -191,5 +191,37 @@ class OrderInfoService extends ServiceBase {
} }
return system.getResultSuccess(); return system.getResultSuccess();
} }
async getOrderList(pobj, actionBody) {//获取已经付款的订单信息列表
if (actionBody.pageIndex) {
actionBody.pageIndex = 1;
}
if (actionBody.pageSize) {
actionBody.pageSize = 20;
}
var pageSize = Number(actionBody.pageSize);
if (pageSize > 50) {
pageSize = 50;
}
var pageIndex = Number(actionBody.pageSize);
var pageIndex = actionBody.pageIndex == 1 ? 0 : Number((actionBody.pageIndex - 1) * pageSize);
var sql = "select `orderNo`,`channelServiceNo`,`channelOrderNo`,`channelUserId`,`ownerUserId`,`payTime`,`quantity`,`serviceQuantity`,`orderStatusName`,`orderStatus`,`totalSum`,`payTotalSum`,`refundSum`,`invoiceApplyStatus`,`opNotes`,`channelItemCode`,`channelItemName`,`serviceItemCode`,`picUrl`"
+ " from v_order where uapp_id=" + pobj.appInfo.uapp_id + " and channelUserId=" + pobj.userInfo.channel_userid;
if (actionBody.channelItemName) {
sql += " and channelItemName like '%" + actionBody.channelItemName + "%'";
}
if (actionBody.channelServiceNo) {
sql += " and channelServiceNo like '%" + actionBody.channelServiceNo + "%'";
}
if (actionBody.orderStatus) {
sql += " and orderStatus ='" + actionBody.orderStatus + "'";
}
sql += " LIMIT " + pageSize + " OFFSET " + pageIndex;
var list = await this.customQuery(sql);
return system.getResultSuccess(list);
}
} }
module.exports = OrderInfoService; module.exports = OrderInfoService;
\ 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