recharge.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div v-loading="loading">
  3. <div class="white-box">
  4. <el-table class="withdraw-table" :data="tableData" stripe style="width: 100%;">
  5. <el-table-column label="创建时间">
  6. <template slot-scope="scope">
  7. {{tool.formatDate(scope.row.CREATED_AT)}}
  8. </template>
  9. </el-table-column>
  10. <el-table-column label="充值金额" prop="AMOUNT">
  11. </el-table-column>
  12. <el-table-column label="充值状态名称">
  13. <template slot-scope="scope">
  14. <el-tag :type="tool.statusType(scope.row.AUDIT_STATUS)">{{scope.row.STATUS_NAME}}</el-tag>
  15. </template>
  16. </el-table-column>
  17. <el-table-column label="汇款银行" prop="OPEN_BANK_NAME">
  18. </el-table-column>
  19. <el-table-column label="我的汇款账号" prop="BANK_NO">
  20. </el-table-column>
  21. <el-table-column label="打印凭证" width="200">
  22. <template slot-scope="scope">
  23. <el-button type="primary" size="small" @click="handleAddInvoiceShow(scope.row)"
  24. v-if="scope.row.AUDIT_STATUS==='0'" icon="el-icon-upload">上传凭证
  25. </el-button>
  26. <el-button type="success" size="small" @click="handleInvoiceShow(scope.row)"
  27. v-if="scope.row.AUDIT_STATUS!=='0'" icon="el-icon-view">查看凭证
  28. </el-button>
  29. </template>
  30. </el-table-column>
  31. </el-table>
  32. <div class="white-box-footer">
  33. <el-button type="primary" size="small" @click="handleAdd">我要充值</el-button>
  34. <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
  35. </div>
  36. <el-dialog title="上传凭证" :visible.sync="dialogAddInvoiceVisible">
  37. <div v-loading="dialogAddInvoiceLoading">
  38. <el-alert type="warning" :closable="false">
  39. <slot name="title">
  40. <pre v-html="message"></pre>
  41. </slot>
  42. </el-alert>
  43. <leo-uploader :requestRoute="'finance/prove-add?id='+auditId" :defaultImageUrl="defaultImageUrl" width="480px" height="320px"
  44. :uploaderSuccessCanChange="false" @on-success="handleSuccess"></leo-uploader>
  45. </div>
  46. </el-dialog>
  47. <el-dialog title="查看充值凭证" :visible.sync="dialogInvoiceVisible">
  48. <div v-loading="dialogInvoiceLoading">
  49. <a :href="invoiceUrl" target="_blank"><img :src="urlimg" alt="" style="max-width: 100%"></a>
  50. </div>
  51. <div slot="footer" class="dialog-footer">
  52. <el-button @click="dialogInvoiceVisible = false">确 定</el-button>
  53. </div>
  54. </el-dialog>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import network from '@/utils/network'
  60. import baseInfo from '@/utils/baseInfo'
  61. import store from '@/utils/vuexStore'
  62. import tool from '@/utils/tool'
  63. import LeoFilter from '@/components/Filter'
  64. import LeoUploader from '@/components/Uploader'
  65. import Pagination from '@/components/Pagination'
  66. export default {
  67. name: "recharge",
  68. components: {LeoFilter, LeoUploader,Pagination},
  69. mounted() {
  70. this.getData();
  71. },
  72. data() {
  73. return {
  74. loading: false,
  75. form:{
  76. },
  77. tableData:null,
  78. list: null,
  79. currentPage: 1,
  80. totalPages: 1,
  81. totalCount: 1,
  82. pageSize: 20,
  83. tool: tool,
  84. dialogAddInvoiceVisible: false,
  85. dialogAddInvoiceLoading: false,
  86. dialogInvoiceVisible: false,
  87. dialogInvoiceLoading: false,
  88. defaultImageUrl: null,
  89. addInvoiceTips: '',
  90. requestRoute: '',
  91. uploadId: null,
  92. invoiceUrl:[],
  93. auditId: null,
  94. message:'',
  95. submitButtonStat: false,
  96. id:'',
  97. dialogImageUrl: '',
  98. dialogVisible: false,
  99. disabled: false,
  100. file:null,
  101. urlimg:'',
  102. postid:''
  103. }
  104. },
  105. methods:{
  106. handleCurrentChange (page) {
  107. this.getData(page, this.pageSize)
  108. },
  109. handleSizeChange (pageSize) {
  110. this.getData(this.currentPage, pageSize)
  111. },
  112. getData (page, pageSize) {
  113. network.getPageData(this, '/finance/recharge', page, pageSize, {type: this.type}, function (response) {
  114. this.loading = false;
  115. this.list = response.list;
  116. let settingObj=this.list;
  117. let settingArr = Object.keys(settingObj).map(key => {
  118. //console.log(key); //为每个键名
  119. return settingObj[key]; //把每个对象返回出去生成一个新的数组中相当于0:{id:1}
  120. } );
  121. this.tableData=settingArr;
  122. console.log(this.tableData)
  123. });
  124. },
  125. handleAdd() {
  126. this.$router.push({path: `/finance/recharge-add`})
  127. },
  128. handlePictureCardPreview(file) {
  129. this.dialogImageUrl = tool.getLocaleLink(file.url, '/files/');
  130. this.dialogVisible = true;
  131. this.file=file;
  132. // console.log(file);
  133. },
  134. getFile(){
  135. let data={
  136. uploadToken:this.uploadToken,
  137. file:this.file,
  138. id:this.auditId
  139. }
  140. console.log(data)
  141. if(this.uploadToken){
  142. network.postData('finance/prove-add',data)
  143. .then(response=>{
  144. console.log(response);
  145. })
  146. }
  147. },
  148. handleAddInvoiceShow(row) {
  149. this.dialogAddInvoiceLoading = true
  150. this.auditId = row.ID
  151. console.log(this.auditId)
  152. //this.requestRoute = 'finance/prove-add/' + this.auditId
  153. this.dialogAddInvoiceVisible = true
  154. this.loading = false;
  155. let vueObj = this
  156. network.getData('finance/prove-add',{id: this.auditId}).then(response => {
  157. console.log(response)
  158. vueObj.dialogAddInvoiceLoading = false
  159. //vueObj.invoiceUrl = response
  160. vueObj.uploadToken=response;
  161. })
  162. },
  163. handleSuccess(response, file) {
  164. this.getData()
  165. this.$message({
  166. message: '上传凭证完成!',
  167. type: 'success'
  168. })
  169. //this.form.image = imageUrl;
  170. },
  171. handleInvoiceShow(row) {
  172. this.dialogInvoiceLoading = true
  173. this.uploadId = row.ID
  174. this.dialogInvoiceVisible = true
  175. network.getData('finance/recharge', {id: this.uploadId}).then(response => {
  176. console.log(response)
  177. this.dialogInvoiceLoading = false
  178. let invoiceUrl = response.list;
  179. console.log(row)
  180. this.urlimg=tool.getLocaleLink(row.BANK_PROVE, '/files/');
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style scoped>
  187. </style>