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.

971 lines
31 KiB

9 months ago
5 months ago
8 months ago
9 months ago
5 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
5 months ago
5 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
8 months ago
5 months ago
8 months ago
8 months ago
5 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
5 months ago
5 months ago
9 months ago
5 months ago
9 months ago
9 months ago
9 months ago
9 months ago
5 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
6 months ago
8 months ago
9 months ago
5 months ago
9 months ago
9 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 ref="tableRef" :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="130px">
  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. const tableRef = ref(null)
  252. // 当前激活的时间按钮
  253. const activeTimeRange = ref('')
  254. const total = ref(50)
  255. // 搜索对象时间
  256. const getTime = ref([])
  257. const activity = ref([])
  258. const market = ref("")
  259. const rejectDialogVisible = ref(false)
  260. const rejectReasonDialogVisible = ref(false) // 驳回理由输入框显示状态
  261. const rejectReason = ref('')
  262. const approveDialogVisible = ref(false)
  263. // 当前行信息
  264. const currentRecord = ref(null)
  265. // 标签页默认是待审批
  266. const activeName = ref('wait')
  267. const sortField = ref('')
  268. const sortOrder = ref('')
  269. // 存储地区选择变化
  270. const selectedMarketPath = ref("")
  271. // 搜索表单
  272. const rechargeAudit = ref({
  273. jwcode: "", // 精网号
  274. activity: "", // 活动名称
  275. payModel: "", // 支付方式
  276. startTime: "", // 充值时间开始
  277. endTime: "", // 充值时间结束
  278. market: "", // 地区
  279. auditStatus: '0',
  280. })
  281. // 搜索对象
  282. const getObj = ref({
  283. pageNum: 1,
  284. pageSize: 50
  285. })
  286. // 支付方式选项
  287. const payModel = [
  288. {
  289. value: '银行转账',
  290. label: t('audit.payMethods.bankTransfer')
  291. },
  292. {
  293. value: '现金',
  294. label: t('audit.payMethods.cash')
  295. },
  296. {
  297. value: '支票',
  298. label: t('audit.payMethods.check')
  299. },
  300. {
  301. value: '刷卡',
  302. label: t('audit.payMethods.card')
  303. },
  304. {
  305. value: 'Grabpay',
  306. label: t('audit.payMethods.grabpay')
  307. },
  308. {
  309. value: 'Nets',
  310. label: t('audit.payMethods.nets')
  311. },
  312. {
  313. value: 'PayPal',
  314. label: t('audit.payMethods.paypal')
  315. },
  316. {
  317. value: 'Stripe',
  318. label: t('audit.payMethods.stripe')
  319. },
  320. {
  321. value: 'Ipay88',
  322. label: t('audit.payMethods.ipay88')
  323. },
  324. {
  325. value: 'PaymentAsia',
  326. label: t('audit.payMethods.paymentAsia')
  327. },
  328. {
  329. value: '其他',
  330. label: t('audit.payMethods.other')
  331. }
  332. ]
  333. // 统计合计数
  334. const stats = ref({
  335. totalNum: 0,
  336. totalCoins: 0,
  337. permanentGolds: 0,
  338. freeGolds: 0,
  339. taskGolds: 0
  340. })
  341. // 表单验证
  342. const rules = reactive({
  343. rejectReason: [{ required: true, message: t('audit.rejectReasonPlaceholder'), trigger: 'blur' }]
  344. })
  345. // 搜索方法
  346. const getRecharge = async function (val) {
  347. if (!hasrechargeWaitShow) {
  348. ElMessage.error(t('elmessage.noPermission'))
  349. return
  350. }
  351. try {
  352. if (getTime.value && getTime.value.length === 2) {
  353. rechargeAudit.value.startTime = formatTime(getTime.value[0])
  354. rechargeAudit.value.endTime = formatTime(getTime.value[1])
  355. } else {
  356. rechargeAudit.value.startTime = ''
  357. rechargeAudit.value.endTime = ''
  358. }
  359. // if (rechargeAudit.value.market === '总部' || rechargeAudit.value.market === '研发部') {
  360. // rechargeAudit.value.market = '';
  361. // }
  362. // 校验精网号(数字格式)
  363. if (rechargeAudit.value.jwcode) {
  364. // 纯数字
  365. const numberRegex = /^\d{1,9}$/;
  366. // 检查是否不是数字
  367. if (!numberRegex.test(rechargeAudit.value.jwcode)) {
  368. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  369. return
  370. }
  371. }
  372. const result = await request({
  373. url: '/audit/selectRecharge',
  374. data: {
  375. pageNum: getObj.value.pageNum,
  376. pageSize: getObj.value.pageSize,
  377. rechargeAudit: {
  378. ...rechargeAudit.value,
  379. sortField: sortField.value,
  380. sortOrder: sortOrder.value,
  381. flag: flag.value
  382. }
  383. }
  384. })
  385. tableData.value = result.list
  386. total.value = result.total
  387. } catch (error) {
  388. console.log('请求失败', error)
  389. }
  390. }
  391. const getStats = async () => {
  392. if (!hasrechargeWaitShow) {
  393. return
  394. }
  395. try {
  396. const params = {
  397. pageNum: getObj.value.pageNum,
  398. pageSize: getObj.value.pageSize,
  399. rechargeAudit: {
  400. ...rechargeAudit.value,
  401. flag: flag.value
  402. }
  403. }
  404. // 校验精网号(数字格式)
  405. if (rechargeAudit.value.jwcode) {
  406. // 纯数字
  407. const numberRegex = /^\d{1,9}$/;
  408. // 检查是否不是数字
  409. if (!numberRegex.test(rechargeAudit.value.jwcode)) {
  410. // ElMessage.error('精网号必须为数字格式')
  411. // 上面提示过了
  412. return
  413. }
  414. }
  415. const res = await API({
  416. url: '/audit/sumRechargeGold',
  417. data: params
  418. })
  419. stats.value.totalNum = res.totalNum
  420. stats.value.permanentGolds = res.permanentGolds / 100
  421. stats.value.freeGolds = res.freeGolds / 100
  422. stats.value.taskGolds = res.taskGolds / 100
  423. console.log('see see stats和搜索对象', stats.value, params)
  424. } catch (error) {
  425. console.log('请求失败', error)
  426. }
  427. }
  428. // 搜索
  429. const handleSearch = function () {
  430. trimJwCode();
  431. getObj.value.pageNum = 1
  432. getRecharge()
  433. getStats()
  434. }
  435. // 重置
  436. const resetSearch = function () {
  437. rechargeAudit.value = {
  438. jwcode: "",
  439. activity: "",
  440. payModel: "",
  441. startTime: "",
  442. endTime: "",
  443. market: "",
  444. auditStatus: rechargeAudit.value.auditStatus
  445. }
  446. // 重置页码
  447. getObj.value.pageNum = 1
  448. selectedMarketPath.value = []
  449. getTime.value = []
  450. activeTimeRange.value = '' // 清除激活状态
  451. getRecharge()
  452. getStats()
  453. }
  454. // 今天
  455. const getToday = function () {
  456. const today = dayjs()
  457. const startTime = today.startOf('day').format('YYYY-MM-DD HH:mm:ss')
  458. const endTime = today.endOf('day').format('YYYY-MM-DD HH:mm:ss')
  459. getTime.value = [startTime, endTime]
  460. console.log('getTime', getTime.value)
  461. activeTimeRange.value = 'today' // 标记当前激活状态
  462. getRecharge()
  463. getStats()
  464. }
  465. // 昨天
  466. const getYesterday = function () {
  467. const today = dayjs()
  468. const startTime = today.subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss')
  469. const endTime = today.subtract(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss')
  470. getTime.value = [startTime, endTime]
  471. console.log('getTime', getTime.value)
  472. activeTimeRange.value = 'yesterday' // 标记当前激活状态
  473. getRecharge()
  474. getStats()
  475. }
  476. // 近7天
  477. const get7Days = function () {
  478. const today = dayjs()
  479. const startTime = today.subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss')
  480. const endTime = today.endOf('day').format('YYYY-MM-DD HH:mm:ss')
  481. getTime.value = [startTime, endTime]
  482. console.log('getTime', getTime.value)
  483. activeTimeRange.value = '7days' // 标记当前激活状态
  484. getRecharge()
  485. getStats()
  486. }
  487. // 待审核充值明细
  488. const adminWait = async function () {
  489. rechargeAudit.value.auditStatus = "0"
  490. getObj.value.pageNum = 1
  491. await getRecharge()
  492. await getStats()
  493. console.log('adminWait,这是点击待审核调用')
  494. }
  495. // 已通过充值明细
  496. const adminPass = async function () {
  497. rechargeAudit.value.auditStatus = "1"
  498. getObj.value.pageNum = 1
  499. await getRecharge()
  500. await getStats()
  501. console.log('adminWait,这是点击已通过调用')
  502. }
  503. // 已驳回充值明细
  504. const adminReject = async function () {
  505. rechargeAudit.value.auditStatus = "2"
  506. getObj.value.pageNum = 1
  507. await getRecharge()
  508. await getStats()
  509. console.log('adminWait,这是点击已驳回调用')
  510. }
  511. const handleButtonClick = function (name) {
  512. activeName.value = name
  513. if (name === 'wait') {
  514. if(!hasrechargeWait){
  515. ElMessage.error(t('elmessage.noPermission'))
  516. return
  517. }
  518. if(hasrechargeWaitShow){
  519. adminWait()
  520. }
  521. } else if (name === 'pass') {
  522. if(!hasrechargeThrough){
  523. ElMessage.error(t('elmessage.noPermission'))
  524. return
  525. }
  526. adminPass()
  527. } else if (name === 'reject') {
  528. if(!hasrechargeReject){
  529. ElMessage.error(t('elmessage.noPermission'))
  530. return
  531. }
  532. adminReject()
  533. }
  534. }
  535. // const handleClick = function (tab, event) {
  536. // activeName.value = tab.props.name
  537. // if (tab.props.name === 'wait') {
  538. // if(!hasrechargeWait){
  539. // ElMessage.error('暂无权限')
  540. // return
  541. // }
  542. // if(hasrechargeWaitShow){
  543. // adminWait()
  544. // }
  545. // } else if (tab.props.name === 'pass') {
  546. // if(!hasrechargeThrough){
  547. // ElMessage.error('暂无权限')
  548. // return
  549. // }
  550. // adminPass()
  551. // } else if (tab.props.name === 'reject') {
  552. // if(!hasrechargeReject){
  553. // ElMessage.error('暂无权限')
  554. // return
  555. // }
  556. // adminReject()
  557. // }
  558. // }
  559. const getActivity = async function () {
  560. try {
  561. const result = await request({
  562. url: '/general/activity',
  563. data: {}
  564. })
  565. activity.value = result.data
  566. console.log('activity', activity.value)
  567. } catch (error) {
  568. console.log('请求失败', error)
  569. }
  570. }
  571. const handlePagination = (type, val) => {
  572. if (type === 'size') {
  573. getObj.value.pageSize = val
  574. } else {
  575. getObj.value.pageNum = val
  576. }
  577. tableRef.value.setScrollTop(0)
  578. getRecharge()
  579. getStats()
  580. }
  581. const clicked = ref(false);
  582. // 显示通过确认对话框
  583. const showApproveDialog = (row) => {
  584. if(!hasrechargeWaitThough){
  585. ElMessage.error(t('elmessage.noPermission'))
  586. return
  587. }
  588. currentRecord.value = row
  589. approveDialogVisible.value = true
  590. }
  591. // 使用handleApproveConfirm函数代替handleApprove
  592. const handleApproveConfirm = async () => {
  593. clicked.value = true
  594. try {
  595. const params = {
  596. orderCode: currentRecord.value.orderCode,
  597. auditId: adminData.value.id,
  598. action: 1,
  599. rejectReason: ''
  600. }
  601. await request({ url: '/audit/audit', data: params })
  602. ElMessage.success(t('elmessage.approveSuccess'))
  603. approveDialogVisible.value = false
  604. await getRecharge()
  605. clicked.value = false
  606. await getStats()
  607. } catch (error) {
  608. console.error(t('elmessage.approveFailed'), error)
  609. ElMessage.error(t('elmessage.operationFailed'))
  610. clicked.value = false
  611. }
  612. }
  613. import _ from 'lodash';
  614. // handleApproveConfirm
  615. const throttledHandleApproveConfirm = _.throttle(handleApproveConfirm, 5000, {
  616. trailing: false
  617. })
  618. // 处理通过取消操作
  619. const handleApproveCancel = () => {
  620. approveDialogVisible.value = false
  621. }
  622. // 处理通过关闭操作
  623. const handleApproveClose = () => {
  624. approveDialogVisible.value = false
  625. }
  626. // 处理通过操作
  627. // const handleApprove = async (row) => {
  628. // if(!hasrechargeWaitThough){
  629. // ElMessage.error('暂无权限')
  630. // return
  631. // }
  632. // clicked.value = true
  633. // try {
  634. // const params = {
  635. // orderCode: row.orderCode,
  636. // auditId: adminData.value.id,
  637. // action: 1,
  638. // rejectReason: ''
  639. // }
  640. // await request({ url: '/audit/audit', data: params })
  641. // ElMessage.success('审核通过成功')
  642. // await getRecharge()
  643. // clicked.value = false
  644. // await getStats()
  645. // } catch (error) {
  646. // console.error('审核通过失败', error)
  647. // ElMessage.error('操作失败')
  648. // }
  649. // }
  650. const showRejectDialog = (row) => {
  651. if(!hasrechargeWaitReject){
  652. ElMessage.error(t('elmessage.noPermission'))
  653. return
  654. }
  655. currentRecord.value = row
  656. rejectReason.value = ''
  657. rejectDialogVisible.value = true
  658. }
  659. //控制驳回确认按钮禁用状态
  660. const cancelClicked = ref(false)
  661. // 处理驳回操作
  662. const handleReject = async () => {
  663. // 在showRejectDialog已经添加过了权限检查,此处应该是可以不用添加的
  664. if(!hasrechargeWaitReject){
  665. ElMessage.error(t('elmessage.noPermission'))
  666. return
  667. }
  668. cancelClicked.value = true
  669. if (!rejectReason.value.trim()) {
  670. ElMessage.warning(t('elmessage.rejectReasonPlaceholder'))
  671. cancelClicked.value = false // 重置按钮状态
  672. return
  673. }
  674. try {
  675. const params = {
  676. orderCode: currentRecord.value.orderCode,
  677. auditId: adminData.value.id,
  678. action: 2,
  679. rejectReason: rejectReason.value
  680. }
  681. await request({ url: '/audit/audit', data: params })
  682. ElMessage.success(t('elmessage.rejectSuccess'))
  683. rejectReasonDialogVisible.value = false
  684. await getRecharge()
  685. cancelClicked.value = false
  686. await getStats()
  687. } catch (error) {
  688. console.error(t('elmessage.rejectFailed'), error)
  689. ElMessage.error(t('elmessage.operationFailed'))
  690. }
  691. }
  692. // 确认驳回后显示理由输入框
  693. const showRejectReasonInput = () => {
  694. rejectDialogVisible.value = false // 关闭确认对话框
  695. rejectReasonDialogVisible.value = true // 打开驳回理由输入框
  696. }
  697. // 处理驳回取消操作
  698. const handleRejectCancel = () => {
  699. rejectDialogVisible.value = false
  700. }
  701. // 处理驳回关闭操作
  702. const handleRejectClose = () => {
  703. rejectDialogVisible.value = false
  704. }
  705. // 处理驳回理由对话框关闭/取消操作
  706. const handleRejectReasonCancel = () => {
  707. rejectReasonDialogVisible.value = false
  708. cancelClicked.value = false // 重置禁用状态
  709. rejectReason.value = '' // 清空驳回理由
  710. }
  711. // 处理排序事件
  712. const handleSortChange = (column) => {
  713. console.log('排序字段:', column.prop)
  714. console.log('排序方式:', column.order)
  715. if (column.prop === 'money') {
  716. sortField.value = 'permanent_gold'
  717. } else if (column.prop === 'permanentGold') {
  718. sortField.value = 'permanent_gold'
  719. } else if (column.prop === 'freeGold') {
  720. sortField.value = 'freeGold'
  721. } else if (column.prop === 'createTime') {
  722. sortField.value = 'create_time'
  723. } else if (column.prop === 'payTime') {
  724. sortField.value = 'pay_time'
  725. } else if (column.prop === 'auditTime') {
  726. sortField.value = 'audit_time'
  727. }
  728. sortOrder.value = column.order === 'ascending' ? 'asc' : 'desc'
  729. getRecharge()
  730. getStats()
  731. }
  732. // 预览图片函数
  733. const previewImage = (imageUrl) => {
  734. // 使用 element-plus 的 el-image 组件实现图片预览功能
  735. const imageElement = document.createElement('img');
  736. imageElement.src = imageUrl;
  737. imageElement.style.maxWidth = '80vw';
  738. imageElement.style.maxHeight = '80vh';
  739. const viewer = document.createElement('div');
  740. viewer.style.position = 'fixed';
  741. viewer.style.top = '0';
  742. viewer.style.left = '0';
  743. viewer.style.width = '100vw';
  744. viewer.style.height = '100vh';
  745. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  746. viewer.style.display = 'flex';
  747. viewer.style.justifyContent = 'center';
  748. viewer.style.alignItems = 'center';
  749. viewer.style.zIndex = '9999';
  750. viewer.style.overflow = 'auto';
  751. viewer.appendChild(imageElement);
  752. document.body.appendChild(viewer);
  753. viewer.addEventListener('click', () => {
  754. document.body.removeChild(viewer);
  755. });
  756. };
  757. const handleMarketChange = (value) => {
  758. if (value && value.length > 0) {
  759. const lastValue = rechargeAudit.value.market = value[value.length - 1]
  760. rechargeAudit.value.market = reverseMarketMapping[lastValue]
  761. } else {
  762. rechargeAudit.value.market = ''
  763. }
  764. }
  765. const props = { multiple: true }
  766. // 获取地区,修改为级联下拉框
  767. const getMarket = async function () {
  768. try {
  769. const result = await API({
  770. url: '/market/selectMarket',
  771. });
  772. console.log('请求成功', result)
  773. // 递归转换树形结构为级联选择器需要的格式(跳过第一级节点)
  774. const transformTree = (nodes) => {
  775. // 直接处理第一级节点的子节点
  776. const allChildren = nodes.flatMap(node => node.children || []);
  777. return allChildren.map(child => {
  778. const grandchildren = child.children && child.children.length
  779. ? transformTree([child]) // 递归处理子节点
  780. : null;
  781. return {
  782. value: child.name,
  783. label: child.name,
  784. children: grandchildren
  785. };
  786. });
  787. };
  788. market.value = transformTree(result.data)
  789. console.log('转换后的地区树==============', market.value)
  790. } catch (error) {
  791. console.log('请求失败', error)
  792. }
  793. }
  794. // 每三位添加逗号
  795. const format3 = (num) => {
  796. return num.toLocaleString('en-US')
  797. }
  798. // 日期选择器变化时清除按钮激活状态
  799. const handleDatePickerChange = () => {
  800. activeTimeRange.value = ''
  801. }
  802. // 精网号去空格
  803. const trimJwCode = () => {
  804. if (rechargeAudit.value.jwcode) {
  805. rechargeAudit.value.jwcode = rechargeAudit.value.jwcode.replace(/\s/g, '');
  806. }
  807. }
  808. const cancelClick = () => {
  809. }
  810. const formatTime = (val) => val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : ''
  811. // 挂载
  812. onMounted(async function () {
  813. await initPermissions()
  814. if(hasrechargeWaitShow.value){
  815. rechargeAudit.value.auditStatus = '0'
  816. }else if(hasrechargeThrough.value){
  817. rechargeAudit.value.auditStatus = '1'
  818. }else if(hasrechargeReject){
  819. rechargeAudit.value.auditStatus = '2'
  820. }
  821. await getActivity()
  822. await getMarket()
  823. await getRecharge()
  824. console.log("看看通信来的用户身份", adminData.value)
  825. await getStats()
  826. })
  827. </script>
  828. <style scoped lang="scss">
  829. .pagination {
  830. display: flex;
  831. margin-top: 1vh;
  832. }
  833. .operation {
  834. display: flex;
  835. }
  836. // 搜索的卡片样式
  837. .card1 {
  838. background: #F3FAFE;
  839. }
  840. // 表单的卡片样式
  841. .card2 {
  842. background: #E7F4FD;
  843. }
  844. // 新币总数等等
  845. .goldStatistics {
  846. margin-left: 1vw;
  847. margin-bottom: 1vh;
  848. color: #000000;
  849. font-family: "PingFang SC";
  850. font-size: 16px;
  851. font-style: normal;
  852. font-weight: 700;
  853. line-height: 20px;
  854. }
  855. // 表头背景等
  856. :deep(.el-table__header-wrapper),
  857. :deep(.el-table__body-wrapper),
  858. :deep(.el-table__cell),
  859. /* 表格 */
  860. :deep(.el-table__body td) {
  861. background-color: #F3FAFE !important;
  862. }
  863. /* 表头 */
  864. :deep(.el-table__header th) {
  865. background-color: #F3FAFE !important;
  866. }
  867. /* 鼠标悬停 */
  868. :deep(.el-table__row:hover > .el-table__cell) {
  869. background-color: #E5EBFE !important;
  870. }
  871. /* 按钮组 */
  872. /* 自定义按钮组布局 */
  873. .custom-button-group {
  874. display: flex;
  875. margin-bottom: 16px;
  876. }
  877. :deep(.el-button.custom-tab-button) {
  878. border-radius: 4px;
  879. transition: all 0.3s ease;
  880. }
  881. /* 自定义激活状态样式 - 使用正确的Element Plus类选择器 */
  882. // 使用了 .el-button--primary 类选择器,这是 Element Plus 按钮组件在设置 type="primary" 时实际添加的类名
  883. :deep(.el-button.custom-tab-button.el-button--primary) {
  884. background-color: #2741DE !important;
  885. border-color: #2741DE !important;
  886. color: #F3FAFE !important;
  887. }
  888. /* 鼠标悬停效果 */
  889. :deep(.el-button.custom-tab-button:hover:not(.is-disabled)) {
  890. opacity: 0.8;
  891. }
  892. .select {
  893. display: flex;
  894. .selectRow {
  895. width: 17vw;
  896. display: flex;
  897. align-items: center;
  898. justify-content: center;
  899. padding: 0 0.5vw;
  900. .text {
  901. width: 5vw;
  902. font-size: 15px;
  903. }
  904. .selectContent {
  905. flex: 1;
  906. }
  907. }
  908. }
  909. </style>