Commit 404f9a06 by 王昆

gsb

parent 3d11ca21
...@@ -4,6 +4,7 @@ class ChannelCtl extends CtlBase { ...@@ -4,6 +4,7 @@ class ChannelCtl extends CtlBase {
constructor() { constructor() {
super(); super();
this.orderSve = system.getObject("service.saas.orderSve"); this.orderSve = system.getObject("service.saas.orderSve");
this.merchantSve = system.getObject("service.saas.merchantSve");
} }
async microAdd(params, pobj2, req) { async microAdd(params, pobj2, req) {
...@@ -30,6 +31,42 @@ class ChannelCtl extends CtlBase { ...@@ -30,6 +31,42 @@ class ChannelCtl extends CtlBase {
} }
} }
async checkPay(params, pobj2, req) {
try {
if(!params.ids || params.ids.length == 0) {
return system.getResult(null, "请至少选择一笔订单");
}
let omap = await this.orderSve.mapByIds({ids: params.ids, attrs: "id, pay_status, price"});
let totalPrice = 0;
let totalNum = 0;
for(let id of params.ids) {
let obj = omap[id];
if(!obj || obj.pay_status !== "10") {
return system.getResult(null , "选择的订单中存在已支付的订单");
}
totalPrice = totalPrice + Number(obj.price);
}
totalNum = params.ids.length;
totalPrice = system.f2y(totalPrice);
let info = await this.merchantSve.info({id: params.saas_merchant_id}) || {};
info = info.data || {};
let result = {
totalNum : totalNum,
totalPrice : totalPrice,
account_name: info.account_name,
account_bank_name: info.account_bank_name,
account_bank_no: info.account_bank_no,
}
// 获取商户信息
return system.getResult(result);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async offlinePay(params, pobj2, req) { async offlinePay(params, pobj2, req) {
try { try {
if(!params.ids || params.ids.length == 0) { if(!params.ids || params.ids.length == 0) {
......
...@@ -29,6 +29,11 @@ class OrderService extends ServiceBase { ...@@ -29,6 +29,11 @@ class OrderService extends ServiceBase {
return rs; return rs;
} }
async mapByIds(params) {
let rs = await this.callms("order", "saasOrderMapByIds", params) || {};
return rs.data || {};
}
transOrderField(rows) { transOrderField(rows) {
if (!rows || rows.length == 0) { if (!rows || rows.length == 0) {
return; return;
......
<a name="menu">目录</a> <a name="menu">目录</a>
1. [订单列表](#page) 1. [订单列表](#page)
1. [查看详情](#info) 1. [查看详情](#info)
1. [支付验证](#checkPay)
1. [订单支付](#offlinePay) 1. [订单支付](#offlinePay)
## **<a name="page"> 订单列表</a>** ## **<a name="page"> 订单列表</a>**
...@@ -141,6 +142,45 @@ ...@@ -141,6 +142,45 @@
``` ```
## **<a name="checkPay"> 支付验证</a>**
[返回到目录](#menu)
##### URL
[/web/saas/orderCtl/checkPay]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"status": 0,
"msg": "操作成功",
"data": {
"totalNum": 3, // 共 XX 笔订单
"totalPrice": 4500, // 应付金额 元
"account_name": "扬大", // 账户名称
"account_bank_name": "中国银行", // 开户银行
"account_bank_no": "222" // 银行账户
},
"bizmsg": "empty"
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": null,
"requestid": "b46e1ff5176143ffa4135a357f93d757"
}
```
## **<a name="offlinePay"> 订单支付</a>** ## **<a name="offlinePay"> 订单支付</a>**
[返回到目录](#menu) [返回到目录](#menu)
##### URL ##### URL
......
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