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.

969 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="throttledHandleApproveConfirm"
  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. import _ from 'lodash';
  612. // handleApproveConfirm
  613. const throttledHandleApproveConfirm = _.throttle(handleApproveConfirm, 5000, {
  614. trailing: false
  615. })
  616. // 处理通过取消操作
  617. const handleApproveCancel = () => {
  618. approveDialogVisible.value = false
  619. }
  620. // 处理通过关闭操作
  621. const handleApproveClose = () => {
  622. approveDialogVisible.value = false
  623. }
  624. // 处理通过操作
  625. // const handleApprove = async (row) => {
  626. // if(!hasrechargeWaitThough){
  627. // ElMessage.error('暂无权限')
  628. // return
  629. // }
  630. // clicked.value = true
  631. // try {
  632. // const params = {
  633. // orderCode: row.orderCode,
  634. // auditId: adminData.value.id,
  635. // action: 1,
  636. // rejectReason: ''
  637. // }
  638. // await request({ url: '/audit/audit', data: params })
  639. // ElMessage.success('审核通过成功')
  640. // await getRecharge()
  641. // clicked.value = false
  642. // await getStats()
  643. // } catch (error) {
  644. // console.error('审核通过失败', error)
  645. // ElMessage.error('操作失败')
  646. // }
  647. // }
  648. const showRejectDialog = (row) => {
  649. if(!hasrechargeWaitReject){
  650. ElMessage.error(t('elmessage.noPermission'))
  651. return
  652. }
  653. currentRecord.value = row
  654. rejectReason.value = ''
  655. rejectDialogVisible.value = true
  656. }
  657. //控制驳回确认按钮禁用状态
  658. const cancelClicked = ref(false)
  659. // 处理驳回操作
  660. const handleReject = async () => {
  661. // 在showRejectDialog已经添加过了权限检查,此处应该是可以不用添加的
  662. if(!hasrechargeWaitReject){
  663. ElMessage.error(t('elmessage.noPermission'))
  664. return
  665. }
  666. cancelClicked.value = true
  667. if (!rejectReason.value.trim()) {
  668. ElMessage.warning(t('elmessage.rejectReasonPlaceholder'))
  669. cancelClicked.value = false // 重置按钮状态
  670. return
  671. }
  672. try {
  673. const params = {
  674. orderCode: currentRecord.value.orderCode,
  675. auditId: adminData.value.id,
  676. action: 2,
  677. rejectReason: rejectReason.value
  678. }
  679. await request({ url: '/audit/audit', data: params })
  680. ElMessage.success(t('elmessage.rejectSuccess'))
  681. rejectReasonDialogVisible.value = false
  682. await getRecharge()
  683. cancelClicked.value = false
  684. await getStats()
  685. } catch (error) {
  686. console.error(t('elmessage.rejectFailed'), error)
  687. ElMessage.error(t('elmessage.operationFailed'))
  688. }
  689. }
  690. // 确认驳回后显示理由输入框
  691. const showRejectReasonInput = () => {
  692. rejectDialogVisible.value = false // 关闭确认对话框
  693. rejectReasonDialogVisible.value = true // 打开驳回理由输入框
  694. }
  695. // 处理驳回取消操作
  696. const handleRejectCancel = () => {
  697. rejectDialogVisible.value = false
  698. }
  699. // 处理驳回关闭操作
  700. const handleRejectClose = () => {
  701. rejectDialogVisible.value = false
  702. }
  703. // 处理驳回理由对话框关闭/取消操作
  704. const handleRejectReasonCancel = () => {
  705. rejectReasonDialogVisible.value = false
  706. cancelClicked.value = false // 重置禁用状态
  707. rejectReason.value = '' // 清空驳回理由
  708. }
  709. // 处理排序事件
  710. const handleSortChange = (column) => {
  711. console.log('排序字段:', column.prop)
  712. console.log('排序方式:', column.order)
  713. if (column.prop === 'money') {
  714. sortField.value = 'permanent_gold'
  715. } else if (column.prop === 'permanentGold') {
  716. sortField.value = 'permanent_gold'
  717. } else if (column.prop === 'freeGold') {
  718. sortField.value = 'freeGold'
  719. } else if (column.prop === 'createTime') {
  720. sortField.value = 'create_time'
  721. } else if (column.prop === 'payTime') {
  722. sortField.value = 'pay_time'
  723. } else if (column.prop === 'auditTime') {
  724. sortField.value = 'audit_time'
  725. }
  726. sortOrder.value = column.order === 'ascending' ? 'asc' : 'desc'
  727. getRecharge()
  728. getStats()
  729. }
  730. // 预览图片函数
  731. const previewImage = (imageUrl) => {
  732. // 使用 element-plus 的 el-image 组件实现图片预览功能
  733. const imageElement = document.createElement('img');
  734. imageElement.src = imageUrl;
  735. imageElement.style.maxWidth = '80vw';
  736. imageElement.style.maxHeight = '80vh';
  737. const viewer = document.createElement('div');
  738. viewer.style.position = 'fixed';
  739. viewer.style.top = '0';
  740. viewer.style.left = '0';
  741. viewer.style.width = '100vw';
  742. viewer.style.height = '100vh';
  743. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  744. viewer.style.display = 'flex';
  745. viewer.style.justifyContent = 'center';
  746. viewer.style.alignItems = 'center';
  747. viewer.style.zIndex = '9999';
  748. viewer.style.overflow = 'auto';
  749. viewer.appendChild(imageElement);
  750. document.body.appendChild(viewer);
  751. viewer.addEventListener('click', () => {
  752. document.body.removeChild(viewer);
  753. });
  754. };
  755. const handleMarketChange = (value) => {
  756. if (value && value.length > 0) {
  757. const lastValue = rechargeAudit.value.market = value[value.length - 1]
  758. rechargeAudit.value.market = reverseMarketMapping[lastValue]
  759. } else {
  760. rechargeAudit.value.market = ''
  761. }
  762. }
  763. const props = { multiple: true }
  764. // 获取地区,修改为级联下拉框
  765. const getMarket = async function () {
  766. try {
  767. const result = await API({
  768. url: '/market/selectMarket',
  769. });
  770. console.log('请求成功', result)
  771. // 递归转换树形结构为级联选择器需要的格式(跳过第一级节点)
  772. const transformTree = (nodes) => {
  773. // 直接处理第一级节点的子节点
  774. const allChildren = nodes.flatMap(node => node.children || []);
  775. return allChildren.map(child => {
  776. const grandchildren = child.children && child.children.length
  777. ? transformTree([child]) // 递归处理子节点
  778. : null;
  779. return {
  780. value: child.name,
  781. label: child.name,
  782. children: grandchildren
  783. };
  784. });
  785. };
  786. market.value = transformTree(result.data)
  787. console.log('转换后的地区树==============', market.value)
  788. } catch (error) {
  789. console.log('请求失败', error)
  790. }
  791. }
  792. // 每三位添加逗号
  793. const format3 = (num) => {
  794. return num.toLocaleString('en-US')
  795. }
  796. // 日期选择器变化时清除按钮激活状态
  797. const handleDatePickerChange = () => {
  798. activeTimeRange.value = ''
  799. }
  800. // 精网号去空格
  801. const trimJwCode = () => {
  802. if (rechargeAudit.value.jwcode) {
  803. rechargeAudit.value.jwcode = rechargeAudit.value.jwcode.replace(/\s/g, '');
  804. }
  805. }
  806. const cancelClick = () => {
  807. }
  808. const formatTime = (val) => val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : ''
  809. // 挂载
  810. onMounted(async function () {
  811. await initPermissions()
  812. if(hasrechargeWaitShow.value){
  813. rechargeAudit.value.auditStatus = '0'
  814. }else if(hasrechargeThrough.value){
  815. rechargeAudit.value.auditStatus = '1'
  816. }else if(hasrechargeReject){
  817. rechargeAudit.value.auditStatus = '2'
  818. }
  819. await getActivity()
  820. await getMarket()
  821. await getRecharge()
  822. console.log("看看通信来的用户身份", adminData.value)
  823. await getStats()
  824. })
  825. </script>
  826. <style scoped lang="scss">
  827. .pagination {
  828. display: flex;
  829. margin-top: 1vh;
  830. }
  831. .operation {
  832. display: flex;
  833. }
  834. // 搜索的卡片样式
  835. .card1 {
  836. background: #F3FAFE;
  837. }
  838. // 表单的卡片样式
  839. .card2 {
  840. background: #E7F4FD;
  841. }
  842. // 新币总数等等
  843. .goldStatistics {
  844. margin-left: 1vw;
  845. margin-bottom: 1vh;
  846. color: #000000;
  847. font-family: "PingFang SC";
  848. font-size: 16px;
  849. font-style: normal;
  850. font-weight: 700;
  851. line-height: 20px;
  852. }
  853. // 表头背景等
  854. :deep(.el-table__header-wrapper),
  855. :deep(.el-table__body-wrapper),
  856. :deep(.el-table__cell),
  857. /* 表格 */
  858. :deep(.el-table__body td) {
  859. background-color: #F3FAFE !important;
  860. }
  861. /* 表头 */
  862. :deep(.el-table__header th) {
  863. background-color: #F3FAFE !important;
  864. }
  865. /* 鼠标悬停 */
  866. :deep(.el-table__row:hover > .el-table__cell) {
  867. background-color: #E5EBFE !important;
  868. }
  869. /* 按钮组 */
  870. /* 自定义按钮组布局 */
  871. .custom-button-group {
  872. display: flex;
  873. margin-bottom: 16px;
  874. }
  875. :deep(.el-button.custom-tab-button) {
  876. border-radius: 4px;
  877. transition: all 0.3s ease;
  878. }
  879. /* 自定义激活状态样式 - 使用正确的Element Plus类选择器 */
  880. // 使用了 .el-button--primary 类选择器,这是 Element Plus 按钮组件在设置 type="primary" 时实际添加的类名
  881. :deep(.el-button.custom-tab-button.el-button--primary) {
  882. background-color: #2741DE !important;
  883. border-color: #2741DE !important;
  884. color: #F3FAFE !important;
  885. }
  886. /* 鼠标悬停效果 */
  887. :deep(.el-button.custom-tab-button:hover:not(.is-disabled)) {
  888. opacity: 0.8;
  889. }
  890. .select {
  891. display: flex;
  892. .selectRow {
  893. width: 17vw;
  894. display: flex;
  895. align-items: center;
  896. justify-content: center;
  897. padding: 0 0.5vw;
  898. .text {
  899. width: 5vw;
  900. font-size: 15px;
  901. }
  902. .selectContent {
  903. flex: 1;
  904. }
  905. }
  906. }
  907. </style>