|
|
@@ -3,7 +3,7 @@
|
|
|
<el-table :data="list" border fit highlight-current-row>
|
|
|
<el-table-column align="center" :label="$t('finance.createdTime')" prop="CREATED_AT" min-width="140px">
|
|
|
<template slot-scope="{row}">
|
|
|
- <span>{{ row.CREATED_AT | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
|
|
+ <span>{{ tool.convertToNigeriaTime(row.CREATED_AT) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" min-width="160px" :label="$t('finance.rechargeAmount')" prop="AMOUNT">
|
|
|
@@ -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,28 @@ export default {
|
|
|
return statusEnums[status] || 'warning'
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ dialog: {
|
|
|
+ handler(newValue, old){
|
|
|
+ if(newValue === false){
|
|
|
+ this.form = {
|
|
|
+ applyAmount: 1,
|
|
|
+ bankNo: '',
|
|
|
+ openBank: '',
|
|
|
+ bankAddress: ''
|
|
|
+ }
|
|
|
+ this.$forceUpdate()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uploadVoucher: {
|
|
|
+ handler(newValue, old){
|
|
|
+ if(newValue === false){
|
|
|
+ this.imageUrl = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
tool: tool,
|
|
|
@@ -116,9 +140,8 @@ export default {
|
|
|
listLoading: true,
|
|
|
listQuery: {
|
|
|
page: 1,
|
|
|
- pageSize: 5
|
|
|
+ pageSize: 10
|
|
|
},
|
|
|
-
|
|
|
dialog: false,
|
|
|
loading: false,
|
|
|
form: {
|
|
|
@@ -131,7 +154,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 +177,8 @@ export default {
|
|
|
'Device-Type': 'pc',
|
|
|
'Suppress-Response-Code': '1',
|
|
|
'Authorization': ''
|
|
|
- }
|
|
|
+ },
|
|
|
+ isEdit: false,
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -184,27 +208,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 +284,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'),
|