Browse Source

Merge branch 'feature/2234-withdrawal-mod' into feature/2703-biopure-ultra-3

theo 2 years ago
parent
commit
e36ee13b7b
2 changed files with 102 additions and 85 deletions
  1. 76 65
      backendEle/src/views/finance/withdraw.vue
  2. 26 20
      common/models/Withdraw.php

+ 76 - 65
backendEle/src/views/finance/withdraw.vue

@@ -4,10 +4,10 @@
       <el-tabs v-model="filterStatus" @tab-click="handleFilterStatusClick">
         <el-tab-pane label="All" name="-1" :lazy="true"></el-tab-pane> <!-- 全部 -->
         <el-tab-pane label="To be reviewed" name="0" :lazy="true"></el-tab-pane> <!-- 待审核 -->
-        <el-tab-pane label="Reviewed" name="2" :lazy="true"></el-tab-pane> <!-- 已审核 -->
+<!--        <el-tab-pane label="Reviewed" name="2" :lazy="true"></el-tab-pane> &lt;!&ndash; 已审核 &ndash;&gt;-->
         <el-tab-pane label="To be paid" name="3" :lazy="true"></el-tab-pane> <!-- 待付款 -->
         <el-tab-pane label="Paid" name="6" :lazy="true"></el-tab-pane> <!-- 已付款 -->
-        <el-tab-pane label="Payment failed" name="4" :lazy="true"></el-tab-pane> <!-- 付款失败 -->
+<!--        <el-tab-pane label="Payment failed" name="4" :lazy="true"></el-tab-pane> &lt;!&ndash; 付款失败 &ndash;&gt;-->
         <el-tab-pane label="Returned" name="7" :lazy="true"></el-tab-pane> <!-- 已退回 -->
       </el-tabs>
       <div class="filter-box">
@@ -33,7 +33,7 @@
         <el-table-column fixed="right" label="Action" width="180"> <!-- 操作 -->
           <template slot-scope="scope">
             <el-dropdown size="small" trigger="click"
-                         v-if="scope.row.AUDIT_STATUS!=='7' && (permission.hasPermission(`finance/withdraw-status`))">
+                         v-if="scope.row.AUDIT_STATUS!=='6' && scope.row.AUDIT_STATUS!=='7' && (permission.hasPermission(`finance/withdraw-status`))">
               <el-button type="primary" size="small" @click.stop="">
                 Action<i class="el-icon-arrow-down el-icon--right"></i>
               </el-button>
@@ -43,41 +43,46 @@
                 <!--v-show="(scope.row.AUDIT_STATUS==='0'||scope.row.AUDIT_STATUS==='1') && (permission.hasPermission(`finance/invoice-audit-add`)||permission.hasPermission(`finance/invoice-audit-edit`))">-->
                 <!--补录发票信息-->
                 <!--</el-dropdown-item>-->
-                <el-dropdown-item command="status"
-                                  @click.native="handleStatusShow(scope.row, 2, 'Are you sure to approve the current withdrawal?')"
-                                  v-show="scope.row.AUDIT_STATUS==='0' && permission.hasPermission(`finance/withdraw-status`)"> <!-- 确定对当前提现进行审核通过操作? -->
-                  Approve <!-- 审核通过 -->
-                </el-dropdown-item>
-                <el-dropdown-item command="status"
-                                  @click.native="handleStatusShow(scope.row, 3, 'Are you sure to set the current withdrawal as payment action?')"
-                                  v-show="scope.row.AUDIT_STATUS === '2' && permission.hasPermission(`finance/withdraw-status`)"> <!-- 确定对当前提现进行设为待付款操作? -->
-                  To be paid<!-- 设为待付款 -->
-                </el-dropdown-item>
+<!--                <el-dropdown-item command="status"-->
+<!--                                  @click.native="handleStatusShow(scope.row, 3, 'Are you sure to approve the current withdrawal?')"-->
+<!--                                  v-show="scope.row.AUDIT_STATUS==='0' && permission.hasPermission(`finance/withdraw-status`)"> &lt;!&ndash; 确定对当前提现进行审核通过操作? &ndash;&gt;-->
+<!--                  Approve &lt;!&ndash; 审核通过 &ndash;&gt;-->
+<!--                </el-dropdown-item>-->
+<!--                <el-dropdown-item command="status"-->
+<!--                                  @click.native="handleStatusShow(scope.row, 3, 'Are you sure to set the current withdrawal as payment action?')"-->
+<!--                                  v-show="scope.row.AUDIT_STATUS === '0' && permission.hasPermission(`finance/withdraw-status`)"> &lt;!&ndash; 确定对当前提现进行设为待付款操作? &ndash;&gt;-->
+<!--                  Approve&lt;!&ndash; 设为待付款 &ndash;&gt;-->
+<!--                </el-dropdown-item>-->
                 <el-dropdown-item command="status"
                                   @click.native="handleStatusShow(scope.row, 6, 'Are you sure to set the current withdrawal as paid?')"
                                   v-show="scope.row.AUDIT_STATUS === '3' && permission.hasPermission(`finance/withdraw-status`)"> <!-- 确定对当前提现进行设为已付款操作 -->
-                  Paid<!--设为已付款-->
+                  Paid<!--付款-->
                 </el-dropdown-item>
                 <el-dropdown-item command="status"
-                                  @click.native="handleStatusShow(scope.row, 3, 'Are you sure to set the current withdrawal as payment action??')"
-                                  v-show="scope.row.AUDIT_STATUS === '4' && permission.hasPermission(`finance/withdraw-status`)"> <!-- 确定对当前提现进行设为待付款操作? -->
-                  To be paid<!-- 设为待付款 -->
-                </el-dropdown-item>
-                <el-dropdown-item command="status"
-                                  @click.native="handleStatusShow(scope.row, 4, 'Are you sure to set payment failure for the current withdrawal?', 'Note')"
-                                  v-show="scope.row.AUDIT_STATUS === '6' && permission.hasPermission(`finance/withdraw-status`)"> <!-- 付款失败备注 --> <!-- 确定对当前提现进行设为付款失败操作? -->
-                  Failed<!-- 设为付款失败 -->
+                                  @click.native="handleStatusShow(scope.row, 0, 'Are you sure to set the current withdrawal as approved?')"
+                                  v-show="scope.row.AUDIT_STATUS === '0' && permission.hasPermission(`finance/withdraw-status`)"> <!-- 确定对当前提现进行设为已付款操作 -->
+                  Approve<!--审核通过-->
                 </el-dropdown-item>
+<!--                <el-dropdown-item command="status"-->
+<!--                                  @click.native="handleStatusShow(scope.row, 4, 'Are you sure to set payment failure for the current withdrawal?', 'Note')"-->
+<!--                                  v-show="scope.row.AUDIT_STATUS === '6' && permission.hasPermission(`finance/withdraw-status`)"> &lt;!&ndash; 付款失败备注 &ndash;&gt; &lt;!&ndash; 确定对当前提现进行设为付款失败操作? &ndash;&gt;-->
+<!--                  Failed&lt;!&ndash; 设为付款失败 &ndash;&gt;-->
+<!--                </el-dropdown-item>-->
                 <el-dropdown-item command="status"
                                   @click.native="handleStatusShow(scope.row, 7, 'Determines that the current withdrawal is set to a withdrawal return operation?', 'Note on withdrawal return')"
-                                  v-show="scope.row.AUDIT_STATUS === '0' && permission.hasPermission(`finance/withdraw-status`)"> <!-- 确定对当前提现进行设为提现退回操作? --> <!-- 提现退回备注 -->
-                  Return <!-- 设为提现退回 -->
+                                  v-show="(scope.row.AUDIT_STATUS === '0') && permission.hasPermission(`finance/withdraw-status`)"><!-- 提现退回备注 -->
+                  Return <!-- 该会员已提供发票,请确认是否处理提现退回 --> <!-- 设为提现退回 -->
                 </el-dropdown-item>
                 <el-dropdown-item command="status"
                                   @click.native="handleStatusShow(scope.row, 7, 'The member has provided the invoice, please confirm whether to process the withdrawal return?', 'Note on withdrawal return')"
-                                  v-show="(scope.row.AUDIT_STATUS === '1'||scope.row.AUDIT_STATUS === '2'||scope.row.AUDIT_STATUS === '3') && permission.hasPermission(`finance/withdraw-status`)"><!-- 提现退回备注 -->
+                                  v-show="(scope.row.AUDIT_STATUS === '1'||scope.row.AUDIT_STATUS === '2') && permission.hasPermission(`finance/withdraw-status`)"><!-- 提现退回备注 -->
                   Return <!-- 该会员已提供发票,请确认是否处理提现退回 --> <!-- 设为提现退回 -->
                 </el-dropdown-item>
+                <el-dropdown-item command="status"
+                                  @click.native="handleStatusShow(scope.row, 7, 'Are you sure to set the current withdrawal as canceled?', 'Note on withdrawal return')"
+                                  v-show="scope.row.AUDIT_STATUS === '3' && permission.hasPermission(`finance/withdraw-status`)"> <!-- 确定对当前提现进行设为提现退回操作? --> <!-- 提现退回备注 -->
+                  Cancel <!-- 取消审核 -->
+                </el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
           </template>
@@ -86,7 +91,7 @@
       <div class="white-box-footer">
 
         <el-dropdown size="small" trigger="click" @command="handleMuli"
-                     v-if="filterStatus!=='-1' && filterStatus!=='7' && (permission.hasPermission(`finance/withdraw-status`))">
+                     v-if="filterStatus!=='-1' && filterStatus!=='6' && filterStatus!=='7' && (permission.hasPermission(`finance/withdraw-status`))">
           <el-button type="primary" size="small">
             Selected data<!--所选数据--><i class="el-icon-arrow-down el-icon--right"></i>
           </el-button>
@@ -94,9 +99,9 @@
             <el-dropdown-item command="2">Batch audit passed</el-dropdown-item> <!-- 批量审核通过-->
             <el-dropdown-item command="7">Batch return</el-dropdown-item> <!-- 批量退回 -->
           </el-dropdown-menu>
-          <el-dropdown-menu v-else-if="filterStatus==='2'" slot="dropdown">
-            <el-dropdown-item command="3">Batch set to be paid</el-dropdown-item><!-- 批量设为待付款 -->
-          </el-dropdown-menu>
+<!--          <el-dropdown-menu v-else-if="filterStatus==='2'" slot="dropdown">-->
+<!--            <el-dropdown-item command="3">Batch set to be paid</el-dropdown-item>&lt;!&ndash; 批量设为待付款 &ndash;&gt;-->
+<!--          </el-dropdown-menu>-->
           <el-dropdown-menu v-else-if="filterStatus==='3'" slot="dropdown">
             <el-dropdown-item command="6">Batch set paid</el-dropdown-item><!--批量设为已付款-->
             <el-dropdown-item command="7">Batch return</el-dropdown-item><!--批量退回-->
@@ -104,9 +109,9 @@
           <el-dropdown-menu v-else-if="filterStatus==='6'" slot="dropdown">
             <el-dropdown-item command="4">Batch set payment failure</el-dropdown-item><!--批量设为付款失败-->
           </el-dropdown-menu>
-          <el-dropdown-menu v-else-if="filterStatus==='4'" slot="dropdown">
-            <el-dropdown-item command="3">Batch set to be paid</el-dropdown-item><!-- 批量设为待付款 -->
-          </el-dropdown-menu>
+<!--          <el-dropdown-menu v-else-if="filterStatus==='4'" slot="dropdown">-->
+<!--            <el-dropdown-item command="3">Batch set to be paid</el-dropdown-item>&lt;!&ndash; 批量设为待付款 &ndash;&gt;-->
+<!--          </el-dropdown-menu>-->
         </el-dropdown>
 
         <el-button type="success" size="small" @click="handleExport"
@@ -159,7 +164,7 @@
                   type="warning" :closable="false">
           </el-alert>
           <el-form :model="auditForm" label-width="180px" style="width:500px;" v-loading="dialogAuditLoading">
-            <el-form-item label="Estimated date of payment" v-show="filterStatus==='2' || filterStatus==='4'"> <!-- 预计付款日期 -->
+            <el-form-item label="Estimated date of payment" v-show="planPayDateVisible"> <!-- 预计付款日期 -->
               <el-date-picker
                       v-model="auditForm.planPaidAt"
                       type="date"
@@ -169,7 +174,7 @@
               >
               </el-date-picker>
             </el-form-item>
-            <el-form-item label="Date of payment" v-show="filterStatus==='3'"><!-- 付款日期 -->
+            <el-form-item label="Date of payment" v-show="filterStatus==='2'"><!-- 付款日期 -->
               <el-date-picker
                       v-model="auditForm.paidAt"
                       type="date"
@@ -219,7 +224,7 @@ export default {
       totalPages: 1,
       totalCount: 1,
       pageSize: 20,
-      pageSizes:  [1, 2, 5, 10, 20, 50, 100],
+      pageSizes: [1, 2, 5, 10, 20, 50, 100],
       tool: tool,
       permission: permission,
       regTypes: baseInfo.regTypes(),
@@ -229,6 +234,7 @@ export default {
       dialogAuditLoading: false,
       dialogAddInvoiceVisible: false,
       dialogAddInvoiceLoading: false,
+      planPayDateVisible: false,
       auditId: null,
       form: {
         id: null,
@@ -236,7 +242,7 @@ export default {
         amount: null,
         planPaidAt: null,
         paidAt: new Date(),
-        createRemark: null,
+        createRemark: null
       },
       invoiceForm: {
         id: null,
@@ -257,16 +263,16 @@ export default {
         sellerBank: null,
         itemName: null,
         invoiceRemark: null,
-        createRemark: null,
+        createRemark: null
       },
       pickerOptions0: {
-        disabledDate(time) {
-          return time.getTime() < Date.now();
+        disabledDate (time) {
+          return time.getTime() < Date.now()
         }
       },
       pickerOptions1: {
-        disabledDate(time) {
-          return time.getTime() < Date.now() - 8.64e7;
+        disabledDate (time) {
+          return time.getTime() < Date.now() - 8.64e7
         }
       },
       auditRemark: '',
@@ -276,19 +282,19 @@ export default {
         selectedIds: [],
         planPaidAt: null,
         createRemark: null,
-        withdrawAudit: '',
+        withdrawAudit: ''
       },
       auditTips: '',
       filterTypes: {},
       filterModel: {},
       excelForm: {
-        rowCount: '',
+        rowCount: ''
       },
-      filterStatus: '0',
+      filterStatus: '0'
     }
   },
   mounted () {
-    this.getData();
+    this.getData()
     // if (permission.hasPermission(`finance/withdraw-7`)) {
     //   this.activeName = 'seven'
     // }
@@ -322,7 +328,7 @@ export default {
           message: 'Select the record to operate on', // 请选择要操作的记录
           type: 'warning'
         })
-        return;
+        return
       }
       this.handleAudit(null, command)
     },
@@ -330,16 +336,16 @@ export default {
       let title = ''
       if (status === '2') {
         title = 'Be sure to pass the review?Note:'// 确定要通过审核?备注:
-      }else if(status === '3') {
+      } else if (status === '3') {
         title = 'Be sure to unpaid the review?Note:'// 确定要设为待付款?备注:
-      }else if(status === '4') {
+      } else if (status === '4') {
         title = 'Be sure to payment failure the review?Note:'// 确定要设为付款失败?备注:
-      }else if(status === '6') {
+      } else if (status === '6') {
         title = 'Be sure to paid the review?Note:'// 确定要设为已付款?备注:
-      }else if(status === '7') {
-        title = 'Be sure to return the review?Note:'//确定要设为已退回?备注:
+      } else if (status === '7') {
+        title = 'Be sure to return the review?Note:'// 确定要设为已退回?备注:
       }
-      this.handleStatusShow(row,status,title);
+      this.handleStatusShow(row, status, title)
     },
     handleExpand (row, event, column) {
       this.$refs.multipleTable.toggleRowExpansion(row)
@@ -389,7 +395,7 @@ export default {
     handleEdit () {
       this.dialogEditFormVisible = false
       this.$message({
-        message: 'Modifying data',//正在修改数据
+        message: 'Modifying data', // 正在修改数据
         type: 'info'
       })
       this.loading = true
@@ -403,14 +409,14 @@ export default {
       }).catch(response => {
       })
     },
-    handleStatusShow(row, status, title, remark = 'Remark') { // 备注
+    handleStatusShow (row, status, title, remark = 'Remark') { // 备注
       this.auditForm = {
         auditTips: '',
         auditStatus: null,
         selectedIds: [],
         planPaidAt: null,
         paidAt: new Date(),
-        remark: null,
+        remark: null
       }
       if (row === null) {
         for (let val of this.multipleSelection) {
@@ -421,7 +427,7 @@ export default {
       }
       if (this.auditForm.selectedIds.length === 0) {
         this.$message({
-          message: 'Select the record to operate on',// 请选择数据
+          message: 'Select the record to operate on', // 请选择数据
           type: 'warning'
         })
         return
@@ -430,6 +436,11 @@ export default {
       this.dialogAuditFormVisible = true
       this.auditForm.auditTips = title
       this.auditForm.auditStatus = status
+      if (status === 3) {
+        this.planPayDateVisible = true
+      } else {
+        this.planPayDateVisible = false
+      }
     },
     handleStatus () {
       network.postData('finance/mult-point', {opType: 2}).then(response => {
@@ -477,26 +488,26 @@ export default {
       }).catch(response => {
       })
     },
-    handleSelectionChange(val) {
+    handleSelectionChange (val) {
       this.multipleSelection = val
     },
-    handleCurrentChange(page) {
+    handleCurrentChange (page) {
       this.getData(page, this.pageSize)
     },
-    handleSizeChange(pageSize) {
+    handleSizeChange (pageSize) {
       this.getData(this.currentPage, pageSize)
     },
-    handleFilterStatusClick(tab, event) {
+    handleFilterStatusClick (tab, event) {
       filterHelper.clearFilterOption(this)
       this.getData()
     },
-    handleFilterUser(filterData) {
+    handleFilterUser (filterData) {
       filterHelper.handleFilterUser(this, filterData)
     },
-    handleFilter() {
+    handleFilter () {
       this.getData()
     },
-    getData(page, pageSize) {
+    getData (page, pageSize) {
       let filterData = this.filterModel
       filterData.filterStatus = this.filterStatus != '-1' ? `=,${this.filterStatus}` : ''
       let vueObj = this
@@ -505,9 +516,9 @@ export default {
         vueObj.filterTypes = response.filterTypes
       })
     },
-    onMessageCallback() {
+    onMessageCallback () {
       this.getData(this.currentPage, this.pageSize)
-    },
+    }
   }
 }
 </script>

+ 26 - 20
common/models/Withdraw.php

@@ -88,8 +88,8 @@ class Withdraw extends \common\components\ActiveRecord {
      */
     public function rules() {
         return [
-            [['USER_ID', 'P_MONTH', 'CREATED_AT', 'PLAN_PAID_AT'], 'required'],
-            [['WITHDRAW_PERIOD_NUM', 'WITHDRAW_YEAR', 'WITHDRAW_MONTH', 'IS_AUTO_WITHDRAW', 'BANK_PROVINCE', 'BANK_CITY', 'BANK_COUNTY', 'AUDIT_STATUS', 'CREATED_AT', 'UPDATED_AT', 'AUDITED_AT', 'PLAN_PAID_AT', 'PAID_AT', 'PAID_FAIL_AT', 'BACK_FAIL_AT', 'PAY_TYPE'], 'integer'],
+            [['USER_ID', 'P_MONTH', 'CREATED_AT',], 'required'],
+            [['WITHDRAW_PERIOD_NUM', 'WITHDRAW_YEAR', 'WITHDRAW_MONTH', 'IS_AUTO_WITHDRAW', 'BANK_PROVINCE', 'BANK_CITY', 'BANK_COUNTY', 'AUDIT_STATUS', 'CREATED_AT', 'UPDATED_AT', 'AUDITED_AT', 'PAID_AT', 'PAID_FAIL_AT', 'BACK_FAIL_AT', 'PAY_TYPE'], 'integer'],
             [['AMOUNT','FEES','REAL_AMOUNT'], 'number'],
             [['ID', 'SN', 'USER_ID', 'INVOICE_ID', 'OPEN_BANK', 'BANK_NO', 'UPDATE_ADMIN', 'AUDIT_ADMIN'], 'string', 'max' => 32],
             [['ID_CARD'], 'string', 'max' => 20],
@@ -341,42 +341,48 @@ class Withdraw extends \common\components\ActiveRecord {
 //        $msg = '提现单' . $sn . '当前状态为【' . $statusName[$nowStatus] . '】,无法设置为【' . $statusName[$toStatus] . '】';
         $msg = 'The current status of the withdrawal ' . $sn . ' is 【' . $statusName[$nowStatus] . '】, cannot be set to【'.  $statusName[$toStatus] . '】';
         switch ($toStatus) {
-            //审核
-            case Withdraw::STATUS_AUDITED:
-                if ($nowStatus == Withdraw::STATUS_APPLIED) {
+            // 取消审核
+            case Withdraw::STATUS_APPLIED; // 0 待审核 取消审核
+                if ($nowStatus == Withdraw::STATUS_WAIT_PAID) {
                     $msg = '';
                 }
                 break;
+            //已审核
+//            case Withdraw::STATUS_AUDITED: // 2 已审核
+//                if ($nowStatus == Withdraw::STATUS_APPLIED) {
+//                    $msg = '';
+//                }
+//                break;
             //待付款
-            case Withdraw::STATUS_WAIT_PAID:
-                if ($nowStatus == Withdraw::STATUS_AUDITED || $nowStatus == Withdraw::STATUS_PAID_FALSE) {
+            case Withdraw::STATUS_WAIT_PAID: // 3 待复核
+                if ($nowStatus == Withdraw::STATUS_APPLIED) {
                     $msg = '';
                 }
                 break;
             //已付款
-            case Withdraw::STATUS_PAID:
+            case Withdraw::STATUS_PAID: // 6 已付款
                 if ($nowStatus == Withdraw::STATUS_WAIT_PAID) {
                     $msg = '';
                 }
                 break;
             //付款失败
-            case Withdraw::STATUS_PAID_FALSE:
-                if ($nowStatus == Withdraw::STATUS_PAID) {
-                    $msg = '';
-                }
-                break;
+//            case Withdraw::STATUS_PAID_FALSE:
+//                if ($nowStatus == Withdraw::STATUS_PAID) {
+//                    $msg = '';
+//                }
+//                break;
             //提现退回
-            case Withdraw::STATUS_RETURN:
-                if ($nowStatus == Withdraw::STATUS_APPLIED  || $nowStatus == Withdraw::STATUS_AUDITED || Withdraw::STATUS_WAIT_PAID) {
-                    $msg = '';
-                }
-                break;
-            //审核拒绝
-            case Withdraw::STATUS_REFUSED:
+            case Withdraw::STATUS_RETURN: // 7 已退回
                 if ($nowStatus == Withdraw::STATUS_APPLIED) {
                     $msg = '';
                 }
                 break;
+            //审核拒绝
+//            case Withdraw::STATUS_REFUSED:
+//                if ($nowStatus == Withdraw::STATUS_APPLIED) {
+//                    $msg = '';
+//                }
+//                break;
             default:
         }
         return $msg;