recharge.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div v-loading="loading">
  3. <div class="white-box">
  4. <div class="filter-box">
  5. <filter-user :filter-types="filterTypes" @select-value="handleFilterUser"></filter-user>
  6. </div>
  7. <el-table class="table-box" ref="multipleTable" :data="tableData" stripe style="width: 100%;" :height="tool.getTableHeight()" @selection-change="handleSelectionChange">
  8. <!-- <el-table-column fixed type="selection" width="55" v-if="tableHeaders" :selectable="checkSelectable"></el-table-column>-->
  9. <el-table-column v-for="(tableHeader, key) in tableHeaders" :key="key" :label="tableHeader.header" :width="tableHeader.other.width ? tableHeader.other.width : ''" :prop="tableHeader.other.prop ? tableHeader.other.prop : null">
  10. <template slot-scope="scope">
  11. <template v-if="scope.row[tableHeader.index].other.tag" >
  12. <el-tag :type="scope.row[tableHeader.index].other.tag.type ? scope.row[tableHeader.index].other.tag.type : null" :size="scope.row[tableHeader.index].other.tag.size ? scope.row[tableHeader.index].other.tag.size : null" :class="scope.row[tableHeader.index].other.tag.class ? scope.row[tableHeader.index].other.tag.class : null" >{{scope.row[tableHeader.index].value}}</el-tag>
  13. </template>
  14. <template v-else>
  15. <div v-html="scope.row[tableHeader.index].value"></div>
  16. </template>
  17. </template>
  18. </el-table-column>
  19. <el-table-column min-width="150" :label="$t('common.action')"> <!-- 操作 -->
  20. <template slot-scope="scope">
  21. <el-button type="success" size="small" @click="handleGroupManage(scope.row)" >
  22. {{ $t('financial.statusManagement') }}<!-- 状态管理 -->
  23. </el-button>
  24. </template></el-table-column>
  25. <!-- <el-table-column min-width="150" :label="$t('financial.typeManagement')"> &lt;!&ndash; 操作 &ndash;&gt;-->
  26. <!-- <template slot-scope="scope">-->
  27. <!-- <el-button type="success" size="small" @click="handleTypeManagement(scope.row)" >-->
  28. <!-- {{ $t('financial.typeManagement') }}&lt;!&ndash; 状态管理 &ndash;&gt;-->
  29. <!-- </el-button>-->
  30. <!-- </template></el-table-column>-->
  31. <el-table-column min-width="150" :label="$t('financial.viewVoucher')"><!-- 查看凭证 -->
  32. <template slot-scope="scope">
  33. <el-button type="success" size="small" @click="handleInvoiceShow(scope.row)"
  34. v-if="scope.row.AUDIT_STATUS!=='0'">{{ $t('financial.viewVoucher') }}<!-- 查看凭证 -->
  35. </el-button>
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. <div class="white-box-footer">
  40. <el-button type="success" size="small" @click="handleExport"
  41. v-show="permission.hasPermission(`finance/recharge-export`)">{{ $t('common.exportExcel') }}
  42. </el-button>
  43. <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
  44. </div>
  45. <el-dialog :title="$t('financial.checkRechargeVoucher')" :visible.sync="dialogInvoiceVisible"> <!-- 查看充值凭证 -->
  46. <div v-loading="dialogInvoiceLoading">
  47. <a :href="invoiceUrl" target="_blank"><img :src="urlimg" alt="" style="max-width: 100%"></a>
  48. </div>
  49. <div slot="footer" class="dialog-footer">
  50. <el-button @click="dialogInvoiceVisible = false">{{ $t('common.confirm') }}</el-button> <!-- 确 定 -->
  51. </div>
  52. </el-dialog>
  53. <el-dialog width="30%" :title="$t('financial.typeManagement')" :visible.sync="dialogTypeVisible"> <!-- 查看充值凭证 -->
  54. <el-form ref="form" :model="form">
  55. <el-form-item :label="$t('financial.type')" prop="rechargeType">
  56. <el-select v-model="form.rechargeType" clearable filterable style="width: 100%">
  57. <el-option v-for="(item,key) in typeList" :key="key" :label="item" :value="item" />
  58. </el-select>
  59. </el-form-item>
  60. </el-form>
  61. <div slot="footer" class="dialog-footer">
  62. <el-button @click="onCancel">{{ $t('table.cancel') }}<!-- 取 消 --></el-button>
  63. <el-button type="primary" @click.native="handleSave">{{ $t('common.save') }}<!-- 发货 --></el-button>
  64. </div>
  65. </el-dialog>
  66. </div>
  67. </div>
  68. </template>
  69. <script>
  70. import tool from '@/utils/tool'
  71. import FilterUser from '@/components/FilterUser'
  72. import permission from '@/utils/permission'
  73. import Pagination from '@/components/Pagination'
  74. import filterHelper from '@/utils/filterHelper'
  75. import {rechargeList, rechargeExport, fetchRechargeTypeList, saveRechargeType} from '@/api/finance'
  76. export default {
  77. name: 'recharge',
  78. components: {FilterUser,Pagination},
  79. mounted () {
  80. this.getData()
  81. this.fetchRechargeTypeList()
  82. },
  83. data () {
  84. return {
  85. tableHeaders: null,
  86. tableData: null,
  87. loading: true,
  88. currentPage: 1,
  89. totalPages: 1,
  90. totalCount: 1,
  91. pageSize: 20,
  92. multipleSelection: [],
  93. tool: tool,
  94. permission: permission,
  95. filterTypes: {},
  96. filterModel: {},
  97. value:[],
  98. selectedIds:'',
  99. dialogInvoiceVisible: false,
  100. dialogInvoiceLoading: false,
  101. dialogTypeVisible: false,
  102. typeList: [],
  103. invoiceUrl:'',
  104. form: {
  105. id: null,
  106. rechargeType: '',
  107. },
  108. urlimg:''
  109. }
  110. },
  111. methods: {
  112. handleSelectionChange(val) {
  113. this.multipleSelection = val
  114. },
  115. handleCurrentChange (page) {
  116. this.getData(page, this.pageSize)
  117. },
  118. handleSizeChange (pageSize) {
  119. this.getData(this.currentPage, pageSize)
  120. },
  121. handleFilterUser(filterData){
  122. filterHelper.handleFilterUser(this, filterData)
  123. },
  124. handleFilter() {
  125. this.getData()
  126. },
  127. checkSelectable(row) {
  128. return row.DONT_DEL !== '1'
  129. },
  130. getData (page, pageSize) {
  131. let filterData = this.filterModel
  132. let vueObj = this
  133. const paramsData = Object.assign({
  134. page: (page === null || page == undefined) ? 1 : page,
  135. pageSize: (pageSize === null || pageSize == undefined) ? vueObj.pageSize : pageSize
  136. }, filterData)
  137. rechargeList(paramsData).then(response => {
  138. vueObj.tableHeaders = response.data.columnsShow ? response.data.columnsShow : []
  139. vueObj.tableData = response.data.list
  140. vueObj.filterTypes = response.data.filterTypes
  141. vueObj.currentPage = page
  142. vueObj.totalPages = parseInt(response.data.totalPages)
  143. vueObj.totalCount = parseInt(response.data.totalCount)
  144. vueObj.pageSize = pageSize
  145. // vueObj.selectedIds = vueObj.tableData.ID;
  146. let settingObj=vueObj.tableData;
  147. let settingArr = Object.keys(settingObj).map(key => {
  148. //console.log(key); //为每个键名
  149. return settingObj[key]; //把每个对象返回出去生成一个新的数组中相当于0:{id:1}
  150. } );
  151. this.tableData=settingArr;
  152. this.loading = false
  153. }).catch(err => {
  154. this.$message({
  155. message: err,
  156. type: 'error'
  157. })
  158. this.loading = false
  159. })
  160. },
  161. handleExport(){
  162. this.$confirm(this.$t('financial.exportNotice'), this.$t('common.hint'), {
  163. confirmButtonText: this.$t('common.confirm'), // 确定
  164. cancelButtonText: this.$t('common.cancel'), // 取消
  165. type: 'warning'
  166. }).then(() => {
  167. rechargeExport(this.filterModel).then(response => {
  168. this.$message({
  169. message: response.data,
  170. type: 'success'
  171. })
  172. }).catch(error => {
  173. this.$message({
  174. message: error,
  175. type: 'error'
  176. })
  177. })
  178. })
  179. },
  180. handleInvoiceShow(row) {
  181. this.dialogInvoiceLoading = true
  182. this.uploadId = row.ID
  183. this.dialogInvoiceVisible = true
  184. this.dialogInvoiceLoading = false
  185. this.urlimg = tool.getArImage(row.BANK_PROVE, '/files/');
  186. },
  187. fetchRechargeTypeList() {
  188. fetchRechargeTypeList().then(response => {
  189. this.typeList = response.data.type
  190. })
  191. },
  192. onCancel() {
  193. this.dialogTypeVisible = false
  194. this.$refs['form'].resetFields()
  195. },
  196. handleTypeManagement(row) {
  197. console.log(row)
  198. this.form.id = row.ID
  199. this.form.rechargeType = row.TYPE.value
  200. this.dialogTypeVisible = true
  201. },
  202. handleSave() {
  203. saveRechargeType(this.form).then(response => {
  204. this.$message({
  205. message: response.data,
  206. type: 'success'
  207. })
  208. this.getData()
  209. }).finally(() => {
  210. this.dialogTypeVisible = false
  211. this.$refs['form'].resetFields()
  212. })
  213. },
  214. /* handlestate(){
  215. this.$router.push({path: `/finance/recharge-status`})
  216. },*/
  217. handleGroupManage(row) {
  218. /* if (this.multipleSelection.length < 1) {
  219. this.$message({
  220. message: '请勾选要操作的会员',
  221. type: 'warning'
  222. })
  223. return
  224. }else{
  225. if(this.multipleSelection.length > 1){
  226. this.$message({
  227. message: '只能选择一个',
  228. type: 'warning'
  229. })
  230. return
  231. }
  232. }*/
  233. this.$router.push({
  234. path: `/finance/recharge-status`,
  235. query: {
  236. mallCode: row
  237. }
  238. })
  239. },
  240. },
  241. }
  242. </script>
  243. <style scoped>
  244. .table-box .el-form-item__label {
  245. width: 100px;
  246. color: #99a9bf;
  247. }
  248. .table-box .el-form-item {
  249. width: 30%;
  250. margin-right: 0;
  251. margin-bottom: 0;
  252. }
  253. .el-button--small, .el-button--small.is-round {
  254. padding: 9px 5px;
  255. }
  256. </style>