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.

677 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. })
  187. // 搜索对象
  188. const getObj = ref({
  189. pageNum: 1,
  190. pageSize: 50
  191. })
  192. // 分页总条目
  193. const total = ref(50)
  194. // 搜索对象时间
  195. const getTime = ref([])
  196. const activity = ref([])
  197. // 搜索地区列表
  198. const market = ref([])
  199. // 驳回弹出框
  200. const rejectDialogVisible = ref(false)
  201. // 驳回理由
  202. const rejectReason = ref('')
  203. // 当前行信息
  204. const currentRecord = ref(null)
  205. // 标签页默认是待审批
  206. const activeName = ref('wait')
  207. // 支付方式选项
  208. const payModel = [
  209. // 现金、支票、刷卡、其他(各地区电子支付)
  210. {
  211. value: '现金',
  212. label: '现金'
  213. },
  214. {
  215. value: '支票',
  216. label: '支票'
  217. },
  218. {
  219. value: '刷卡',
  220. label: '刷卡'
  221. },
  222. {
  223. value: '其他(各地区电子支付)',
  224. label: '其他(各地区电子支付)'
  225. },
  226. ]
  227. // 表单验证ref
  228. const Ref = ref(null)
  229. // 统计合计数
  230. const stats = ref({
  231. totalNum: 0,
  232. totalCoins: 0,
  233. permanentGolds: 0,
  234. freeGolds: 0,
  235. taskGolds: 0
  236. })
  237. // 新增排序字段和排序方式
  238. const sortField = ref('')
  239. const sortOrder = ref('')
  240. // 表单验证
  241. const rules = reactive({
  242. rejectReason: [{required: true, message: '请输入驳回理由', trigger: 'blur'}]
  243. })
  244. const getAdminData = async function () {
  245. try {
  246. const result = await request({
  247. url: '/admin/userinfo',
  248. data: {}
  249. })
  250. adminData.value = result
  251. console.log('用户信息', adminData.value)
  252. } catch (error) {
  253. console.log('请求失败', error)
  254. }
  255. }
  256. // 搜索方法
  257. const getRecharge = async function (val) {
  258. try {
  259. // 搜索参数页码赋值
  260. if (typeof val === 'number') {
  261. getObj.value.pageNum = val
  262. }
  263. // 搜索参数时间赋值
  264. if (getTime.value && getTime.value.length === 2) {
  265. rechargeAudit.value.startTime = formatTime(getTime.value[0])
  266. rechargeAudit.value.endTime = formatTime(getTime.value[1])
  267. } else {
  268. rechargeAudit.value.startTime = ''
  269. rechargeAudit.value.endTime = ''
  270. }
  271. console.log('搜索参数', getObj.value)
  272. const result = await request({
  273. url: '/audit/selectRecharge',
  274. data: {
  275. pageNum: getObj.value.pageNum,
  276. pageSize: getObj.value.pageSize,
  277. rechargeAudit: {
  278. ...rechargeAudit.value,
  279. sortField: sortField.value,
  280. sortOrder: sortOrder.value
  281. }
  282. }
  283. })
  284. // 存储表格数据
  285. tableData.value = result.list
  286. // 存储总条数
  287. total.value = result.total
  288. } catch (error) {
  289. console.log('请求失败', error)
  290. }
  291. }
  292. const getStats = async () => {
  293. try {
  294. const params = {
  295. pageNum: getObj.value.pageNum,
  296. pageSize: getObj.value.pageSize,
  297. rechargeAudit: rechargeAudit.value
  298. }
  299. const res = await API({
  300. url: '/audit/sumRechargeGold',
  301. data: params
  302. })
  303. stats.value.totalNum = res.totalNum
  304. stats.value.permanentGolds = res.permanentGolds / 100
  305. stats.value.freeGolds = res.freeGolds / 100
  306. stats.value.taskGolds = res.taskGolds / 100
  307. console.log('see see stats和搜索对象', stats.value, params)
  308. } catch (error) {
  309. console.log('请求失败', error)
  310. }
  311. }
  312. // 搜索
  313. const handleSearch = function () {
  314. trimJwCode();
  315. getObj.value.pageNum = 1
  316. getRecharge()
  317. getStats()
  318. }
  319. // 重置
  320. const resetSearch = function () {
  321. rechargeAudit.value = {
  322. jwcode: "",
  323. activity: "",
  324. payModel: "",
  325. startTime: "",
  326. endTime: "",
  327. market: "",
  328. auditStatus: rechargeAudit.value.auditStatus
  329. }
  330. getTime.value = []
  331. getRecharge()
  332. getStats()
  333. }
  334. // 今天
  335. const getToday = function () {
  336. const today = new Date()
  337. const startTime = new Date(
  338. today.getFullYear(),
  339. today.getMonth(),
  340. today.getDate()
  341. )
  342. const endTime = new Date(
  343. today.getFullYear(),
  344. today.getMonth(),
  345. today.getDate() + 1
  346. )
  347. getTime.value = [startTime, endTime]
  348. console.log('getTime', getTime.value)
  349. getRecharge()
  350. getStats()
  351. }
  352. // 昨天
  353. const getYesterday = function () {
  354. const yesterday = new Date()
  355. yesterday.setDate(yesterday.getDate() - 1)
  356. const startTime = new Date(
  357. yesterday.getFullYear(),
  358. yesterday.getMonth(),
  359. yesterday.getDate()
  360. )
  361. const endTime = new Date(
  362. yesterday.getFullYear(),
  363. yesterday.getMonth(),
  364. yesterday.getDate() + 1
  365. )
  366. getTime.value = [startTime, endTime]
  367. console.log('getTime', getTime.value)
  368. getRecharge()
  369. getStats()
  370. }
  371. // 近7天
  372. const get7Days = function () {
  373. const today = new Date()
  374. const startTime = new Date(
  375. today.getFullYear(),
  376. today.getMonth(),
  377. today.getDate() - 6
  378. )
  379. const endTime = new Date(
  380. today.getFullYear(),
  381. today.getMonth(),
  382. today.getDate() + 1
  383. )
  384. getTime.value = [startTime, endTime]
  385. console.log('getTime', getTime.value)
  386. getRecharge()
  387. getStats()
  388. }
  389. // 待审核充值明细
  390. const adminWait = async function () {
  391. rechargeAudit.value.auditStatus = "0"
  392. getObj.value.pageNum = 1
  393. await getRecharge()
  394. await getStats()
  395. console.log('adminWait,这是点击待审核调用')
  396. }
  397. // 已通过充值明细
  398. const adminPass = async function () {
  399. rechargeAudit.value.auditStatus = "1"
  400. getObj.value.pageNum = 1
  401. await getRecharge()
  402. await getStats()
  403. console.log('adminWait,这是点击已通过调用')
  404. }
  405. // 已驳回充值明细
  406. const adminReject = async function () {
  407. rechargeAudit.value.auditStatus = "2"
  408. getObj.value.pageNum = 1
  409. await getRecharge()
  410. await getStats()
  411. console.log('adminWait,这是点击已驳回调用')
  412. }
  413. const handleClick = function (tab, event) {
  414. activeName.value = tab.props.name
  415. if (tab.props.name === 'wait') {
  416. adminWait()
  417. } else if (tab.props.name === 'pass') {
  418. adminPass()
  419. } else if (tab.props.name === 'reject') {
  420. adminReject()
  421. }
  422. }
  423. const getActivity = async function () {
  424. try {
  425. const result = await request({
  426. url: '/general/activity',
  427. data: {}
  428. })
  429. activity.value = result.data
  430. console.log('activity', activity.value)
  431. } catch (error) {
  432. console.log('请求失败', error)
  433. }
  434. }
  435. // 地区下拉框
  436. const getMarket = async function () {
  437. try {
  438. const result = await request({
  439. url: '/general/market',
  440. data: {}
  441. })
  442. market.value = result.data
  443. console.log('地区', market.value)
  444. } catch (error) {
  445. console.log('请求失败', error)
  446. }
  447. }
  448. const handlePagination = (type, val) => {
  449. if (type === 'size') {
  450. getObj.value.pageSize = val
  451. } else {
  452. getObj.value.pageNum = val
  453. }
  454. getRecharge()
  455. getStats()
  456. }
  457. // 处理通过操作
  458. const handleApprove = async (row) => {
  459. try {
  460. const params = {
  461. orderCode: row.orderCode,
  462. auditId: adminData.value.id,
  463. action: 1,
  464. rejectReason: ''
  465. }
  466. await request({url: '/audit/audit', data: params})
  467. ElMessage.success('审核通过成功')
  468. await getRecharge()
  469. await getStats()
  470. } catch (error) {
  471. console.error('审核通过失败', error)
  472. ElMessage.error('操作失败')
  473. }
  474. }
  475. // 显示驳回对话框
  476. const showRejectDialog = (row) => {
  477. currentRecord.value = row
  478. rejectReason.value = '' // 清空之前的
  479. rejectDialogVisible.value = true
  480. }
  481. // 处理驳回操作
  482. const handleReject = async () => {
  483. if (!rejectReason.value.trim()) {
  484. ElMessage.warning('请输入驳回理由')
  485. return
  486. }
  487. try {
  488. const params = {
  489. orderCode: currentRecord.value.orderCode,
  490. auditId: adminData.value.id,
  491. action: 2,
  492. rejectReason: rejectReason.value
  493. }
  494. await request({url: '/audit/audit', data: params})
  495. ElMessage.success('驳回操作成功')
  496. rejectDialogVisible.value = false
  497. await getRecharge()
  498. await getStats()
  499. } catch (error) {
  500. console.error('驳回操作失败', error)
  501. ElMessage.error('操作失败')
  502. }
  503. }
  504. // 处理排序事件
  505. const handleSortChange = (column) => {
  506. console.log('排序字段:', column.prop)
  507. console.log('排序方式:', column.order)
  508. if (column.prop === 'money') {
  509. sortField.value = 'permanent_gold'
  510. } else if (column.prop === 'permanentGold') {
  511. sortField.value = 'permanent_gold'
  512. } else if (column.prop === 'freeGold') {
  513. sortField.value = 'freeGold'
  514. } else if (column.prop === 'createTime') {
  515. sortField.value = 'create_time'
  516. } else if (column.prop === 'payTime') {
  517. sortField.value = 'pay_time'
  518. } else if (column.prop === 'auditTime') {
  519. sortField.value = 'audit_time'
  520. }
  521. sortOrder.value = column.order === 'ascending' ? 'asc' : 'desc'
  522. getRecharge()
  523. getStats()
  524. }
  525. // 预览图片函数
  526. const previewImage = (imageUrl) => {
  527. // 使用 element-plus 的 el-image 组件实现图片预览功能
  528. const imageElement = document.createElement('img');
  529. imageElement.src = imageUrl;
  530. imageElement.style.maxWidth = '80vw';
  531. imageElement.style.maxHeight = '80vh';
  532. const viewer = document.createElement('div');
  533. viewer.style.position = 'fixed';
  534. viewer.style.top = '0';
  535. viewer.style.left = '0';
  536. viewer.style.width = '100vw';
  537. viewer.style.height = '100vh';
  538. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  539. viewer.style.display = 'flex';
  540. viewer.style.justifyContent = 'center';
  541. viewer.style.alignItems = 'center';
  542. viewer.style.zIndex = '9999';
  543. viewer.style.overflow = 'auto';
  544. viewer.appendChild(imageElement);
  545. document.body.appendChild(viewer);
  546. viewer.addEventListener('click', () => {
  547. document.body.removeChild(viewer);
  548. });
  549. };
  550. // 挂载
  551. onMounted(async function () {
  552. await getAdminData()
  553. await getActivity()
  554. await getMarket()
  555. await getRecharge()
  556. console.log('111')
  557. await getStats()
  558. })
  559. </script>
  560. <style scoped>
  561. .pagination {
  562. display: flex;
  563. }
  564. .operation {
  565. display: flex;
  566. }
  567. .green-dot {
  568. background-color: #67C23A;
  569. }
  570. .grey-dot {
  571. background-color: #909399;
  572. }
  573. .red-dot {
  574. background-color: #F56C6C;
  575. }
  576. .time-controls {
  577. display: flex;
  578. align-items: center;
  579. }
  580. .time-group {
  581. display: flex;
  582. align-items: center;
  583. gap: 10px;
  584. }
  585. .quick-buttons {
  586. display: flex;
  587. align-items: center;
  588. }
  589. .status {
  590. display: flex;
  591. align-items: center;
  592. /* 确保子元素垂直居中对齐 */
  593. gap: 6px;
  594. /* 设置圆点和文字之间的间距 */
  595. }
  596. .green-dot,
  597. .grey-dot,
  598. .red-dot {
  599. display: inline-block;
  600. width: 8px;
  601. height: 8px;
  602. border-radius: 50%;
  603. flex-shrink: 0;
  604. /* 防止圆点在空间不足时缩小 */
  605. margin: 0;
  606. /* 移除原有的 margin-right */
  607. }
  608. /* 备注列样式 */
  609. .remark-cell {
  610. display: block;
  611. width: 100%;
  612. overflow: hidden;
  613. text-overflow: ellipsis;
  614. white-space: nowrap;
  615. }
  616. /* 设置单元格内容溢出隐藏 */
  617. .el-table .el-table__cell {
  618. overflow: hidden;
  619. text-overflow: ellipsis;
  620. white-space: nowrap;
  621. }
  622. </style>