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.

678 lines
20 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <!-- 支付凭证 -->
  2. <template>
  3. <el-row>
  4. <el-col>
  5. <el-card style="margin-bottom: 5px">
  6. <el-row style="margin-bottom: 5px">
  7. <el-col :span="6">
  8. <el-text size="large">精网号</el-text>
  9. <el-input v-model="rechargeAudit.jwcode" placeholder="请输入精网号" style="width: 240px" clearable/>
  10. </el-col>
  11. <el-col :span="6">
  12. <el-text size="large">活动名称</el-text>
  13. <el-select v-model="rechargeAudit.activity" placeholder="请选择活动名称" style="width: 240px" clearable>
  14. <el-option v-for="item in activity" :key="item" :label="item" :value="item"/>
  15. </el-select>
  16. </el-col>
  17. <el-col :span="6">
  18. <el-text size="large">支付方式</el-text>
  19. <el-select v-model="rechargeAudit.payModel" placeholder="请选择支付方式" style="width: 240px" clearable>
  20. <el-option v-for="item in payModel" :key="item.value" :label="item.label" :value="item.value"/>
  21. </el-select>
  22. </el-col>
  23. <el-col :span="6">
  24. <div class="head-card-element">
  25. <el-text size="large">所属地区</el-text>
  26. <el-select v-model="rechargeAudit.market" placeholder="请选择所属地区" style="width: 240px" clearable>
  27. <el-option v-for="item in market" :key="item" :label="item" :value="item"/>
  28. </el-select>
  29. </div>
  30. </el-col>
  31. </el-row>
  32. <el-row>
  33. <el-col :span="12">
  34. <div class="time-controls">
  35. <div class="time-group">
  36. <el-text size="large" style="width: 80px">充值时间</el-text>
  37. <el-date-picker v-model="getTime" type="datetimerange" range-separator="" start-placeholder="起始时间"
  38. end-placeholder="结束时间" style="width: 400px"/>
  39. <el-button @click="getToday()" style="margin-left: 10px"> </el-button>
  40. <el-button @click="getYesterday()" style="margin-left: 10px"> </el-button>
  41. <el-button @click="get7Days()" style="margin-left: 10px"> 近7天</el-button>
  42. <el-button @click="resetSearch" type="success">重置</el-button>
  43. <el-button type="primary" @click="handleSearch">查询</el-button>
  44. </div>
  45. </div>
  46. </el-col>
  47. </el-row>
  48. </el-card>
  49. </el-col>
  50. </el-row>
  51. <el-row>
  52. <el-col>
  53. <el-card>
  54. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  55. <el-tab-pane label="待审核" name="wait"></el-tab-pane>
  56. <el-tab-pane label="已通过" name="pass"></el-tab-pane>
  57. <el-tab-pane label="已驳回" name="reject"></el-tab-pane>
  58. <div>
  59. 总条数{{ stats.totalNum }}&nbsp;&nbsp;&nbsp;&nbsp;
  60. 总金币数{{ (stats.permanentGolds + stats.freeGolds + stats.taskGolds).toFixed(2) }}金币&nbsp;&nbsp;&nbsp;&nbsp;
  61. 永久金币{{ stats.permanentGolds.toFixed(2) }}金币&nbsp;&nbsp;&nbsp;&nbsp;
  62. 免费金币{{ stats.freeGolds.toFixed(2) }}金币&nbsp;&nbsp;&nbsp;&nbsp;
  63. <!-- 任务金币{{ stats.taskGolds.toFixed(2) }}金币-->
  64. </div>
  65. </el-tabs>
  66. <!--表格-->
  67. <div style="height: 540px; overflow-y: auto">
  68. <el-table :data="tableData" style="width: 100%" height="540px" @sort-change="handleSortChange"
  69. :row-style="{ height: '50px' }">
  70. <el-table-column type="index" label="序号" width="100px" fixed="left">
  71. <template #default="scope">
  72. <span>{{ scope.$index + 1 + (getObj.pageNum - 1) * getObj.pageSize }}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column fixed="left" prop="name" label="姓名" width="150px"/>
  76. <el-table-column fixed="left" prop="jwcode" label="精网号" width="110px"/>
  77. <el-table-column prop="market" label="所属地区" width="100px"/>
  78. <el-table-column prop="activity" label="活动名称" width="100px" show-overflow-tooltip/>
  79. <el-table-column prop="money" label="充值金额" sortable="custom" width="110px">
  80. <template #default="scope">{{ scope.row.permanentGold / 100 }}</template>
  81. </el-table-column>
  82. <el-table-column prop="permanentGold" label="永久金币" width="110px" sortable="custom">
  83. <template #default="scope">{{ scope.row.permanentGold / 100 }}</template>
  84. </el-table-column>
  85. <el-table-column prop="freeGold" label="免费金币" sortable="custom" width="110px">
  86. <template #default="scope">{{ (scope.row.freeGold) / 100 }}</template>
  87. </el-table-column>
  88. <el-table-column prop="remark" label="备注" width="200px" show-overflow-tooltip/>
  89. <el-table-column prop="payModel" label="支付方式" width="110px"/>
  90. <el-table-column prop="voucher" label="支付凭证" width="110px">
  91. <template #default="scope">
  92. <div v-if="scope.row.voucher" style="display: flex; justify-content: center; align-items: center; cursor: pointer;" @click="previewImage(scope.row.voucher)">
  93. <img :src="scope.row.voucher" alt="支付凭证" style="width: auto; height: 40px;">
  94. </div>
  95. <div v-else style="display: flex; justify-content: center; align-items: center; height: 40px;">--</div>
  96. </template>
  97. </el-table-column>
  98. <el-table-column prop="adminName" label="提交人" width="100px"/>
  99. <el-table-column prop="rejectReason" v-if="activeName === 'reject'" label="驳回理由" width="200px"
  100. show-overflow-tooltip/>
  101. <el-table-column v-if="activeName !== 'wait'" prop="auditName" label="审核人" width="100px"/>
  102. <el-table-column prop="payTime" sortable="custom" label="付款时间" width="200px">
  103. <template #default="scope">
  104. {{ moment(scope.row.payTime).format('YYYY-MM-DD HH:mm:ss') }}
  105. </template>
  106. </el-table-column>
  107. <el-table-column prop="createTime" sortable="custom" label="提交时间" width="200px">
  108. <template #default="scope">
  109. {{ moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}
  110. </template>
  111. </el-table-column>
  112. <el-table-column v-if="activeName !== 'wait'" prop="auditTime" label="审核时间" width="200px">
  113. <template #default="scope">
  114. {{ moment(scope.row.auditTime).format('YYYY-MM-DD HH:mm:ss') }}
  115. </template>
  116. </el-table-column>
  117. <el-table-column v-if="activeName === 'wait'" fixed="right" prop="operation" label="操作" width="150px">
  118. <template #default="scope">
  119. <div class="operation">
  120. <el-popconfirm title="确定要通过此条记录吗?" @confirm="handleApprove(scope.row)">
  121. <template #reference>
  122. <el-button :disabled="scope.row.auditStatus === 1 || scope.row.auditStatus === 2" type="primary"
  123. text>
  124. 通过
  125. </el-button>
  126. </template>
  127. </el-popconfirm>
  128. <el-button :disabled="scope.row.auditStatus === 1 || scope.row.auditStatus === 2" type="primary" text
  129. @click="showRejectDialog(scope.row)">
  130. 驳回
  131. </el-button>
  132. </div>
  133. </template>
  134. </el-table-column>
  135. </el-table>
  136. </div>
  137. <div class="pagination">
  138. <el-pagination background :page-size="getObj.pageSize" :page-sizes="[5, 10, 20, 50, 100]"
  139. layout="total, sizes, prev, pager, next, jumper" :total="total"
  140. @size-change="handlePagination('size', $event)"
  141. @current-change="handlePagination('page', $event)"></el-pagination>
  142. </div>
  143. </el-card>
  144. </el-col>
  145. </el-row>
  146. <el-dialog v-model="rejectDialogVisible" title="驳回理由" width="500px">
  147. <el-form>
  148. <el-form-item label="驳回理由" required>
  149. <el-input v-model="rejectReason" type="textarea" :rows="4" placeholder="请输入驳回理由" maxlength="200"
  150. show-word-limit/>
  151. </el-form-item>
  152. </el-form>
  153. <template #footer>
  154. <span class="dialog-footer">
  155. <el-button @click="rejectDialogVisible = false">取消</el-button>
  156. <el-button type="primary" @click="handleReject">确定</el-button>
  157. </span>
  158. </template>
  159. </el-dialog>
  160. </template>
  161. <script setup>
  162. import {computed, onMounted, reactive, ref} from 'vue'
  163. import {ElMessage} from 'element-plus'
  164. import request from '@/util/http'
  165. import moment from 'moment'
  166. import API from '@/util/http'
  167. // 精网号去空格
  168. const trimJwCode = () => {
  169. if (rechargeAudit.value.jwcode) {
  170. rechargeAudit.value.jwcode = rechargeAudit.value.jwcode.replace(/\s/g, '');
  171. }
  172. }
  173. const formatTime = (val) => val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : ''
  174. // 这是获取用户信息的接口
  175. const adminData = ref({})
  176. // 充值明细表格
  177. const tableData = ref([])
  178. // 搜索表单数据
  179. const rechargeAudit = ref({
  180. jwcode: "", // 精网号
  181. activity: "", // 活动名称
  182. payModel: "", // 支付方式
  183. startTime: "", // 充值时间开始
  184. endTime: "", // 充值时间结束
  185. market: "", // 地区
  186. auditStatus : "0",
  187. })
  188. // 搜索对象
  189. const getObj = ref({
  190. pageNum: 1,
  191. pageSize: 50
  192. })
  193. // 分页总条目
  194. const total = ref(50)
  195. // 搜索对象时间
  196. const getTime = ref([])
  197. const activity = ref([])
  198. // 搜索地区列表
  199. const market = ref([])
  200. // 驳回弹出框
  201. const rejectDialogVisible = ref(false)
  202. // 驳回理由
  203. const rejectReason = ref('')
  204. // 当前行信息
  205. const currentRecord = ref(null)
  206. // 标签页默认是待审批
  207. const activeName = ref('wait')
  208. // 支付方式选项
  209. const payModel = [
  210. // 现金、支票、刷卡、其他(各地区电子支付)
  211. {
  212. value: '现金',
  213. label: '现金'
  214. },
  215. {
  216. value: '支票',
  217. label: '支票'
  218. },
  219. {
  220. value: '刷卡',
  221. label: '刷卡'
  222. },
  223. {
  224. value: '其他(各地区电子支付)',
  225. label: '其他(各地区电子支付)'
  226. },
  227. ]
  228. // 表单验证ref
  229. const Ref = ref(null)
  230. // 统计合计数
  231. const stats = ref({
  232. totalNum: 0,
  233. totalCoins: 0,
  234. permanentGolds: 0,
  235. freeGolds: 0,
  236. taskGolds: 0
  237. })
  238. // 新增排序字段和排序方式
  239. const sortField = ref('')
  240. const sortOrder = ref('')
  241. // 表单验证
  242. const rules = reactive({
  243. rejectReason: [{required: true, message: '请输入驳回理由', trigger: 'blur'}]
  244. })
  245. const getAdminData = async function () {
  246. try {
  247. const result = await request({
  248. url: '/admin/userinfo',
  249. data: {}
  250. })
  251. adminData.value = result
  252. console.log('用户信息', adminData.value)
  253. } catch (error) {
  254. console.log('请求失败', error)
  255. }
  256. }
  257. // 搜索方法
  258. const getRecharge = async function (val) {
  259. try {
  260. // 搜索参数页码赋值
  261. if (typeof val === 'number') {
  262. getObj.value.pageNum = val
  263. }
  264. // 搜索参数时间赋值
  265. if (getTime.value && getTime.value.length === 2) {
  266. rechargeAudit.value.startTime = formatTime(getTime.value[0])
  267. rechargeAudit.value.endTime = formatTime(getTime.value[1])
  268. } else {
  269. rechargeAudit.value.startTime = ''
  270. rechargeAudit.value.endTime = ''
  271. }
  272. console.log('搜索参数', getObj.value)
  273. const result = await request({
  274. url: '/audit/selectRecharge',
  275. data: {
  276. pageNum: getObj.value.pageNum,
  277. pageSize: getObj.value.pageSize,
  278. rechargeAudit: {
  279. ...rechargeAudit.value,
  280. sortField: sortField.value,
  281. sortOrder: sortOrder.value
  282. }
  283. }
  284. })
  285. // 存储表格数据
  286. tableData.value = result.list
  287. // 存储总条数
  288. total.value = result.total
  289. } catch (error) {
  290. console.log('请求失败', error)
  291. }
  292. }
  293. const getStats = async () => {
  294. try {
  295. const params = {
  296. pageNum: getObj.value.pageNum,
  297. pageSize: getObj.value.pageSize,
  298. rechargeAudit: rechargeAudit.value
  299. }
  300. const res = await API({
  301. url: '/audit/sumRechargeGold',
  302. data: params
  303. })
  304. stats.value.totalNum = res.totalNum
  305. stats.value.permanentGolds = res.permanentGolds / 100
  306. stats.value.freeGolds = res.freeGolds / 100
  307. stats.value.taskGolds = res.taskGolds / 100
  308. console.log('see see stats和搜索对象', stats.value, params)
  309. } catch (error) {
  310. console.log('请求失败', error)
  311. }
  312. }
  313. // 搜索
  314. const handleSearch = function () {
  315. trimJwCode();
  316. getObj.value.pageNum = 1
  317. getRecharge()
  318. getStats()
  319. }
  320. // 重置
  321. const resetSearch = function () {
  322. rechargeAudit.value = {
  323. jwcode: "",
  324. activity: "",
  325. payModel: "",
  326. startTime: "",
  327. endTime: "",
  328. market: "",
  329. auditStatus: rechargeAudit.value.auditStatus
  330. }
  331. getTime.value = []
  332. getRecharge()
  333. getStats()
  334. }
  335. // 今天
  336. const getToday = function () {
  337. const today = new Date()
  338. const startTime = new Date(
  339. today.getFullYear(),
  340. today.getMonth(),
  341. today.getDate()
  342. )
  343. const endTime = new Date(
  344. today.getFullYear(),
  345. today.getMonth(),
  346. today.getDate() + 1
  347. )
  348. getTime.value = [startTime, endTime]
  349. console.log('getTime', getTime.value)
  350. getRecharge()
  351. getStats()
  352. }
  353. // 昨天
  354. const getYesterday = function () {
  355. const yesterday = new Date()
  356. yesterday.setDate(yesterday.getDate() - 1)
  357. const startTime = new Date(
  358. yesterday.getFullYear(),
  359. yesterday.getMonth(),
  360. yesterday.getDate()
  361. )
  362. const endTime = new Date(
  363. yesterday.getFullYear(),
  364. yesterday.getMonth(),
  365. yesterday.getDate() + 1
  366. )
  367. getTime.value = [startTime, endTime]
  368. console.log('getTime', getTime.value)
  369. getRecharge()
  370. getStats()
  371. }
  372. // 近7天
  373. const get7Days = function () {
  374. const today = new Date()
  375. const startTime = new Date(
  376. today.getFullYear(),
  377. today.getMonth(),
  378. today.getDate() - 6
  379. )
  380. const endTime = new Date(
  381. today.getFullYear(),
  382. today.getMonth(),
  383. today.getDate() + 1
  384. )
  385. getTime.value = [startTime, endTime]
  386. console.log('getTime', getTime.value)
  387. getRecharge()
  388. getStats()
  389. }
  390. // 待审核充值明细
  391. const adminWait = async function () {
  392. rechargeAudit.value.auditStatus = "0"
  393. getObj.value.pageNum = 1
  394. await getRecharge()
  395. await getStats()
  396. console.log('adminWait,这是点击待审核调用')
  397. }
  398. // 已通过充值明细
  399. const adminPass = async function () {
  400. rechargeAudit.value.auditStatus = "1"
  401. getObj.value.pageNum = 1
  402. await getRecharge()
  403. await getStats()
  404. console.log('adminWait,这是点击已通过调用')
  405. }
  406. // 已驳回充值明细
  407. const adminReject = async function () {
  408. rechargeAudit.value.auditStatus = "2"
  409. getObj.value.pageNum = 1
  410. await getRecharge()
  411. await getStats()
  412. console.log('adminWait,这是点击已驳回调用')
  413. }
  414. const handleClick = function (tab, event) {
  415. activeName.value = tab.props.name
  416. if (tab.props.name === 'wait') {
  417. adminWait()
  418. } else if (tab.props.name === 'pass') {
  419. adminPass()
  420. } else if (tab.props.name === 'reject') {
  421. adminReject()
  422. }
  423. }
  424. const getActivity = async function () {
  425. try {
  426. const result = await request({
  427. url: '/general/activity',
  428. data: {}
  429. })
  430. activity.value = result.data
  431. console.log('activity', activity.value)
  432. } catch (error) {
  433. console.log('请求失败', error)
  434. }
  435. }
  436. // 地区下拉框
  437. const getMarket = async function () {
  438. try {
  439. const result = await request({
  440. url: '/general/market',
  441. data: {}
  442. })
  443. market.value = result.data
  444. console.log('地区', market.value)
  445. } catch (error) {
  446. console.log('请求失败', error)
  447. }
  448. }
  449. const handlePagination = (type, val) => {
  450. if (type === 'size') {
  451. getObj.value.pageSize = val
  452. } else {
  453. getObj.value.pageNum = val
  454. }
  455. getRecharge()
  456. getStats()
  457. }
  458. // 处理通过操作
  459. const handleApprove = async (row) => {
  460. try {
  461. const params = {
  462. orderCode: row.orderCode,
  463. auditId: adminData.value.id,
  464. action: 1,
  465. rejectReason: ''
  466. }
  467. await request({url: '/audit/audit', data: params})
  468. ElMessage.success('审核通过成功')
  469. await getRecharge()
  470. await getStats()
  471. } catch (error) {
  472. console.error('审核通过失败', error)
  473. ElMessage.error('操作失败')
  474. }
  475. }
  476. // 显示驳回对话框
  477. const showRejectDialog = (row) => {
  478. currentRecord.value = row
  479. rejectReason.value = '' // 清空之前的
  480. rejectDialogVisible.value = true
  481. }
  482. // 处理驳回操作
  483. const handleReject = async () => {
  484. if (!rejectReason.value.trim()) {
  485. ElMessage.warning('请输入驳回理由')
  486. return
  487. }
  488. try {
  489. const params = {
  490. orderCode: currentRecord.value.orderCode,
  491. auditId: adminData.value.id,
  492. action: 2,
  493. rejectReason: rejectReason.value
  494. }
  495. await request({url: '/audit/audit', data: params})
  496. ElMessage.success('驳回操作成功')
  497. rejectDialogVisible.value = false
  498. await getRecharge()
  499. await getStats()
  500. } catch (error) {
  501. console.error('驳回操作失败', error)
  502. ElMessage.error('操作失败')
  503. }
  504. }
  505. // 处理排序事件
  506. const handleSortChange = (column) => {
  507. console.log('排序字段:', column.prop)
  508. console.log('排序方式:', column.order)
  509. if (column.prop === 'money') {
  510. sortField.value = 'permanent_gold'
  511. } else if (column.prop === 'permanentGold') {
  512. sortField.value = 'permanent_gold'
  513. } else if (column.prop === 'freeGold') {
  514. sortField.value = 'freeGold'
  515. } else if (column.prop === 'createTime') {
  516. sortField.value = 'create_time'
  517. } else if (column.prop === 'payTime') {
  518. sortField.value = 'pay_time'
  519. } else if (column.prop === 'auditTime') {
  520. sortField.value = 'audit_time'
  521. }
  522. sortOrder.value = column.order === 'ascending' ? 'asc' : 'desc'
  523. getRecharge()
  524. getStats()
  525. }
  526. // 预览图片函数
  527. const previewImage = (imageUrl) => {
  528. // 使用 element-plus 的 el-image 组件实现图片预览功能
  529. const imageElement = document.createElement('img');
  530. imageElement.src = imageUrl;
  531. imageElement.style.maxWidth = '80vw';
  532. imageElement.style.maxHeight = '80vh';
  533. const viewer = document.createElement('div');
  534. viewer.style.position = 'fixed';
  535. viewer.style.top = '0';
  536. viewer.style.left = '0';
  537. viewer.style.width = '100vw';
  538. viewer.style.height = '100vh';
  539. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  540. viewer.style.display = 'flex';
  541. viewer.style.justifyContent = 'center';
  542. viewer.style.alignItems = 'center';
  543. viewer.style.zIndex = '9999';
  544. viewer.style.overflow = 'auto';
  545. viewer.appendChild(imageElement);
  546. document.body.appendChild(viewer);
  547. viewer.addEventListener('click', () => {
  548. document.body.removeChild(viewer);
  549. });
  550. };
  551. // 挂载
  552. onMounted(async function () {
  553. await getAdminData()
  554. await getActivity()
  555. await getMarket()
  556. await getRecharge()
  557. console.log('111')
  558. await getStats()
  559. })
  560. </script>
  561. <style scoped>
  562. .pagination {
  563. display: flex;
  564. }
  565. .operation {
  566. display: flex;
  567. }
  568. .green-dot {
  569. background-color: #67C23A;
  570. }
  571. .grey-dot {
  572. background-color: #909399;
  573. }
  574. .red-dot {
  575. background-color: #F56C6C;
  576. }
  577. .time-controls {
  578. display: flex;
  579. align-items: center;
  580. }
  581. .time-group {
  582. display: flex;
  583. align-items: center;
  584. gap: 10px;
  585. }
  586. .quick-buttons {
  587. display: flex;
  588. align-items: center;
  589. }
  590. .status {
  591. display: flex;
  592. align-items: center;
  593. /* 确保子元素垂直居中对齐 */
  594. gap: 6px;
  595. /* 设置圆点和文字之间的间距 */
  596. }
  597. .green-dot,
  598. .grey-dot,
  599. .red-dot {
  600. display: inline-block;
  601. width: 8px;
  602. height: 8px;
  603. border-radius: 50%;
  604. flex-shrink: 0;
  605. /* 防止圆点在空间不足时缩小 */
  606. margin: 0;
  607. /* 移除原有的 margin-right */
  608. }
  609. /* 备注列样式 */
  610. .remark-cell {
  611. display: block;
  612. width: 100%;
  613. overflow: hidden;
  614. text-overflow: ellipsis;
  615. white-space: nowrap;
  616. }
  617. /* 设置单元格内容溢出隐藏 */
  618. .el-table .el-table__cell {
  619. overflow: hidden;
  620. text-overflow: ellipsis;
  621. white-space: nowrap;
  622. }
  623. </style>