Commit 63a48587 by 王昆

gsb

parent d4e976a6
var system = require("../../../system")
const CtlBase = require("../../ctlms.base");
class MerchantCtl extends CtlBase {
constructor() {
super();
this.merchantSve = system.getObject("service.saas.merchantSve");
}
async dics(params, pobj2, req) {
try {
return await this.merchantSve.dics(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async info(params, pobj2, req) {
try {
return await this.merchantSve.info(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async page(params, pobj2, req) {
try {
this.doTimeCondition(params, ["createBegin", "createEnd"]);
return await this.merchantSve.page(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async signPage(params, pobj2, req) {
try {
params.is_sign = 1;
this.doTimeCondition(params, ["createBegin", "createEnd"]);
return await this.merchantSve.page(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async save(params, pobj2, req) {
try {
return await this.merchantSve.save(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async sign(params, pobj2, req) {
try {
params.bm_reg_price = system.y2f(params.bm_reg_price || 0);
params.invoice_service_rate = system.y2f(params.invoice_service_rate || 0);
params.trans_service_rate = system.y2f(params.trans_service_rate || 0);
return await this.merchantSve.sign(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async signInfo(params, pobj2, req) {
try {
return await this.merchantSve.signInfo(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
}
module.exports = MerchantCtl;
\ No newline at end of file
......@@ -25,5 +25,10 @@ class ChannelService extends ServiceBase {
var rs = await this.callms("merchant", "channelInfo", params);
return rs;
}
async mapByIds(params) {
var rs = await this.callms("merchant", "channelMapByIds", params);
return rs;
}
}
module.exports = ChannelService;
\ No newline at end of file
......@@ -25,5 +25,10 @@ class MainService extends ServiceBase {
var rs = await this.callms("merchant", "mainInfo", params);
return rs;
}
async mapByIds(params) {
var rs = await this.callms("merchant", "mainMapByIds", params);
return rs;
}
}
module.exports = MainService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
class MerchantService extends ServiceBase {
constructor() {
super();
this.channelSve = system.getObject("service.saas.channelSve");
this.mainSve = system.getObject("service.saas.mainSve");
}
async mapByIds(params) {
var rs = await this.callms("merchant", "mchtMapByIds", params || {});
return rs;
}
async dics(params) {
var rs = await this.callms("merchant", "mchtDics", params);
return rs;
}
async info(params) {
var rs = await this.callms("merchant", "mchtInfo", params);
if(rs.data && rs.data.sign) {
this.transSignFields([rs.data.sign]);
await this.setChannel([rs.data]);
}
return rs;
}
async save(params) {
var rs = await this.callms("merchant", "mchtSave", params);
return rs;
}
async page(params) {
var rs = await this.callms("merchant", "mchtPage", params);
if(rs.data && rs.data.rows) {
this.transSignFields(rs.data.rows);
await this.setChannel(rs.data.rows);
await this.setMain(rs.data.rows);
}
return rs;
}
async sign(params) {
var rs = await this.callms("merchant", "mchtSign", params);
return rs;
}
async signInfo(params) {
var rs = await this.callms("merchant", "mchtSignInfo", params);
if(rs.data) {
this.transSignFields([rs.data]);
}
return rs;
}
async setChannel(rows) {
if(!rows) {
return;
}
let channelIds = [];
for(let row of rows) {
if(row.channel_id) {
channelIds.push(row.channel_id);
}
}
if(channelIds.length == 0) {
return;
}
let map = await this.channelSve.mapByIds({ids: channelIds}) || {};
map = map.data || {};
for(let row of rows) {
row.channel = map[row.channel_id] || {};
}
}
async setMain(rows) {
if(!rows) {
return;
}
let mainIds = [];
for(let row of rows) {
if(row.main_id) {
mainIds.push(row.main_id);
}
}
if(mainIds.length == 0) {
return;
}
let map = await this.mainSve.mapByIds({ids: mainIds}) || {};
map = map.data || {};
for(let row of rows) {
row.main = map[row.main_id] || {};
}
}
transSignFields(rows) {
if (!rows) {
return;
}
for (var item of rows) {
if (!item) {
continue;
}
item.bm_reg_price = system.f2y(item.bm_reg_price);
item.invoice_service_rate = system.f2y(item.invoice_service_rate);
item.trans_service_rate = system.f2y(item.trans_service_rate);
}
}
}
module.exports = MerchantService;
\ No newline at end of file
<a name="menu">目录</a>
1. [字典](#dics)
1. [商户列表](#page)
1. [新增/修改](#save)
1. [详情](#info)
1. [签约](#sign)
1. [签约列表](#signPage)
## **<a name="dics"> 字典</a>**
[返回到目录](#menu)
##### URL
[/web/saas/merchantCtl/dics]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": [
{
"id": 110361382269, // 商户id
"name": "司机宝" // 商户名称
"short_name": "去测1" // 简称
},
]
}
```
## **<a name="page"> 商户列表</a>**
[返回到目录](#menu)
##### URL
[/web/saas/merchantCtl/page]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"currentPage": "1",
"pageSize": "10",
"name": "", // 商户名称
"createBegin": "", // 开始时间
"createEnd": "", // 结束时间
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 10,
"rows": [
{
"id": "13575990142000991", // 商户编号
"name" : "", // 商户名称,
"short_name" : "", // 商户简称,
"credit_code" : "", // 统一社会信用代码,
"business_lincense_img" : "", // 营业执照图,
"residence" : "", // 住所,
"tax_type" : "", // 纳税人类型 00一般纳税人 10小规模纳税人,
"business_scope" : "", // 经营范围,
"term" : "", // 经营期限 1长期 2固定日期,
"term_end" : "", // 经营期限固定日期,
"idcard_front" : "", // 身份证正面照片,
"idcard_back" : "", // 身份证反面照片,
"legal_idno" : "", // 身份证号码,
"legal_name" : "", // 法人姓名,
"validity" : "", // 经营期限 1长期 2固定日期,
"validity_end" : "", // 经营期限固定日期,
"account_name" : "", // 对公账户-账户名称,
"account_bank_name" : "", // 对公账户-开户行,
"account_bank_no" : "", // 对公账户-开户账号,
"account_mobile" : "", // 对公账户-联系电话,
"contact_man" : "", // 联系人-联系人姓名,
"contact_mobile" : "", // 联系电话,
"contact_email" : "", // 联系邮箱
"main_id": 50000, // 签约主体id
"begin_date": "2020-03-19", // 签约开始时间
"end_date": "2025-03-19", // 签约结束时间
"bm_reg_price": 5.11, // 个体户注册单价
"invoice_service_rate": 6.01, // 开票服务费比率
"trans_service_rate": 16.1, // 转账服务费比率
// 渠道对象
"channel": {
"id": "", // 渠道id
"name": "", // 渠道名称
"short_name": "", // 渠道简称
},
// 签约主体对象
"main": {
"name": "name2", // 签约主体名称
}
},
]
},
"requestid": "081f13fd9dd5441094487eeff6d0ff6f"
}
```
## **<a name="save"> 添加/修改</a>**
[返回到目录](#menu)
##### URL
[/web/saas/merchantCtl/save]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": 0, // id,为空或者不填写该字段时新增,指定具体id时修改
"channel_id": "13575990531", // 渠道id
"name" : "", // 商户名称,
"short_name" : "", // 商户简称,
"credit_code" : "", // 统一社会信用代码,
"business_lincense_img" : "", // 营业执照图,
"residence" : "", // 住所,
"tax_type" : "", // 纳税人类型 00一般纳税人 10小规模纳税人,
"business_scope" : "", // 经营范围,
"term" : "", // 经营期限 1长期 2固定日期,
"term_end" : "", // 经营期限固定日期,
"idcard_front" : "", // 身份证正面照片,
"idcard_back" : "", // 身份证反面照片,
"legal_idno" : "", // 身份证号码,
"legal_name" : "", // 法人姓名,
"validity" : "", // 经营期限 1长期 2固定日期,
"validity_end" : "", // 经营期限固定日期,
"account_name" : "", // 对公账户-账户名称,
"account_bank_name" : "", // 对公账户-开户行,
"account_bank_no" : "", // 对公账户-开户账号,
"account_mobile" : "", // 对公账户-联系电话,
"contact_man" : "", // 联系人-联系人姓名,
"contact_mobile" : "", // 联系电话,
"contact_email" : "", // 联系邮箱
"created_at": "9", // 创建时间
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {}
}
```
## **<a name="info"> 详情</a>**
[返回到目录](#menu)
##### URL
[/web/saas/merchantCtl/info]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": "" // id
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"id": "13575990142000991", // 渠道编号
"channel_id": "13575990531", // 渠道id
"name" : "", // 渠道名称,
"short_name" : "", // 渠道简称,
"credit_code" : "", // 统一社会信用代码,
"business_lincense_img" : "", // 营业执照图,
"residence" : "", // 住所,
"tax_type" : "", // 纳税人类型 00一般纳税人 10小规模纳税人,
"business_scope" : "", // 经营范围,
"term" : "", // 经营期限 1长期 2固定日期,
"term_end" : "", // 经营期限固定日期,
"idcard_front" : "", // 身份证正面照片,
"idcard_back" : "", // 身份证反面照片,
"legal_idno" : "", // 身份证号码,
"legal_name" : "", // 法人姓名,
"validity" : "", // 经营期限 1长期 2固定日期,
"validity_end" : "", // 经营期限固定日期,
"account_name" : "", // 对公账户-账户名称,
"account_bank_name" : "", // 对公账户-开户行,
"account_bank_no" : "", // 对公账户-开户账号,
"account_mobile" : "", // 对公账户-联系电话,
"contact_man" : "", // 联系人-联系人姓名,
"contact_mobile" : "", // 联系电话,
"contact_email" : "", // 联系邮箱
"created_at": "9", // 创建时间
// 签约信息
"sign": {
"main_id": 50000, // 签约主体id
"begin_date": "2020-03-19", // 签约开始时间
"end_date": "2025-03-19", // 签约结束时间
"bm_reg_price": 5.11, // 个体户注册单价
"invoice_service_rate": 6.01, // 开票服务费比率
"trans_service_rate": 16.1, // 转账服务费比率
},
// 渠道对象
"channel": {
"id": "", // 渠道id
"name": "", // 渠道名称
"short_name": "", // 渠道简称
},
},
"requestid": "cf6320a1b615423b8a9ceb3b66b713f1"
}
```
## **<a name="signPage"> 签约列表</a>**
[返回到目录](#menu)
##### URL
[/web/saas/merchantCtl/signPage]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"currentPage": "1",
"pageSize": "10",
"name": "", // 商户名称
"createBegin": "", // 开始时间
"createEnd": "", // 结束时间
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 10,
"rows": [
{
"id": "13575990142000991", // 商户编号
"name" : "", // 商户名称,
"short_name" : "", // 商户简称,
"credit_code" : "", // 统一社会信用代码,
"business_lincense_img" : "", // 营业执照图,
"residence" : "", // 住所,
"tax_type" : "", // 纳税人类型 00一般纳税人 10小规模纳税人,
"business_scope" : "", // 经营范围,
"term" : "", // 经营期限 1长期 2固定日期,
"term_end" : "", // 经营期限固定日期,
"idcard_front" : "", // 身份证正面照片,
"idcard_back" : "", // 身份证反面照片,
"legal_idno" : "", // 身份证号码,
"legal_name" : "", // 法人姓名,
"validity" : "", // 经营期限 1长期 2固定日期,
"validity_end" : "", // 经营期限固定日期,
"account_name" : "", // 对公账户-账户名称,
"account_bank_name" : "", // 对公账户-开户行,
"account_bank_no" : "", // 对公账户-开户账号,
"account_mobile" : "", // 对公账户-联系电话,
"contact_man" : "", // 联系人-联系人姓名,
"contact_mobile" : "", // 联系电话,
"contact_email" : "", // 联系邮箱
"main_id": 50000, // 签约主体id
"begin_date": "2020-03-19", // 签约开始时间
"end_date": "2025-03-19", // 签约结束时间
"bm_reg_price": 5.11, // 个体户注册单价
"invoice_service_rate": 6.01, // 开票服务费比率
"trans_service_rate": 16.1, // 转账服务费比率
// 渠道对象
"channel": {
"id": "", // 渠道id
"name": "", // 渠道名称
"short_name": "", // 渠道简称
},
// 签约主体对象
"main": {
"name": "name2", // 签约主体名称
}
},
]
},
"requestid": "081f13fd9dd5441094487eeff6d0ff6f"
}
```
## **<a name="sign"> 签约</a>**
[返回到目录](#menu)
##### URL
[/web/saas/merchantCtl/sign]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": "11247613260000707", // 商户id
"main_id": 50000, // 签约主体id
"begin_date": "2020-03-19", // 签约开始时间
"end_date": "2025-03-19", // 签约结束时间
"bm_reg_price": 5.11, // 个体户注册单价
"invoice_service_rate": 6.01, // 开票服务费比率
"trans_service_rate": 16.1, // 转账服务费比率
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data":
}
```
\ 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