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.

771 lines
23 KiB

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