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.

636 lines
21 KiB

1 week ago
1 week ago
2 weeks ago
2 weeks ago
2 months ago
1 week ago
2 months ago
2 months ago
2 months ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month 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. <template>
  2. <el-card style="margin-bottom: 0.5vh;background-color: rgb(243,250,254);">
  3. <div class="condition1">
  4. <div class="search">
  5. <el-text size="large" style="width:4vw;">姓名</el-text>
  6. <el-input v-model="searchForm.name" placeholder="请输入姓名" style="width:9vw;" clearable />
  7. </div>
  8. <div class="search">
  9. <el-text size="large" style="width:4vw;">精网号</el-text>
  10. <el-input v-model="searchForm.jwcode" placeholder="请输入精网号" style="width:9vw;" clearable />
  11. </div>
  12. <div class="search">
  13. <el-text size="large" style="width:4vw;">产品名称</el-text>
  14. <el-cascader v-model="searchForm.goodsName" :options="productList" style="width: 10vw;" clearable />
  15. </div>
  16. <div class="search">
  17. <el-text size="large" style="width:4vw;">所属地区</el-text>
  18. <el-cascader style="width: 9vw;" v-model="searchForm.markets" :options="market" placeholder="请选择所属地区"
  19. clearable />
  20. </div>
  21. <div class="search">
  22. <el-text size="large" style="width:4vw;">退款币种</el-text>
  23. <el-select v-model="searchForm.refundCurrency" style="width:9vw;" clearable>
  24. <el-option v-for="item in currencies" :key="item.value" :label="item.label" :value="item.value" />
  25. </el-select>
  26. </div>
  27. </div>
  28. <div class="condition1">
  29. <div class="search2">
  30. <el-text size="large" style="width:4vw;">退款途径</el-text>
  31. <el-select v-model="searchForm.refundChannels" style="width:9vw;" clearable>
  32. <el-option v-for="item in channelOptions" :key="item.value" :label="item.label" :value="item.value" />
  33. </el-select>
  34. </div>
  35. <div class="search2">
  36. <el-text size="large" style="width:4vw;">订单状态</el-text>
  37. <el-select v-model="searchForm.statuses" style="width:9vw;" clearable>
  38. <el-option v-for="item in statusList" :label="item" :value="item" :key="item" />
  39. </el-select>
  40. </div>
  41. <div class="search2" style="width: 25.5vw;">
  42. <el-text size="large" style="width:4vw;">退款时间</el-text>
  43. <el-date-picker v-model="dateRange" type="datetimerange" range-separator="" start-placeholder="起始时间"
  44. end-placeholder="结束时间" style="width:18vw;" clearable
  45. :disabled-date="disabledDate" :default-time="defaultTime" />
  46. </div>
  47. <div>
  48. <el-button type="primary" size="medium" @click="getRefund">查询</el-button>
  49. <el-button type="success" size="medium" @click="reset">重置</el-button>
  50. </div>
  51. </div>
  52. </el-card>
  53. <el-card style="background-color: rgb(231,244,253);height:80vh;">
  54. <el-table :data="tableData" style="height:70vh;width:82vw;">
  55. <el-table-column type="index" label="序号" width="60" fixed="left">
  56. <template #default="scope">
  57. {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }}
  58. </template>
  59. </el-table-column>
  60. <el-table-column prop="jwcode" label="Homily ID" width="120" fixed="left" />
  61. <el-table-column prop="name" label="姓名" width="120" fixed="left" show-overflow-tooltip />
  62. <el-table-column prop="marketName" label="所属地区" width="120" />
  63. <el-table-column prop="goodsName" label="产品名称" width="120" />
  64. <el-table-column prop="goodsNum" label="产品数量" width="120" />
  65. <el-table-column prop="refundModel" label="退款方式" width="120">
  66. <template #default="scope">
  67. {{ scope.row.refundModel === 1 ? '部分退款' : '全部退款' }}
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="refundCurrency" label="退款币种" width="120">
  71. <template #default="scope">
  72. <div v-if="!scope.row.refundCurrency">
  73. <text style="color: #FA5A1E;">待补充</text>
  74. </div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column prop="refundAmount" label="退款金额" width="120">
  78. <template #default="scope">
  79. <div v-if="!scope.row.refundAmount">
  80. <text style="color: #FA5A1E;">待补充</text>
  81. </div>
  82. </template>
  83. </el-table-column>
  84. <el-table-column prop="refundChannels" label="退款途径" width="120">
  85. <template #default="scope">
  86. <div v-if="!scope.row.refundChannels">
  87. <text style="color: #FA5A1E;">待补充</text>
  88. </div>
  89. </template>
  90. </el-table-column>
  91. <el-table-column prop="refundVoucher" label="退款截图" width="120">
  92. <template #default="scope">
  93. <el-image v-if="scope.row.refundVoucher" :src="scope.row.refundVoucher"
  94. @click="previewImage(scope.row.refundVoucher)"
  95. style="width: 40px; height: 40px; cursor: pointer;z-index: 99999;" fit="cover" />
  96. <span v-else style="color: #FA5A1E;">待补充</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column prop="refundTime" label="退款时间" width="180">
  100. <template #default="scope">
  101. <div v-if="!scope.row.refundTime">
  102. <text style="color: #FA5A1E;">待补充</text>
  103. </div>
  104. </template>
  105. </el-table-column>
  106. <el-table-column prop="status" label="订单状态" width="120">
  107. <template #default="scope">
  108. {{ scope.row.status === 41 ? '退款成功' : '待处理' }}
  109. </template>
  110. </el-table-column>
  111. <el-table-column prop="operation" label="操作" fixed="right" width="100px">
  112. <template #default="scope">
  113. <div class="operation">
  114. <el-button v-if="scope.row.status === 40" type="primary" text @click="showEditDialog(scope.row)">
  115. 提交
  116. </el-button>
  117. <el-button v-else type="primary" text @click="showEditDialog(scope.row)">
  118. 编辑
  119. </el-button>
  120. </div>
  121. </template>
  122. </el-table-column>
  123. </el-table>
  124. <el-pagination v-model:current-page="pagination.pageNum" v-model:page-size="pagination.pageSize"
  125. layout="total, sizes, prev, pager, next, jumper" :total="pagination.total" style="margin-top: 1vh;" />
  126. </el-card>
  127. <el-dialog v-model="showEdit" class="edit" overflow draggable style="width: 40vw; background-color: #F3FAFE !important;">
  128. <div style="display: flex;">
  129. <div class="left">
  130. <div class="dialog-item">
  131. <el-text style="width:4vw;">精网号</el-text>
  132. <el-input v-model="editRow.jwcode" style="width:10vw;" disabled />
  133. </div>
  134. <div class="dialog-item">
  135. <el-text style="width:4vw;">客户姓名</el-text>
  136. <el-input v-model="editRow.name" style="width:10vw;" disabled />
  137. </div>
  138. <div class="dialog-item">
  139. <el-text style="width:4vw;">所属地区</el-text>
  140. <el-input v-model="editRow.marketName" style="width:10vw;" disabled />
  141. </div>
  142. <div class="dialog-item">
  143. <el-text style="width:4vw;">产品名称</el-text>
  144. <el-input v-model="editRow.goodsName" style="width:10vw;" disabled />
  145. </div>
  146. <div class="dialog-item">
  147. <el-text style="width:4vw;">退款类型</el-text>
  148. <el-select v-model="editRow.refundModel" style="width:10vw;" disabled>
  149. <el-option label="全部退款" :value="0"></el-option>
  150. <el-option label="部分退款" :value="1"></el-option>
  151. </el-select>
  152. </div>
  153. <div class="dialog-item">
  154. <el-text style="width:4vw;">付款币种</el-text>
  155. <el-input v-model="editRow.paymentCurrency" style="width:10vw;" disabled />
  156. </div>
  157. <div class="dialog-item">
  158. <el-text style="width:4vw;">付款金额</el-text>
  159. <el-input v-model="editRow.paymentAmount" style="width:10vw;" disabled />
  160. </div>
  161. <div class="dialog-item">
  162. <el-text style="width:4vw;">支付方式</el-text>
  163. <el-input v-model="editRow.payType" style="width:10vw;" disabled />
  164. </div>
  165. <div class="dialog-item">
  166. <el-text style="width:4vw;">付款时间</el-text>
  167. <el-date-picker v-model="editRow.payTime" type="datetime" style="width:10vw;" disabled />
  168. </div>
  169. <div class="dialog-item">
  170. <el-text style="width:4vw;">提交人</el-text>
  171. <el-input v-model="editRow.submitter" style="width:10vw;" disabled />
  172. </div>
  173. <div class="dialog-item">
  174. <el-text style="width:4vw;">转账凭证</el-text>
  175. <img v-if="editRow.voucher" :src="editRow.voucher" style="width: 80px; height: 80px; object-fit: cover;">
  176. <div v-else>
  177. 无转账凭证
  178. </div>
  179. </div>
  180. <div class="dialog-item">
  181. <el-text style="width:4vw;">备注</el-text>
  182. <el-input v-model="editRow.remark" style="width:10vw;" :row="3" disabled maxlength="100" type="textarea"
  183. show-word-limit clearable />
  184. </div>
  185. </div>
  186. <div class="right">
  187. <div class="dialog-item">
  188. <el-text style="width:4vw;">退款币种</el-text>
  189. <el-select v-model="editForm.refundCurrency" placeholder="请选择退款币种" style="width:10vw;">
  190. <el-option v-for="item in currencies" :key="item.value" :label="item.label" :value="item.value" />
  191. </el-select>
  192. </div>
  193. <div class="dialog-item">
  194. <el-text style="width:4vw;">退款金额</el-text>
  195. <el-input v-model="editForm.refundAmount" placeholder="请输入退款金额" style="width:10vw;" clearable />
  196. </div>
  197. <div class="dialog-item">
  198. <el-text style="width:4vw;">退款途径</el-text>
  199. <el-select v-model="editForm.refundChannels" placeholder="请选择退款途径" style="width:10vw;">
  200. <el-option v-for="item in channelOptions" :key="item.value" :label="item.label" :value="item.value" />
  201. </el-select>
  202. </div>
  203. <div class="dialog-item">
  204. <el-text style="width:4vw;">退款时间</el-text>
  205. <el-date-picker v-model="editForm.refundTime" type="datetime" placeholder="请选择退款时间" style="width:10vw;"
  206. clearable />
  207. </div>
  208. <div class="dialog-item">
  209. <el-text style="width:4vw;">支付凭证</el-text>
  210. <el-upload ref="uploadRef" :http-request="customUpload" list-type="picture-card" :auto-upload="false"
  211. :on-change="handleImageChange" :before-upload="beforeUpload" :show-file-list="false">
  212. <template #default>
  213. <img v-if="editForm.imageUrl" :src="editForm.imageUrl"
  214. style="width: 80px; height: 80px; object-fit: cover;">
  215. <el-icon v-else>
  216. <Plus />
  217. </el-icon>
  218. </template>
  219. </el-upload>
  220. </div>
  221. <div class="dialog-item">
  222. <el-text style="width:4vw;">备注</el-text>
  223. <el-input v-model="editForm.refundRemark" placeholder="请输入备注" style="width:10vw;" :rows="3" maxlength="100"
  224. show-word-limit type="textarea" clearable />
  225. </div>
  226. <div style="display:flex;justify-content: center;margin-top: 5vh;">
  227. <el-button type="default" @click="hideEditDialog" style="margin-right: 2vw;">取消</el-button>
  228. <el-button type="primary" @click="submitRefund">提交</el-button>
  229. </div>
  230. </div>
  231. </div>
  232. </el-dialog>
  233. </template>
  234. <script setup>
  235. import { ref, onMounted } from 'vue'
  236. import { ElMessage } from 'element-plus'
  237. import API from '@/util/http.js'
  238. import dayjs from 'dayjs'
  239. import { useAdminStore } from "@/store/index.js"
  240. import { storeToRefs } from "pinia"
  241. import { Delete, Download, Plus, ZoomIn } from '@element-plus/icons-vue'
  242. import { productList } from '@/views/moneyManage/receiveDetail/utils/staticData.js'
  243. const adminStore = useAdminStore()
  244. const { adminData, menuTree } = storeToRefs(adminStore)
  245. import { permissionMapping, findMenuById } from "@/utils/menuTreePermission.js"
  246. import moment from 'moment'
  247. const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'
  248. const dateRange = ref([])
  249. const tableData = ref([])
  250. const editRow = ref({})// 编辑回显
  251. const statusList = ref(['待处理', '退款成功'])
  252. const pagination = ref({
  253. pageNum: 1,
  254. pageSize: 50,
  255. total: 0
  256. })
  257. const market = ref([])
  258. const uploadRef = ref(null)
  259. const searchForm = ref({
  260. jwcode: '',
  261. markets: []
  262. })
  263. const showEdit = ref(false)
  264. const editForm = ref({
  265. jwcode: ''
  266. })
  267. // 查全部
  268. const getRefund = async function () {
  269. try {
  270. const statusesParam = [40, 41] // 默认:看不到进度没到这里的
  271. if (searchForm.value.statuses === '待处理') {
  272. statusesParam.value = [40]
  273. } else if (searchForm.value.statuses === '退款成功') {
  274. statusesParam.value = [41]
  275. } else {
  276. statusesParam.value = [40, 41]
  277. }
  278. const params = {
  279. pageNum: pagination.value.pageNum,
  280. pageSize: pagination.value.pageSize,
  281. cashRecordDTO: {
  282. jwcode: searchForm.value.jwcode,
  283. name: searchForm.value.name,
  284. markets: searchForm.value.markets,
  285. goodsNames: searchForm.value.goodsName,
  286. statuses: statusesParam.value,//10:地区财务待审核;12:地区财务驳回;
  287. // 20:地区负责人待审核;22:地区负责人驳回;
  288. // 30:总部财务待审核;32:总部财务驳回;
  289. // 40:执行人待处理;41:执行人已处理,退款完成;
  290. paymentCurrency: searchForm.value.paymentCurrency,
  291. refundCurrency: searchForm.value.refundCurrency,
  292. sTime: dateRange.value && dateRange.value[0] ? dayjs(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : "",
  293. eTime: dateRange.value && dateRange.value[1] ? dayjs(dateRange.value[1]).format('YYYY-MM-DD HH:mm:ss') : "",
  294. adminId: adminData.value.id,
  295. account: adminData.value.account,
  296. refundChannels: searchForm.value.refundChannels
  297. }
  298. }
  299. const result = await API({
  300. url: '/Money/exSelect',
  301. method: 'POST',
  302. data: params
  303. })
  304. tableData.value = result.data.list || []
  305. pagination.value.total = result.data.total || 0
  306. } catch (error) {
  307. ElMessage.error(error.message || '查询失败')
  308. }
  309. }
  310. // 提交
  311. const submitRefund = async function () {
  312. try {
  313. const numberReg = /^[0-9]+(\.[0-9]+)?$/
  314. if (!numberReg.test(editForm.value.refundAmount)) {
  315. ElMessage.error('请输入数字或小数')
  316. return
  317. }
  318. const params = {
  319. refundVoucher: editForm.value.imageUrl,
  320. refundTime: editForm.value.refundTime ? dayjs(editForm.value.refundTime).format('YYYY-MM-DD HH:mm:ss') : "",
  321. refundRemark: editForm.value.refundRemark,
  322. id: editRow.value.id,
  323. refundCurrency: editForm.value.refundCurrency,
  324. refundAmount: editForm.value.refundAmount,
  325. refundChannels: editForm.value.refundChannels,
  326. status: 41,
  327. auditId: editRow.value.auditId,
  328. executor: adminData.value.account
  329. }
  330. const result = await API({
  331. url: '/Money/executor',
  332. data: params
  333. })
  334. if (result.code === 200) {
  335. ElMessage.success('提交成功')
  336. hideEditDialog()
  337. getRefund()
  338. } else {
  339. ElMessage.error(result.data.msg || '提交失败')
  340. }
  341. } catch (error) {
  342. ElMessage.error(error.message || '提交失败')
  343. }
  344. }
  345. const getMarket = async function () {
  346. try {
  347. const result = await API({
  348. url: '/market/selectMarket',
  349. })
  350. console.log('看看地区树', result)
  351. const transformTree = (nodes) => {
  352. const allChildren = nodes.flatMap(node => node.children || []);
  353. return allChildren.map(child => {
  354. const grandchildren = child.children && child.children.length
  355. ? transformTree([child])
  356. : null;
  357. return {
  358. value: child.id,
  359. label: child.name,
  360. children: grandchildren
  361. };
  362. });
  363. };
  364. market.value = transformTree(result.data)
  365. console.log('转换后的地区树==============', market.value)
  366. } catch (error) {
  367. console.log('请求失败', error)
  368. }
  369. }
  370. const showEditDialog = (row) => {
  371. editRow.value = row
  372. showEdit.value = true
  373. }
  374. const hideEditDialog = () => {
  375. showEdit.value = false
  376. editForm.value = {
  377. jwcode: ''
  378. }
  379. }
  380. const channelOptions = ref([{
  381. value: '银行转账',
  382. label: '银行转账'
  383. },
  384. {
  385. value: '刷卡',
  386. label: '刷卡'
  387. },
  388. {
  389. value: '现金',
  390. label: '现金'
  391. },
  392. {
  393. value: '支票',
  394. label: '支票'
  395. },
  396. {
  397. value: 'Grabpay',
  398. label: 'Grabpay'
  399. },
  400. {
  401. value: 'Nets',
  402. label: 'Nets'
  403. },
  404. {
  405. value: 'E-Transfer',
  406. label: 'E-Transfer'
  407. },
  408. {
  409. value: 'PayPal',
  410. label: 'PayPal'
  411. },
  412. {
  413. value: 'Stripe-链接收款',
  414. label: 'Stripe-链接收款'
  415. },
  416. {
  417. value: 'PaymentAsia-链接收款',
  418. label: 'PaymentAsia-链接收款'
  419. },
  420. {
  421. value: 'Ipay88-链接收款',
  422. label: 'Ipay88-链接收款'
  423. }
  424. ])
  425. const currencies = ref([
  426. {
  427. value: '新币',
  428. label: '新币'
  429. },
  430. {
  431. value: '港币',
  432. label: '港币'
  433. },
  434. {
  435. value: '马币',
  436. label: '马币'
  437. },
  438. {
  439. value: '加币',
  440. label: '加币'
  441. },
  442. {
  443. value: '泰铢',
  444. label: '泰铢'
  445. },
  446. {
  447. value: '越南盾',
  448. label: '越南盾'
  449. }
  450. ])
  451. // 预览图片函数
  452. const previewImage = (imageUrl) => {
  453. // 使用 element-plus 的 el-image 组件实现图片预览功能
  454. const imageElement = document.createElement('img');
  455. imageElement.src = imageUrl;
  456. imageElement.style.maxWidth = '80vw';
  457. imageElement.style.maxHeight = '80vh';
  458. const viewer = document.createElement('div');
  459. viewer.style.position = 'fixed';
  460. viewer.style.top = '0';
  461. viewer.style.left = '0';
  462. viewer.style.width = '100vw';
  463. viewer.style.height = '100vh';
  464. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  465. viewer.style.display = 'flex';
  466. viewer.style.justifyContent = 'center';
  467. viewer.style.alignItems = 'center';
  468. viewer.style.zIndex = '9999';
  469. viewer.style.overflow = 'auto';
  470. viewer.appendChild(imageElement);
  471. document.body.appendChild(viewer);
  472. viewer.addEventListener('click', () => {
  473. document.body.removeChild(viewer);
  474. });
  475. };
  476. const handleImageChange = (file) => {
  477. uploadRef.value.submit()
  478. }
  479. const beforeUpload = (file) => {
  480. const isJPG = file.type === 'image/jpeg'
  481. const isPNG = file.type === 'image/png'
  482. const isLt1 = file.size / 1024 < 2048
  483. if (!isJPG && !isPNG) {
  484. ElMessage.error('上传图片只能是 JPG 或 PNG 格式')
  485. return false
  486. }
  487. if (!isLt1) {
  488. ElMessage.error('上传图片大小不能超过2MB')
  489. return false
  490. }
  491. return true
  492. }
  493. const customUpload = async (options) => {
  494. try {
  495. const formData = new FormData()
  496. formData.append('file', options.file)
  497. const response = await API({
  498. url: uploadUrl,
  499. method: 'POST',
  500. data: formData,
  501. headers: {
  502. 'Content-Type': 'multipart/form-data'
  503. }
  504. })
  505. if (response.code === 200 && response.data) {
  506. editForm.value.imageUrl = response.data.url
  507. ElMessage.success(response.msg || '上传成功')
  508. } else {
  509. ElMessage.error(response.msg || '上传失败')
  510. }
  511. } catch (error) {
  512. console.error('上传错误:', error)
  513. ElMessage.error(`上传失败: ${error.msg || error.message || '网络异常'}`)
  514. }
  515. }
  516. const defaultTime = [
  517. new Date(2000, 1, 1, 0, 0, 0),
  518. new Date(2000, 2, 1, 23, 59, 59),
  519. ]
  520. const disabledDate = (time) => {
  521. const limitDate = new Date(2025, 0, 1);
  522. return time.getTime() < limitDate.getTime();
  523. }
  524. const reset = function () {
  525. searchForm.value = {
  526. jwcode: '',
  527. markets: [],
  528. statuses: []
  529. }
  530. // 重置页码
  531. pagination.value.pageNum = 1
  532. dateRange.value = []
  533. getRefund()
  534. }
  535. onMounted(() => {
  536. console.log('???????????????????', adminData.value)
  537. getRefund()
  538. getMarket()
  539. })
  540. </script>
  541. <style scoped>
  542. :deep(.el-table__header-wrapper),
  543. :deep(.el-table__body-wrapper),
  544. :deep(.el-table__cell),
  545. :deep(.el-table__body td) {
  546. background-color: #F3FAFE !important;
  547. }
  548. :deep(.el-table__header th) {
  549. background-color: #F3FAFE !important;
  550. }
  551. :deep(.el-image-viewer) {
  552. z-index: 3000 !important;
  553. /* 确保高于固定列和对话框的层级 */
  554. }
  555. /* 若固定列仍遮挡,强制提高固定列容器的层级(可选) */
  556. :deep(.el-table__fixed),
  557. :deep(.el-table__fixed-right) {
  558. z-index: 10 !important;
  559. /* 低于预览层的 3000 即可 */
  560. }
  561. .condition1 {
  562. width: 82vw;
  563. display: flex;
  564. align-items: center;
  565. height: 4vh;
  566. .search {
  567. width: 18%;
  568. display: flex;
  569. align-items: center;
  570. margin-bottom: 1vh;
  571. margin-right: 0.5vw;
  572. }
  573. .search2 {
  574. width: 18%;
  575. display: flex;
  576. align-items: center;
  577. margin-right: 0.5vw;
  578. }
  579. }
  580. .edit {
  581. .left {
  582. width: 45%;
  583. height: 60vh;
  584. padding: 0 2vw;
  585. .dialog-item {
  586. display: flex;
  587. align-items: center;
  588. margin-bottom: 1vh;
  589. }
  590. .image {
  591. width: 4vw !important;
  592. height: 4vw !important;
  593. }
  594. :deep(.el-upload--picture-card) {
  595. width: 4vw !important;
  596. height: 4vw !important;
  597. padding: 0 !important;
  598. }
  599. }
  600. .right {
  601. width: 50%;
  602. .dialog-item {
  603. display: flex;
  604. align-items: center;
  605. margin-bottom: 1vh;
  606. }
  607. }
  608. }
  609. </style>