|
@@ -29,7 +29,10 @@ module.exports = app => {
|
|
|
* @returns {Promise<boolean>}
|
|
|
*/
|
|
|
async addDefaultPayData(tid, transaction) {
|
|
|
+ const existPays = this.getAllDataByCondition({tid: tid});
|
|
|
const pays = JSON.parse(JSON.stringify(payConst.payTemplate));
|
|
|
+ if (existPays.length >= pays.length) { return false; }
|
|
|
+
|
|
|
for (const p of pays) {
|
|
|
p.tid = tid;
|
|
|
p.csid = 0;
|
|
@@ -104,8 +107,8 @@ module.exports = app => {
|
|
|
const pay = await this.getDataByCondition({id: id});
|
|
|
if (!pay) {
|
|
|
throw '合同支付项不存在';
|
|
|
- } else if (pay.uid === -1) {
|
|
|
- throw '默认合同支付项不可删除';
|
|
|
+ } else if (pay.ptype !== payConst.payType.normal) {
|
|
|
+ throw '该合同支付项不可删除';
|
|
|
}
|
|
|
// 删除合同支付
|
|
|
const transaction = await this.db.beginTransaction();
|