Commit 084b98af by lixinming

no message

parent e850b287
......@@ -2,7 +2,7 @@
* 收费
*/
import { INVOICESTATUS, MEMBERSTATE, ORDEREXAMINE, ORDERSTATE, PAYMENTSTATUS, PAYMENTTYPE, RECEIPTCONFIRMATION, STATE, WEICHARTPAYSTATE } from "../../config/enum";
import { INVOICESTATUS, MEMBERSTATE, MEMBERTYPE, ORDEREXAMINE, ORDERSTATE, PAYMENTSTATUS, PAYMENTTYPE, RECEIPTCONFIRMATION, STATE, WEICHARTPAYSTATE } from "../../config/enum";
import { TABLEENUM } from "../../data/models/model";
import { findCount, findOnce, findOnceToSort } from "../../data/select";
import * as path from "path";
......@@ -122,6 +122,60 @@ export async function orderClose({id, weChartPR}) {
}
export async function testCallback(weChartPR) {
let oldInfo = await findOnce(TABLEENUM.订单表, {weChartPR});
if (!oldInfo || !oldInfo.id) throw new BizError(ERRORENUM.目标数据不存在);
let userInfo = await findOnce(TABLEENUM.用户表, {userId:oldInfo.userId});
//更新订单状态
let updateInfo:any = {
paymentNum:"test_____test",
state:ORDERSTATE.已支付,
paymentMethod:PAYMENTTYPE.微信支付,
payTime:new Date().valueOf(),
weChartState:WEICHARTPAYSTATE.已支付,
confirmReceipt:RECEIPTCONFIRMATION.收款确认,
confirmReceiptMs:new Date().valueOf(),
invoiceStatus:INVOICESTATUS.未开发票
};
if (userInfo.memberType == MEMBERTYPE.单位会员) {
updateInfo.invoiceStatus = INVOICESTATUS.不具备开票条件;
}
//更新用户状态
let notPayCount = await findCount(TABLEENUM.订单表, {userId:oldInfo.userId, state:ORDERSTATE.未支付} );
/**只有一笔欠费时才更新用户状态 */
let updateUserInfo:any = {};
if (notPayCount < 1) {
let newOrderInfo = await findOnceToSort(TABLEENUM.订单表, {userId:oldInfo.userId}, {lifespanEndTime:-1}, ["orderCycleStart","orderCycleEnd"]);
updateUserInfo.lifespanStartTime = newOrderInfo.orderCycleStart,
updateUserInfo.lifespanEndTime = newOrderInfo.orderCycleEnd,
updateUserInfo.isGracePeriod = STATE.,
updateUserInfo.gracePeriodEndTime = 0,
updateUserInfo.memberState = MEMBERSTATE.正常,
updateUserInfo.paymentStatus = PAYMENTSTATUS.已支付
} else {//非一笔订单 要更新会员到期时间 到 用户表
updateUserInfo.lifespanStartTime = oldInfo.orderCycleStart;
updateUserInfo.lifespanEndTime = oldInfo.orderCycleEnd;
}
if (oldInfo.isFirst) {
updateUserInfo.isFirstPay = true;
}
if (Object.keys(updateUserInfo).length) await updateOneData(TABLEENUM.用户表, {userId:oldInfo.userId}, updateUserInfo);
//添加审批日志
let addLogInfo = {
orderId:oldInfo.id,
operationTime:new Date().valueOf(),
operationBehavior:ORDEREXAMINE.用户提交,
remarks:"微信付款"
};
await addOneData(TABLEENUM.订单审批历史表, addLogInfo );
await updateOneData(TABLEENUM.订单表, {weChartPR}, updateInfo);
}
/**
* 微信回调函数【微信用】
*/
......@@ -141,11 +195,12 @@ export async function payCallback(body) {
paymentMethod:PAYMENTTYPE.微信支付,
payTime:new Date().valueOf(),
weChartState:WEICHARTPAYSTATE.已支付,
confirmReceipt:RECEIPTCONFIRMATION.确认,
confirmReceipt:RECEIPTCONFIRMATION.收款确认,
confirmReceiptMs:new Date().valueOf(),
invoiceStatus:INVOICESTATUS.未开发票
};
await updateOneData(TABLEENUM.订单表, {weChartPR:wechartCallbackData.out_trade_no}, updateInfo);
//更新用户状态
......
......@@ -40,8 +40,8 @@ export async function pendingReviewList({name, memberType, documentId, phone, ma
if (!selectParam["$and"]) selectParam["$and"] = [];
selectParam["$and"] = [
{"$or":[
{unitName:{"$regex":`${name}`}, memberType:MEMBERTYPE.单位会员},
{name:{"$regex":`${name}`}, memberType:MEMBERTYPE.个人会员}
{unitName:{"$regex":`${name}`}},
{name:{"$regex":`${name}`}}
]}
];
}
......
......@@ -37,13 +37,24 @@ export async function paidList({name, memberType, documentId, phone, mail, joinS
let findParam:any = {
state:ORDERSTATE.已支付
}
};
if (payType == 1) {
findParam.paymentMethod = PAYMENTTYPE.微信支付;
} else if (payType == 2) {
findParam.paymentMethod = {"$ne":PAYMENTTYPE.微信支付};
}
if (examineState) {
if (examineState == 1) {
findParam.confirmReceipt = RECEIPTCONFIRMATION.待确认;
} else {
findParam.confirmReceipt = RECEIPTCONFIRMATION.收款确认;
}
} else findParam.confirmReceipt = {"$ne":RECEIPTCONFIRMATION.退回}
/**用户表查询条件 */
let checkUserIdList = [];
let itemParam:any = {};
......@@ -93,13 +104,7 @@ export async function paidList({name, memberType, documentId, phone, mail, joinS
}
if (phone) findParam.phone = phone;
if (examineState) {
if (examineState == 1) {
findParam.confirmReceipt = RECEIPTCONFIRMATION.待确认;
} else {
findParam.confirmReceipt = RECEIPTCONFIRMATION.收款确认;
}
} else findParam.confirmReceipt = {"$ne":RECEIPTCONFIRMATION.退回}
if (costType) findParam.isFirst = costType == COSTTYPE.首次;
let selectFile = ["id", "unitName", "userId", "orderCycleStart", "orderCycleEnd", "money", "paymentMethod", "memberCategory", "isFirst", "paymentNum", "memberState", "operationTime", "confirmReceipt", "invoiceStatus" ];
......@@ -289,3 +294,64 @@ export async function outPutConfirmReceipt({exportColumns}) {
return {dataList};
}
/**
* 发票管理-财务核对页-批量收款确认 success
* @param id 订单id
*/
export async function confirmReceiptManyPass({idList}) {
//限制长度
if (idList.length > 10) throw new BizError(ERRORENUM.批量操作超过个数限制);
let thisDate = new Date();
const NowMs = thisDate.valueOf();
for (let i = 0; i < idList.length; i++) {
let id = idList[i];
let orderInfo = await findOnce(TABLEENUM.订单表, {id});
if (!orderInfo || !orderInfo.id ) throw new BizError(ERRORENUM.目标数据不存在);
// if (orderInfo.isFirst && !orderInfo.firstPayExamine ) throw new BizError(ERRORENUM.重复提交, '发票管理-财务核对页-收款确认', `提交通过时订单未通过待支付页的校验`);
if (orderInfo.confirmReceipt != RECEIPTCONFIRMATION.待确认) throw new BizError(ERRORENUM.重复提交, '发票管理-财务核对页-收款确认', `提交通过时订单已经不是待确认 是${orderInfo.confirmReceipt}`);
let updateInfo:any = {confirmReceipt:RECEIPTCONFIRMATION.收款确认, confirmReceiptMs:new Date().valueOf()};
if (orderInfo.invoiceStatus != INVOICESTATUS.已开发票) updateInfo.invoiceStatus = INVOICESTATUS.未开发票;
await updateOneData(TABLEENUM.订单表, {id}, updateInfo);
let notPayCount = await findCount(TABLEENUM.订单表, {userId:orderInfo.userId, state:ORDERSTATE.未支付} );
let updateUserInfo:any = {};
/**只有一笔欠费时才更新用户状态 */
if (notPayCount < 1) {
let newOrderInfo = await findOnceToSort(TABLEENUM.订单表, {userId:orderInfo.userId}, {lifespanEndTime:-1}, ["orderCycleStart","orderCycleEnd"]);
updateUserInfo.lifespanStartTime = newOrderInfo.orderCycleStart,
updateUserInfo.lifespanEndTime = newOrderInfo.orderCycleEnd,
updateUserInfo.isGracePeriod = STATE.,
updateUserInfo.gracePeriodEndTime = 0,
updateUserInfo.memberState = MEMBERSTATE.正常,
updateUserInfo.paymentStatus = PAYMENTSTATUS.已支付
} else {//非一笔订单 要更新会员到期时间 到 用户表
updateUserInfo.lifespanStartTime = orderInfo.orderCycleStart;
updateUserInfo.lifespanEndTime = orderInfo.orderCycleEnd;
}
if (orderInfo.isFirst) {
updateUserInfo.isFirstPay = true;
}
if (Object.keys(updateUserInfo).length) await updateOneData(TABLEENUM.用户表, {userId:orderInfo.userId}, updateUserInfo);
//添加日志
let addLogInfo = {
orderId:id,
operationTime:new Date().valueOf(),
operationBehavior:ORDEREXAMINE.审核时间,
isReceiveMoney:true,
remarks:``
};
await addOneData(TABLEENUM.订单审批历史表, addLogInfo );
}
return successResult();
}
......@@ -35,18 +35,38 @@ import { successResult } from "../../../tools/system";
*/
export async function billStateList({name, memberType, documentId, phone, mail, joinStartTime, joinEndTime, memberLevel, payState,paymentType, invoiceState, weChartPR, pageNumber}) {
if (payState != 1 && payState != 2 && payState != 3) throw new BizError(ERRORENUM.参数错误);
let findParam:any = {};
if (invoiceState) {
let findParam:any = {invoiceStatus:{"$ne":INVOICESTATUS.已开发票}};
if (payState == 1) {//已支付
findParam.state = ORDERSTATE.已支付;
if (invoiceState == 1) {//已申请
findParam.invoiceStatus = INVOICESTATUS.未开发票
} else {//未申请
} else if (invoiceState == 2) {//未申请
findParam["$or"] = [{invoiceStatus:INVOICESTATUS.不具备开票条件}, {invoiceStatus:INVOICESTATUS.退回}];
} else {//全部
// findParam.invoiceStatus = {"$ne": INVOICESTATUS.已开发票};
}
}
if (payState == 1) {
findParam.state = ORDERSTATE.已支付;
} else if (payState == 2){
} else if (payState == 2){//未支付
findParam.state = ORDERSTATE.未支付;
if (!invoiceState || invoiceState == 1) {//已申请 和 全部
findParam.invoiceStatus = INVOICESTATUS.未开发票
} else {//未申请
return {dataList:[], dataCount:0};
}
} else {//全部
if (!invoiceState) {// 全部
findParam["$or"] = [
{ state : ORDERSTATE.已支付, },
{ state : ORDERSTATE.未支付, invoiceStatus:INVOICESTATUS.未开发票},
// { invoiceStatus : INVOICESTATUS.未开发票},
// {"$or":[{invoiceStatus:INVOICESTATUS.不具备开票条件}, {invoiceStatus:INVOICESTATUS.退回}]}
]
} else if ( invoiceState == 1) {//已申请
findParam.invoiceStatus = INVOICESTATUS.未开发票;
}else {//未申请
findParam = { state : ORDERSTATE.未支付, invoiceStatus:INVOICESTATUS.未开发票};
}
}
/**用户表查询条件 */
......@@ -104,13 +124,13 @@ export async function billStateList({name, memberType, documentId, phone, mail,
}
if (weChartPR) findParam.paymentNum = {"$regex":`${weChartPR}`};
let selectFile = ["id", "unitName", "orderCycleStart", "orderCycleEnd", "money", "paymentMethod", "memberCategory", "state", "paymentNum", "userId", "desc", "invoiceMail", "weChartCreatePayMs"];
let selectFile = ["id", "unitName", "orderCycleStart", "orderCycleEnd", "money", "paymentMethod", "memberCategory", "state", "paymentNum", "userId", "desc", "invoiceMail", "weChartCreatePayMs", "invoiceStatus"];
let dbList = await findToPage(TABLEENUM.订单表, findParam, selectFile, pageNumber);
let dataCount = await findCount(TABLEENUM.订单表, findParam);
let dataList = [];
let itemFile = ["id", "userId", "unitName", "money", "paymentNum", "memberCategory", "state", "paymentMethod", "desc", "invoiceMail", "weChartCreatePayMs"];
let itemFile = ["id", "userId", "unitName", "money", "paymentNum", "memberCategory", "state", "paymentMethod", "desc", "invoiceMail", "weChartCreatePayMs", "invoiceStatus"];
for (let i= 0; i < dbList.length; i++) {
let info = dbList[i];
let itemData:any = extractData(info, itemFile);
......@@ -121,7 +141,6 @@ export async function billStateList({name, memberType, documentId, phone, mail,
itemData.paymentMethod = changeEnumValue(PAYMENTTYPE, itemData.paymentMethod);
itemData.isPay = changeEnumValue(ORDERSTATE, itemData.state);
itemData.payState = info.state == ORDERSTATE.已支付 ? "已支付" : "未支付";
let userInfomation = await findOnce(TABLEENUM.用户表, {userId:itemData.userId}, ["userId", "memberState", "name", "memberLevel", "individualMemberType", "unitMemberType"]);
if (!userInfomation || !userInfomation.userId) continue;
......@@ -133,8 +152,10 @@ export async function billStateList({name, memberType, documentId, phone, mail,
itemData.memberType = changeEnumValue(MEMBERTYPEECCENUM, userInfomation.unitMemberType);
}
itemData.memberLevel = changeEnumValue(MEMBERLEVEL, userInfomation.memberLevel);
itemData.memberState = changeEnumValue(MEMBERSTATE, userInfomation.memberState);
// itemData.memberState = changeEnumValue(MEMBERSTATE, userInfomation.memberState);
}
itemData.invoiceStatus = itemData.invoiceStatus == INVOICESTATUS.未开发票 ? "已申请" : "未申请";
// itemData.cycle = `${moment(info.orderCycleStart).format("YYYY-MM-DD")}至${moment(info.orderCycleEnd).format("YYYY-MM-DD")}`;
itemData.cycle = `${moment(info.orderCycleStart).format("YYYY")}${moment(info.orderCycleEnd).format("YYYY")}`;
......
......@@ -250,7 +250,7 @@ export async function getSheng ({userId}) {
*/
export async function getCertificate({userId}) {
const Files = ["userId", "memberType", "userRegisterState", "paymentStatus", "individualMemberType", "unitMemberType",
"sheng", "documentId", "memberNum", "lifespanStartTime", "lifespanEndTime", "shi","qu","addres", "unitName", "session"];
"sheng", "documentId", "memberNum", "lifespanStartTime", "lifespanEndTime", "shi","qu","addres", "unitName", "session", "name"];
let userInfo = await findOnce(TABLEENUM.用户表, {userId}, Files);
if (!userInfo || !userInfo.userId) throw new BizError(ERRORENUM.目标数据不存在);
......@@ -266,6 +266,7 @@ export async function getSheng ({userId}) {
if (userInfo.individualMemberType == INDIVIDUALMEMBERTYPE.专家会员) certificate = true;
if (certificate) {
cefaInfo = {
name:userInfo.name,
area:getCityNameByCode(userInfo.sheng),
documentId:userInfo.documentId,
memberNum:userInfo.memberNum,
......@@ -608,26 +609,29 @@ export async function applyReason({applyStr, userId}) {
export async function infomationChangeUpdate({userId, unitName, uscc, legalPerson, unitMemberType, uusinessLicenseUrl, applicationForm, desc}) {
export async function infomationChangeUpdate({userId, unitName, uscc, legalPerson, unitMemberType, uusinessLicenseUrl, applicationForm, desc, yuanXiaoBanXueLeiXing, legalPersonMail, legalPersonPhone}) {
let userInfo = await findOnce(TABLEENUM.用户表, {userId}, ["memberType"]);
if (userInfo.memberType != MEMBERTYPE.单位会员) throw new BizError(ERRORENUM.非单位会员不可操作);
//添加日志
/**添加审批历史 */
let applyInfo:any = {
applyId:generateSystemId(TABLEENUM.理事变更审批历史表, userId),
infoChangeId:generateSystemId(TABLEENUM.理事变更审批历史表, userId),
applyId:generateSystemId(TABLEENUM.资料变更审批历史表, userId),
infoChangeId:generateSystemId(TABLEENUM.资料变更审批历史表, userId),
userId,
unitName,
uscc,
legalPerson,
unitMemberType,
uusinessLicenseUrl,
applicationForm,
applicationForm,
yuanXiaoBanXueLeiXing,
desc,
legalPersonMail,
legalPersonPhone,
infoChangeOptionType:INFOCHANGEAPPLYTYPE.待审批,
createTimeMs:new Date().valueOf()
};
await updateOneData(TABLEENUM.用户表, {userId}, {infoChangeId:applyInfo.infoChangeId, infoChangeOptionType:INFOCHANGEAPPLYTYPE.待审批});
await updateOneData(TABLEENUM.用户表, {userId}, {infoChangeId:applyInfo.infoChangeId, infoChangeMs:new Date().valueOf(), infoChangeOptionType:INFOCHANGEAPPLYTYPE.待审批});
await addOneData(TABLEENUM.资料变更审批历史表, applyInfo);
return successResult();
......@@ -638,6 +642,7 @@ export async function infomationChangeInfo({userId}) {
let userInfo = await findOnce(TABLEENUM.用户表, {userId});
let dataInfo:any = {};
let isUpdate = true;
//这里的条件有点乱,因为加班到很晚了
if (!userInfo.infoChangeId || (userInfo.infoChangeId && userInfo.infoChangeOptionType == INFOCHANGEAPPLYTYPE.通过)) {
let userInfo = await findOnce(TABLEENUM.用户表, {userId});
......@@ -650,7 +655,11 @@ export async function infomationChangeInfo({userId}) {
uusinessLicenseUrl:userInfo.uusinessLicenseUrl || "",//营业执照
applicationForm:userInfo.applicationForm || "",//盖章申请表
desc:"",
yuanXiaoBanXueLeiXing:userInfo.yuanXiaoBanXueLeiXing || "",
legalPersonMail:userInfo.legalPersonMail,
legalPersonPhone:userInfo.legalPersonPhone,
};
isUpdate = true;
} else {
let infomationChangeHistoryInfo = await findOnceToSort(TABLEENUM.资料变更审批历史表, {userId}, {createTimeMs:-1});
dataInfo = {
......@@ -660,8 +669,15 @@ export async function infomationChangeInfo({userId}) {
unitMemberType:infomationChangeHistoryInfo.unitMemberType,//单位会员类型
uusinessLicenseUrl:infomationChangeHistoryInfo.uusinessLicenseUrl,//营业执照
applicationForm:infomationChangeHistoryInfo.applicationForm,//盖章申请表
desc:infomationChangeHistoryInfo.desc
desc:infomationChangeHistoryInfo.desc,
yuanXiaoBanXueLeiXing:infomationChangeHistoryInfo.yuanXiaoBanXueLeiXing,
legalPersonMail:infomationChangeHistoryInfo.legalPersonMail,
legalPersonPhone:infomationChangeHistoryInfo.legalPersonPhone,
};
if (infomationChangeHistoryInfo.infoChangeOptionType == INFOCHANGEAPPLYTYPE.待审批) {
isUpdate = false;
}
else isUpdate = true;
}
const UnitConfig = ["unitMemberType", "yuanXiaoBanXueLeiXing", "yuanXiaoZhuGuanBuMen", "yuanXiaoFuZeRen", "yuanXiaoFuZeRenZhiWu", "yuanXiaoBanGongFuZeRenZhiWu",
"yuanXiaoFuZeRenDianHua", "yuanXiaoBanGongFuZeRen", "yuanXiaoBanGongFuZeRenDianHua", "ZhuYaoFuZeRenYouXiang", "yuanXiaoKeYanFuZeRen", "yuanXiaoKeYanFuZeRenDianHua",
......@@ -672,11 +688,6 @@ export async function infomationChangeInfo({userId}) {
if (unitInfo.yuanXiaoBanXueLeiXing) unitInfo.yuanXiaoBanXueLeiXing = changeEnumValue(BANXUELEIXING, unitInfo.yuanXiaoBanXueLeiXing);
dataInfo.unitInfo = unitInfo;
dataInfo.isUpdate = isUpdate;
return {dataInfo};
}
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import { generateOrderId, successResult } from "../../tools/system";
import { changeEnumValue, eccEnumValue } from "../../util/verificationEnum";
import { addOneData } from "../../data/add";
import { TABLEENUM } from "../../data/models/model";
import { find, findCount, findOnce, findOnceToSort, findToPage, findToSortToPage } from "../../data/select";
import { find, findCount, findOnce, findOnceToSort, findToPage, findToSort, findToSortToPage } from "../../data/select";
import { extractData } from "../../util/piecemeal";
import { BizError } from "../../util/bizError";
import { ERRORENUM } from "../../config/errorEnum";
......@@ -328,7 +328,7 @@ export async function applicationInadvanceInvoiceInfo({id}) {
let orderInfo = await findOnce(TABLEENUM.订单表, {id}, ["id", "userId", "invoiceMail", "desc", "invoiceStatus", "state"]);
if (!orderInfo || !orderInfo.id) throw new BizError(ERRORENUM.目标数据不存在);
let userInfo = await findOnce(TABLEENUM.用户表, {userId:orderInfo.userId}, ["userId", "memberType", "mail", "unitMemberType"]);
let userInfo = await findOnce(TABLEENUM.用户表, {userId:orderInfo.userId}, ["userId", "memberType", "mail", "unitMemberType", "unit", "uscc", "unitName"]);
if (userInfo.memberType != MEMBERTYPE.单位会员) {
throw new BizError(ERRORENUM.发票已发送至邮请注意查看);
}else if (orderInfo.state == ORDERSTATE.未支付 && userInfo.unitMemberType != UNITMEMBERTYPE.院校) {
......@@ -336,8 +336,10 @@ export async function applicationInadvanceInvoiceInfo({id}) {
}
let resultObj = {
invoiceMail: orderInfo.invoiceMail || userInfo.mail || "",
desc:orderInfo.desc || ""
invoiceMail: orderInfo.invoiceMail || "",
desc:orderInfo.desc || "",
uscc:userInfo.uscc,
unitName:userInfo.unitName
}
return resultObj;
......@@ -391,7 +393,7 @@ export async function getInvoiceStatus({id}) {
if (oldInfo.invoiceStatus != INVOICESTATUS.退回) dataInfo.state = AUDITINGCLIENT.审核失败;
/**获取驳回理由 */
let userOldInfo = await findOnceToSort(TABLEENUM.审批历史表, {userId:oldInfo.userId, operationBehavior:OPERATIONREHAVIOR.驳回修改},{operationTime:-1}, ["userId", "remarks"]);
let userOldInfo = await findOnceToSort(TABLEENUM.订单审批历史表, {userId:oldInfo.userId, operationBehavior:OPERATIONREHAVIOR.驳回修改},{operationTime:-1}, ["userId", "remarks"]);
if (userOldInfo && userOldInfo.userId) dataInfo.remark = userOldInfo.remark;
return {dataInfo};
......@@ -416,7 +418,9 @@ export async function getInvoiceStatus({id}) {
payTime:new Date().valueOf(),
confirmReceipt:RECEIPTCONFIRMATION.待确认,
invoiceMail,
desc
desc,
invoiceStatus:INVOICESTATUS.未开发票,
advanceInvoice:true
};
await updateOneData(TABLEENUM.订单表, {id}, updateInfo);
......@@ -444,21 +448,40 @@ export async function reasonInfo({id}) {
if ( orderInfo.confirmReceipt != RECEIPTCONFIRMATION.退回) throw new BizError(ERRORENUM.该订单未被退回);
let logInfo = await findOnceToSort(TABLEENUM.订单审批历史表, {operationBehavior:ORDEREXAMINE.用户提交}, {operationTime:-1});
let logInfoList = await findToSort(TABLEENUM.订单审批历史表, {orderId:id}, {operationTime:-1});
let dataInfo = {
operationTime:moment(logInfo.operationTime).format("YYYY/MM/DD HH:mm:SS"),
behavior:"退回",
isReceiveMoney:logInfo.isReceiveMoney ? "已到款项" : "未到款项",
remarks:logInfo.remarks
};
let dataList = [];
logInfoList.forEach(info => {
let isReceiveMoney = info.isReceiveMoney ? "已到款项" : "未到款项";
let remarks = info.remarks
if (info.operationBehavior == ORDEREXAMINE.退款申请) {
isReceiveMoney = "-";
if (info.refundName) remarks += `-${info.refundName}`;
if (info.refundBankNum) remarks += `-${info.refundBankNum}`;
if (info.refundBankName) remarks += `-${info.refundBankName}`;
} else if (info.operationBehavior == ORDEREXAMINE.用户提交) {
isReceiveMoney = "-";
}
return {dataList:[dataInfo]};
let dataInfo = {
operationTime:moment(info.operationTime).format("YYYY/MM/DD HH:mm:SS"),
behavior:changeEnumValue(ORDEREXAMINE, info.operationBehavior),
isReceiveMoney,
remarks
};
dataList.push(dataInfo);
})
let isUpdate = true;
if ( orderInfo.isReplenishReturnInfo && orderInfo.refundReject == false ) isUpdate = false;
return {dataList:dataList, isUpdate};
}
/**
* 退款信息
* 退款信息更新
* @param param0
*/
export async function accountInfo({id, form}) {
......@@ -473,7 +496,8 @@ export async function accountInfo({id, form}) {
refundBankCarId : form.refundBankCarId,
refundBankName : form.refundBankName,
refundDesc : form.refundDesc,
isReplenishReturnInfo:true
isReplenishReturnInfo:true,
refundReject:false
};
await updateOneData(TABLEENUM.订单表, {id}, updateInfo );
......@@ -483,7 +507,10 @@ export async function accountInfo({id, form}) {
orderId:id,
operationTime:new Date().valueOf(),
operationBehavior:ORDEREXAMINE.退款申请,
remarks:`${form.refundDesc}`
remarks:`${form.refundDesc}`,
refundName:form.refundName,
refundBankNum:form.refundBankCarId,
refundBankName:form.refundBankName
};
await addOneData(TABLEENUM.订单审批历史表, addLogInfo );
......@@ -497,7 +524,7 @@ export async function accountInfo({id, form}) {
*/
export async function refundList({name, memberType, joinStartTime, joinEndTime, pageNumber}) {
let findParam:any = {
isReceive:{"$ne":null}
isReceive:{"$gt":0}
};
/**用户表查询条件 */
......@@ -562,7 +589,7 @@ export async function refundList({name, memberType, joinStartTime, joinEndTime,
}
}
if (!info.isReplenishReturnInfo) itemData.state = "资料补充中";
if (!info.isReplenishReturnInfo || (info.refundReject== true && !info.refundSuccessful)) itemData.state = "资料补充中";
else {
if (info.refundSuccessful) itemData.state = "已退款";
else itemData.state = "待退款";
......@@ -659,6 +686,33 @@ export async function refundApprove({id, refundImgUrl}) {
return {dataList};
}
/**
* 退款驳回
*/
export async function refundOut({id, desc}) {
let orderInfo = await findOnce(TABLEENUM.订单表, {id});
if (!orderInfo || !orderInfo.id ) throw new BizError(ERRORENUM.目标数据不存在);
// if (orderInfo.isFirst && !orderInfo.firstPayExamine ) throw new BizError(ERRORENUM.重复提交, '发票管理-财务核对页-收款确认', `提交通过时订单未通过待支付页的校验`);
if (orderInfo.confirmReceipt != RECEIPTCONFIRMATION.退回) throw new BizError(ERRORENUM.订单非退回状态, '发票管理-退款列表页-退款确认', `退款确认时订单已经不是退款状态 是${orderInfo.confirmReceipt}`);
if (orderInfo.paymentMethod == PAYMENTTYPE.微信支付) throw new BizError(ERRORENUM.微信支付无法被退回);
if (orderInfo.isReceive != ISRECEIVE.提供账户_zkh需退款_ykh) throw new BizError(ERRORENUM.该类型退款无需确认);
let updateInfo:any = {refundSuccessful:false,isReplenishReturnInfo:false, refundReject:true};
await updateOneData(TABLEENUM.订单表, {id}, updateInfo);
//添加日志
let addLogInfo = {
orderId:id,
operationTime:new Date().valueOf(),
operationBehavior:ORDEREXAMINE.驳回,
isReceiveMoney:true,
remarks:desc,
};
await addOneData(TABLEENUM.订单审批历史表, addLogInfo );
return successResult();
}
/**
......@@ -674,8 +728,13 @@ export async function approveLog({id}) {
let desc = "";
if (operationBehavior == ORDEREXAMINE.用户提交) desc = "线下付款";
else {
desc = isReceiveMoney ? changeEnumValue(ISRECEIVE, ISRECEIVE.未收到款项_xg其他) : changeEnumValue(ISRECEIVE, ISRECEIVE.提供账户_zkh需退款_ykh)
}
if (isReceiveMoney) {
desc = "未收到"
} else {
desc = "已收到"
}
// desc = isReceiveMoney ? changeEnumValue(ISRECEIVE, ISRECEIVE.未收到款项_xg其他) : changeEnumValue(ISRECEIVE, ISRECEIVE.提供账户_zkh需退款_ykh)
}
let addInfo:any = {
operationTime:moment(operationTime).format("YYYY-MM-DD HH:mm:SS"),
operationBehavior:changeEnumValue(ORDEREXAMINE, operationBehavior),
......
......@@ -86,7 +86,7 @@ enum TABLEENUM {
订单表 = 'order',
单位所获得科研成果表 = "scientificResearch",
验证码表 = "code",
审批历史表 = "approvalHistory",
审批历史表 = "approvalHistory",//审批会员用的
权限表 = "authority",
订单审批历史表 = "orderApprovalHistory",
标签表 = "lable",
......@@ -457,6 +457,7 @@ const ModelArray = [
rejectRemarks:'String',//变更理事驳回理由
applyId:{ type:'String', index:true },
infoChangeId:{type:"String", index:true},//资料更新关联id
infoChangeMs:{type:"Number"},//资料更新申请时间
infoChangeOptionType:{type:"Number"}//INFOCHANGEAPPLYTYPE
}
},
......@@ -517,7 +518,9 @@ const ModelArray = [
refundDesc:"String",
isReplenishReturnInfo:{type:'Boolean', default:false},//是否补充退款信息
//
refundSuccessful:{type:"Boolean", default:false},//退款确认
refundReject:{type:"Boolean", default:false},//退款驳回 true = 被驳回
refundImgUrl:"String",
//新加的状态
isSueInvoicesInAdvance:{type:"Boolean", default:false},//提前开票 弃用
......@@ -627,8 +630,11 @@ const ModelArray = [
operationBehavior:{ type:'Number'},//操作行为 枚举 ORDEREXAMINE
isReceiveMoney:{type:'Boolean', default:false},//是否收到款项
remarks:{ type:'String' },//备注
refundImgUrl:"String"//退款确认发票地址
refundImgUrl:"String",//退款确认发票地址
//退款信息
refundName:"String",//退款姓名
refundBankNum:"String",//银行账号
refundBankName:"String",//银行开户行
}
},
{
......@@ -661,6 +667,9 @@ const ModelArray = [
uusinessLicenseUrl:"String",//营业执照
applicationForm:"String",//盖章申请表
desc:"String",//描述
legalPersonMail:"String",//法人邮箱
legalPersonPhone:"String",//法人电话
yuanXiaoBanXueLeiXing:'Number',//办学类型
rejectRemarks:'String',//变更驳回理由
createTimeMs:'Number',//日志时间
}
......
import moment = require("moment");
import { initActivity } from "./biz/member/msgActivity";
import { createOrder } from "./biz/member/order";
import { initAdmin } from "./biz/member/rightsMgmt";
import { t } from "./biz/provide";
import { initSaveUnsubmitted } from "./biz/register";
import { initSMS } from "./biz/sms";
import { initSystemTask } from "./biz/task";
import { initConfig, systemConfig} from "./config/serverConfig";
import { initDataBaseModel } from "./data/db/db";
import { test } from "./httpTOhttps";
import { httpServer } from "./net/http_server";
async function lanuch() {
......@@ -32,7 +27,8 @@ async function lanuch() {
// await test();
// console.log(moment(1498262400000).format("YYYY-MM-DD HH:mm:SS"))
console.log("服务初始化成功");
// await testCallback("aeaa2492b585abd2bcfe4302a59bccb4")
}
lanuch();
......
......@@ -1023,9 +1023,12 @@ export const Config = {
{key:"uscc", type:"String", desc:"统一信用代码"},
{key:"legalPerson", type:"String", desc:"法人代表"},
{key:"unitMemberType", type:"Number", desc:"单位会员类型"},
{key:"yuanXiaoBanXueLeiXing", type:"Number", desc:"帮学类型"},
{key:"uusinessLicenseUrl", type:"String", desc:"营业执照"},
{key:"applicationForm", type:"String", desc:"盖章申请表"},
{key:"desc", type:"String", desc:"描述位"}
{key:"desc", type:"String", desc:"描述位"},
{key:"legalPersonMail", type:"String", desc:"法人邮件"},
{key:"legalPersonPhone", type:"String", desc:"法人电话"},
],
bindBiz:homePageBiz.infomationChangeUpdate
},
......
......@@ -87,6 +87,14 @@ export const Config = {
bindBiz:costVerificationBiz.confirmReceiptPass
},
{
apiName:"财务核对-批量收款确认",
subUrl:'/order/invoice/examine/manypass',
param:[
{key:"idList", type:"[String]", desc:"订单id"}
],
bindBiz:costVerificationBiz.confirmReceiptManyPass
},
{
apiName:"财务核对-退回",
subUrl:'/order/invoice/examine/out',
param:[
......@@ -226,6 +234,15 @@ export const Config = {
bindBiz:orderBiz.refundApprove
},
{
apiName:"退款驳回",
subUrl:'/order/refundout',
param:[
{key:"id", type:"String", desc:"订单id"},
{key:"desc", type:"String", desc:"备注"},
],
bindBiz:orderBiz.refundOut
},
{
apiName:"退款列表-数据导出",
subUrl:'/order/invoice/examine/outputrefund',
param:[
......
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