소스 검색

feat: NG-93: 【会员端】——【Recharge Details】,新增“编辑”按钮及功能。

tyler 1 년 전
부모
커밋
64b86512eb
6개의 변경된 파일104개의 추가작업 그리고 30개의 파일을 삭제
  1. 8 0
      src/api/finance.js
  2. 0 1
      src/components/Breadcrumb/index.vue
  3. 1 1
      src/components/Pagination/index.vue
  4. 3 1
      src/lang/en.js
  5. 3 1
      src/lang/zh.js
  6. 89 26
      src/views/finance/recharge-list.vue

+ 8 - 0
src/api/finance.js

@@ -72,4 +72,12 @@ export function fetchApplyRecharge(data) {
   })
 }
 
+export function editApplyRecharge(data) {
+  return request({
+    url: '/v1/finance/recharge-update',
+    method: 'post',
+    data
+  })
+}
+
 

+ 0 - 1
src/components/Breadcrumb/index.vue

@@ -38,7 +38,6 @@ export default {
     getBreadcrumb() {
       // only show routes with meta.title
       let matched = this.$route.matched.filter(item => item.meta && item.meta.title)
-      console.log(matched)
       const first = matched[0]
 
       if (!this.isDashboard(first)) {

+ 1 - 1
src/components/Pagination/index.vue

@@ -36,7 +36,7 @@ export default {
     pageSizes: {
       type: Array,
       default() {
-        return [10, 20, 30, 50]
+        return [5, 10, 20, 30, 50]
       }
     },
     layout: {

+ 3 - 1
src/lang/en.js

@@ -558,7 +558,9 @@ export default {
     viewVoucher: 'View',
     bankInformation: 'Bank Info',
     selectBank: 'Select Bank',
-    accountName: 'Account Name'
+    accountName: 'Account Name',
+    uploadEdit: 'Edit',
+    paymentReference: 'Payment Reference',
   },
   notificationProps: {
     title: '📢 system update',

+ 3 - 1
src/lang/zh.js

@@ -553,7 +553,9 @@ export default {
     viewVoucher: '查看',
     bankInformation: '银行信息',
     selectBank: '请选择开户行',
-    accountName: '开户支行'
+    accountName: '开户支行',
+    uploadEdit: '编辑',
+    paymentReference: '汇款账号',
   },
   notificationProps: {
     title: '📢 系统更新',

+ 89 - 26
src/views/finance/recharge-list.vue

@@ -17,28 +17,30 @@
         </template>
       </el-table-column>
       <el-table-column align="center" min-width="180px" :label="$t('finance.bankName')" prop="OPEN_BANK_NAME" />
-      <el-table-column align="center" min-width="150px" :label="$t('finance.bankAccount')" prop="BANK_NO" />
+      <el-table-column align="center" min-width="150px" :label="$t('finance.paymentReference')" prop="BANK_NO" />
       <el-table-column align="center" min-width="150px" :label="$t('finance.printVoucher')">
         <template slot-scope="{row}">
           <el-button v-if="row.AUDIT_STATUS === '0'" type="primary" size="mini" @click="handleUpload(row.ID)">{{ $t('finance.uploadVoucher') }}</el-button>
           <el-button v-if="row.AUDIT_STATUS !== '0'" type="success" size="mini" @click="handleView(row)">{{ $t('finance.viewVoucher') }}</el-button>
+          <el-button v-if="row.AUDIT_STATUS === '0'" type="success" size="mini" @click="handleEdit(row)">{{ $t('finance.uploadEdit') }}</el-button>
+
         </template>
       </el-table-column>
     </el-table>
 
     <div class="white-box-footer" style="margin-top: 10px;">
-      <el-button size="small" type="primary" @click="dialog = true">{{ $t('finance.recharge') }}</el-button>
+      <el-button size="small" type="primary" @click="dialog = true, isEdit = false">{{ $t('finance.recharge') }}</el-button>
       <pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize" @pagination="getList" />
     </div>
 
     <el-dialog :title="$t('finance.recharge')" :visible.sync="dialog" :width="screenWidth" style="margin-top: -70px;">
-      <el-form ref="form" v-loading="loading" :model="form" :rules="rules" :label-position="labelPosition" style="margin-top: -20px; margin-bottom: -30px;">
+      <el-form ref="form" v-if="dialog" v-loading="loading" :model="form" :rules="rules" :label-position="labelPosition" style="margin-top: -20px; margin-bottom: -30px;">
         <el-row :gutter="20">
           <el-col :xs="24" :sm="24" :lg="24">
             <el-form-item :label="$t('finance.rechargeAmount')" prop="applyAmount" required>
               <el-input-number v-model.number="form.applyAmount" :min="minAmount" :max="maxAmount" :step="10000" style="width: 100%" clearable />
             </el-form-item>
-            <el-form-item :label="$t('finance.bankAccount')" prop="bankNo" required>
+            <el-form-item :label="$t('finance.paymentReference')" prop="bankNo" required>
               <el-input v-model="form.bankNo" type="text" clearable style="width: 100%" />
             </el-form-item>
             <el-form-item :label="$t('finance.bankName')" prop="openBank" required>
@@ -84,7 +86,7 @@
 </template>
 
 <script>
-import { fetchApplyRecharge, fetchBankList, fetchRechargeList } from '@/api/finance'
+import { fetchApplyRecharge, fetchBankList, fetchRechargeList, editApplyRecharge } from '@/api/finance'
 import { fetchToken } from '@/api/file'
 import waves from '@/directive/waves'
 import Pagination from '@/components/Pagination'
@@ -108,6 +110,27 @@ export default {
       return statusEnums[status] || 'warning'
     }
   },
+  watch: {
+    dialog: {
+      handler(newValue, old){
+        if(newValue === false){
+          this.form = {
+            applyAmount: 1,
+            bankNo: '',
+            openBank: '',
+          }
+          this.$forceUpdate()
+        }
+      }
+    },
+    uploadVoucher: {
+      handler(newValue, old){
+        if(newValue === false){
+          this.imageUrl = ''
+        }
+      }
+    }
+  },
   data() {
     return {
       tool: tool,
@@ -116,9 +139,8 @@ export default {
       listLoading: true,
       listQuery: {
         page: 1,
-        pageSize: 5
+        pageSize: 10
       },
-
       dialog: false,
       loading: false,
       form: {
@@ -131,7 +153,7 @@ export default {
       maxAmount: 10000000000,
       rules: {
         applyAmount: [required, integer, range(this.minAmount, this.maxAmount)],
-        bankNo: [{ required: true, message: this.$t('finance.bankAccount') + this.$t('common.require'), trigger: 'blur' }],
+        bankNo: [{ required: true, message: this.$t('finance.paymentReference') + this.$t('common.require'), trigger: 'blur' }],
         openBank: [{ required: true, message: this.$t('finance.bankName') + this.$t('common.require'), trigger: 'blur' }]
       },
       bankList: [],
@@ -154,7 +176,8 @@ export default {
         'Device-Type': 'pc',
         'Suppress-Response-Code': '1',
         'Authorization': ''
-      }
+      },
+      isEdit: false,
     }
   },
   created() {
@@ -184,27 +207,55 @@ export default {
       this.$refs['form'].validate((valid) => {
         if (valid) {
           this.loading = true
-          fetchApplyRecharge(this.form).then(response => {
-            this.$message({
-              message: response.data,
-              type: 'success',
-              duration: 1.5 * 1000
-            })
+          let form = {}
+          let { applyAmount, bankNo, openBank, bankAddress, ID } = this.form
+          if(this.isEdit){
+            form = { applyAmount, bankNo, openBank, bankAddress, id: ID }
+            editApplyRecharge(form).then(response => {
+              this.$message({
+                message: response.data,
+                type: 'success',
+                duration: 1.5 * 1000
+              })
 
-            this.$refs['form'].resetFields()
-            this.dialog = false
-            this.loading = false
+              this.$refs['form'].resetFields()
+              this.dialog = false
+              this.loading = false
 
-            this.getList()
-          }).catch((err) => {
-            this.$message({
-              message: err,
-              type: 'error',
-              duration: 3 * 1000
+              this.getList()
+            }).catch((err) => {
+              this.$message({
+                message: err,
+                type: 'error',
+                duration: 3 * 1000
+              })
+
+              this.loading = false
             })
+          } else {
+            form = { applyAmount, bankNo, openBank, bankAddress }
+            fetchApplyRecharge(form).then(response => {
+              this.$message({
+                message: response.data,
+                type: 'success',
+                duration: 1.5 * 1000
+              })
+
+              this.$refs['form'].resetFields()
+              this.dialog = false
+              this.loading = false
 
-            this.loading = false
-          })
+              this.getList()
+            }).catch((err) => {
+              this.$message({
+                message: err,
+                type: 'error',
+                duration: 3 * 1000
+              })
+
+              this.loading = false
+            })
+          }
         } else {
           return false
         }
@@ -232,6 +283,18 @@ export default {
         this.uploadVoucher = true
       }, 0.5 * 1000)
     },
+    handleEdit(row){
+      let { AMOUNT, BANK_NO, OPEN_BANK, ID } = row
+      this.form = {
+        applyAmount: AMOUNT,
+        bankNo: BANK_NO,
+        openBank: OPEN_BANK,
+        ID: ID
+      }
+      this.isEdit = true
+      this.dialog = true
+      this.$forceUpdate()
+    },
     async uploaderHandleBefore() {
       this.$message({
         message: this.$t('common.uploadHints'),