|
@@ -30,7 +30,9 @@
|
|
|
<!-- <el-table-column align="center" prop="payment_type" label="支付方式"></el-table-column> -->
|
|
|
<el-table-column align="center" prop="add_time" label="充值时间"></el-table-column>
|
|
|
<el-table-column align="center" label="充值凭证">
|
|
|
- <el-button type="success" size="small" @click="seeDialogVisible = true">查看</el-button>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="success" size="small" @click="seeBtn(scope.row.voucher_path)">查看</el-button>
|
|
|
+ </template>
|
|
|
<!-- <el-button size="small" type="primary" @click="uploadDialogVisible = true">上传</el-button> -->
|
|
|
<!-- <el-upload
|
|
|
class="upload-demo"
|
|
@@ -60,7 +62,7 @@
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- 上传弹层 -->
|
|
|
- <el-dialog title="上传凭证" :visible="uploadDialogVisible" class="updata" @closed="onCloseEditDialog">
|
|
|
+ <el-dialog title="上传凭证" :visible="uploadDialogVisible" class="updata" @close="onCloseEditDialog">
|
|
|
<!-- <el-form :model="formData" label-width="120px">
|
|
|
<el-form-item label="充值金额: ">
|
|
|
<el-input v-model="formData.amount" style="width:300px"></el-input>
|
|
@@ -139,12 +141,13 @@
|
|
|
</template>
|
|
|
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
|
|
|
<script>
|
|
|
-// getVoucherList-获取充值列表 updateVoucher-上传凭证 queryVoucherList-查询充值
|
|
|
+// getVoucherList-获取充值列表 updateVoucher-上传凭证 queryVoucherList-查询充值 updateVoucherList-上传凭证列表
|
|
|
import {
|
|
|
// balanceList,
|
|
|
getVoucherList,
|
|
|
updateVoucher,
|
|
|
- queryVoucherList
|
|
|
+ queryVoucherList,
|
|
|
+ updateVoucherList
|
|
|
} from "@/api";
|
|
|
import { balanceType } from '@/utils/constants'
|
|
|
export default {
|
|
@@ -194,36 +197,28 @@ export default {
|
|
|
amount: [{ required: true, message: '请输入充值金额', trigger: 'blur' }],
|
|
|
bank_username: [{ required: true, message: '请输入开户人姓名', trigger: 'blur' }],
|
|
|
bank_name: [{ required: true, message: '请输入银行名称', trigger: 'blur' }],
|
|
|
- voucher: [{ required: true, message: '请上传充值凭证', trigger: 'change' }],
|
|
|
+ voucher: [{ required: true, message: '请上传充值凭证', trigger: 'blur' }],
|
|
|
},
|
|
|
files: '',
|
|
|
selectFileobj: '',
|
|
|
imgCode: '',
|
|
|
- fileImg: ''
|
|
|
+ fileImg: '',
|
|
|
+ // 上传图片返回地址
|
|
|
+ file_path: ''
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- // this.getOrderList();
|
|
|
},
|
|
|
created () {
|
|
|
this.getVoucherList()
|
|
|
},
|
|
|
methods: {
|
|
|
- // getOrderList() {
|
|
|
- // const _self = this;
|
|
|
- // balanceList({
|
|
|
- // pageSize: _self.pageSize,
|
|
|
- // pageNumber: _self.pageNumber,
|
|
|
- // order_sn: _self.searchValue,
|
|
|
- // start_time: _self.dataRange && _self.dataRange.length == 2 ? _self.dataRange[0] : '',
|
|
|
- // end_time: _self.dataRange && _self.dataRange.length == 2 ? _self.dataRange[1] : ''
|
|
|
- // }).then((res) => {
|
|
|
- // if (res && res.msg == "ok") {
|
|
|
- // _self.total = res.data.total;
|
|
|
- // _self.tableData = [...res.data.rows];
|
|
|
- // }
|
|
|
- // });
|
|
|
- // },
|
|
|
+ // 查看
|
|
|
+ seeBtn(path) {
|
|
|
+ this.seeDialogVisible = true
|
|
|
+ this.url = path
|
|
|
+ this.srcList = [path]
|
|
|
+ },
|
|
|
// 关闭弹层
|
|
|
onCloseEditDialog() {
|
|
|
this.formData = {};
|
|
@@ -359,6 +354,18 @@ export default {
|
|
|
// this.fileName = event.target.files[0].name;
|
|
|
this.fileImg = event.target.files[0];
|
|
|
console.log('file', event.target.files[0]);
|
|
|
+
|
|
|
+ // var reader = new FileReader()
|
|
|
+ // reader.readAsDataURL(this.fileImg)
|
|
|
+ // reader.onload = async function (e) {
|
|
|
+ // let fd = new FormData(document.getElementById("uploadForm"));
|
|
|
+ // fd.append('file', this.fileImg);
|
|
|
+ // console.log('fd', fd);
|
|
|
+ // const res = await updateVoucher(fd) // 调用接口实现文件上传
|
|
|
+ // console.log('res', res);
|
|
|
+ // this.file_path = res.datas.file_path
|
|
|
+
|
|
|
+ // }
|
|
|
}
|
|
|
},
|
|
|
// 上传按钮
|
|
@@ -386,12 +393,34 @@ export default {
|
|
|
// }
|
|
|
|
|
|
//关于formdata使用方式请自行搜索
|
|
|
- // let uploadForm = document.getElementById("uploadForm");
|
|
|
- // console.log('uploadForm',uploadForm);
|
|
|
+ let uploadForm = document.getElementById("uploadForm");
|
|
|
+ console.log('uploadForm',uploadForm);
|
|
|
let fd = new FormData(document.getElementById("uploadForm"));
|
|
|
- fd.append('voucher', this.fileImg);
|
|
|
+ fd.append('file', this.fileImg);
|
|
|
+ console.log('fd', fd);
|
|
|
const res = await updateVoucher(fd) // 调用接口实现文件上传
|
|
|
console.log('res', res);
|
|
|
+ this.file_path = res.datas.file_path
|
|
|
+
|
|
|
+ // const res = await this.$axios.post('http://192.168.1.195/upfile.php', {
|
|
|
+ // name: fd
|
|
|
+ // })
|
|
|
+ // console.log('res', res);
|
|
|
+
|
|
|
+ // 上传凭证列表
|
|
|
+ this.$nextTick(async () => {
|
|
|
+ const result = await updateVoucherList({
|
|
|
+ amount: this.formData.amount,
|
|
|
+ bank_username: this.formData.bank_username,
|
|
|
+ bank_name: this.formData.bank_name,
|
|
|
+ voucher: this.file_path
|
|
|
+ })
|
|
|
+ console.log('result', result);
|
|
|
+ if (result && result.code == 200) {
|
|
|
+ this.$message.success('上传成功')
|
|
|
+ this.uploadDialogVisible = false
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
}
|
|
@@ -402,9 +431,9 @@ export default {
|
|
|
display: inline-block;
|
|
|
margin-left: 10px;
|
|
|
}
|
|
|
-/* .seeDialog /deep/.el-dialog__body {
|
|
|
+.seeDialog /deep/.el-dialog__body {
|
|
|
text-align: center;
|
|
|
-} */
|
|
|
+}
|
|
|
/* .avatar-uploader {
|
|
|
text-align: center;
|
|
|
} */
|