recharge.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <div class="search">
  3. <Row>
  4. <Col>
  5. <Card>
  6. <Row @keydown.enter.native="handleSearch">
  7. <Form
  8. ref="searchForm"
  9. :model="searchForm"
  10. inline
  11. :label-width="70"
  12. class="search-form"
  13. >
  14. <Form-item label="会员名称" prop="memberName">
  15. <Input
  16. type="text"
  17. v-model="searchForm.memberName"
  18. placeholder="请输入会员名称"
  19. clearable
  20. style="width: 200px"
  21. />
  22. </Form-item>
  23. <Form-item label="充值单号" prop="rechargeSn">
  24. <Input
  25. type="text"
  26. v-model="searchForm.rechargeSn"
  27. placeholder="请输入充值单号"
  28. clearable
  29. style="width: 200px"
  30. />
  31. </Form-item>
  32. <Form-item label="支付时间">
  33. <DatePicker
  34. v-model="selectDate"
  35. type="datetimerange"
  36. format="yyyy-MM-dd HH:mm:ss"
  37. clearable
  38. @on-change="selectDateRange"
  39. placeholder="选择起始时间"
  40. style="width: 200px"
  41. ></DatePicker>
  42. </Form-item>
  43. <Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
  44. </Form>
  45. </Row>
  46. <Row class="padding-row">
  47. <Table
  48. :loading="loading"
  49. border
  50. :columns="columns"
  51. :data="data"
  52. ref="table"
  53. sortable="custom"
  54. @on-sort-change="changeSort"
  55. @on-selection-change="changeSelect"
  56. ></Table>
  57. </Row>
  58. <Row type="flex" justify="end" class="page">
  59. <Page
  60. :current="searchForm.pageNumber"
  61. :total="total"
  62. :page-size="searchForm.pageSize"
  63. @on-change="changePage"
  64. @on-page-size-change="changePageSize"
  65. :page-size-opts="[10, 20, 50]"
  66. size="small"
  67. show-total
  68. show-elevator
  69. show-sizer
  70. ></Page>
  71. </Row>
  72. </Card>
  73. </Col>
  74. </Row>
  75. </div>
  76. </template>
  77. <script>
  78. import {
  79. getUserRecharge,
  80. } from "@/api/member";
  81. export default {
  82. name: "recharge",
  83. components: {},
  84. data() {
  85. return {
  86. loading: true, // 表单加载状态
  87. searchForm: {
  88. // 搜索框初始化对象
  89. pageNumber: 1, // 当前页数
  90. pageSize: 10, // 页面大小
  91. sort: "createTime", // 默认排序字段
  92. order: "desc", // 默认排序方式
  93. startDate: "", // 起始时间
  94. endDate: "", // 终止时间
  95. memberName:""
  96. },
  97. selectDate: null, // 选择区间时间
  98. submitLoading: false, // 添加或编辑提交状态
  99. selectList: [], // 多选数据
  100. selectCount: 0, // 多选计数
  101. columns: [
  102. {
  103. title: "会员名称",
  104. key: "memberName",
  105. minWidth: 120,
  106. tooltip: true
  107. },
  108. {
  109. title: "订单号",
  110. key: "rechargeSn",
  111. minWidth: 180,
  112. tooltip: true
  113. },
  114. {
  115. title: "充值金额",
  116. key: "rechargeMoney",
  117. width: 160,
  118. sortable: true,
  119. render: (h, params) => {
  120. return h(
  121. "div",
  122. this.$options.filters.unitPrice(params.row.rechargeMoney, "¥")
  123. );
  124. },
  125. },
  126. {
  127. title: "充值方式",
  128. key: "rechargeWay",
  129. width: 120,
  130. },
  131. {
  132. title: "支付状态",
  133. key: "payStatus",
  134. align: "left",
  135. width: 120,
  136. sortable: false,
  137. render: (h, params) => {
  138. if (params.row.payStatus == "PAID") {
  139. return h("div", [
  140. h("Badge", {
  141. props: {
  142. status: "success",
  143. text: "已付款",
  144. },
  145. }),
  146. ]);
  147. } else if (params.row.payStatus == "UNPAID") {
  148. return h("div", [
  149. h("Badge", {
  150. props: {
  151. status: "error",
  152. text: "未付款",
  153. },
  154. }),
  155. ]);
  156. }
  157. },
  158. },
  159. {
  160. title: "支付时间",
  161. key: "payTime",
  162. align: "left",
  163. width: 190,
  164. sortable: false,
  165. },
  166. ],
  167. data: [], // 表单数据
  168. total: 0, // 表单数据总数
  169. };
  170. },
  171. methods: {
  172. init() {
  173. this.getDataList();
  174. },
  175. changePage(v) {
  176. this.searchForm.pageNumber = v;
  177. this.getDataList();
  178. this.clearSelectAll();
  179. },
  180. changePageSize(v) {
  181. this.searchForm.pageSize = v;
  182. this.getDataList();
  183. },
  184. handleSearch() {
  185. this.searchForm.pageNumber = 1;
  186. this.searchForm.pageSize = 10;
  187. this.getDataList();
  188. },
  189. handleReset() {
  190. this.$refs.searchForm.resetFields();
  191. this.searchForm.pageNumber = 1;
  192. this.searchForm.pageSize = 10;
  193. this.selectDate = null;
  194. this.searchForm.startDate = "";
  195. this.searchForm.endDate = "";
  196. this.searchForm.memberName = "";
  197. // 重新加载数据
  198. this.getDataList();
  199. },
  200. changeSort(e) {
  201. this.searchForm.sort = e.key;
  202. this.searchForm.order = e.order;
  203. if (e.order === "normal") {
  204. this.searchForm.order = "";
  205. }
  206. this.getDataList();
  207. },
  208. clearSelectAll() {
  209. this.$refs.table.selectAll(false);
  210. },
  211. changeSelect(e) {
  212. this.selectList = e;
  213. this.selectCount = e.length;
  214. },
  215. selectDateRange(v) {
  216. if (v) {
  217. this.searchForm.startDate = v[0];
  218. this.searchForm.endDate = v[1];
  219. }
  220. },
  221. getDataList() {
  222. this.loading = true;
  223. // 带多条件搜索参数获取表单数据 请自行修改接口
  224. getUserRecharge(this.searchForm).then((res) => {
  225. this.loading = false;
  226. if (res.success) {
  227. this.data = res.result.records;
  228. this.total = res.result.total;
  229. }
  230. });
  231. this.total = this.data.length;
  232. this.loading = false;
  233. },
  234. },
  235. mounted() {
  236. this.init();
  237. },
  238. };
  239. </script>
  240. <style lang="scss" scoped>
  241. // 建议引入通用样式 可删除下面样式代码
  242. @import "@/styles/table-common.scss";
  243. </style>