64 lines
2.0 KiB
JavaScript
64 lines
2.0 KiB
JavaScript
'use strict';
|
|
const dbName = require("../../../../dao/config.js")
|
|
module.exports = {
|
|
/**
|
|
* 签署合同
|
|
* @url client/enquiry/quote/kh/extSign 前端调用的url参数地址
|
|
* data 请求参数
|
|
* @param {String} params1 参数1
|
|
*/
|
|
main: async (event) => {
|
|
let { data = {}, userInfo, util, filterResponse, originalParam } = event;
|
|
let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
|
|
let { uid, contractId } = data;
|
|
let res = { code: 0, msg: "" };
|
|
// 业务逻辑开始-----------------------------------------------------------
|
|
// 获取用户ID
|
|
const {fadadaCustomerId} = userInfo
|
|
|
|
// 获取合同信息
|
|
const userContract = await vk.baseDao.selects({
|
|
dbName: dbName.userContract,
|
|
getMain: true,
|
|
getOne: true,
|
|
whereJson: {
|
|
contractId: contractId,
|
|
userId: uid
|
|
},
|
|
foreignDB:[
|
|
{
|
|
dbName: dbName.contract,
|
|
localKey:"contractId", // 主表外键字段名
|
|
foreignKey: "_id", // 副表外键字段名
|
|
as: "contract",
|
|
limit: 1, // 当limit = 1时,以对象形式返回,否则以数组形式返回
|
|
}
|
|
],
|
|
})
|
|
console.log('userContract: ',userContract);
|
|
|
|
let sign_keyword = '';
|
|
if(userContract.role == 'buyer') {
|
|
sign_keyword = userContract.contract.buyerSignKeyword
|
|
}else if(userContract.role == 'seller') {
|
|
sign_keyword = userContract.contract.sellerSignKeyword
|
|
}
|
|
|
|
|
|
const fadadaUrl = await pubFun.fadadaUrl('extsign.api', {
|
|
transaction_id: userContract.transactionId,
|
|
contract_id: userContract.contract.fadadaContractId,
|
|
customer_id: fadadaCustomerId,
|
|
doc_title: userContract.contract.docTitle,
|
|
sign_keyword: sign_keyword,
|
|
notify_url: 'https://fc-mp-0737e52b-fffa-4223-bcdf-d4ad3d9968a5.next.bspapp.com/fadada_contract_notify',
|
|
return_url: 'https://static-mp-0737e52b-fffa-4223-bcdf-d4ad3d9968a5.next.bspapp.com/#/pages/contract/index'
|
|
})
|
|
|
|
res.data = fadadaUrl
|
|
|
|
// 业务逻辑结束-----------------------------------------------------------
|
|
return res;
|
|
}
|
|
}
|