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.

689 lines
20 KiB

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