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.

958 lines
30 KiB

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