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.

948 lines
29 KiB

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