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.

788 lines
25 KiB

3 weeks ago
2 months ago
2 months ago
3 months ago
2 months ago
4 months ago
3 weeks ago
3 months ago
4 months ago
3 weeks ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
3 weeks ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
3 weeks ago
3 months ago
3 months ago
3 weeks ago
3 months ago
3 months ago
3 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
4 months ago
4 months ago
4 months ago
3 weeks ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
2 months ago
3 months ago
4 months ago
2 weeks ago
4 months ago
4 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="resetSearch" type="success">重置</el-button>
  45. <el-button @click="handleSearch" type="primary">查询</el-button>
  46. </div>
  47. </div>
  48. </el-col>
  49. </el-card>
  50. <el-card class="card2">
  51. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  52. <el-tab-pane label="待审核" name="wait" v-if="hasrechargeWait&&hasrechargeWaitShow"></el-tab-pane>
  53. <el-tab-pane label="已通过" name="pass" v-if="hasrechargeThrough"></el-tab-pane>
  54. <el-tab-pane label="已驳回" name="reject" v-if="hasrechargeReject"></el-tab-pane>
  55. <div class="goldStatistics">
  56. <!-- 总条数{{ format3(stats.totalNum) }}&nbsp;&nbsp;&nbsp;&nbsp;-->
  57. 充值新币{{ format3(stats.permanentGolds) }}新币&nbsp;&nbsp;&nbsp;&nbsp;
  58. 总金币数{{ format3((stats.permanentGolds + stats.freeGolds + stats.taskGolds).toFixed(2))
  59. }}金币&nbsp;&nbsp;&nbsp;&nbsp;
  60. 永久金币{{ format3(stats.permanentGolds.toFixed(2)) }}金币&nbsp;&nbsp;&nbsp;&nbsp;
  61. 免费金币{{ format3(stats.freeGolds.toFixed(2)) }}金币&nbsp;&nbsp;&nbsp;&nbsp;
  62. </div>
  63. </el-tabs>
  64. <el-table :data="tableData" style="width: 82vw;height:54vh" @sort-change="handleSortChange"
  65. :row-style="{ height: '50px' }">
  66. <el-table-column type="index" label="序号" width="100px" fixed="left">
  67. <template #default="scope">
  68. <span>{{ scope.$index + 1 + (getObj.pageNum - 1) * getObj.pageSize }}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column fixed="left" prop="name" label="姓名" width="150px" show-overflow-tooltip />
  72. <el-table-column fixed="left" prop="jwcode" label="精网号" width="110px" />
  73. <el-table-column prop="market" label="所属地区" width="100px" />
  74. <el-table-column prop="activity" label="活动名称" width="100px" show-overflow-tooltip />
  75. <el-table-column prop="rateName" label="货币名称" width="110px" />
  76. <el-table-column prop="money" label="充值金额" sortable="custom" width="110px">
  77. <template #default="scope">{{ scope.row.money / 100 }}</template>
  78. </el-table-column>
  79. <el-table-column prop="permanentGold" label="永久金币" width="110px" sortable="custom">
  80. <template #default="scope">{{ scope.row.permanentGold / 100 }}</template>
  81. </el-table-column>
  82. <el-table-column prop="freeGold" label="免费金币" sortable="custom" width="110px">
  83. <template #default="scope">{{ (scope.row.freeGold) / 100 }}</template>
  84. </el-table-column>
  85. <el-table-column prop="remark" label="备注" width="200px" show-overflow-tooltip />
  86. <el-table-column prop="payModel" label="支付方式" width="110px" />
  87. <el-table-column prop="voucher" label="支付凭证" width="110px">
  88. <template #default="scope">
  89. <div v-if="scope.row.voucher"
  90. style="display: flex; justify-content: center; align-items: center; cursor: pointer;"
  91. @click="previewImage(scope.row.voucher)">
  92. <img :src="scope.row.voucher" alt="支付凭证" style="width: auto; height: 40px;">
  93. </div>
  94. <div v-else style="display: flex; justify-content: center; align-items: center; height: 40px;">--</div>
  95. </template>
  96. </el-table-column>
  97. <el-table-column prop="adminName" label="提交人" width="100px" />
  98. <el-table-column prop="rejectReason" v-if="activeName === 'reject'" label="驳回理由" width="200px"
  99. show-overflow-tooltip />
  100. <el-table-column v-if="activeName !== 'wait'" prop="auditName" label="审核人" width="100px" />
  101. <el-table-column prop="payTime" sortable="custom" label="交款时间" width="200px">
  102. <template #default="scope">
  103. {{ moment(scope.row.payTime).format('YYYY-MM-DD HH:mm:ss') }}
  104. </template>
  105. </el-table-column>
  106. <el-table-column prop="createTime" sortable="custom" label="提交时间" width="200px">
  107. <template #default="scope">
  108. <!-- {{ moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}-->
  109. {{
  110. activeName === 'wait'
  111. ? moment(scope.row.auditTime).format('YYYY-MM-DD HH:mm:ss')
  112. : moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss')
  113. }}
  114. </template>
  115. </el-table-column>
  116. <el-table-column v-if="activeName !== 'wait'" prop="auditTime" label="审核时间" width="200px">
  117. <template #default="scope">
  118. {{ moment(scope.row.auditTime).format('YYYY-MM-DD HH:mm:ss') }}
  119. </template>
  120. </el-table-column>
  121. <el-table-column v-if="activeName === 'wait'&&(hasrechargeWaitThough||hasrechargeWaitReject)&&hasrechargeWaitShow" fixed="right" prop="operation" label="操作" width="150px">
  122. <template #default="scope">
  123. <div class="operation">
  124. <el-popconfirm title="确定要通过此条记录吗?" @confirm="handleApprove(scope.row)">
  125. <template #reference>
  126. <el-button v-if="hasrechargeWaitThough" :disabled="clicked || cancelClicked" type="primary" text>
  127. 通过
  128. </el-button>
  129. </template>
  130. <template #actions="{ confirm, cancel }">
  131. <el-button size="small" @click="cancel">取消</el-button>
  132. <el-button type="primary" size="small" :disabled="clicked" @click="confirm">
  133. 确认
  134. </el-button>
  135. </template>
  136. </el-popconfirm>
  137. <el-button v-if="hasrechargeWaitReject" :disabled="clicked || cancelClicked" type="primary" text @click="showRejectDialog(scope.row)">
  138. 驳回
  139. </el-button>
  140. </div>
  141. </template>
  142. </el-table-column>
  143. </el-table>
  144. <div class="pagination">
  145. <el-pagination :page-size="getObj.pageSize" :page-sizes="[5, 10, 20, 50, 100]"
  146. layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handlePagination('size', $event)"
  147. @current-change="handlePagination('page', $event)"></el-pagination>
  148. </div>
  149. </el-card>
  150. <el-dialog v-model="rejectDialogVisible" title="驳回理由" width="500px">
  151. <el-form>
  152. <el-form-item label="驳回理由" required>
  153. <el-input v-model="rejectReason" type="textarea" :rows="4" placeholder="请输入驳回理由" maxlength="200"
  154. show-word-limit />
  155. </el-form-item>
  156. </el-form>
  157. <template #footer>
  158. <span class="dialog-footer">
  159. <el-button @click="rejectDialogVisible = false">取消</el-button>
  160. <el-button :disabled="cancelClicked" type="primary" @click="handleReject">确定</el-button>
  161. </span>
  162. </template>
  163. </el-dialog>
  164. </template>
  165. <script setup>
  166. import { onMounted, reactive, ref } from 'vue'
  167. import { ElMessage } from 'element-plus'
  168. import request from '@/util/http.js'
  169. import API from '@/util/http.js'
  170. import moment from 'moment'
  171. import { useAdminStore } from "@/store/index.js";
  172. import { storeToRefs } from "pinia";
  173. const adminStore = useAdminStore();
  174. const { adminData, menuTree } = storeToRefs(adminStore);
  175. import { permissionMapping, hasMenuPermission } from "@/utils/menuTreePermission.js"
  176. import dayjs from "dayjs";
  177. //操作权限
  178. const hasrechargeThrough = ref(false) // 充值审核已通过
  179. const hasrechargeReject = ref(false) // 充值审核已驳回
  180. const hasrechargeWait = ref(false) // 充值审核待审核
  181. const hasrechargeWaitShow = ref(false) // 充值审核待审核查看
  182. const hasrechargeWaitThough = ref(false) // 充值审核通过
  183. const hasrechargeWaitReject = ref(false) // 充值审核驳回
  184. // 初始化权限状态
  185. const initPermissions = async() => {
  186. if (!menuTree.value || !menuTree.value.length) return;
  187. hasrechargeThrough.value = hasMenuPermission(menuTree.value, permissionMapping.rechargeThrough);
  188. hasrechargeReject.value = hasMenuPermission(menuTree.value, permissionMapping.rechargeReject);
  189. hasrechargeWait.value = hasMenuPermission(menuTree.value, permissionMapping.rechargeWait);
  190. hasrechargeWaitShow.value = hasMenuPermission(menuTree.value, permissionMapping.rechargeWaitShow);
  191. hasrechargeWaitThough.value = hasMenuPermission(menuTree.value, permissionMapping.rechargeWaitThough);
  192. hasrechargeWaitReject.value = hasMenuPermission(menuTree.value, permissionMapping.rechargeWaitReject);
  193. console.log(hasrechargeWaitThough.value)
  194. console.log(hasrechargeWaitReject.value)
  195. };
  196. const defaultTime = [
  197. new Date(2000, 1, 1, 0, 0, 0),
  198. new Date(2000, 2, 1, 23, 59, 59),
  199. ]
  200. //无法选择的时间
  201. const disabledDate = (time) => {
  202. const limitDate = new Date(2025, 0, 1);
  203. return time.getTime() < limitDate.getTime();
  204. }
  205. const tableData = ref([])
  206. // 当前激活的时间按钮
  207. const activeTimeRange = ref('')
  208. const total = ref(50)
  209. // 搜索对象时间
  210. const getTime = ref([])
  211. const activity = ref([])
  212. const market = ref("")
  213. const rejectDialogVisible = ref(false)
  214. const rejectReason = ref('')
  215. // 当前行信息
  216. const currentRecord = ref(null)
  217. // 标签页默认是待审批
  218. const activeName = ref('wait')
  219. const sortField = ref('')
  220. const sortOrder = ref('')
  221. // 存储地区选择变化
  222. const selectedMarketPath = ref("")
  223. // 搜索表单
  224. const rechargeAudit = ref({
  225. jwcode: "", // 精网号
  226. activity: "", // 活动名称
  227. payModel: "", // 支付方式
  228. startTime: "", // 充值时间开始
  229. endTime: "", // 充值时间结束
  230. market: "", // 地区
  231. auditStatus: '0',
  232. })
  233. // 搜索对象
  234. const getObj = ref({
  235. pageNum: 1,
  236. pageSize: 50
  237. })
  238. // 支付方式选项
  239. const payModel = [
  240. {
  241. value: '银行转账',
  242. label: '银行转账'
  243. },
  244. {
  245. value: '现金',
  246. label: '现金'
  247. },
  248. {
  249. value: '支票',
  250. label: '支票'
  251. },
  252. {
  253. value: '刷卡',
  254. label: '刷卡'
  255. },
  256. {
  257. value: 'Grabpay',
  258. label: 'Grabpay'
  259. },
  260. {
  261. value: 'Nets',
  262. label: 'Nets'
  263. },
  264. {
  265. value: 'PayPal',
  266. label: 'PayPal'
  267. },
  268. {
  269. value: 'Stripe-链接收款',
  270. label: 'Stripe-链接收款'
  271. },
  272. {
  273. value: 'Ipay88-链接收款',
  274. label: 'Ipay88-链接收款'
  275. },
  276. {
  277. value: 'PaymentAsia-链接收款',
  278. label: 'PaymentAsia-链接收款'
  279. },
  280. {
  281. value: '其他',
  282. label: '其他'
  283. }
  284. ]
  285. // 统计合计数
  286. const stats = ref({
  287. totalNum: 0,
  288. totalCoins: 0,
  289. permanentGolds: 0,
  290. freeGolds: 0,
  291. taskGolds: 0
  292. })
  293. // 表单验证
  294. const rules = reactive({
  295. rejectReason: [{ required: true, message: '请输入驳回理由', trigger: 'blur' }]
  296. })
  297. // 搜索方法
  298. const getRecharge = async function (val) {
  299. if (!hasrechargeWaitShow) {
  300. ElMessage.error('暂无权限')
  301. return
  302. }
  303. try {
  304. if (getTime.value && getTime.value.length === 2) {
  305. rechargeAudit.value.startTime = formatTime(getTime.value[0])
  306. rechargeAudit.value.endTime = formatTime(getTime.value[1])
  307. } else {
  308. rechargeAudit.value.startTime = ''
  309. rechargeAudit.value.endTime = ''
  310. }
  311. // if (rechargeAudit.value.market === '总部' || rechargeAudit.value.market === '研发部') {
  312. // rechargeAudit.value.market = '';
  313. // }
  314. // 校验精网号(数字格式)
  315. if (rechargeAudit.value.jwcode) {
  316. // 纯数字
  317. const numberRegex = /^\d{1,9}$/;
  318. // 检查是否不是数字
  319. if (!numberRegex.test(rechargeAudit.value.jwcode)) {
  320. ElMessage.error('请检查精网号格式')
  321. return
  322. }
  323. }
  324. const result = await request({
  325. url: '/audit/selectRecharge',
  326. data: {
  327. pageNum: getObj.value.pageNum,
  328. pageSize: getObj.value.pageSize,
  329. rechargeAudit: {
  330. ...rechargeAudit.value,
  331. sortField: sortField.value,
  332. sortOrder: sortOrder.value
  333. }
  334. }
  335. })
  336. tableData.value = result.list
  337. total.value = result.total
  338. } catch (error) {
  339. console.log('请求失败', error)
  340. }
  341. }
  342. const getStats = async () => {
  343. if (!hasrechargeWaitShow) {
  344. return
  345. }
  346. try {
  347. const params = {
  348. pageNum: getObj.value.pageNum,
  349. pageSize: getObj.value.pageSize,
  350. rechargeAudit: rechargeAudit.value
  351. }
  352. // 校验精网号(数字格式)
  353. if (rechargeAudit.value.jwcode) {
  354. // 纯数字
  355. const numberRegex = /^\d{1,9}$/;
  356. // 检查是否不是数字
  357. if (!numberRegex.test(rechargeAudit.value.jwcode)) {
  358. // ElMessage.error('精网号必须为数字格式')
  359. // 上面提示过了
  360. return
  361. }
  362. }
  363. const res = await API({
  364. url: '/audit/sumRechargeGold',
  365. data: params
  366. })
  367. stats.value.totalNum = res.totalNum
  368. stats.value.permanentGolds = res.permanentGolds / 100
  369. stats.value.freeGolds = res.freeGolds / 100
  370. stats.value.taskGolds = res.taskGolds / 100
  371. console.log('see see stats和搜索对象', stats.value, params)
  372. } catch (error) {
  373. console.log('请求失败', error)
  374. }
  375. }
  376. // 搜索
  377. const handleSearch = function () {
  378. trimJwCode();
  379. getObj.value.pageNum = 1
  380. getRecharge()
  381. getStats()
  382. }
  383. // 重置
  384. const resetSearch = function () {
  385. rechargeAudit.value = {
  386. jwcode: "",
  387. activity: "",
  388. payModel: "",
  389. startTime: "",
  390. endTime: "",
  391. market: "",
  392. auditStatus: rechargeAudit.value.auditStatus
  393. }
  394. selectedMarketPath.value = []
  395. getTime.value = []
  396. activeTimeRange.value = '' // 清除激活状态
  397. getRecharge()
  398. getStats()
  399. }
  400. // 今天
  401. const getToday = function () {
  402. const today = dayjs()
  403. const startTime = today.startOf('day').format('YYYY-MM-DD HH:mm:ss')
  404. const endTime = today.endOf('day').format('YYYY-MM-DD HH:mm:ss')
  405. getTime.value = [startTime, endTime]
  406. console.log('getTime', getTime.value)
  407. activeTimeRange.value = 'today' // 标记当前激活状态
  408. getRecharge()
  409. getStats()
  410. }
  411. // 昨天
  412. const getYesterday = function () {
  413. const today = dayjs()
  414. const startTime = today.subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss')
  415. const endTime = today.subtract(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss')
  416. getTime.value = [startTime, endTime]
  417. console.log('getTime', getTime.value)
  418. activeTimeRange.value = 'yesterday' // 标记当前激活状态
  419. getRecharge()
  420. getStats()
  421. }
  422. // 近7天
  423. const get7Days = function () {
  424. const today = dayjs()
  425. const startTime = today.subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss')
  426. const endTime = today.endOf('day').format('YYYY-MM-DD HH:mm:ss')
  427. getTime.value = [startTime, endTime]
  428. console.log('getTime', getTime.value)
  429. activeTimeRange.value = '7days' // 标记当前激活状态
  430. getRecharge()
  431. getStats()
  432. }
  433. // 待审核充值明细
  434. const adminWait = async function () {
  435. rechargeAudit.value.auditStatus = "0"
  436. getObj.value.pageNum = 1
  437. await getRecharge()
  438. await getStats()
  439. console.log('adminWait,这是点击待审核调用')
  440. }
  441. // 已通过充值明细
  442. const adminPass = async function () {
  443. rechargeAudit.value.auditStatus = "1"
  444. getObj.value.pageNum = 1
  445. await getRecharge()
  446. await getStats()
  447. console.log('adminWait,这是点击已通过调用')
  448. }
  449. // 已驳回充值明细
  450. const adminReject = async function () {
  451. rechargeAudit.value.auditStatus = "2"
  452. getObj.value.pageNum = 1
  453. await getRecharge()
  454. await getStats()
  455. console.log('adminWait,这是点击已驳回调用')
  456. }
  457. const handleClick = function (tab, event) {
  458. activeName.value = tab.props.name
  459. if (tab.props.name === 'wait') {
  460. if(!hasrechargeWait){
  461. ElMessage.error('暂无权限')
  462. return
  463. }
  464. if(hasrechargeWaitShow){
  465. adminWait()
  466. }
  467. } else if (tab.props.name === 'pass') {
  468. if(!hasrechargeThrough){
  469. ElMessage.error('暂无权限')
  470. return
  471. }
  472. adminPass()
  473. } else if (tab.props.name === 'reject') {
  474. if(!hasrechargeReject){
  475. ElMessage.error('暂无权限')
  476. return
  477. }
  478. adminReject()
  479. }
  480. }
  481. const getActivity = async function () {
  482. try {
  483. const result = await request({
  484. url: '/general/activity',
  485. data: {}
  486. })
  487. activity.value = result.data
  488. console.log('activity', activity.value)
  489. } catch (error) {
  490. console.log('请求失败', error)
  491. }
  492. }
  493. const handlePagination = (type, val) => {
  494. if (type === 'size') {
  495. getObj.value.pageSize = val
  496. } else {
  497. getObj.value.pageNum = val
  498. }
  499. getRecharge()
  500. getStats()
  501. }
  502. const clicked = ref(false);
  503. // 处理通过操作
  504. const handleApprove = async (row) => {
  505. if(!hasrechargeWaitThough){
  506. ElMessage.error('暂无权限')
  507. return
  508. }
  509. clicked.value = true
  510. try {
  511. const params = {
  512. orderCode: row.orderCode,
  513. auditId: adminData.value.id,
  514. action: 1,
  515. rejectReason: ''
  516. }
  517. await request({ url: '/audit/audit', data: params })
  518. ElMessage.success('审核通过成功')
  519. await getRecharge()
  520. clicked.value = false
  521. await getStats()
  522. } catch (error) {
  523. console.error('审核通过失败', error)
  524. ElMessage.error('操作失败')
  525. }
  526. }
  527. const showRejectDialog = (row) => {
  528. if(!hasrechargeWaitReject){
  529. ElMessage.error('暂无权限')
  530. return
  531. }
  532. currentRecord.value = row
  533. rejectReason.value = ''
  534. rejectDialogVisible.value = true
  535. }
  536. //控制驳回确认按钮禁用状态
  537. const cancelClicked = ref(false)
  538. // 处理驳回操作
  539. const handleReject = async () => {
  540. if(!hasrechargeWaitReject){
  541. ElMessage.error('暂无权限')
  542. return
  543. }
  544. cancelClicked.value = true
  545. if (!rejectReason.value.trim()) {
  546. ElMessage.warning('请输入驳回理由')
  547. return
  548. }
  549. try {
  550. const params = {
  551. orderCode: currentRecord.value.orderCode,
  552. auditId: adminData.value.id,
  553. action: 2,
  554. rejectReason: rejectReason.value
  555. }
  556. await request({ url: '/audit/audit', data: params })
  557. ElMessage.success('驳回操作成功')
  558. rejectDialogVisible.value = false
  559. await getRecharge()
  560. cancelClicked.value = false
  561. await getStats()
  562. } catch (error) {
  563. console.error('驳回操作失败', error)
  564. ElMessage.error('操作失败')
  565. }
  566. }
  567. // 处理排序事件
  568. const handleSortChange = (column) => {
  569. console.log('排序字段:', column.prop)
  570. console.log('排序方式:', column.order)
  571. if (column.prop === 'money') {
  572. sortField.value = 'permanent_gold'
  573. } else if (column.prop === 'permanentGold') {
  574. sortField.value = 'permanent_gold'
  575. } else if (column.prop === 'freeGold') {
  576. sortField.value = 'freeGold'
  577. } else if (column.prop === 'createTime') {
  578. sortField.value = 'create_time'
  579. } else if (column.prop === 'payTime') {
  580. sortField.value = 'pay_time'
  581. } else if (column.prop === 'auditTime') {
  582. sortField.value = 'audit_time'
  583. }
  584. sortOrder.value = column.order === 'ascending' ? 'asc' : 'desc'
  585. getRecharge()
  586. getStats()
  587. }
  588. // 预览图片函数
  589. const previewImage = (imageUrl) => {
  590. // 使用 element-plus 的 el-image 组件实现图片预览功能
  591. const imageElement = document.createElement('img');
  592. imageElement.src = imageUrl;
  593. imageElement.style.maxWidth = '80vw';
  594. imageElement.style.maxHeight = '80vh';
  595. const viewer = document.createElement('div');
  596. viewer.style.position = 'fixed';
  597. viewer.style.top = '0';
  598. viewer.style.left = '0';
  599. viewer.style.width = '100vw';
  600. viewer.style.height = '100vh';
  601. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  602. viewer.style.display = 'flex';
  603. viewer.style.justifyContent = 'center';
  604. viewer.style.alignItems = 'center';
  605. viewer.style.zIndex = '9999';
  606. viewer.style.overflow = 'auto';
  607. viewer.appendChild(imageElement);
  608. document.body.appendChild(viewer);
  609. viewer.addEventListener('click', () => {
  610. document.body.removeChild(viewer);
  611. });
  612. };
  613. const handleMarketChange = (value) => {
  614. if (value && value.length > 0) {
  615. rechargeAudit.value.market = value[value.length - 1]
  616. } else {
  617. rechargeAudit.value.market = ''
  618. }
  619. }
  620. const props = { multiple: true }
  621. // 获取地区,修改为级联下拉框
  622. const getMarket = async function () {
  623. try {
  624. const result = await API({
  625. url: '/market/selectMarket',
  626. });
  627. console.log('请求成功', result)
  628. // 递归转换树形结构为级联选择器需要的格式(跳过第一级节点)
  629. const transformTree = (nodes) => {
  630. // 直接处理第一级节点的子节点
  631. const allChildren = nodes.flatMap(node => node.children || []);
  632. return allChildren.map(child => {
  633. const grandchildren = child.children && child.children.length
  634. ? transformTree([child]) // 递归处理子节点
  635. : null;
  636. return {
  637. value: child.name,
  638. label: child.name,
  639. children: grandchildren
  640. };
  641. });
  642. };
  643. market.value = transformTree(result.data)
  644. console.log('转换后的地区树==============', market.value)
  645. } catch (error) {
  646. console.log('请求失败', error)
  647. }
  648. }
  649. // 每三位添加逗号
  650. const format3 = (num) => {
  651. return num.toLocaleString('en-US')
  652. }
  653. // 日期选择器变化时清除按钮激活状态
  654. const handleDatePickerChange = () => {
  655. activeTimeRange.value = ''
  656. }
  657. // 精网号去空格
  658. const trimJwCode = () => {
  659. if (rechargeAudit.value.jwcode) {
  660. rechargeAudit.value.jwcode = rechargeAudit.value.jwcode.replace(/\s/g, '');
  661. }
  662. }
  663. const cancelClick = () => {
  664. }
  665. const formatTime = (val) => val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : ''
  666. // 挂载
  667. onMounted(async function () {
  668. await initPermissions()
  669. if(hasrechargeWaitShow.value){
  670. rechargeAudit.value.auditStatus = '0'
  671. }else if(hasrechargeThrough.value){
  672. rechargeAudit.value.auditStatus = '1'
  673. }else if(hasrechargeReject){
  674. rechargeAudit.value.auditStatus = '2'
  675. }
  676. await getActivity()
  677. await getMarket()
  678. await getRecharge()
  679. console.log("看看通信来的用户身份", adminData.value)
  680. await getStats()
  681. })
  682. </script>
  683. <style scoped lang="scss">
  684. .pagination {
  685. display: flex;
  686. margin-top: 0.5vh;
  687. }
  688. .operation {
  689. display: flex;
  690. }
  691. // 搜索的卡片样式
  692. .card1 {
  693. background: #F3FAFE;
  694. }
  695. // 表单的卡片样式
  696. .card2 {
  697. background: #E7F4FD;
  698. }
  699. // 新币总数等等
  700. .goldStatistics {
  701. margin-left: 1vw;
  702. margin-bottom: 1vh;
  703. color: #000000;
  704. font-family: "PingFang SC";
  705. font-size: 16px;
  706. font-style: normal;
  707. font-weight: 700;
  708. line-height: 20px;
  709. }
  710. // 表头背景等
  711. :deep(.el-table__header-wrapper),
  712. :deep(.el-table__body-wrapper),
  713. :deep(.el-table__cell),
  714. /* 表格 */
  715. :deep(.el-table__body td) {
  716. background-color: #F3FAFE !important;
  717. }
  718. /* 表头 */
  719. :deep(.el-table__header th) {
  720. background-color: #F3FAFE !important;
  721. }
  722. /* 鼠标悬停 */
  723. :deep(.el-table__row:hover > .el-table__cell) {
  724. background-color: #E5EBFE !important;
  725. }
  726. .select {
  727. display: flex;
  728. .selectRow {
  729. width: 17vw;
  730. display: flex;
  731. align-items: center;
  732. justify-content: center;
  733. padding: 0 0.5vw;
  734. .text {
  735. width: 5vw;
  736. font-size: 15px;
  737. }
  738. .selectContent {
  739. flex: 1;
  740. }
  741. }
  742. }
  743. </style>