MaiXinRong 1 سال پیش
والد
کامیت
e628658313
1فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 4 3
      app/controller/settle_controller.js

+ 4 - 3
app/controller/settle_controller.js

@@ -94,7 +94,7 @@ module.exports = app => {
 
         async add(ctx) {
             try {
-                if (ctx.session.sessionUser.accountId !== ctx.tender.data.user_id) throw '您无权创建计量期';
+                if (ctx.session.sessionUser.accountId !== ctx.tender.data.user_id) throw '您无权创建结算期';
 
                 const date = ctx.request.body.date;
                 const period = ctx.request.body.period;
@@ -140,10 +140,11 @@ module.exports = app => {
                 const settle = await ctx.service.settle.getDataById(sid);
                 const settleCount = await ctx.service.settle.count({ tid: ctx.tender.id });
                 if (!settle || settle.tid !== ctx.tender.id) throw '选择的结算期已不存在';
-                if (settleCount === settle.settle_order) throw '选择的结算期无法删除';
+                if (settleCount !== settle.settle_order) throw '选择的结算期无法删除';
+
                 if (ctx.session.sessionUser.accountId !== settle.user_id && !ctx.session.sessionUser.is_admin) throw '您无权删除结算期';
 
-                await ctx.service.deleteSettle(sid);
+                await ctx.service.settle.deleteSettle(sid);
                 ctx.redirect('/tender/' + ctx.tender.id + '/settle/');
             } catch (err) {
                 ctx.log(err);