Commit 6d3e1eb1 by 王昆

'个体户审核页面简单应用开发'

parent 64a6e6e3
......@@ -19,5 +19,38 @@ class BMmerchantcompanyDao extends Dao{
return list;
}
async findMapByIds(ids) {
let result = {};
if(!ids || ids.length == 0) {
return result;
}
let sql = "SELECT * FROM bm_merchant_company where id IN (:ids) ";
let list = await this.customQuery(sql, {ids:ids});
if(!list || list.length == 0) {
return result;
}
for(let item of list) {
result[item.id] = item;
}
return result;
}
async setMerchantCompany(list, idField) {
if (!list || list.length == 0) {
return;
}
let ids = [];
for (let item of list) {
ids.push(item[idField] || 0);
}
let map = await this.findMapByIds(ids);
for (let item of list) {
item.merchantCompany = map[(item.id || 0)] || {};
}
}
}
module.exports=BMmerchantcompanyDao;
......@@ -28,7 +28,64 @@ class BmuserbizDao extends Dao{
let sql = `UPDATE ${this.model.tableName} SET front_half_img = :front_half_img, declaration_file = :declaration_file, updated_at = NOW() WHERE idcard = :idcard`;
let rs = await this.customUpdate(sql, params);
return rs;
}
async countByCondition(params) {
let sql = [];
sql.push("SELECT");
sql.push("count(DISTINCT t1.id) as num");
sql.push("FROM bm_user_biz t1");
sql.push("INNER JOIN bm_order t2 ON t1.orderId = t2.id");
sql.push("WHERE 1 = 1 ");
this.setCondition(sql, params);
let list = await this.customQuery(sql.join(" "), params);
if (!list || list.length == 0) {
return 0;
}
return list[0].num;
}
async listByCondition(params) {
params.startRow = Number(params.startRow || 0);
params.pageSize = Number(params.pageSize || 10);
let sql = [];
sql.push("SELECT");
sql.push("t1.*, ");
sql.push("t1.merchantId, t2.companyId, t2.orderNo, t2.audit_status");
sql.push("FROM bm_user_biz t1");
sql.push("INNER JOIN bm_order t2 ON t1.orderId = t2.id");
sql.push("WHERE 1 = 1 ");
this.setCondition(sql, params);
sql.push("ORDER BY t1.id DESC");
sql.push("LIMIT :startRow, :pageSize");
return await this.customQuery(sql.join(" "), params);
}
setCondition(sql, params) {
if (!params || !sql) {
return;
}
if (params.hasOwnProperty("audit_status")) {
sql.push("AND t2.audit_status = :audit_status");
}
if (params.merchantId) {
sql.push("AND t1.merchantId = :merchantId");
}
if (params.legalName) {
params.legalNameLike = `%${params.legalName}%`;
sql.push("AND t1.legal_name LIKE :legalNameLike");
}
if (params.legal_mobile) {
sql.push("AND t1.legal_mobile = :legal_mobile");
}
if (params.idcard) {
sql.push("AND t1.idcard = :idcard");
}
}
}
module.exports=BmuserbizDao;
const system=require("../../system");
const ServiceBase=require("../sve.base");
const system = require("../../system");
const ServiceBase = require("../sve.base");
const md5 = require("md5");
class BmuserbizService extends ServiceBase{
constructor(){
super(ServiceBase.getDaoName(BmuserbizService));
//this.appDao=system.getObject("db.appDao");
this.restClient = system.getObject("util.restClient");
class BmuserbizService extends ServiceBase {
constructor() {
super(ServiceBase.getDaoName(BmuserbizService));
//this.appDao=system.getObject("db.appDao");
this.restClient = system.getObject("util.restClient");
this.bmmerchantcompanyDao = system.getObject("db.bmmerchantcompanyDao");
}
async saveByStep(userbiz) {
if(!userbiz || !userbiz.id) {
if (!userbiz || !userbiz.id) {
return;
}
var biz = await this.findById(userbiz.id);
var step = biz.step;
if(step == 1) {
if (step == 1) {
biz.idcard_front = userbiz.idcard_front;
biz.idcard_back = userbiz.idcard_back;
biz.idcard = userbiz.idcard;
biz.realName = userbiz.realName;
biz.step = 2;
} else if(step == 2) {
} else if (step == 2) {
biz.bank_front = userbiz.bank_front;
biz.bank_back = userbiz.bank_back;
biz.bank = userbiz.bank;
......@@ -33,12 +35,12 @@ class BmuserbizService extends ServiceBase{
// if(stdout.code != 0) {
// return stdout.msg || "银行三要素(姓名、身份证、银行卡)验证失败"
// }
} else if(step == 3) {
} else if (step == 3) {
biz.person_img = userbiz.person_img;
biz.legal_name = userbiz.legal_name;
biz.legal_mobile = userbiz.legal_mobile;
biz.step = 4;
} else if(step == 4) {
} else if (step == 4) {
biz.companyNames = userbiz.companyNames;
biz.businessScope = userbiz.businessScope;
biz.step = 5;
......@@ -51,7 +53,7 @@ class BmuserbizService extends ServiceBase{
async checkBank(biz) {
var params = {
accNo : biz.bankno,
accNo: biz.bankno,
idName: biz.realName,
idNo: biz.idcard,
nonceStr: await this.getUidStr(16),
......@@ -66,5 +68,30 @@ class BmuserbizService extends ServiceBase{
async updateSupplement(params) {
return this.dao.updateSupplement(params);
}
async pageByCondition(params) {
let currentPage = Number(params.currentPage || 1);
params.pageSize = Number(params.pageSize || 10);
params.startRow = (currentPage - 1) * params.pageSize;
var page = {
count: 0,
rows: []
};
page.count = await this.dao.countByCondition(params);
if (page.count == 0) {
return page;
}
page.rows = await this.dao.listByCondition(params) || [];
if (page.rows) {
for (let item of page.rows) {
this.handleDate(item, ["created_at"], null, -8);
}
// await this.bmmerchantcompanyDao.setMerchantCompany(page.rows, "companyId");
}
return page;
}
}
module.exports=BmuserbizService;
module.exports = BmuserbizService;
......@@ -346,6 +346,61 @@ class xggApplet extends AppletBase {
}
}
async toAuditOrders(gobj, pobj, req) {
pobj = pobj.search || {};
try {
let params = {
pageSize: pobj.pageSize || 10,
currentPage: pobj.currentPage || 1,
audit_status: 0,
merchantId: this.merchantId,
legalName: this.trim(pobj.legalName)
};
//0待审核 1审核通过
let page = await this.bmuserbizSve.pageByCondition(params);
let result = {code : 1, data: page};
return result;
} catch (e) {
console.log(e.stack);
//日志记录
logCtl.error({
optitle: "toAuditOrders, params [" + JSON.stringify(params) + " ]",
op: "wxapplet/impl/xggApplet/toAuditOrders",
content: e.stack,
clientIp: req.clientIp
});
return {
code: -200,
msg: "error",
data: {},
stack : e.stack
};
}
}
/**
* 审核
* @param {*} gobj
* @param {*} pobj
* @param {*} req
* @param {*} loginUser
*/
async auditBiz(gobj, pobj, req, loginUser){
try {
let param = {
auditId: 1,
rejectReason:this.trim(pobj.auditReason),
auditStatus:parseInt(pobj.auditStatus),
id: this.trim(pobj.id)
}
return await this.bmorderSve.audit(param);
} catch (error) {
console.log(error);
return system.getResult(null,error);
}
}
/**
* 审核
* @param {*} gobj
......
......@@ -58,7 +58,9 @@ module.exports = function (app) {
res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild');
res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
// res.header('Access-Control-Allow-Credentials', 'true');
if (req.method == 'OPTIONS') {
res.header('content-type', 'text/html;charset=UTF-8');
if (req.method == 'OPTIONS') {
res.send(200); /让options请求快速返回/
}
else {
......
......@@ -115,4 +115,7 @@ module.exports = function (app) {
app.get('/supplement_hc', function (req, res) {
res.render("supplement_hc", {});
});
app.get('/audit_page', function (req, res) {
res.render("audit_page", {});
});
};
var app = new Vue({
el: "#app",
data: function () {
return {
btnloading: false,
uploadLoading: null,
showAudit: false,
auditLoading: false,
search: {
list: [],
currentPage: 1,
pageSize: 20,
total : 0,
legalName:'',
},
auditItem: {},
auditReason: "",
}
},
created: function () {
},
mounted: function () {
$("#loading").fadeOut();
this.opSearch();
},
methods: {
postReq(path, data) {
return axios.post(path, data).then(function (r) {
return r.data ? r.data : null;
})
},
resetSearch() {
this.search = this.getEmptySearch();
this.getList();
},
getEmptySearch() {
return {
list: [],
currentPage: 1,
pageSize: 20,
total : 0,
legalName:'',
}
},
getParams() {
var params = {};
for(var f in this.search) {
if(f == "list") {
continue;
}
params[f] = this.search[f];
}
return params;
},
opSearch() {
this.search.currentPage = 1;
this.search.total = 0;
this.getList();
},
getList() {
var self = this;
var params = this.getParams();
this.$root.postReq("/applet/xggApplet/toAuditOrders", {
search: params
}).then(function (d) {
if (d.code == 1) {
self.search.list = d.data.rows || [];
self.search.total = d.data.count || 0;
} else {
}
});
},
btnclick (pfm, code) {
},
openAudit(item) {
console.log(item);
this.auditItem = item;
if (item.audit_status == 0) {
item.audit_status_name = "待审核";
} else if (item.audit_status == 1) {
item.audit_status_name = "审核通过";
} else {
item.audit_status_name = "审核驳回";
}
if (item.companyId == 1) {
item.companyName = "汇财"
} else if(item.companyId == 2) {
item.companyName = "张舟怡帆---北京"
} else {
item.companyName = "网众共创---北京"
}
item.companyNames = item.companyNames.split("#com#").join(",");
this.auditReason = "";
this.auditLoading = false;
this.showAudit = true;
},
saveAudit(auditStatus) {
var self = this;
self.auditLoading = true;
if (auditStatus == 2 && (!this.auditReason || !this.auditReason.trim())) {
self.auditLoading = false;
self.$message.warning("请输入驳回原因");
return;
}
var auditParam = {
auditStatus: auditStatus,
auditReason: this.auditReason,
id: this.auditItem.orderId
};
// 处理审核
self.$root.postReq("/applet/xggApplet/auditBiz", auditParam).then(function(d){
console.log(d);
if (d.code == 1) {
self.showAudit = false;
self.getList();
self.$message.success("审核成功");
self.auditItem = {};
} else {
self.$message.warning(d.msg || "审核成功, 请稍候重试");
}
self.auditLoading = false;
});
},
topic_preview(filed) {
let url = this.auditItem[filed || ""];
if(url) {
window.open(url);
} else {
this.$message.warning("未上传");
}
},
onColFormater(row, column, cellValue, index) {
return cellValue || "---";
},
handleSizeChange(val) {
this.search.pageSize = val;
this.resetSearch();
},
handleCurrentChange(val) {
this.search.currentPage = val;
this.getList();
},
demofunction() {
},
},
});
\ 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