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.

962 lines
30 KiB

7 months ago
4 months ago
6 months ago
7 months ago
4 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
4 months ago
4 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
4 months ago
6 months ago
6 months ago
4 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
4 months ago
4 months ago
7 months ago
4 months ago
7 months ago
7 months ago
7 months ago
7 months ago
4 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
5 months ago
6 months ago
7 months ago
3 months ago
7 months ago
7 months ago
  1. <template>
  2. <el-card class="card1" style="margin-bottom: 0.5vh;">
  3. <el-col style="margin-bottom: 1vh">
  4. <div class="select">
  5. <div class="selectRow">
  6. <el-text class="text" size="large">{{ $t('common.jwcode') }}</el-text>
  7. <el-input class="selectContent" v-model="rechargeAudit.jwcode" :placeholder="$t('common.jwcodePlaceholder')" clearable />
  8. </div>
  9. <div class="selectRow">
  10. <el-text class="text" size="large">{{ $t('common.activityName') }}</el-text>
  11. <el-select class="selectContent" v-model="rechargeAudit.activity" :placeholder="$t('common.activityNamePlaceholder')" clearable>
  12. <el-option v-for="item in activity" :key="item" :label="item" :value="item" />
  13. </el-select>
  14. </div>
  15. <div class="selectRow">
  16. <el-text class="text" size="large">{{ $t('common.payModel') }}</el-text>
  17. <el-select class="selectContent" v-model="rechargeAudit.payModel" :placeholder="$t('common.payModelPlaceholder')" clearable>
  18. <el-option v-for="item in payModel" :key="item.value" :label="item.label" :value="item.value" />
  19. </el-select>
  20. </div>
  21. <div class="selectRow">
  22. <el-text class="text" size="large">{{ $t('common.market') }}</el-text>
  23. <el-cascader class="selectContent" v-model="selectedMarketPath" :options="market" :placeholder="$t('common.marketPlaceholder')"
  24. clearable @change="handleMarketChange" />
  25. </div>
  26. </div>
  27. </el-col>
  28. <el-col>
  29. <div class="select">
  30. <div class="selectRow" style="width: 36vw;">
  31. <el-text class="text" size="large">
  32. {{ activeName === 'wait' ? $t('common.submitTime') : $t('common.auditTime') }}
  33. </el-text>
  34. <el-date-picker class="selectContent" v-model="getTime" type="datetimerange" :range-separator="$t('common.to')"
  35. :start-placeholder="$t('common.startTime')" :end-placeholder="$t('common.endTime')" style="margin-right:1vw;width:25vw"
  36. @change="handleDatePickerChange" :default-time="defaultTime" :disabled-date="disabledDate" />
  37. <div v-if="false">
  38. <el-button @click="getToday()" :type="activeTimeRange === 'today' ? 'primary' : ''"></el-button>
  39. <el-button @click="getYesterday()" :type="activeTimeRange === 'yesterday' ? 'primary' : ''"></el-button>
  40. <el-button @click="get7Days()" :type="activeTimeRange === '7days' ? 'primary' : ''">近7天</el-button>
  41. </div>
  42. </div>
  43. <div class="selectRow" style="justify-content: flex-start;">
  44. <el-button @click="handleSearch" type="primary">{{ $t('common.search') }}</el-button>
  45. <el-button @click="resetSearch" type="success">{{ $t('common.reset') }}</el-button>
  46. </div>
  47. </div>
  48. </el-col>
  49. </el-card>
  50. <el-card class="card2">
  51. <div class="custom-button-group">
  52. <el-button
  53. v-if="hasrechargeWait&&hasrechargeWaitShow"
  54. :type="activeName === 'wait' ? 'primary' : 'default'"
  55. @click="handleButtonClick('wait')"
  56. class="custom-tab-button"
  57. >
  58. {{ $t('audit.waitAudit') }}
  59. </el-button>
  60. <el-button
  61. v-if="hasrechargeThrough"
  62. :type="activeName === 'pass' ? 'primary' : 'default'"
  63. @click="handleButtonClick('pass')"
  64. class="custom-tab-button"
  65. >
  66. {{ $t('audit.passed') }}
  67. </el-button>
  68. <el-button
  69. v-if="hasrechargeReject"
  70. :type="activeName === 'reject' ? 'primary' : 'default'"
  71. @click="handleButtonClick('reject')"
  72. class="custom-tab-button"
  73. >
  74. {{ $t('audit.rejected') }}
  75. </el-button>
  76. </div>
  77. <div class="goldStatistics">
  78. <!-- 总条数{{ format3(stats.totalNum) }}&nbsp;&nbsp;&nbsp;&nbsp;-->
  79. {{ $t('audit.rechargeSGD') }}{{ format3(stats.permanentGolds) }} {{ $t('common.SGD') }}&nbsp;&nbsp;&nbsp;&nbsp;
  80. {{ $t('audit.totalGold') }}{{ format3((stats.permanentGolds + stats.freeGolds + stats.taskGolds).toFixed(2))
  81. }}{{ $t('common.goldCoin') }}&nbsp;&nbsp;&nbsp;&nbsp;
  82. {{ $t('audit.permanentGold') }}{{ format3(stats.permanentGolds.toFixed(2)) }}{{ $t('common.goldCoin') }}&nbsp;&nbsp;&nbsp;&nbsp;
  83. {{ $t('audit.freeGold') }}{{ format3(stats.freeGolds.toFixed(2)) }}{{ $t('common.goldCoin') }}&nbsp;&nbsp;&nbsp;&nbsp;
  84. </div>
  85. <el-table :data="tableData" style="width: 82vw;height:61vh" @sort-change="handleSortChange"
  86. :row-style="{ height: '50px' }">
  87. <el-table-column type="index" :label="$t('audit.id')" width="100px" fixed="left">
  88. <template #default="scope">
  89. <span>{{ scope.$index + 1 + (getObj.pageNum - 1) * getObj.pageSize }}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column fixed="left" prop="name" :label="$t('audit.name')" width="150px" show-overflow-tooltip />
  93. <el-table-column fixed="left" prop="jwcode" :label="$t('audit.jwcode')" width="110px" />
  94. <el-table-column prop="market" :label="$t('audit.market')" width="120px" />
  95. <el-table-column prop="activity" :label="$t('audit.activityName')" width="100px" show-overflow-tooltip />
  96. <el-table-column prop="rateName" :label="$t('audit.currencyName')" width="110px" />
  97. <el-table-column prop="money" :label="$t('audit.rechargeAmount')" sortable="custom" width="110px">
  98. <template #default="scope">{{ scope.row.money / 100 }}</template>
  99. </el-table-column>
  100. <el-table-column prop="permanentGold" :label="$t('audit.permanentGold')" width="130px" sortable="custom">
  101. <template #default="scope">{{ scope.row.permanentGold / 100 }}</template>
  102. </el-table-column>
  103. <el-table-column prop="freeGold" :label="$t('audit.freeGold')" sortable="custom" width="110px">
  104. <template #default="scope">{{ (scope.row.freeGold) / 100 }}</template>
  105. </el-table-column>
  106. <el-table-column prop="remark" :label="$t('audit.note')" width="180px" show-overflow-tooltip />
  107. <el-table-column prop="payModel" :label="$t('audit.payModel')" width="130px" />
  108. <el-table-column prop="voucher" :label="$t('audit.paymentVoucher')" width="110px">
  109. <template #default="scope">
  110. <div v-if="scope.row.voucher"
  111. style="display: flex; justify-content: center; align-items: center; cursor: pointer;"
  112. @click="previewImage(scope.row.voucher)">
  113. <img :src="scope.row.voucher" :alt="$t('audit.paymentVoucher')" style="width: auto; height: 40px;">
  114. </div>
  115. <div v-else style="display: flex; justify-content: center; align-items: center; height: 40px;">--</div>
  116. </template>
  117. </el-table-column>
  118. <el-table-column prop="adminName" :label="$t('audit.submitter')" width="100px" />
  119. <el-table-column prop="rejectReason" v-if="activeName === 'reject'" :label="$t('audit.rejectReason')" width="200px"
  120. show-overflow-tooltip />
  121. <el-table-column v-if="activeName !== 'wait'" prop="auditName" :label="$t('audit.auditor')" width="100px" />
  122. <el-table-column prop="payTime" sortable="custom" :label="$t('audit.paymentTime')" width="200px">
  123. <template #default="scope">
  124. {{ moment(scope.row.payTime).format('YYYY-MM-DD HH:mm:ss') }}
  125. </template>
  126. </el-table-column>
  127. <el-table-column prop="createTime" sortable="custom" :label="$t('audit.submitTime')" width="200px">
  128. <template #default="scope">
  129. <!-- {{ moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}-->
  130. {{
  131. activeName === 'wait'
  132. ? moment(scope.row.auditTime).format('YYYY-MM-DD HH:mm:ss')
  133. : moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss')
  134. }}
  135. </template>
  136. </el-table-column>
  137. <el-table-column v-if="activeName !== 'wait'" prop="auditTime" sortable="custom" :label="$t('audit.auditTime')" width="200px">
  138. <template #default="scope">
  139. {{ moment(scope.row.auditTime).format('YYYY-MM-DD HH:mm:ss') }}
  140. </template>
  141. </el-table-column>
  142. <el-table-column v-if="activeName === 'wait'&&(hasrechargeWaitThough||hasrechargeWaitReject)&&hasrechargeWaitShow" fixed="right" prop="operation" :label="$t('audit.operation')" width="150px">
  143. <template #default="scope">
  144. <div class="operation">
  145. <el-link :underline="false" class="pass-btn" v-if="hasrechargeWaitThough"
  146. :disabled="clicked || cancelClicked" type="primary"
  147. @click="showApproveDialog(scope.row)">
  148. {{ $t('common.pass') }}
  149. </el-link>
  150. <el-link :underline="false" class="reject-btn" v-if="hasrechargeWaitReject"
  151. :disabled="clicked || cancelClicked" type="primary"
  152. @click="showRejectDialog(scope.row)">
  153. {{ $t('common.reject') }}
  154. </el-link>
  155. </div>
  156. </template>
  157. </el-table-column>
  158. </el-table>
  159. <div class="pagination">
  160. <el-pagination background :current-page="getObj.pageNum" :page-size="getObj.pageSize" :page-sizes="[5, 10, 20, 50, 100]"
  161. layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handlePagination('size', $event)"
  162. @current-change="handlePagination('page', $event)"></el-pagination>
  163. </div>
  164. </el-card>
  165. <el-dialog v-model="rejectReasonDialogVisible" :title="$t('audit.rejectReason')" width="400px" @close="handleRejectReasonCancel">
  166. <el-form>
  167. <el-form-item :label="$t('audit.rejectReason')" required>
  168. <el-input v-model="rejectReason" type="textarea" :rows="4" :placeholder="$t('audit.rejectReason')" maxlength="200"
  169. show-word-limit />
  170. </el-form-item>
  171. </el-form>
  172. <template #footer>
  173. <span class="dialog-footer">
  174. <el-button @click="handleRejectReasonCancel">{{ $t('common.cancel') }}</el-button>
  175. <el-button :disabled="cancelClicked" type="primary" @click="handleReject">{{ $t('common.confirm') }}</el-button>
  176. </span>
  177. </template>
  178. </el-dialog>
  179. <ConfirmDialog
  180. v-model="rejectDialogVisible"
  181. :message="$t('audit.rejectRecord')"
  182. @confirm="showRejectReasonInput"
  183. @cancel="handleRejectCancel"
  184. @close="handleRejectClose"
  185. />
  186. <!-- 新增使用ConfirmDialog组件 -->
  187. <ConfirmDialog
  188. v-model="approveDialogVisible"
  189. :message="$t('audit.passRecord')"
  190. @confirm="handleApproveConfirm"
  191. @cancel="handleApproveCancel"
  192. @close="handleApproveClose"
  193. />
  194. </template>
  195. <script setup>
  196. import { onMounted, reactive, ref, watch } from 'vue'
  197. import { ElMessage } from 'element-plus'
  198. import request from '@/util/http.js'
  199. import API from '@/util/http.js'
  200. import moment from 'moment'
  201. import { useAdminStore } from "@/store/index.js";
  202. import { storeToRefs } from "pinia";
  203. import ConfirmDialog from '@/components/dialogs/ConfirmDialog.vue'
  204. const adminStore = useAdminStore();
  205. const { adminData, menuTree, flag } = storeToRefs(adminStore);
  206. import { permissionMapping, hasMenuPermission } from "@/utils/menuTreePermission.js"
  207. import dayjs from "dayjs";
  208. import { useI18n } from 'vue-i18n';
  209. import {reverseMarketMapping} from "@/utils/marketMap.js";
  210. const { t } = useI18n();
  211. // 监听全局flag状态变化
  212. watch(flag, (newFlag, oldFlag) => {
  213. // 当flag状态改变时,重新发送请求
  214. if (newFlag !== oldFlag) {
  215. // console.log('员工数据flag状态改变,重新加载数据', newFlag)
  216. getRecharge()
  217. console.log('flag10',flag.value)
  218. getStats()
  219. console.log('flag2',flag)
  220. }
  221. })
  222. //操作权限
  223. const hasrechargeThrough = ref(false) // 充值审核已通过
  224. const hasrechargeReject = ref(false) // 充值审核已驳回
  225. const hasrechargeWait = ref(false) // 充值审核待审核
  226. const hasrechargeWaitShow = ref(false) // 充值审核待审核查看
  227. const hasrechargeWaitThough = ref(false) // 充值审核通过
  228. const hasrechargeWaitReject = ref(false) // 充值审核驳回
  229. // 初始化权限状态
  230. const initPermissions = async() => {
  231. if (!menuTree.value || !menuTree.value.length) return;
  232. hasrechargeThrough.value = hasMenuPermission(menuTree.value, permissionMapping.gold_coin_recharge_approved);
  233. hasrechargeReject.value = hasMenuPermission(menuTree.value, permissionMapping.gold_coin_recharge_rejected);
  234. hasrechargeWait.value = hasMenuPermission(menuTree.value, permissionMapping.gold_coin_recharge_pending);
  235. hasrechargeWaitShow.value = hasMenuPermission(menuTree.value, permissionMapping.view_gold_recharge_pending);
  236. hasrechargeWaitThough.value = hasMenuPermission(menuTree.value, permissionMapping.pass_gold_refund_audit);
  237. hasrechargeWaitReject.value = hasMenuPermission(menuTree.value, permissionMapping.reject_gold_refund_audit);
  238. console.log(hasrechargeWaitThough.value)
  239. console.log(hasrechargeWaitReject.value)
  240. };
  241. const defaultTime = [
  242. new Date(2000, 1, 1, 0, 0, 0),
  243. new Date(2000, 2, 1, 23, 59, 59),
  244. ]
  245. //无法选择的时间
  246. const disabledDate = (time) => {
  247. const limitDate = new Date(2025, 0, 1);
  248. return time.getTime() < limitDate.getTime();
  249. }
  250. const tableData = ref([])
  251. // 当前激活的时间按钮
  252. const activeTimeRange = ref('')
  253. const total = ref(50)
  254. // 搜索对象时间
  255. const getTime = ref([])
  256. const activity = ref([])
  257. const market = ref("")
  258. const rejectDialogVisible = ref(false)
  259. const rejectReasonDialogVisible = ref(false) // 驳回理由输入框显示状态
  260. const rejectReason = ref('')
  261. const approveDialogVisible = ref(false)
  262. // 当前行信息
  263. const currentRecord = ref(null)
  264. // 标签页默认是待审批
  265. const activeName = ref('wait')
  266. const sortField = ref('')
  267. const sortOrder = ref('')
  268. // 存储地区选择变化
  269. const selectedMarketPath = ref("")
  270. // 搜索表单
  271. const rechargeAudit = ref({
  272. jwcode: "", // 精网号
  273. activity: "", // 活动名称
  274. payModel: "", // 支付方式
  275. startTime: "", // 充值时间开始
  276. endTime: "", // 充值时间结束
  277. market: "", // 地区
  278. auditStatus: '0',
  279. })
  280. // 搜索对象
  281. const getObj = ref({
  282. pageNum: 1,
  283. pageSize: 50
  284. })
  285. // 支付方式选项
  286. const payModel = [
  287. {
  288. value: '银行转账',
  289. label: t('audit.payMethods.bankTransfer')
  290. },
  291. {
  292. value: '现金',
  293. label: t('audit.payMethods.cash')
  294. },
  295. {
  296. value: '支票',
  297. label: t('audit.payMethods.check')
  298. },
  299. {
  300. value: '刷卡',
  301. label: t('audit.payMethods.card')
  302. },
  303. {
  304. value: 'Grabpay',
  305. label: t('audit.payMethods.grabpay')
  306. },
  307. {
  308. value: 'Nets',
  309. label: t('audit.payMethods.nets')
  310. },
  311. {
  312. value: 'PayPal',
  313. label: t('audit.payMethods.paypal')
  314. },
  315. {
  316. value: 'Stripe-链接收款',
  317. label: t('audit.payMethods.stripe')
  318. },
  319. {
  320. value: 'Ipay88-链接收款',
  321. label: t('audit.payMethods.ipay88')
  322. },
  323. {
  324. value: 'PaymentAsia-链接收款',
  325. label: t('audit.payMethods.paymentAsia')
  326. },
  327. {
  328. value: '其他',
  329. label: t('audit.payMethods.other')
  330. }
  331. ]
  332. // 统计合计数
  333. const stats = ref({
  334. totalNum: 0,
  335. totalCoins: 0,
  336. permanentGolds: 0,
  337. freeGolds: 0,
  338. taskGolds: 0
  339. })
  340. // 表单验证
  341. const rules = reactive({
  342. rejectReason: [{ required: true, message: t('audit.rejectReasonPlaceholder'), trigger: 'blur' }]
  343. })
  344. // 搜索方法
  345. const getRecharge = async function (val) {
  346. if (!hasrechargeWaitShow) {
  347. ElMessage.error(t('elmessage.noPermission'))
  348. return
  349. }
  350. try {
  351. if (getTime.value && getTime.value.length === 2) {
  352. rechargeAudit.value.startTime = formatTime(getTime.value[0])
  353. rechargeAudit.value.endTime = formatTime(getTime.value[1])
  354. } else {
  355. rechargeAudit.value.startTime = ''
  356. rechargeAudit.value.endTime = ''
  357. }
  358. // if (rechargeAudit.value.market === '总部' || rechargeAudit.value.market === '研发部') {
  359. // rechargeAudit.value.market = '';
  360. // }
  361. // 校验精网号(数字格式)
  362. if (rechargeAudit.value.jwcode) {
  363. // 纯数字
  364. const numberRegex = /^\d{1,9}$/;
  365. // 检查是否不是数字
  366. if (!numberRegex.test(rechargeAudit.value.jwcode)) {
  367. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  368. return
  369. }
  370. }
  371. const result = await request({
  372. url: '/audit/selectRecharge',
  373. data: {
  374. pageNum: getObj.value.pageNum,
  375. pageSize: getObj.value.pageSize,
  376. rechargeAudit: {
  377. ...rechargeAudit.value,
  378. sortField: sortField.value,
  379. sortOrder: sortOrder.value,
  380. flag: flag.value
  381. }
  382. }
  383. })
  384. tableData.value = result.list
  385. total.value = result.total
  386. } catch (error) {
  387. console.log('请求失败', error)
  388. }
  389. }
  390. const getStats = async () => {
  391. if (!hasrechargeWaitShow) {
  392. return
  393. }
  394. try {
  395. const params = {
  396. pageNum: getObj.value.pageNum,
  397. pageSize: getObj.value.pageSize,
  398. rechargeAudit: {
  399. ...rechargeAudit.value,
  400. flag: flag.value
  401. }
  402. }
  403. // 校验精网号(数字格式)
  404. if (rechargeAudit.value.jwcode) {
  405. // 纯数字
  406. const numberRegex = /^\d{1,9}$/;
  407. // 检查是否不是数字
  408. if (!numberRegex.test(rechargeAudit.value.jwcode)) {
  409. // ElMessage.error('精网号必须为数字格式')
  410. // 上面提示过了
  411. return
  412. }
  413. }
  414. const res = await API({
  415. url: '/audit/sumRechargeGold',
  416. data: params
  417. })
  418. stats.value.totalNum = res.totalNum
  419. stats.value.permanentGolds = res.permanentGolds / 100
  420. stats.value.freeGolds = res.freeGolds / 100
  421. stats.value.taskGolds = res.taskGolds / 100
  422. console.log('see see stats和搜索对象', stats.value, params)
  423. } catch (error) {
  424. console.log('请求失败', error)
  425. }
  426. }
  427. // 搜索
  428. const handleSearch = function () {
  429. trimJwCode();
  430. getObj.value.pageNum = 1
  431. getRecharge()
  432. getStats()
  433. }
  434. // 重置
  435. const resetSearch = function () {
  436. rechargeAudit.value = {
  437. jwcode: "",
  438. activity: "",
  439. payModel: "",
  440. startTime: "",
  441. endTime: "",
  442. market: "",
  443. auditStatus: rechargeAudit.value.auditStatus
  444. }
  445. // 重置页码
  446. getObj.value.pageNum = 1
  447. selectedMarketPath.value = []
  448. getTime.value = []
  449. activeTimeRange.value = '' // 清除激活状态
  450. getRecharge()
  451. getStats()
  452. }
  453. // 今天
  454. const getToday = function () {
  455. const today = dayjs()
  456. const startTime = today.startOf('day').format('YYYY-MM-DD HH:mm:ss')
  457. const endTime = today.endOf('day').format('YYYY-MM-DD HH:mm:ss')
  458. getTime.value = [startTime, endTime]
  459. console.log('getTime', getTime.value)
  460. activeTimeRange.value = 'today' // 标记当前激活状态
  461. getRecharge()
  462. getStats()
  463. }
  464. // 昨天
  465. const getYesterday = function () {
  466. const today = dayjs()
  467. const startTime = today.subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss')
  468. const endTime = today.subtract(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss')
  469. getTime.value = [startTime, endTime]
  470. console.log('getTime', getTime.value)
  471. activeTimeRange.value = 'yesterday' // 标记当前激活状态
  472. getRecharge()
  473. getStats()
  474. }
  475. // 近7天
  476. const get7Days = function () {
  477. const today = dayjs()
  478. const startTime = today.subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss')
  479. const endTime = today.endOf('day').format('YYYY-MM-DD HH:mm:ss')
  480. getTime.value = [startTime, endTime]
  481. console.log('getTime', getTime.value)
  482. activeTimeRange.value = '7days' // 标记当前激活状态
  483. getRecharge()
  484. getStats()
  485. }
  486. // 待审核充值明细
  487. const adminWait = async function () {
  488. rechargeAudit.value.auditStatus = "0"
  489. getObj.value.pageNum = 1
  490. await getRecharge()
  491. await getStats()
  492. console.log('adminWait,这是点击待审核调用')
  493. }
  494. // 已通过充值明细
  495. const adminPass = async function () {
  496. rechargeAudit.value.auditStatus = "1"
  497. getObj.value.pageNum = 1
  498. await getRecharge()
  499. await getStats()
  500. console.log('adminWait,这是点击已通过调用')
  501. }
  502. // 已驳回充值明细
  503. const adminReject = async function () {
  504. rechargeAudit.value.auditStatus = "2"
  505. getObj.value.pageNum = 1
  506. await getRecharge()
  507. await getStats()
  508. console.log('adminWait,这是点击已驳回调用')
  509. }
  510. const handleButtonClick = function (name) {
  511. activeName.value = name
  512. if (name === 'wait') {
  513. if(!hasrechargeWait){
  514. ElMessage.error(t('elmessage.noPermission'))
  515. return
  516. }
  517. if(hasrechargeWaitShow){
  518. adminWait()
  519. }
  520. } else if (name === 'pass') {
  521. if(!hasrechargeThrough){
  522. ElMessage.error(t('elmessage.noPermission'))
  523. return
  524. }
  525. adminPass()
  526. } else if (name === 'reject') {
  527. if(!hasrechargeReject){
  528. ElMessage.error(t('elmessage.noPermission'))
  529. return
  530. }
  531. adminReject()
  532. }
  533. }
  534. // const handleClick = function (tab, event) {
  535. // activeName.value = tab.props.name
  536. // if (tab.props.name === 'wait') {
  537. // if(!hasrechargeWait){
  538. // ElMessage.error('暂无权限')
  539. // return
  540. // }
  541. // if(hasrechargeWaitShow){
  542. // adminWait()
  543. // }
  544. // } else if (tab.props.name === 'pass') {
  545. // if(!hasrechargeThrough){
  546. // ElMessage.error('暂无权限')
  547. // return
  548. // }
  549. // adminPass()
  550. // } else if (tab.props.name === 'reject') {
  551. // if(!hasrechargeReject){
  552. // ElMessage.error('暂无权限')
  553. // return
  554. // }
  555. // adminReject()
  556. // }
  557. // }
  558. const getActivity = async function () {
  559. try {
  560. const result = await request({
  561. url: '/general/activity',
  562. data: {}
  563. })
  564. activity.value = result.data
  565. console.log('activity', activity.value)
  566. } catch (error) {
  567. console.log('请求失败', error)
  568. }
  569. }
  570. const handlePagination = (type, val) => {
  571. if (type === 'size') {
  572. getObj.value.pageSize = val
  573. } else {
  574. getObj.value.pageNum = val
  575. }
  576. getRecharge()
  577. getStats()
  578. }
  579. const clicked = ref(false);
  580. // 显示通过确认对话框
  581. const showApproveDialog = (row) => {
  582. if(!hasrechargeWaitThough){
  583. ElMessage.error(t('elmessage.noPermission'))
  584. return
  585. }
  586. currentRecord.value = row
  587. approveDialogVisible.value = true
  588. }
  589. // 使用handleApproveConfirm函数代替handleApprove
  590. const handleApproveConfirm = async () => {
  591. clicked.value = true
  592. try {
  593. const params = {
  594. orderCode: currentRecord.value.orderCode,
  595. auditId: adminData.value.id,
  596. action: 1,
  597. rejectReason: ''
  598. }
  599. await request({ url: '/audit/audit', data: params })
  600. ElMessage.success(t('elmessage.approveSuccess'))
  601. approveDialogVisible.value = false
  602. await getRecharge()
  603. clicked.value = false
  604. await getStats()
  605. } catch (error) {
  606. console.error(t('elmessage.approveFailed'), error)
  607. ElMessage.error(t('elmessage.operationFailed'))
  608. clicked.value = false
  609. }
  610. }
  611. // 处理通过取消操作
  612. const handleApproveCancel = () => {
  613. approveDialogVisible.value = false
  614. }
  615. // 处理通过关闭操作
  616. const handleApproveClose = () => {
  617. approveDialogVisible.value = false
  618. }
  619. // 处理通过操作
  620. // const handleApprove = async (row) => {
  621. // if(!hasrechargeWaitThough){
  622. // ElMessage.error('暂无权限')
  623. // return
  624. // }
  625. // clicked.value = true
  626. // try {
  627. // const params = {
  628. // orderCode: row.orderCode,
  629. // auditId: adminData.value.id,
  630. // action: 1,
  631. // rejectReason: ''
  632. // }
  633. // await request({ url: '/audit/audit', data: params })
  634. // ElMessage.success('审核通过成功')
  635. // await getRecharge()
  636. // clicked.value = false
  637. // await getStats()
  638. // } catch (error) {
  639. // console.error('审核通过失败', error)
  640. // ElMessage.error('操作失败')
  641. // }
  642. // }
  643. const showRejectDialog = (row) => {
  644. if(!hasrechargeWaitReject){
  645. ElMessage.error(t('elmessage.noPermission'))
  646. return
  647. }
  648. currentRecord.value = row
  649. rejectReason.value = ''
  650. rejectDialogVisible.value = true
  651. }
  652. //控制驳回确认按钮禁用状态
  653. const cancelClicked = ref(false)
  654. // 处理驳回操作
  655. const handleReject = async () => {
  656. // 在showRejectDialog已经添加过了权限检查,此处应该是可以不用添加的
  657. if(!hasrechargeWaitReject){
  658. ElMessage.error(t('elmessage.noPermission'))
  659. return
  660. }
  661. cancelClicked.value = true
  662. if (!rejectReason.value.trim()) {
  663. ElMessage.warning(t('elmessage.rejectReasonPlaceholder'))
  664. cancelClicked.value = false // 重置按钮状态
  665. return
  666. }
  667. try {
  668. const params = {
  669. orderCode: currentRecord.value.orderCode,
  670. auditId: adminData.value.id,
  671. action: 2,
  672. rejectReason: rejectReason.value
  673. }
  674. await request({ url: '/audit/audit', data: params })
  675. ElMessage.success(t('elmessage.rejectSuccess'))
  676. rejectReasonDialogVisible.value = false
  677. await getRecharge()
  678. cancelClicked.value = false
  679. await getStats()
  680. } catch (error) {
  681. console.error(t('elmessage.rejectFailed'), error)
  682. ElMessage.error(t('elmessage.operationFailed'))
  683. }
  684. }
  685. // 确认驳回后显示理由输入框
  686. const showRejectReasonInput = () => {
  687. rejectDialogVisible.value = false // 关闭确认对话框
  688. rejectReasonDialogVisible.value = true // 打开驳回理由输入框
  689. }
  690. // 处理驳回取消操作
  691. const handleRejectCancel = () => {
  692. rejectDialogVisible.value = false
  693. }
  694. // 处理驳回关闭操作
  695. const handleRejectClose = () => {
  696. rejectDialogVisible.value = false
  697. }
  698. // 处理驳回理由对话框关闭/取消操作
  699. const handleRejectReasonCancel = () => {
  700. rejectReasonDialogVisible.value = false
  701. cancelClicked.value = false // 重置禁用状态
  702. rejectReason.value = '' // 清空驳回理由
  703. }
  704. // 处理排序事件
  705. const handleSortChange = (column) => {
  706. console.log('排序字段:', column.prop)
  707. console.log('排序方式:', column.order)
  708. if (column.prop === 'money') {
  709. sortField.value = 'permanent_gold'
  710. } else if (column.prop === 'permanentGold') {
  711. sortField.value = 'permanent_gold'
  712. } else if (column.prop === 'freeGold') {
  713. sortField.value = 'freeGold'
  714. } else if (column.prop === 'createTime') {
  715. sortField.value = 'create_time'
  716. } else if (column.prop === 'payTime') {
  717. sortField.value = 'pay_time'
  718. } else if (column.prop === 'auditTime') {
  719. sortField.value = 'audit_time'
  720. }
  721. sortOrder.value = column.order === 'ascending' ? 'asc' : 'desc'
  722. getRecharge()
  723. getStats()
  724. }
  725. // 预览图片函数
  726. const previewImage = (imageUrl) => {
  727. // 使用 element-plus 的 el-image 组件实现图片预览功能
  728. const imageElement = document.createElement('img');
  729. imageElement.src = imageUrl;
  730. imageElement.style.maxWidth = '80vw';
  731. imageElement.style.maxHeight = '80vh';
  732. const viewer = document.createElement('div');
  733. viewer.style.position = 'fixed';
  734. viewer.style.top = '0';
  735. viewer.style.left = '0';
  736. viewer.style.width = '100vw';
  737. viewer.style.height = '100vh';
  738. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  739. viewer.style.display = 'flex';
  740. viewer.style.justifyContent = 'center';
  741. viewer.style.alignItems = 'center';
  742. viewer.style.zIndex = '9999';
  743. viewer.style.overflow = 'auto';
  744. viewer.appendChild(imageElement);
  745. document.body.appendChild(viewer);
  746. viewer.addEventListener('click', () => {
  747. document.body.removeChild(viewer);
  748. });
  749. };
  750. const handleMarketChange = (value) => {
  751. if (value && value.length > 0) {
  752. const lastValue = rechargeAudit.value.market = value[value.length - 1]
  753. rechargeAudit.value.market = reverseMarketMapping[lastValue]
  754. } else {
  755. rechargeAudit.value.market = ''
  756. }
  757. }
  758. const props = { multiple: true }
  759. // 获取地区,修改为级联下拉框
  760. const getMarket = async function () {
  761. try {
  762. const result = await API({
  763. url: '/market/selectMarket',
  764. });
  765. console.log('请求成功', result)
  766. // 递归转换树形结构为级联选择器需要的格式(跳过第一级节点)
  767. const transformTree = (nodes) => {
  768. // 直接处理第一级节点的子节点
  769. const allChildren = nodes.flatMap(node => node.children || []);
  770. return allChildren.map(child => {
  771. const grandchildren = child.children && child.children.length
  772. ? transformTree([child]) // 递归处理子节点
  773. : null;
  774. return {
  775. value: child.name,
  776. label: child.name,
  777. children: grandchildren
  778. };
  779. });
  780. };
  781. market.value = transformTree(result.data)
  782. console.log('转换后的地区树==============', market.value)
  783. } catch (error) {
  784. console.log('请求失败', error)
  785. }
  786. }
  787. // 每三位添加逗号
  788. const format3 = (num) => {
  789. return num.toLocaleString('en-US')
  790. }
  791. // 日期选择器变化时清除按钮激活状态
  792. const handleDatePickerChange = () => {
  793. activeTimeRange.value = ''
  794. }
  795. // 精网号去空格
  796. const trimJwCode = () => {
  797. if (rechargeAudit.value.jwcode) {
  798. rechargeAudit.value.jwcode = rechargeAudit.value.jwcode.replace(/\s/g, '');
  799. }
  800. }
  801. const cancelClick = () => {
  802. }
  803. const formatTime = (val) => val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : ''
  804. // 挂载
  805. onMounted(async function () {
  806. await initPermissions()
  807. if(hasrechargeWaitShow.value){
  808. rechargeAudit.value.auditStatus = '0'
  809. }else if(hasrechargeThrough.value){
  810. rechargeAudit.value.auditStatus = '1'
  811. }else if(hasrechargeReject){
  812. rechargeAudit.value.auditStatus = '2'
  813. }
  814. await getActivity()
  815. await getMarket()
  816. await getRecharge()
  817. console.log("看看通信来的用户身份", adminData.value)
  818. await getStats()
  819. })
  820. </script>
  821. <style scoped lang="scss">
  822. .pagination {
  823. display: flex;
  824. margin-top: 1vh;
  825. }
  826. .operation {
  827. display: flex;
  828. }
  829. // 搜索的卡片样式
  830. .card1 {
  831. background: #F3FAFE;
  832. }
  833. // 表单的卡片样式
  834. .card2 {
  835. background: #E7F4FD;
  836. }
  837. // 新币总数等等
  838. .goldStatistics {
  839. margin-left: 1vw;
  840. margin-bottom: 1vh;
  841. color: #000000;
  842. font-family: "PingFang SC";
  843. font-size: 16px;
  844. font-style: normal;
  845. font-weight: 700;
  846. line-height: 20px;
  847. }
  848. // 表头背景等
  849. :deep(.el-table__header-wrapper),
  850. :deep(.el-table__body-wrapper),
  851. :deep(.el-table__cell),
  852. /* 表格 */
  853. :deep(.el-table__body td) {
  854. background-color: #F3FAFE !important;
  855. }
  856. /* 表头 */
  857. :deep(.el-table__header th) {
  858. background-color: #F3FAFE !important;
  859. }
  860. /* 鼠标悬停 */
  861. :deep(.el-table__row:hover > .el-table__cell) {
  862. background-color: #E5EBFE !important;
  863. }
  864. /* 按钮组 */
  865. /* 自定义按钮组布局 */
  866. .custom-button-group {
  867. display: flex;
  868. margin-bottom: 16px;
  869. }
  870. :deep(.el-button.custom-tab-button) {
  871. border-radius: 4px;
  872. transition: all 0.3s ease;
  873. }
  874. /* 自定义激活状态样式 - 使用正确的Element Plus类选择器 */
  875. // 使用了 .el-button--primary 类选择器,这是 Element Plus 按钮组件在设置 type="primary" 时实际添加的类名
  876. :deep(.el-button.custom-tab-button.el-button--primary) {
  877. background-color: #2741DE !important;
  878. border-color: #2741DE !important;
  879. color: #F3FAFE !important;
  880. }
  881. /* 鼠标悬停效果 */
  882. :deep(.el-button.custom-tab-button:hover:not(.is-disabled)) {
  883. opacity: 0.8;
  884. }
  885. .select {
  886. display: flex;
  887. .selectRow {
  888. width: 17vw;
  889. display: flex;
  890. align-items: center;
  891. justify-content: center;
  892. padding: 0 0.5vw;
  893. .text {
  894. width: 5vw;
  895. font-size: 15px;
  896. }
  897. .selectContent {
  898. flex: 1;
  899. }
  900. }
  901. }
  902. </style>