金币系统前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

576 lines
16 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <script setup>
  2. import { ref, onMounted, reactive, computed } from "vue";
  3. import ElementPlus from "element-plus";
  4. import { ElMessage, ElMessageBox } from "element-plus";
  5. import { AiFillRead } from "vue-icons-plus/ai";
  6. import axios from "axios";
  7. import moment from "moment";
  8. import API from "../../api/index.js";
  9. // 变量
  10. //这是获取用户信息的接口
  11. const adminData = ref({});
  12. const getAdminData = async function () {
  13. try {
  14. const result = await API.post(
  15. "http://39.99.159.73:20090/admin/userinfo",
  16. {}
  17. );
  18. adminData.value = result;
  19. console.log("请求成功", result);
  20. console.log("用户信息", adminData.value);
  21. } catch (error) {
  22. console.log("请求失败", error);
  23. }
  24. };
  25. // 充值明细表格
  26. const tableData = ref([]);
  27. // 搜索======================================
  28. // 搜索rechargeVo
  29. const rechargeVo = ref({});
  30. // 搜索对象
  31. const getObj = ref({
  32. pageNum: 1,
  33. pageSize: 50,
  34. });
  35. //分页总条目
  36. const total = ref(100);
  37. // 搜索对象时间
  38. const getTime = ref([]);
  39. // 搜索活动列表
  40. const activity = ref([]);
  41. // 所有信息
  42. const allData = ref([]);
  43. // 搜索地区列表
  44. const area = ref([]);
  45. //标签页默认高亮选项
  46. const activeName = ref("all");
  47. // 支付方式选项
  48. const payWay = [
  49. {
  50. value: "微信",
  51. label: "微信",
  52. },
  53. {
  54. value: "支付宝",
  55. label: "支付宝",
  56. },
  57. {
  58. value: "银联",
  59. label: "银联",
  60. },
  61. {
  62. value: "信用卡",
  63. label: "信用卡",
  64. },
  65. {
  66. value: "借记卡",
  67. label: "借记卡",
  68. },
  69. {
  70. value: "现金充值",
  71. label: "现金充值",
  72. },
  73. ];
  74. // //表格高度
  75. // const tableHeight = computed(function () {
  76. // return (getObj.value.pageSize + 2) * 60 + "px";
  77. // });
  78. // 方法
  79. // 搜索==============================================================
  80. // 搜索方法
  81. const get = async function (val) {
  82. try {
  83. // 地区赋值
  84. if (adminData.value.area != "总部") {
  85. rechargeVo.value.area = adminData.value.area;
  86. }
  87. // 搜索参数页码赋值
  88. if (typeof val === "number") {
  89. getObj.value.pageNum = val;
  90. }
  91. // 搜索参数时间赋值
  92. if (getTime.value != null) {
  93. if (getTime.value.startDate != "" && getTime.value.endDate != "") {
  94. rechargeVo.value.startDate = getTime.value[0];
  95. rechargeVo.value.endDate = getTime.value[1];
  96. }
  97. } else {
  98. rechargeVo.value.startDate = "";
  99. rechargeVo.value.endDate = "";
  100. }
  101. console.log("搜索参数", getObj.value);
  102. // 发送POST请求
  103. const result = await API.post(
  104. "http://39.99.159.73:20090/recharge/recharge",
  105. { ...getObj.value, rechargeVo: { ...rechargeVo.value } }
  106. );
  107. // 将响应结果存储到响应式数据中
  108. console.log("请求成功", result);
  109. // 存储表格数据
  110. tableData.value = result.data.list;
  111. console.log("tableData", tableData.value);
  112. // 存储分页总数
  113. total.value = result.data.total;
  114. console.log("total", total.value);
  115. } catch (error) {
  116. console.log("请求失败", error);
  117. // 在这里可以处理错误逻辑,比如显示错误提示等
  118. }
  119. };
  120. // 搜索
  121. const search = function () {
  122. getObj.value.pageNum = 1;
  123. get();
  124. };
  125. // 重置
  126. const reset = function () {
  127. rechargeVo.value.activityId = "";
  128. rechargeVo.value.payWay = "";
  129. rechargeVo.value.area = "";
  130. rechargeVo.value.startDate = "";
  131. rechargeVo.value.endDate = "";
  132. getTime.value = {};
  133. };
  134. // 今天
  135. const getToday = function () {
  136. const today = new Date();
  137. const startDate = new Date(
  138. today.getFullYear(),
  139. today.getMonth(),
  140. today.getDate()
  141. );
  142. const endDate = new Date(
  143. today.getFullYear(),
  144. today.getMonth(),
  145. today.getDate() + 1
  146. );
  147. getTime.value = [startDate, endDate];
  148. console.log("getTime", getTime.value);
  149. get();
  150. };
  151. // 昨天
  152. const getYesterday = function () {
  153. const yesterday = new Date();
  154. yesterday.setDate(yesterday.getDate() - 1);
  155. const startDate = new Date(
  156. yesterday.getFullYear(),
  157. yesterday.getMonth(),
  158. yesterday.getDate()
  159. );
  160. const endDate = new Date(
  161. yesterday.getFullYear(),
  162. yesterday.getMonth(),
  163. yesterday.getDate() + 1
  164. );
  165. getTime.value = [startDate, endDate];
  166. console.log("getTime", getTime.value);
  167. get();
  168. };
  169. // 近7天
  170. const get7Days = function () {
  171. const today = new Date();
  172. const startDate = new Date(
  173. today.getFullYear(),
  174. today.getMonth(),
  175. today.getDate() - 6
  176. );
  177. const endDate = new Date(
  178. today.getFullYear(),
  179. today.getMonth(),
  180. today.getDate() + 1
  181. );
  182. getTime.value = [startDate, endDate];
  183. console.log("getTime", getTime.value);
  184. get();
  185. };
  186. //全部充值明细
  187. const adminAll = function () {
  188. console.log("adminAll");
  189. rechargeVo.value.status = "";
  190. getObj.value.pageNum = 1;
  191. get();
  192. };
  193. //待审核充值明细
  194. const adminWait = function () {
  195. rechargeVo.value.status = 0;
  196. getObj.value.pageNum = 1;
  197. get();
  198. console.log("adminWait");
  199. };
  200. //已通过充值明细
  201. const adminPass = function () {
  202. rechargeVo.value.status = 1;
  203. getObj.value.pageNum = 1;
  204. get();
  205. console.log("adminPass");
  206. };
  207. //已驳回充值明细
  208. const adminReject = function () {
  209. rechargeVo.value.status = 2;
  210. getObj.value.pageNum = 1;
  211. get();
  212. console.log("adminReject");
  213. };
  214. //点击标签页
  215. const handleClick = function (tab, event) {
  216. if (tab.props.name === "all") {
  217. adminAll();
  218. } else if (tab.props.name === "wait") {
  219. adminWait();
  220. } else if (tab.props.name === "pass") {
  221. adminPass();
  222. } else if (tab.props.name === "reject") {
  223. adminReject();
  224. }
  225. };
  226. // 获取活动名称
  227. const getActivity = async function () {
  228. try {
  229. // 发送POST请求
  230. const result = await API.post(
  231. "http://39.99.159.73:20090/recharge/activity/select",
  232. {}
  233. );
  234. // 将响应结果存储到响应式数据中
  235. console.log("请求成功", result);
  236. // 存储表格数据
  237. activity.value = result.data;
  238. console.log("activity", activity.value);
  239. } catch (error) {
  240. console.log("请求失败", error);
  241. // 在这里可以处理错误逻辑,比如显示错误提示等
  242. }
  243. };
  244. // 获取地区
  245. // 获取地区
  246. const getArea = async function () {
  247. try {
  248. // 发送POST请求
  249. const result = await API.post(
  250. "http://39.99.159.73:20090/recharge/user/search",
  251. {}
  252. );
  253. // 将响应结果存储到响应式数据中
  254. console.log("请求成功", result);
  255. // 存储地区信息
  256. area.value = result.data;
  257. console.log("地区", area.value);
  258. } catch (error) {
  259. console.log("请求失败", error);
  260. // 在这里可以处理错误逻辑,比如显示错误提示等
  261. }
  262. };
  263. // 验证跳转输入框的数字是否合法
  264. const checkNumber = function () {
  265. if (typeof parseInt(getObj.value.pageNum) === "number") {
  266. console.log(
  267. "总共有多少页" + Math.ceil(total.value / getObj.value.pageSize)
  268. );
  269. if (
  270. getObj.value.pageNum > 0 &&
  271. getObj.value.pageNum <= Math.ceil(total.value / getObj.value.pageSize)
  272. ) {
  273. getObj.value.pageNum = parseInt(getObj.value.pageNum);
  274. console.log("输入的数字合法");
  275. get();
  276. } else {
  277. //提示
  278. ElMessage({
  279. type: "error",
  280. message: "请检查输入内容",
  281. });
  282. }
  283. } else {
  284. //提示
  285. ElMessage({
  286. type: "error",
  287. message: "请检查输入内容",
  288. });
  289. }
  290. };
  291. // 挂载
  292. onMounted(async function () {
  293. await getAdminData();
  294. await get();
  295. await getActivity();
  296. await getArea();
  297. });
  298. </script>
  299. <template>
  300. <el-row>
  301. <el-col>
  302. <el-card style="margin-bottom: 20px">
  303. <el-row style="margin-bottom: 10px">
  304. <el-col :span="8">
  305. <div class="head-card-element">
  306. <el-text class="mx-1" size="large">活动名称</el-text>
  307. <el-select
  308. v-model="rechargeVo.activityId"
  309. placeholder="请选择活动名称"
  310. size="large"
  311. style="width: 240px"
  312. clearable
  313. >
  314. <el-option
  315. v-for="item in activity"
  316. :key="item.activityId"
  317. :label="item.activityName"
  318. :value="item.activityId"
  319. />
  320. </el-select>
  321. </div>
  322. </el-col>
  323. <el-col :span="8">
  324. <div class="head-card-element">
  325. <el-text class="mx-1" size="large">支付方式</el-text>
  326. <el-select
  327. v-model="rechargeVo.payWay"
  328. placeholder="请选择支付方式"
  329. size="large"
  330. style="width: 240px"
  331. clearable
  332. >
  333. <el-option
  334. v-for="item in payWay"
  335. :key="item.value"
  336. :label="item.label"
  337. :value="item.value"
  338. />
  339. </el-select>
  340. </div>
  341. </el-col>
  342. <el-col :span="8">
  343. <div class="head-card-element" v-if="adminData.area == '总部'">
  344. <el-text class="mx-1" size="large">所属地区</el-text>
  345. <el-select
  346. v-model="rechargeVo.area"
  347. placeholder="请选择所属地区"
  348. size="large"
  349. style="width: 240px"
  350. clearable
  351. >
  352. <el-option
  353. v-for="item in area"
  354. :key="item"
  355. :label="item"
  356. :value="item"
  357. />
  358. </el-select>
  359. </div>
  360. </el-col>
  361. </el-row>
  362. <el-row>
  363. <el-col :span="21">
  364. <div class="head-card-element">
  365. <el-text class="mx-1" size="large">充值时间</el-text>
  366. <el-date-picker
  367. v-model="getTime"
  368. type="datetimerange"
  369. range-separator="至"
  370. start-placeholder="起始时间"
  371. end-placeholder="结束时间"
  372. />
  373. <el-button style="margin-left: 10px" @click="getToday()"
  374. ></el-button
  375. >
  376. <el-button @click="getYesterday()"></el-button>
  377. <el-button @click="get7Days()">近7天</el-button>
  378. </div>
  379. </el-col>
  380. <el-col :span="3">
  381. <div class="head-card-btn">
  382. <el-button @click="reset()">重置</el-button>
  383. <el-button type="primary" @click="search()">查询</el-button>
  384. </div>
  385. </el-col>
  386. </el-row>
  387. </el-card>
  388. </el-col>
  389. </el-row>
  390. <el-row>
  391. <el-col>
  392. <el-card>
  393. <el-tabs
  394. v-model="activeName"
  395. type="card"
  396. class="demo-tabs"
  397. @tab-click="handleClick"
  398. >
  399. <el-tab-pane label="全部" name="all"></el-tab-pane>
  400. <el-tab-pane label="待审核" name="wait"></el-tab-pane>
  401. <el-tab-pane label="已通过" name="pass"></el-tab-pane>
  402. <el-tab-pane label="已驳回" name="reject"></el-tab-pane>
  403. </el-tabs>
  404. <div>
  405. <el-table :data="tableData" :height="tableHeight" style="width: 100%">
  406. <el-table-column
  407. type="index"
  408. label="序号"
  409. width="100px"
  410. fixed="left"
  411. >
  412. <template #default="scope">
  413. <span>{{
  414. scope.$index + 1 + (getObj.pageNum - 1) * getObj.pageSize
  415. }}</span>
  416. </template>
  417. </el-table-column>
  418. <el-table-column prop="username" label="姓名" width="100px" />
  419. <el-table-column prop="jwcode" label="精网号" width="130px" />
  420. <el-table-column prop="area" label="所属地区" width="100px" />
  421. <el-table-column
  422. prop="activityName"
  423. label="活动名称"
  424. width="150px"
  425. />
  426. <el-table-column
  427. prop="paidGold"
  428. label="充值金额"
  429. width="120px"
  430. sortable
  431. />
  432. <el-table-column
  433. prop="rechargeWay"
  434. label="充值方式"
  435. width="100px"
  436. />
  437. <el-table-column prop="paidGold" label="永久金币" width="100px" />
  438. <el-table-column prop="freeGold" label="免费金币" width="100px" />
  439. <el-table-column
  440. prop="remark"
  441. label="备注"
  442. width="200px"
  443. show-overflow-tooltip
  444. />
  445. <el-table-column prop="payWay" label="支付方式" width="100px" />
  446. <el-table-column
  447. prop="rechargeVoucher"
  448. label="支付凭证"
  449. width="150px"
  450. >
  451. <template #default="scope">
  452. <el-image
  453. :preview-src-list="[scope.row.rechargeVoucher]"
  454. preview-teleported="true"
  455. :src="scope.row.rechargeVoucher"
  456. alt="凭证"
  457. style="width: 50px; height: 50px"
  458. />
  459. </template>
  460. </el-table-column>
  461. <el-table-column prop="name" label="提交人" width="100px" />
  462. <el-table-column prop="status" label="状态" width="100px">
  463. <template #default="scope">
  464. <span v-if="scope.row.status === 1">
  465. <div class="status">
  466. <span class="green-dot"></span>
  467. <span>已通过</span>
  468. </div>
  469. </span>
  470. <span v-if="scope.row.status === 0">
  471. <div class="status">
  472. <span class="grey-dot"></span>
  473. <span>待审核</span>
  474. </div>
  475. </span>
  476. <span v-if="scope.row.status === 2">
  477. <div class="status">
  478. <span class="red-dot"></span>
  479. <span>已驳回</span>
  480. </div>
  481. </span>
  482. </template>
  483. </el-table-column>
  484. <el-table-column
  485. prop="reson"
  486. label="驳回理由"
  487. width="200px"
  488. show-overflow-tooltip
  489. />
  490. <el-table-column prop="rechargeTime" label="交款时间" width="200px">
  491. <template #default="scope">
  492. {{
  493. moment(scope.row.rechargeTime).format("YYYY-MM-DD HH:mm:ss")
  494. }}
  495. </template>
  496. </el-table-column>
  497. <el-table-column prop="createTime" label="提交时间" width="200px" />
  498. </el-table>
  499. </div>
  500. <!-- 分页 -->
  501. <div class="pagination" style="margin-top: 20px">
  502. <el-pagination
  503. background
  504. :page-size="getObj.pageSize"
  505. layout="slot"
  506. :total="total"
  507. >
  508. <div>{{ total }},每页</div>
  509. <el-select
  510. v-model="getObj.pageSize"
  511. class="page-size"
  512. @change="get()"
  513. style="width: 80px"
  514. >
  515. <el-option
  516. v-for="item in [5, 10, 20, 50, 100]"
  517. :key="item"
  518. :label="item"
  519. :value="item"
  520. ></el-option>
  521. </el-select>
  522. <div></div>
  523. </el-pagination>
  524. <el-pagination
  525. background
  526. layout="prev, pager, next,slot"
  527. :page-size="getObj.pageSize"
  528. :total="total"
  529. :current-page="getObj.pageNum"
  530. @current-change="get"
  531. >
  532. <div>跳至</div>
  533. <el-input
  534. v-model="getObj.pageNum"
  535. style="width: 40px"
  536. @change="checkNumber"
  537. />
  538. <div></div>
  539. </el-pagination>
  540. </div>
  541. </el-card>
  542. </el-col>
  543. </el-row>
  544. </template>
  545. <style scoped>
  546. .pagination {
  547. display: flex;
  548. }
  549. .status {
  550. display: flex;
  551. }
  552. .head-card {
  553. display: flex;
  554. }
  555. .head-card-element {
  556. margin-right: 20px;
  557. }
  558. .head-card-btn {
  559. margin-left: auto;
  560. }
  561. </style>