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.

938 lines
36 KiB

1 month ago
2 months ago
1 month ago
2 months ago
2 months ago
1 week ago
2 weeks ago
2 months ago
1 week ago
2 months ago
1 week ago
1 month ago
2 months ago
1 week ago
1 month ago
2 months ago
2 months ago
1 month ago
1 month ago
2 months ago
1 month ago
2 weeks ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 weeks ago
1 month ago
2 months ago
1 week ago
2 months ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
1 month ago
2 months ago
1 week ago
4 days ago
1 week ago
4 days ago
1 week ago
1 month ago
1 week ago
2 months ago
1 month ago
2 months ago
1 week ago
2 months ago
1 month ago
2 months ago
2 weeks ago
1 week ago
2 months ago
1 week ago
2 months ago
1 week ago
2 months ago
1 week ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 week ago
2 months ago
1 month ago
2 months ago
1 week ago
2 months ago
1 week ago
2 months ago
1 week ago
2 months ago
1 week ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
1 week ago
1 month ago
1 month ago
2 weeks ago
1 month ago
2 months ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
1 week ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
1 week ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
1 month ago
2 months ago
1 week ago
1 week ago
2 months ago
2 months ago
1 month ago
1 week ago
1 week ago
1 week ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
2 weeks ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 week ago
2 months ago
4 weeks ago
2 months ago
1 week ago
1 week ago
1 month ago
1 week ago
1 week ago
1 week ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
2 months ago
1 month ago
4 weeks ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
4 weeks ago
1 month ago
1 month ago
1 month ago
1 month ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
4 weeks ago
1 month ago
1 month ago
1 month ago
2 weeks ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 week ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
1 week ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
  1. <!-- 总部财务/管理员 -->
  2. <template>
  3. <el-card style="margin-bottom: 0.5vh;background-color: rgb(243,250,254);">
  4. <div class="condition">
  5. <div class="item1">
  6. <el-text size="large" style="width:4vw;">精网号</el-text>
  7. <el-input v-model="searchForm.jwcode" placeholder="请输入精网号" style="width:9vw;" clearable />
  8. </div>
  9. <div class="item1">
  10. <el-text size="large" style="width:4vw;">客户姓名</el-text>
  11. <el-input v-model="searchForm.name" placeholder="请输入客户姓名" style="width:9vw;" clearable />
  12. </div>
  13. <div class="item1">
  14. <el-text size="large" style="width:4vw;">产品名称</el-text>
  15. <el-cascader v-model="searchForm.goodsName" :options="productList" style="width: 10vw;"
  16. placeholder="请选择产品名称" clearable />
  17. </div>
  18. <div class="item1" v-if="adminData.markets === '总部'">
  19. <el-text size="large" style="width:4vw;">所属地区</el-text>
  20. <el-cascader style="width: 9vw;" v-model="searchForm.markets" :options="market" placeholder="请选择所属地区"
  21. clearable @change="handleMarketChange" />
  22. </div>
  23. <div class="item1">
  24. <el-text size="large" style="width:4vw;">订单状态</el-text>
  25. <el-select v-model="searchForm.statuses" style="width:9vw;" placeholder="请选择订单状态" clearable>
  26. <el-option v-for="item in statusList" :label="item" :value="item" :key="item" />
  27. </el-select>
  28. </div>
  29. </div>
  30. <div class="condition">
  31. <div class="item2">
  32. <el-text size="large" style="width:4vw;">付款币种</el-text>
  33. <el-select v-model="searchForm.paymentCurrency" style="width:9vw;" placeholder="请选择付款币种" clearable>
  34. <el-option v-for="item in currencies" :key="item" :label="item" :value="item" />
  35. </el-select>
  36. </div>
  37. <div class="item2">
  38. <el-text size="large" style="width:4vw;">支付方式</el-text>
  39. <el-select v-model="searchForm.payType" style="width:9vw;" placeholder="请选择支付方式" clearable>
  40. <el-option v-for="item in channelOptions" :key="item" :label="item" :value="item" />
  41. </el-select>
  42. </div>
  43. <div class="item2" style="width: 28.5vw;">
  44. <el-text size="large" style="width:4vw;">付款时间</el-text>
  45. <el-date-picker v-model="dateRange" type="datetimerange" range-separator="" start-placeholder="起始时间"
  46. end-placeholder="结束时间" style="width:22vw;" @change="handleDatePickerChange" clearable
  47. :disabled-date="disabledDate" :default-time="defaultTime" />
  48. </div>
  49. <div>
  50. <el-button type="primary" @click="getRefund">查询</el-button>
  51. <el-button type="warning" @click="exportExcel()">导出excel</el-button>
  52. <el-button type="primary" @click="openExportList">查看导出列表</el-button>
  53. <el-button type="success" @click="reset">重置</el-button>
  54. </div>
  55. </div>
  56. </el-card>
  57. <el-card style="margin-top: 0.5vh;background-color: rgb(231,244,253);">
  58. <el-table :data="tableData" style="height:73vh;width:82vw">
  59. <el-table-column type="index" label="序号" width="60" fixed="left">
  60. <template #default="scope">
  61. {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }}
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="name" label="Homily ID" width="120" fixed="left" />
  65. <el-table-column prop="jwcode" label="姓名" width="120" fixed="left" show-overflow-tooltip />
  66. <el-table-column prop="marketName" label="所属地区" width="120" />
  67. <el-table-column prop="goodsName" label="产品名称" width="130" show-overflow-tooltip />
  68. <el-table-column prop="goodsNum" label="产品数量" width="120" />
  69. <el-table-column prop="refundModel" label="退款方式" width="120">
  70. <template #default="scope">
  71. {{ scope.row.refundModel === 1 ? '部分退款' : '全部退款' }}
  72. </template>
  73. </el-table-column>
  74. <el-table-column prop="submitter" label="提交人" width="120" />
  75. <el-table-column prop="refundReason" label="退款理由" width="120" show-overflow-tooltip />
  76. <el-table-column prop="remark" label="备注" width="150" show-overflow-tooltip />
  77. <el-table-column prop="status" label="订单状态" width="120">
  78. <template #default="scope">
  79. {{
  80. [30].includes(scope.row.status) ? '待审核' :
  81. [40].includes(scope.row.status) ? '审核通过' :
  82. scope.row.status === 32 ? '已驳回' :
  83. scope.row.status === 41 ? '退款成功' : scope.row.status
  84. }}
  85. </template>
  86. </el-table-column>
  87. <el-table-column prop="operation" label="操作" fixed="right" width="100px">
  88. <template #default="scope">
  89. <div class="operation">
  90. <el-button v-if="scope.row.status === 30" type="primary" text @click="showAudit(scope.row)">
  91. 审核
  92. </el-button>
  93. <el-button v-else type="primary" text @click="showStep(scope.row)">
  94. 查看进度
  95. </el-button>
  96. </div>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. <el-pagination v-model:current-page="pagination.pageNum" v-model:page-size="pagination.pageSize"
  101. layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"
  102. @size-change="handlePageSizeChange" @current-change="handleCurrentChange"
  103. style="margin-top: 1vh;"></el-pagination>
  104. </el-card>
  105. <el-dialog v-model="showAudit2" title="审核" class="audit2" width="35vw" overflow draggable
  106. style="background-color: #F3FAFE !important;">
  107. <div class="top">
  108. <el-button @click="" class="smallTitle" size="small">退款申请信息</el-button>
  109. <div class="top-item">
  110. <el-text style="width:4vw;" size="small">退款方式</el-text>
  111. <el-select v-model="auditRow.refundModel" size="small" style="width:10vw;" disabled>
  112. <el-option label="全部退款" :value="0"></el-option>
  113. <el-option label="部分退款" :value="1"></el-option>
  114. </el-select>
  115. </div>
  116. <div class="top-item">
  117. <el-text style="width:4vw;" size="small">永久金币</el-text>
  118. <el-input v-model="auditRow.gold" size="small" style="width:10vw;" disabled />&nbsp;
  119. </div>
  120. <div class="top-item">
  121. <el-text style="width:4vw;" size="small">免费金币</el-text>
  122. <el-input v-model="auditRow.free" size="small" style="width:10vw;" disabled />&nbsp;
  123. </div>
  124. <div class="top-item">
  125. <el-text style="width:4vw;" size="small">退款理由</el-text>
  126. <el-input v-model="auditRow.refundReason" size="small" style="width:10vw;" :rows="3" maxlength="100"
  127. show-word-limit type="textarea" disabled />
  128. </div>
  129. </div>
  130. <el-button @click="" class="smallTitle" size="small">原订单信息</el-button>
  131. <div class="center">
  132. <div class="center-left">
  133. <div class="center-item">
  134. <el-text style="width:4vw;" size="small">精网号</el-text>
  135. <el-input v-model="auditRow.jwcode" size="small" style="width:10vw;" disabled />
  136. </div>
  137. <div class="center-item">
  138. <el-text style="width:4vw;" size="small">产品名称</el-text>
  139. <el-input v-model="auditRow.goodsName" size="small" style="width:10vw;" disabled />
  140. </div>
  141. <div class="center-item">
  142. <el-text style="width:4vw;" size="small">所属地区</el-text>
  143. <el-input v-model="auditRow.marketName" size="small" style="width:10vw;" disabled />
  144. </div>
  145. <div class="center-item">
  146. <el-text style="width:4vw;" size="small">付款币种</el-text>
  147. <el-input v-model="auditRow.paymentCurrency" size="small" style="width:10vw;" disabled />
  148. </div>
  149. <div class="center-item">
  150. <el-text style="width:4vw;" size="small">付款金额</el-text>
  151. <el-input v-model="auditRow.paymentAmount" size="small" style="width:10vw;" disabled />
  152. </div>
  153. <div class="center-item">
  154. <el-text style="width:4vw;" size="small">付款时间</el-text>
  155. <el-input v-model="auditRow.payTime" size="small" style="width:10vw;" disabled />
  156. </div>
  157. <div class="center-item">
  158. <el-text style="width:4vw;">转账凭证</el-text>
  159. <img v-if="auditRow.payVoucher" :src="auditRow.payVoucher"
  160. style="width: 80px; height: 80px; object-fit: cover;">
  161. <div v-else>
  162. 无转账凭证
  163. </div>
  164. </div>
  165. </div>
  166. <div class="center-right">
  167. <div class="right-item">
  168. <el-text style="width:4vw;" size="small">客户姓名</el-text>
  169. <el-input v-model="auditRow.name" size="small" style="width:10vw;" disabled />
  170. </div>
  171. <div class="right-item">
  172. <el-text style="width:4vw;" size="small">活动名称</el-text>
  173. <el-input v-model="auditRow.activity" size="small" style="width:10vw;" disabled />
  174. </div>
  175. <div class="right-item">
  176. <el-text style="width:4vw;" size="small">支付方式</el-text>
  177. <el-input v-model="auditRow.payType" size="small" style="width:10vw;" disabled />
  178. </div>
  179. <div class="right-item">
  180. <el-text style="width:4vw;" size="small">到账币种</el-text>
  181. <el-input v-model="auditRow.receivedCurrency" size="small" style="width:10vw;" disabled />
  182. </div>
  183. <div class="right-item">
  184. <el-text style="width:4vw;" size="small">到账金额</el-text>
  185. <el-input v-model="auditRow.receivedAmount" size="small" style="width:10vw;" disabled />
  186. </div>
  187. <div class="right-item">
  188. <el-text style="width:4vw;" size="small">到账时间</el-text>
  189. <el-input v-model="auditRow.receivedTime" size="small" style="width:10vw;" disabled />
  190. </div>
  191. <div class="right-item">
  192. <el-text style="width:4vw;" size="small">手续费</el-text>
  193. <el-input v-model="auditRow.handlingCharge" size="small" style="width:10vw;" disabled />
  194. </div>
  195. <div class="right-item">
  196. <el-text style="width:4vw;" size="small">提交人</el-text>
  197. <el-input v-model="auditRow.submitter" size="small" style="width:10vw;" disabled />
  198. </div>
  199. <div class="right-item">
  200. <el-text style="width:4vw;" size="small">备注</el-text>
  201. <el-input v-model="auditRow.remark" size="small" style="width:10vw;" :row="3" maxlength="100"
  202. type="textarea" show-word-limit disabled />
  203. </div>
  204. </div>
  205. </div>
  206. <div class="bottom">
  207. <el-button class="smallTitle" size="small" v-show="showReject">驳回信息</el-button>
  208. <div class="bottom-item" v-show="showReject">
  209. <el-text style="width:4vw;" size="small">驳回备注</el-text>
  210. <el-input v-model="addForm.remark" placeholder="请输入驳回备注" size="small" style="width:10vw;" :row="3"
  211. maxlength="100" type="textarea" show-word-limit clearable />
  212. </div>
  213. <div class="bottom-item" v-show="showExecutor">
  214. <el-text style="width:4vw;" size="small">执行人</el-text>
  215. <el-select v-model="addForm.executor" style="width:9vw;">
  216. <el-option v-for="item in executorList" :key="item.value" :label="item.label" :value="item.value" />
  217. </el-select>
  218. </div>
  219. <div style="text-align: center;" v-show="!showReject && !showExecutor">
  220. <el-button type="default" @click="showReject = true">驳回</el-button>
  221. <el-button type="primary" @click="showExecutor = true">通过</el-button>
  222. </div>
  223. <div style="text-align: center;" v-show="showReject">
  224. <el-button type="default" @click="hideReject">取消</el-button>
  225. <el-button type="primary" @click="handleReject">确定</el-button>
  226. </div>
  227. <div style="text-align: center;" v-show="showExecutor">
  228. <el-button type="default" @click="hideExecutor">取消</el-button>
  229. <el-button type="primary" @click="handlePass">确定</el-button>
  230. </div>
  231. </div>
  232. </el-dialog>
  233. <el-dialog v-model="showSteps" title="退款进度" overflow draggable width="1206px" height="506px" :style="{
  234. backgroundImage: `url(${BackgroundSvg})`,
  235. backgroundSize: 'cover',
  236. backgroundPosition: 'center'
  237. }">
  238. <div class="steps">
  239. <div class="steps-content">
  240. <el-steps :active="currentStep" align-center>
  241. <el-step>
  242. <template #title>
  243. <div>
  244. 提交人<br>{{ submitter || '未知提交人' }}
  245. </div>
  246. </template>
  247. <template #icon>
  248. <img src="@/assets/images/refund-approved.png" alt="已完成">
  249. </template>
  250. </el-step>
  251. <el-step>
  252. <template #title>
  253. <div>
  254. 地区财务<br>{{ areaFinance || '未记录审核人' }}
  255. </div>
  256. </template>
  257. <template #icon>
  258. <img v-if="currentStep === 2" src="@/assets/images/refund-rejected.png" alt="已驳回">
  259. <img v-else-if="currentStep === 1" src="@/assets/images/refund-approving.png" alt="待审核">
  260. <img v-else-if="currentStep > 2" src="@/assets/images/refund-approved.png" alt="已审核">
  261. </template>
  262. </el-step>
  263. <el-step>
  264. <template #title>
  265. <div>
  266. 地区负责人<br>{{ areaCharge || '未记录审核人' }}
  267. </div>
  268. </template>
  269. <template #icon>
  270. <img v-if="currentStep === 4" src="@/assets/images/refund-rejected.png" alt="已驳回">
  271. <img v-else-if="currentStep === 3" src="@/assets/images/refund-approving.png" alt="待审核">
  272. <img v-else-if="currentStep > 3 && currentStep != 4"
  273. src="@/assets/images/refund-approved.png" alt="已审核">
  274. <img v-else-if="currentStep < 3" src="@/assets/images/refund-waiting.png" alt="未开始">
  275. </template>
  276. </el-step>
  277. <el-step>
  278. <template #title>
  279. <div>
  280. 总部财务<br>{{ headFinance || '未记录审核人' }}
  281. </div>
  282. </template>
  283. <template #icon>
  284. <img v-if="currentStep === 6" src="@/assets/images/refund-rejected.png" alt="已驳回">
  285. <img v-else-if="currentStep === 5" src="@/assets/images/refund-approving.png" alt="待审核">
  286. <img v-else-if="currentStep > 5 && currentStep != 6"
  287. src="@/assets/images/refund-approved.png" alt="已审核">
  288. <img v-else-if="currentStep < 5" src="@/assets/images/refund-waiting.png" alt="未开始">
  289. </template>
  290. </el-step>
  291. <el-step>
  292. <template #title>
  293. <div>
  294. 指定执行人<br>{{ executor || '未记录执行人' }}
  295. </div>
  296. </template>
  297. <template #icon>
  298. <img v-if="currentStep === 7" src="@/assets/images/refund-approving.png" alt="待处理">
  299. <img v-else-if="currentStep === 8" src="@/assets/images/refund-approved.png" alt="已完成">
  300. <img v-else-if="currentStep < 7" src="@/assets/images/refund-waiting.png" alt="未开始">
  301. </template>
  302. </el-step>
  303. </el-steps>
  304. </div>
  305. <div class="steps-btn">
  306. <el-button type="primary" @click="showSteps = false">确定</el-button>
  307. </div>
  308. </div>
  309. </el-dialog>
  310. <el-dialog v-model="exportListVisible" title="导出列表" width="80%">
  311. <el-table :data="exportList" style="width: 100% ;height: 60vh;" :loading="exportListLoading">
  312. <el-table-column prop="fileName" label="文件名" />
  313. <el-table-column prop="state" label="状态">
  314. <template #default="scope">
  315. <el-tag :type="getTagType(scope.row.state)" :effect="scope.row.state === 3 ? 'light' : 'plain'">
  316. {{ getTagText(scope.row.state) }}
  317. </el-tag>
  318. </template>
  319. </el-table-column>
  320. <el-table-column prop="createTime" label="创建时间">
  321. <template #default="scope">
  322. {{ moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}
  323. </template>
  324. </el-table-column>
  325. <el-table-column label="操作">
  326. <template #default="scope">
  327. <el-button type="primary" size="small" @click="downloadExportFile(scope.row)"
  328. :disabled="scope.row.state !== 2">
  329. 下载
  330. </el-button>
  331. </template>
  332. </el-table-column>
  333. </el-table>
  334. <template #footer>
  335. <div class="dialog-footer">
  336. <el-button text @click="exportListVisible = false">关闭</el-button>
  337. </div>
  338. </template>
  339. </el-dialog>
  340. </template>
  341. <script setup>
  342. import BackgroundSvg from '@/assets/images/refund-progress.png'
  343. import { ref, onMounted } from 'vue'
  344. import { ElMessage } from 'element-plus'
  345. import API from '@/util/http.js'
  346. const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'
  347. import { useAdminStore } from "@/store/index.js"
  348. import { storeToRefs } from "pinia"
  349. import dayjs from 'dayjs'
  350. const adminStore = useAdminStore()
  351. const { adminData, menuTree } = storeToRefs(adminStore)
  352. import { permissionMapping, findMenuById, hasMenuPermission } from "@/utils/menuTreePermission.js"
  353. import moment from 'moment'
  354. import { productList, CurrencyForId } from '@/views/moneyManage/receiveDetail/utils/staticData.js'
  355. import { isNumber } from 'lodash'
  356. const startsWith1 = (mainStr, prefix) => {
  357. // 处理前缀为空字符串的情况(空字符串是所有字符串的前缀)
  358. if (prefix === '') {
  359. return true;
  360. }
  361. // 处理主字符串长度小于前缀长度的情况
  362. if (mainStr.length < prefix.length) {
  363. return false;
  364. }
  365. // 比较主字符串开头与前缀相同长度的部分
  366. return mainStr.substring(0, prefix.length) === prefix;
  367. }
  368. const currentStep = ref(0)// 进度图
  369. const searchForm = ref({
  370. jwcode: '',
  371. markets: [],
  372. statuses: []
  373. })
  374. const isReject = ref(false)// 进度图有没有驳回状态
  375. const addForm = ref({
  376. remark: ''
  377. })
  378. const market = ref([])
  379. const showReject = ref(false)
  380. const showExecutor = ref(false)
  381. const auditRow = ref({})// 审核回显
  382. const dateRange = ref([])
  383. const pagination = ref({
  384. pageNum: 1,
  385. pageSize: 50,
  386. total: 0
  387. })
  388. const showAudit2 = ref(false)
  389. const tableData = ref([])
  390. const showSteps = ref(false)
  391. const uploadRef = ref(null)
  392. const submitter = ref('')// 提交人
  393. const areaFinance = ref('')// 地区财务
  394. const areaCharge = ref('')// 地区负责人
  395. const headFinance = ref('')// 总部财务
  396. const executor = ref('')// 指定执行人
  397. const exportListVisible = ref(false)
  398. const exportList = ref([])
  399. // 导出列表加载状态
  400. const exportListLoading = ref(false)
  401. const statusStepMap = {
  402. 10: [1, false],
  403. 12: [2, true],
  404. 20: [3, false],
  405. 22: [4, true],
  406. 30: [5, false],
  407. 32: [6, true],
  408. 40: [7, false],
  409. 41: [8, false]
  410. }
  411. const currencies = ref(['美元(USD)', '港币(HKD)', '新币(SGD)', '马币(MYR)', '泰铢(THB)', '加币(CAD)', '越南盾(VDN)', '韩元(KRW)'])
  412. const channelOptions = ref(["Stripe-链接收款", "PaymentAsia-链接收款", "Ipay88-链接收款", "银行转账", "刷卡", "现金", "支票", "Grabpay", "Nets", "E-Transfer", "Paypal"])
  413. const statusList = ref(['待审核', '审核通过', '已驳回', '退款成功'])
  414. const executorList = ref([
  415. {
  416. value: '305485',
  417. label: '新:Zoe'
  418. },
  419. {
  420. value: '200723',
  421. label: '马:Jennifer'
  422. },
  423. {
  424. value: '301388',
  425. label: '港:林育平'
  426. },
  427. {
  428. value: '839448',
  429. label: '加:Mandy'
  430. },
  431. {
  432. value: '304904',
  433. label: '泰:杨丽娇'
  434. },
  435. {
  436. value: '315915',
  437. label: '越:范秋霞'
  438. },
  439. {
  440. value: '90047681',
  441. label: '李慧琳演示机'
  442. },
  443. {
  444. value: '90047947',
  445. label: '宋彤彤'
  446. }
  447. ])
  448. // 查全部
  449. const getRefund = async function () {
  450. if (!hasMenuPermission(menuTree.value, permissionMapping.view_headquarters_refund)) {
  451. ElMessage.error('无此权限')
  452. return
  453. }
  454. try {
  455. const statusParam = ref([30, 32, 40, 41])// 默认:看不到进度没到这里的
  456. if (searchForm.value.statuses === '待审核') {
  457. statusParam.value = [30]
  458. } else if (searchForm.value.statuses === '审核通过') {
  459. statusParam.value = [40]
  460. } else if (searchForm.value.statuses === '已驳回') {
  461. statusParam.value = [32]
  462. } else if (searchForm.value.statuses === '退款成功') {
  463. statusParam.value = [41]
  464. } else {
  465. statusParam.value = [30, 32, 40, 41]
  466. }
  467. const goodsName = searchForm.value.goodsName && searchForm.value.goodsName.length > 0
  468. ? searchForm.value.goodsName[searchForm.value.goodsName.length - 1] : ''
  469. if (searchForm.value.jwcode) {
  470. const isPositiveInteger = /^[1-9]\d*$/.test(searchForm.value.jwcode);
  471. if (!isPositiveInteger) {
  472. ElMessage.error('请输入正确的精网号')
  473. return;
  474. }
  475. }
  476. // 增加精网号长度限制,防止后端400错误
  477. if (searchForm.value.jwcode.length > 8) {
  478. ElMessage.error('精网号长度不能超过8位')
  479. return;
  480. }
  481. const params = {
  482. pageNum: pagination.value.pageNum,
  483. pageSize: pagination.value.pageSize,
  484. cashRecordDTO: {
  485. jwcode: searchForm.value.jwcode,
  486. name: searchForm.value.name,
  487. markets: searchForm.value.markets && searchForm.value.markets.length > 0 ? [searchForm.value.markets[searchForm.value.markets.length - 1]] : [],
  488. goodsName: goodsName,
  489. statuses: statusParam.value,
  490. paymentCurrency: CurrencyForId(searchForm.value.paymentCurrency),
  491. payType: searchForm.value.payType,
  492. startTime: dateRange.value && dateRange.value[0] ? dayjs(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : "",
  493. endTime: dateRange.value && dateRange.value[1] ? dayjs(dateRange.value[1]).format('YYYY-MM-DD HH:mm:ss') : "",
  494. adminId: adminData.value.id
  495. }
  496. }
  497. const result = await API({
  498. url: '/Money/select',
  499. method: 'POST',
  500. data: params
  501. })
  502. tableData.value = result.data.list || []
  503. pagination.value.total = result.data.total || 0
  504. } catch (error) {
  505. ElMessage.error(error.message || '查询失败')
  506. }
  507. }
  508. // 审核通过
  509. const handlePass = async function () {
  510. if (!hasMenuPermission(menuTree.value, permissionMapping.audit_headquarters_refund)) {
  511. ElMessage.error('无此权限')
  512. return
  513. }
  514. try {
  515. const params = {
  516. id: auditRow.value.id,
  517. executor: addForm.value.executor,
  518. status: 40,
  519. headFinance: adminData.value.adminName,
  520. auditId: auditRow.value.auditId,
  521. goodsName: auditRow.value.goodsName,
  522. permanentGold: auditRow.value.permanentGold * 100,
  523. freeGold: auditRow.value.freeGold * 100,
  524. orderCode: auditRow.value.orderCode,
  525. jwcode: auditRow.value.jwcode,
  526. adminId: adminData.value.id
  527. }
  528. const result = await API({
  529. url: '/Money/finalReview',
  530. data: params
  531. })
  532. if (result.code === 200) {
  533. ElMessage.success('审核通过')
  534. showAudit2.value = false
  535. getRefund()
  536. hideExecutor()
  537. }
  538. } catch (error) {
  539. ElMessage.error(error.message || '审核失败')
  540. }
  541. }
  542. // 审核驳回
  543. const handleReject = async function () {
  544. if (!hasMenuPermission(menuTree.value, permissionMapping.audit_headquarters_refund)) {
  545. ElMessage.error('无此权限')
  546. return
  547. }
  548. try {
  549. const params = {
  550. id: auditRow.value.id,
  551. status: 32,
  552. rejectReason: addForm.value.remark,
  553. headFinance: adminData.value.adminName,
  554. auditId: auditRow.value.auditId,
  555. orderCode: auditRow.value.orderCode,
  556. adminId: adminData.value.id
  557. }
  558. const result = await API({
  559. url: '/Money/finalReview',
  560. data: params
  561. })
  562. if (result.code === 200) {
  563. ElMessage.success('审核驳回')
  564. showAudit2.value = false
  565. getRefund()
  566. addForm.value.remark = ''
  567. showReject.value = false
  568. }
  569. } catch (error) {
  570. ElMessage.error(error.message || '审核失败')
  571. }
  572. }
  573. const getMarket = async function () {
  574. try {
  575. const result = await API({
  576. url: '/market/selectMarket',
  577. })
  578. console.log('看看地区树', result)
  579. const transformTree = (nodes) => {
  580. const allChildren = nodes.flatMap(node => node.children || []);
  581. return allChildren.map(child => {
  582. const grandchildren = child.children && child.children.length
  583. ? transformTree([child])
  584. : null;
  585. return {
  586. value: child.id,
  587. label: child.name,
  588. children: grandchildren
  589. };
  590. });
  591. };
  592. market.value = transformTree(result.data)
  593. console.log('转换后的地区树==============', market.value)
  594. } catch (error) {
  595. console.log('请求失败', error)
  596. }
  597. }
  598. const hideReject = function () {
  599. showReject.value = false
  600. addForm.value.remark = ''
  601. }
  602. const exportExcel = async function () {
  603. const statusParam = ref([30, 32, 40, 41])// 默认:看不到进度没到这里的
  604. if (searchForm.value.statuses === '待审核') {
  605. statusParam.value = [30]
  606. } else if (searchForm.value.statuses === '审核通过') {
  607. statusParam.value = [40]
  608. } else if (searchForm.value.statuses === '已驳回') {
  609. statusParam.value = [32]
  610. } else if (searchForm.value.statuses === '退款成功') {
  611. statusParam.value = [41]
  612. } else {
  613. statusParam.value = [30, 32, 40, 41]
  614. }
  615. const goodsName = searchForm.value.goodsName && searchForm.value.goodsName.length > 0
  616. ? searchForm.value.goodsName[searchForm.value.goodsName.length - 1] : ''
  617. if (searchForm.value.jwcode) {
  618. const isPositiveInteger = /^[1-9]\d*$/.test(searchForm.value.jwcode);
  619. if (!isPositiveInteger) {
  620. ElMessage.error('请输入正确的精网号')
  621. return;
  622. }
  623. }
  624. // 增加精网号长度限制,防止后端400错误
  625. if (searchForm.value.jwcode.length > 8) {
  626. ElMessage.error('精网号长度不能超过8位')
  627. return;
  628. }
  629. const params = {
  630. pageNum: pagination.value.pageNum,
  631. pageSize: pagination.value.pageSize,
  632. cashRecordDTO: {
  633. jwcode: searchForm.value.jwcode,
  634. name: searchForm.value.name,
  635. markets: searchForm.value.markets && searchForm.value.markets.length > 0 ? [searchForm.value.markets[searchForm.value.markets.length - 1]] : [],
  636. goodsName: goodsName,
  637. statuses: statusParam.value,
  638. paymentCurrency: CurrencyForId(searchForm.value.paymentCurrency),
  639. payType: searchForm.value.payType,
  640. startTime: dateRange.value && dateRange.value[0] ? dayjs(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : "",
  641. endTime: dateRange.value && dateRange.value[1] ? dayjs(dateRange.value[1]).format('YYYY-MM-DD HH:mm:ss') : "",
  642. adminId: adminData.value.id
  643. }
  644. }
  645. const res = await API({ url: '/export/exportFinance', data: params })
  646. if (res.code === 200) {
  647. ElMessage.success('导出成功')
  648. } else {
  649. ElMessage.error(res.msg || '导出失败')
  650. }
  651. }
  652. const openExportList = () => {
  653. getExportList()
  654. exportListVisible.value = true
  655. }
  656. const getExportList = async () => {
  657. exportListLoading.value = true
  658. try {
  659. const result = await API({ url: '/export/export' })
  660. if (result.code === 200) {
  661. const filteredData = result.data.filter(item => {
  662. return item.type === 12
  663. })
  664. exportList.value = filteredData
  665. } else {
  666. ElMessage.error(result.msg || '获取导出列表失败')
  667. }
  668. } catch (error) {
  669. console.error('获取导出列表出错:', error)
  670. ElMessage.error('获取导出列表失败,请稍后重试')
  671. } finally {
  672. exportListLoading.value = false
  673. }
  674. }
  675. const downloadExportFile = (item) => {
  676. if (item.state === 2) {
  677. const link = document.createElement('a')
  678. link.href = item.url
  679. link.download = item.fileName
  680. link.click()
  681. } else {
  682. ElMessage.warning('文件还在导出中,请稍后再试')
  683. }
  684. }
  685. const getTagType = (state) => {
  686. switch (state) {
  687. case 0:
  688. return 'info';
  689. case 1:
  690. return 'primary';
  691. case 2:
  692. return 'success';
  693. case 3:
  694. return 'danger';
  695. default:
  696. return 'info';
  697. }
  698. }
  699. //根据状态返回对应的标签文案
  700. const getTagText = (state) => {
  701. switch (state) {
  702. case 0:
  703. return '待执行';
  704. case 1:
  705. return '执行中';
  706. case 2:
  707. return '执行完成';
  708. case 3:
  709. return '执行出错';
  710. default:
  711. return '未知状态';
  712. }
  713. }
  714. const reset = function () {
  715. searchForm.value = {
  716. jwcode: '',
  717. markets: [],
  718. statuses: []
  719. }
  720. // 重置页码
  721. pagination.value.pageNum = 1
  722. dateRange.value = []
  723. getRefund()
  724. }
  725. const showStep = function (row) {
  726. if (!hasMenuPermission(menuTree.value, permissionMapping.track_headquarters_refund_progress)) {
  727. ElMessage.error('无此权限')
  728. return
  729. }
  730. isReject.value = false
  731. submitter.value = row.submitter || ''
  732. areaFinance.value = row.areaFinance || ''
  733. areaCharge.value = row.areaCharge || ''
  734. headFinance.value = row.headFinance || ''
  735. executor.value = row.executorName || ''
  736. currentStep.value = 1
  737. const status = row.status
  738. if (statusStepMap[status]) {
  739. const [step, reject] = statusStepMap[status]
  740. currentStep.value = step
  741. isReject.value = reject
  742. }
  743. console.log('步骤条状态', currentStep.value)
  744. showSteps.value = true
  745. }
  746. const hideExecutor = function () {
  747. addForm.value.executor = ''
  748. showExecutor.value = false
  749. }
  750. const showAudit = function (row) {
  751. auditRow.value = row
  752. showAudit2.value = true
  753. }
  754. const defaultTime = [
  755. new Date(2000, 1, 1, 0, 0, 0),
  756. new Date(2000, 2, 1, 23, 59, 59),
  757. ]
  758. const disabledDate = (time) => {
  759. const limitDate = new Date(2025, 0, 1);
  760. return time.getTime() < limitDate.getTime();
  761. }
  762. const handlePageSizeChange = function (val) {
  763. pagination.value.pageSize = val
  764. getRefund()
  765. }
  766. const handleCurrentChange = function (val) {
  767. pagination.value.pageNum = val
  768. getRefund()
  769. }
  770. onMounted(() => {
  771. console.log('???????????????????', adminData.value)
  772. getRefund()
  773. getMarket()
  774. })
  775. </script>
  776. <style scoped lang="scss">
  777. :deep(.el-table__header-wrapper),
  778. :deep(.el-table__body-wrapper),
  779. :deep(.el-table__cell),
  780. :deep(.el-table__body td) {
  781. background-color: #F3FAFE !important;
  782. }
  783. :deep(.el-table__header th) {
  784. background-color: #F3FAFE !important;
  785. }
  786. .condition {
  787. width: 82vw;
  788. display: flex;
  789. align-items: center;
  790. height: 4vh;
  791. .item1 {
  792. width: 18%;
  793. display: flex;
  794. align-items: center;
  795. margin-bottom: 1vh;
  796. margin-right: 0.5vw;
  797. }
  798. .item2 {
  799. width: 18%;
  800. display: flex;
  801. align-items: center;
  802. margin-right: 0.5vw;
  803. }
  804. }
  805. .audit1 {
  806. height: 47vh;
  807. .audit-item {
  808. display: flex;
  809. align-items: center;
  810. margin-bottom: 1vh;
  811. }
  812. }
  813. .audit2 {
  814. display: flex;
  815. justify-content: center;
  816. .top {
  817. width: 30vw;
  818. height: 22vh;
  819. .top-item {
  820. display: flex;
  821. align-items: center;
  822. margin-bottom: 1vh;
  823. }
  824. }
  825. .smallTitle {
  826. background-color: white;
  827. color: rgb(64, 158, 255);
  828. border-color: rgb(64, 158, 255);
  829. margin-bottom: 0.5vh;
  830. }
  831. .center {
  832. display: flex;
  833. width: 30vw;
  834. height: 35vh;
  835. .dialog-item {
  836. display: flex;
  837. align-items: center;
  838. margin-bottom: 1vh;
  839. }
  840. .center-left {
  841. width: 60%;
  842. height: 35vh;
  843. :deep(.el-upload--picture-card) {
  844. width: 4vw !important;
  845. height: 4vw !important;
  846. padding: 0 !important;
  847. }
  848. .center-item {
  849. display: flex;
  850. align-items: center;
  851. margin-bottom: 1vh;
  852. }
  853. }
  854. .center-right {
  855. height: 35vh;
  856. .right-item {
  857. display: flex;
  858. align-items: center;
  859. margin-bottom: 1vh;
  860. }
  861. }
  862. }
  863. .bottom {
  864. width: 30vw;
  865. height: 12vh;
  866. .bottom-item {
  867. display: flex;
  868. align-items: center;
  869. margin-bottom: 1vh;
  870. }
  871. }
  872. }
  873. .steps {
  874. .steps-content {
  875. padding-top: 15vw;
  876. }
  877. .steps-status {
  878. display: flex;
  879. align-items: center;
  880. justify-content: center;
  881. }
  882. .steps-btn {
  883. height: 15vh;
  884. display: flex;
  885. justify-content: center;
  886. align-items: center;
  887. }
  888. }
  889. </style>