withdrawrecords.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList"
  4. :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
  5. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  6. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
  7. <template slot="menuLeft">
  8. <el-button type="danger" size="small" icon="el-icon-delete" plain v-if="permission.withdrawrecords_delete"
  9. @click="handleDelete">删 除
  10. </el-button>
  11. </template>
  12. <template slot="userInfo" slot-scope="scope">
  13. <div style="display: flex;">
  14. <div style="display: flex;justify-content: center;align-items: center;">
  15. <el-avatar size="large" :src="scope.row.avatar"></el-avatar>
  16. </div>
  17. <div style="padding: 10px;">
  18. <div>昵称:{{scope.row.nickName}}</div>
  19. <div>手机:{{scope.row.phone}}</div>
  20. </div>
  21. </div>
  22. </template>
  23. <!-- 操作菜单 -->
  24. <template slot="timeInfo" slot-scope="scope">
  25. <div>下单时间:{{scope.row.orderTime}}</div>
  26. <div>完成时间:{{scope.row.finishTime}}</div>
  27. </template>
  28. <template slot="accountInfo" slot-scope="scope">
  29. <div>银行账号:{{scope.row.receiverAccountNo}}</div>
  30. <div>开户姓名:{{scope.row.receiverAccountName}}</div>
  31. </template>
  32. <template slot="cashInfo" slot-scope="scope">
  33. <div>提现金额:<span style="color: #ff0000;padding-right: 5px;">{{scope.row.cashValue}}</span> 元</div>
  34. <div>到账金额:<span style="color: #ff0000;padding-right: 5px;">{{scope.row.receiveAmount}}</span> 元 </div>
  35. <div>手续费:<span style="color: #ff0000;padding-right: 5px;">{{scope.row.fee}}</span> 元</div>
  36. </template>
  37. <template slot="receiveType" slot-scope="scope">
  38. <el-tag type="success" v-if="scope.row.receiveType=='REAL_TIME'">实时到账</el-tag>
  39. </template>
  40. <template slot="withdrawStatus" slot-scope="scope">
  41. <el-tag type="warning" v-if="scope.row.withdrawStatus==0">处理中</el-tag>
  42. <el-tag type="success" v-if="scope.row.withdrawStatus==1">已处理</el-tag>
  43. <el-tag type="danger" v-if="scope.row.withdrawStatus==2">提现失败</el-tag>
  44. </template>
  45. </avue-crud>
  46. </basic-container>
  47. </template>
  48. <script>
  49. import {
  50. getList,
  51. getDetail,
  52. add,
  53. update,
  54. remove
  55. } from "@/api/withdrawrecords/withdrawrecords";
  56. import {
  57. dateFormat
  58. } from "../../util/date.js"
  59. import {
  60. mapGetters
  61. } from "vuex";
  62. export default {
  63. data() {
  64. return {
  65. form: {},
  66. query: {},
  67. loading: true,
  68. page: {
  69. pageSize: 10,
  70. currentPage: 1,
  71. total: 0
  72. },
  73. selectionList: [],
  74. option: {
  75. height: 'auto',
  76. calcHeight: 30,
  77. tip: false,
  78. searchShow: true,
  79. searchMenuSpan: 6,
  80. border: true,
  81. index: true,
  82. viewBtn: false,
  83. selection: true,
  84. dialogClickModal: false,
  85. column: [{
  86. label: "用户id",
  87. hide: true,
  88. prop: "userId",
  89. rules: [{
  90. required: true,
  91. message: "请输入用户id",
  92. trigger: "blur"
  93. }]
  94. },
  95. {
  96. slot: true,
  97. width:180,
  98. label: "用户信息",
  99. prop: "userInfo"
  100. },
  101. {
  102. label:"账户信息",
  103. width:200,
  104. slot:true,
  105. prop:"accountInfo"
  106. },
  107. {
  108. hide:true,
  109. label: "手机号",
  110. prop: "phone",
  111. search: true
  112. },
  113. {
  114. hide:true,
  115. label: "昵称",
  116. prop: "nickName",
  117. search: true
  118. },
  119. {
  120. label: "openid",
  121. hide:true,
  122. prop: "openid",
  123. rules: [{
  124. required: true,
  125. message: "请输入用户id",
  126. trigger: "blur"
  127. }]
  128. },
  129. {
  130. label: "提现状态",
  131. width:100,
  132. search: true,
  133. type: "select",
  134. dicData: [{
  135. label: '处理中',
  136. value: 0
  137. },
  138. {
  139. label: '已处理',
  140. value: 1
  141. },
  142. {
  143. label: '提现失败',
  144. value: 2
  145. }
  146. ],
  147. prop: 'withdrawStatus'
  148. },
  149. {
  150. label: "备注说明",
  151. width:100,
  152. prop: "note",
  153. rules: [{
  154. required: true,
  155. message: "请输入备注说明",
  156. trigger: "blur"
  157. }]
  158. },
  159. {
  160. label: "消耗的热力值",
  161. width:100,
  162. prop: "hotValue",
  163. rules: [{
  164. required: true,
  165. message: "请输入消耗的热力值",
  166. trigger: "blur"
  167. }]
  168. },
  169. {
  170. label:"金额信息",
  171. prop:'cashInfo',
  172. slot:true
  173. },
  174. {
  175. hide:true,
  176. label: "提现金额",
  177. prop: "cashValue",
  178. rules: [{
  179. required: true,
  180. message: "请输入提现金额",
  181. trigger: "blur"
  182. }]
  183. },
  184. {
  185. hide:true,
  186. label: "提现到账的金额",
  187. prop: "receiveAmount",
  188. rules: [{
  189. required: true,
  190. message: "请输入提现到账的金额",
  191. trigger: "blur"
  192. }]
  193. },
  194. {
  195. hide:true,
  196. label: "提现手续费",
  197. prop: "fee",
  198. rules: [{
  199. required: true,
  200. message: "请输入提现手续费",
  201. trigger: "blur"
  202. }]
  203. },
  204. {
  205. label:"时间",
  206. width:210,
  207. prop:'timeInfo',
  208. slot:true
  209. },
  210. {
  211. label: "订单时间",
  212. hide:true,
  213. prop: "orderTime",
  214. rules: [{
  215. required: true,
  216. message: "请输入订单时间",
  217. trigger: "blur"
  218. }]
  219. },
  220. {
  221. label: "完成时间",
  222. hide:true,
  223. prop: "finishTime",
  224. rules: [{
  225. required: true,
  226. message: "请输入完成时间",
  227. trigger: "blur"
  228. }]
  229. },
  230. {
  231. label: "接收人真实姓名",
  232. hide:true,
  233. prop: "receiverAccountName",
  234. rules: [{
  235. required: true,
  236. message: "请输入接收人真实姓名",
  237. trigger: "blur"
  238. }]
  239. },
  240. {
  241. label: "接收人的银行账号",
  242. hide:true,
  243. prop: "receiverAccountNo",
  244. rules: [{
  245. required: true,
  246. message: "请输入接收人的银行账号",
  247. trigger: "blur"
  248. }]
  249. },
  250. {
  251. label: "到账类型",
  252. slot:true,
  253. prop: "receiveType",
  254. rules: [{
  255. required: true,
  256. message: "请输入到账类型,默认实时到账",
  257. trigger: "blur"
  258. }]
  259. },
  260. {
  261. label: "失败的原因",
  262. prop: "failReason",
  263. rules: [{
  264. required: true,
  265. message: "请输入失败的原因",
  266. trigger: "blur"
  267. }]
  268. },
  269. ]
  270. },
  271. data: []
  272. };
  273. },
  274. computed: {
  275. ...mapGetters(["permission"]),
  276. permissionList() {
  277. return {
  278. addBtn: this.vaildData(this.permission.withdrawrecords_add, false),
  279. viewBtn: this.vaildData(this.permission.withdrawrecords_view, false),
  280. delBtn: this.vaildData(this.permission.withdrawrecords_delete, false),
  281. editBtn: this.vaildData(this.permission.withdrawrecords_edit, false)
  282. };
  283. },
  284. ids() {
  285. let ids = [];
  286. this.selectionList.forEach(ele => {
  287. ids.push(ele.id);
  288. });
  289. return ids.join(",");
  290. }
  291. },
  292. methods: {
  293. confirm(row) {
  294. let _this = this
  295. this.$alert('确定发款?', '提示', {
  296. confirmButtonText: '确定',
  297. callback: () => {
  298. _this.doConfirm(row)
  299. }
  300. });
  301. },
  302. async doConfirm(row) {
  303. let grantTime = dateFormat(new Date())
  304. let params = {
  305. id: row.id,
  306. grantTime,
  307. withdrawStatus: 1
  308. }
  309. let res = await update(params)
  310. if (res.data.success) {
  311. this.onLoad(this.page);
  312. this.$message({
  313. type: 'success',
  314. message: "发款成功!"
  315. });
  316. }
  317. },
  318. rowSave(row, done, loading) {
  319. add(row).then(() => {
  320. this.onLoad(this.page);
  321. this.$message({
  322. type: "success",
  323. message: "操作成功!"
  324. });
  325. done();
  326. }, error => {
  327. loading();
  328. window.console.log(error);
  329. });
  330. },
  331. rowUpdate(row, index, done, loading) {
  332. update(row).then(() => {
  333. this.onLoad(this.page);
  334. this.$message({
  335. type: "success",
  336. message: "操作成功!"
  337. });
  338. done();
  339. }, error => {
  340. loading();
  341. console.log(error);
  342. });
  343. },
  344. rowDel(row) {
  345. this.$confirm("确定将选择数据删除?", {
  346. confirmButtonText: "确定",
  347. cancelButtonText: "取消",
  348. type: "warning"
  349. })
  350. .then(() => {
  351. return remove(row.id);
  352. })
  353. .then(() => {
  354. this.onLoad(this.page);
  355. this.$message({
  356. type: "success",
  357. message: "操作成功!"
  358. });
  359. });
  360. },
  361. handleDelete() {
  362. if (this.selectionList.length === 0) {
  363. this.$message.warning("请选择至少一条数据");
  364. return;
  365. }
  366. this.$confirm("确定将选择数据删除?", {
  367. confirmButtonText: "确定",
  368. cancelButtonText: "取消",
  369. type: "warning"
  370. })
  371. .then(() => {
  372. return remove(this.ids);
  373. })
  374. .then(() => {
  375. this.onLoad(this.page);
  376. this.$message({
  377. type: "success",
  378. message: "操作成功!"
  379. });
  380. this.$refs.crud.toggleSelection();
  381. });
  382. },
  383. beforeOpen(done, type) {
  384. if (["edit", "view"].includes(type)) {
  385. getDetail(this.form.id).then(res => {
  386. this.form = res.data.data;
  387. });
  388. }
  389. done();
  390. },
  391. searchReset() {
  392. this.query = {};
  393. this.onLoad(this.page);
  394. },
  395. searchChange(params, done) {
  396. this.query = params;
  397. this.page.currentPage = 1;
  398. this.onLoad(this.page, params);
  399. done();
  400. },
  401. selectionChange(list) {
  402. this.selectionList = list;
  403. },
  404. selectionClear() {
  405. this.selectionList = [];
  406. this.$refs.crud.toggleSelection();
  407. },
  408. currentChange(currentPage) {
  409. this.page.currentPage = currentPage;
  410. },
  411. sizeChange(pageSize) {
  412. this.page.pageSize = pageSize;
  413. },
  414. refreshChange() {
  415. this.onLoad(this.page, this.query);
  416. },
  417. onLoad(page, params = {}) {
  418. this.loading = true;
  419. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  420. const data = res.data.data;
  421. this.page.total = data.total;
  422. this.data = data.records;
  423. this.loading = false;
  424. this.selectionClear();
  425. });
  426. }
  427. }
  428. };
  429. </script>
  430. <style>
  431. </style>