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.

925 lines
28 KiB

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