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.

1091 lines
42 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
3 months ago
3 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 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="condition-row">
  6. <div class="item1">
  7. <el-text size="large" style="width:6vw;">{{ t('common.jwcode') }}</el-text>
  8. <el-input v-model="searchForm.jwcode" :placeholder="t('common.jwcodePlaceholder')" style="width:9vw;"
  9. clearable />
  10. </div>
  11. <div class="item1">
  12. <el-text size="large" style="width:6vw;">{{ t('common.customerName') }}</el-text>
  13. <el-input v-model="searchForm.name" :placeholder="t('common.customerNamePlaceholder')"
  14. style="width:9vw;" clearable />
  15. </div>
  16. <div class="item1">
  17. <el-text size="large" style="width:6vw;">{{ t('common.productName') }}</el-text>
  18. <el-cascader v-model="searchForm.goodsName" :options="productList" style="width: 10vw;"
  19. :placeholder="t('common.productNamePlaceholder')" clearable />
  20. </div>
  21. </div>
  22. <div class="condition-row">
  23. <div class="item1" v-if="isHeadquarters">
  24. <el-text size="large" style="width:6vw;">{{ t('common.market') }}</el-text>
  25. <el-cascader style="width: 9vw;" v-model="searchForm.markets" :options="market"
  26. :placeholder="t('common.marketPlaceholder')" clearable @change="handleMarketChange" />
  27. </div>
  28. <div class="item1">
  29. <el-text size="large" style="width:6vw;">{{ t('common.orderStatus') }}</el-text>
  30. <el-select v-model="searchForm.statuses" style="width:9vw;"
  31. :placeholder="t('common.orderStatusPlaceholder')" clearable>
  32. <el-option v-for="item in statusList" :label="item" :value="item" :key="item" />
  33. </el-select>
  34. </div>
  35. <div class="condition-actions">
  36. <el-button type="primary" @click="getRefund">{{ t('common.search') }}</el-button>
  37. <el-button type="warning" @click="exportExcel()">{{ t('common.exportExcel') }}</el-button>
  38. <el-button type="primary" @click="openExportList">{{ t('common.viewExportList') }}</el-button>
  39. <el-button type="success" @click="reset">{{ t('common.reset') }}</el-button>
  40. </div>
  41. </div>
  42. </div>
  43. </el-card>
  44. <el-card style="margin-top: 0.5vh;background-color: rgb(231,244,253);">
  45. <el-table ref="tableRef" :data="tableData" style="height:73vh;width:82vw">
  46. <el-table-column type="index" :label="t('common_list.id')" width="60" fixed="left">
  47. <template #default="scope">
  48. {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }}
  49. </template>
  50. </el-table-column>
  51. <el-table-column prop="name" :label="t('common_list.name')" width="120" fixed="left" />
  52. <el-table-column prop="jwcode" label="Homily ID" width="120" fixed="left"
  53. show-overflow-tooltip />
  54. <el-table-column prop="marketName" :label="t('common_list.market')" width="120" />
  55. <el-table-column prop="goodsName" :label="t('common_list.productName')" width="130" show-overflow-tooltip />
  56. <el-table-column prop="goodsNum" :label="t('common_list.productNum')" width="130px">
  57. <template #default="scope">
  58. <!-- <span v-if="scope.row.goodsName == t('common_list.goldRecharge')">{{
  59. scope.row.permanentGold }} {{ t('cash.unit') }}</span> -->
  60. <span>{{ scope.row.goodsNum }} {{ scope.row.numUnit }}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="refundModel" :label="t('common_list.refundModel')" width="120">
  64. <template #default="scope">
  65. {{ scope.row.refundModel === 1 ? t('common_list.refundModelPart') : t('common_list.refundModelAll')
  66. }}
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="submitter" :label="t('common_list.submitter')" width="120" />
  70. <el-table-column prop="refundReason" :label="t('common_list.refundReason')" width="120"
  71. show-overflow-tooltip />
  72. <el-table-column prop="remark" :label="t('common_list.remark')" width="150" show-overflow-tooltip />
  73. <el-table-column prop="status" :label="t('common_list.orderStatus')" width="130">
  74. <template #default="scope">
  75. {{
  76. [20].includes(scope.row.status) ? t('cash.statusList.pending') :
  77. [30, 40].includes(scope.row.status) ? t('cash.statusList.passed') :
  78. [22, 32].includes(scope.row.status) ? t('cash.statusList.rejected') :
  79. scope.row.status === 41 ? t('cash.refundSuccess') : scope.row.status
  80. }}
  81. </template>
  82. </el-table-column>
  83. <el-table-column prop="operation" :label="t('common_list.operation')" fixed="right" width="140px">
  84. <template #default="scope">
  85. <div class="operation">
  86. <el-button v-if="scope.row.status === 20" type="primary" text @click="showAudit(scope.row)">
  87. {{ t('common.audit') }}
  88. </el-button>
  89. <el-button v-else type="primary" text @click="showStep(scope.row)">
  90. {{ t('common.viewProgress') }}
  91. </el-button>
  92. </div>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. <el-pagination v-model:current-page="pagination.pageNum" v-model:page-size="pagination.pageSize"
  97. layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"
  98. @size-change="handlePageSizeChange" @current-change="handleCurrentChange"
  99. style="margin-top: 1vh;"></el-pagination>
  100. </el-card>
  101. <el-dialog v-model="showAudit2" :title="t('common.audit')" class="audit2" width="35vw" overflow draggable
  102. style="background-color: #F3FAFE !important;">
  103. <div class="top">
  104. <el-button @click="" class="smallTitle" size="small">{{ t('common_add.refundApplyInfo') }}</el-button>
  105. <div class="top-item">
  106. <el-text style="width:4vw;" size="small">{{ t('common_add.refundModel') }}</el-text>
  107. <el-select v-model="auditRow.refundModel" size="small" style="width:10vw;" disabled>
  108. <el-option :label="t('common_add.refundModelAll')" :value="0"></el-option>
  109. <el-option :label="t('common_add.refundModelPart')" :value="1"></el-option>
  110. </el-select>
  111. </div>
  112. <div class="top-item">
  113. <el-text style="width:4vw;" size="small">{{ t('common_add.permanentGold') }}</el-text>
  114. <el-input v-model="auditRow.permanentGold" size="small" style="width:10vw;" disabled /><span>&nbsp;{{
  115. t('common.个') }}</span>
  116. </div>
  117. <div class="top-item">
  118. <el-text style="width:4vw;" size="small">{{ t('common_add.freeGold') }}</el-text>
  119. <el-input v-model="auditRow.freeGold" size="small" style="width:10vw;" disabled /><span>&nbsp;{{
  120. t('common.个') }}</span>
  121. </div>
  122. <div class="top-item">
  123. <el-text style="width:4vw;" size="small">{{ t('common_add.refundReason') }}</el-text>
  124. <el-input v-model="auditRow.refundReason" size="small" style="width:10vw;" :rows="3" maxlength="100"
  125. show-word-limit type="textarea" disabled />
  126. </div>
  127. </div>
  128. <el-button @click="" class="smallTitle" size="small">{{ t('common_add.originalOrderInfo') }}</el-button>
  129. <div class="center">
  130. <div class="center-left">
  131. <div class="center-item">
  132. <el-text style="width:4vw;" size="small">{{ t('common_add.jwcode') }}</el-text>
  133. <el-input v-model="auditRow.jwcode" size="small" style="width:10vw;" disabled />
  134. </div>
  135. <div class="center-item">
  136. <el-text style="width:4vw;" size="small">{{ t('common_add.market') }}</el-text>
  137. <el-input v-model="auditRow.marketName" size="small" style="width:10vw;" disabled />
  138. </div>
  139. <div class="center-item">
  140. <el-text style="width:4vw;" size="small">{{ t('common_add.productName') }}</el-text>
  141. <el-input v-model="auditRow.goodsName" size="small" style="width:10vw;" disabled />
  142. </div>
  143. <div class="center-item">
  144. <el-text style="width:4vw;" size="small">{{ t('common_add.payCurrency') }}</el-text>
  145. <el-input v-model="auditRow.paymentCurrency" size="small" style="width:10vw;" disabled />
  146. </div>
  147. <div class="center-item">
  148. <el-text style="width:4vw;" size="small">{{ t('common_add.payAmount') }}</el-text>
  149. <el-input v-model="auditRow.paymentAmount" size="small" style="width:10vw;" disabled />
  150. </div>
  151. <div class="center-item">
  152. <el-text style="width:4vw;" size="small">{{ t('common_add.payTime') }}</el-text>
  153. <el-input v-model="auditRow.payTime" size="small" style="width:10vw;" disabled />
  154. </div>
  155. <div class="center-item">
  156. <el-text style="width:4vw;">{{ t('common_add.transferVoucher') }}</el-text>
  157. <img v-if="auditRow.payVoucher" :src="auditRow.payVoucher"
  158. style="width: 80px; height: 80px; object-fit: cover;"
  159. @click.stop="previewImage(auditRow.payVoucher)"/>
  160. <div v-else>
  161. {{ t('common_add.noTransferVoucher') }}
  162. </div>
  163. </div>
  164. </div>
  165. <div class="center-right">
  166. <div class="right-item">
  167. <el-text style="width:4vw;" size="small">{{ t('common_add.customerName') }}</el-text>
  168. <el-input v-model="auditRow.name" size="small" style="width:10vw;" disabled />
  169. </div>
  170. <div class="right-item">
  171. <el-text style="width:4vw;" size="small">{{ t('common_add.activity') }}</el-text>
  172. <el-input v-model="auditRow.activity" size="small" style="width:10vw;" disabled />
  173. </div>
  174. <div class="right-item">
  175. <el-text style="width:4vw;" size="small">{{ t('common_add.payMethod') }}</el-text>
  176. <el-input v-model="auditRow.payType" size="small" style="width:10vw;" disabled />
  177. </div>
  178. <div class="right-item">
  179. <el-text style="width:4vw;" size="small">{{ t('common_add.receiveCurrency') }}</el-text>
  180. <el-input v-model="auditRow.receivedCurrency" size="small" style="width:10vw;" disabled />
  181. </div>
  182. <div class="right-item">
  183. <el-text style="width:4vw;" size="small">{{ t('common_add.receiveAmount') }}</el-text>
  184. <el-input v-model="auditRow.receivedAmount" size="small" style="width:10vw;" disabled />
  185. </div>
  186. <div class="right-item">
  187. <el-text style="width:4vw;" size="small">{{ t('common_add.receiveTime') }}</el-text>
  188. <el-input v-model="auditRow.receivedTime" size="small" style="width:10vw;" disabled />
  189. </div>
  190. <div class="right-item">
  191. <el-text style="width:4vw;" size="small">{{ t('common_add.fee') }}</el-text>
  192. <el-input v-model="auditRow.handlingCharge" size="small" style="width:10vw;" disabled />
  193. </div>
  194. <div class="right-item">
  195. <el-text style="width:4vw;" size="small">{{ t('common_add.submitter') }}</el-text>
  196. <el-input v-model="auditRow.submitter" size="small" style="width:10vw;" disabled />
  197. </div>
  198. <div class="right-item">
  199. <el-text style="width:4vw;" size="small">{{ t('common_add.remark') }}</el-text>
  200. <el-input v-model="auditRow.remark" size="small" style="width:10vw;" :row="3" maxlength="100"
  201. type="textarea" show-word-limit disabled />
  202. </div>
  203. </div>
  204. </div>
  205. <div class="bottom">
  206. <el-button class="smallTitle" size="small" v-show="showReject">{{ t('common.rejectInfo') }}</el-button>
  207. <div class="bottom-item" v-show="showReject">
  208. <el-text style="width:4vw;" size="small">{{ t('common_add.rejectRemark') }}</el-text>
  209. <el-input v-model="addForm.remark" :placeholder="t('common_add.rejectRemarkPlaceholder')" size="small"
  210. style="width:10vw;" :row="3" maxlength="100" type="textarea" show-word-limit clearable />
  211. </div>
  212. <div style="text-align: center;" v-show="!showReject">
  213. <el-button type="default" @click="showReject = true">{{ t('common.reject') }}</el-button>
  214. <el-button type="primary" @click="handlePass">{{ t('common.pass') }}</el-button>
  215. </div>
  216. <div style="text-align: center;" v-show="showReject">
  217. <el-button type="default" @click="hideReject">{{ t('common.cancel') }}</el-button>
  218. <el-button type="primary" @click="handleReject">{{ t('common.confirm') }}</el-button>
  219. </div>
  220. </div>
  221. </el-dialog>
  222. <el-dialog v-model="showSteps" overflow draggable width="1206px" height="506px" :style="{
  223. backgroundImage: `url(${RefundChargeBackground})`,
  224. backgroundSize: 'cover',
  225. backgroundPosition: 'center'
  226. }">
  227. <div class="steps">
  228. <div class="steps-content">
  229. <div class="reject-reason" v-if="isReject">{{ t('common_list.rejectReason') }}{{ rejectReason }}</div>
  230. <el-steps :active="currentStep" align-center>
  231. <el-step>
  232. <template #title>
  233. <div>
  234. {{ t('common_list.submitter') }}<br>{{ submitter || t('common.unknownSubmitter') }}
  235. </div>
  236. </template>
  237. <template #icon>
  238. <img src="@/assets/images/refund-approved.png" :alt="t('common.completed')">
  239. </template>
  240. </el-step>
  241. <el-step>
  242. <template #title>
  243. <div>
  244. {{ t('cash.progress.areaFinance') }}<br>{{ areaFinance || t('common.noAuditorRecorded')
  245. }}
  246. </div>
  247. </template>
  248. <template #icon>
  249. <img v-if="currentStep === 2" src="@/assets/images/refund-rejected.png"
  250. :alt="t('common.rejected')">
  251. <img v-else-if="currentStep === 1" src="@/assets/images/refund-approving.png"
  252. :alt="t('common.pendingAudit')">
  253. <img v-else-if="currentStep > 2" src="@/assets/images/refund-approved.png"
  254. :alt="t('common.passed')">
  255. </template>
  256. </el-step>
  257. <el-step>
  258. <template #title>
  259. <div>
  260. {{ t('cash.progress.areaCharge') }}<br>{{ areaCharge || t('common.noAuditorRecorded') }}
  261. </div>
  262. </template>
  263. <template #icon>
  264. <img v-if="currentStep === 4" src="@/assets/images/refund-rejected.png"
  265. :alt="t('common.rejected')">
  266. <img v-else-if="currentStep === 3" src="@/assets/images/refund-approving.png"
  267. :alt="t('common.pendingAudit')">
  268. <img v-else-if="currentStep > 3 && currentStep != 4"
  269. src="@/assets/images/refund-approved.png" :alt="t('common.audited')">
  270. <img v-else-if="currentStep < 3" src="@/assets/images/refund-waiting.png"
  271. :alt="t('common_list.activityStatus.notStarted')">
  272. </template>
  273. </el-step>
  274. <el-step>
  275. <template #title>
  276. <div>
  277. {{ t('cash.progress.headFinance') }}<br>{{ headFinance || t('common.noAuditorRecorded')
  278. }}
  279. </div>
  280. </template>
  281. <template #icon>
  282. <img v-if="currentStep === 6" src="@/assets/images/refund-rejected.png"
  283. :alt="t('common.rejected')">
  284. <img v-else-if="currentStep === 5" src="@/assets/images/refund-approving.png"
  285. :alt="t('common.pendingAudit')">
  286. <img v-else-if="currentStep > 5 && currentStep != 6"
  287. src="@/assets/images/refund-approved.png" :alt="t('common.audited')">
  288. <img v-else-if="currentStep < 5" src="@/assets/images/refund-waiting.png"
  289. :alt="t('common_list.activityStatus.notStarted')">
  290. </template>
  291. </el-step>
  292. <el-step>
  293. <template #title>
  294. <div>
  295. {{ t('cash.progress.executor') }}<br>{{ executor || t('common.noExecutorRecorded') }}
  296. </div>
  297. </template>
  298. <template #icon>
  299. <img v-if="currentStep === 7" src="@/assets/images/refund-approving.png"
  300. :alt="t('common_list.pending')">
  301. <img v-else-if="currentStep === 8" src="@/assets/images/refund-approved.png"
  302. :alt="t('common.completed')">
  303. <img v-else-if="currentStep < 7" src="@/assets/images/refund-waiting.png"
  304. :alt="t('common_list.activityStatus.notStarted')">
  305. </template>
  306. </el-step>
  307. </el-steps>
  308. </div>
  309. <div class="steps-btn">
  310. <el-button type="primary" @click="showSteps = false">{{ t('common.confirm') }}</el-button>
  311. </div>
  312. </div>
  313. </el-dialog>
  314. <el-dialog v-model="exportListVisible" :title="t('common_export.exportList')" width="80%">
  315. <el-table :data="exportList" style="width: 100% ;height: 60vh;" :loading="exportListLoading">
  316. <el-table-column prop="fileName" :label="t('common_export.fileName')" />
  317. <el-table-column prop="state" :label="t('common_export.status')">
  318. <template #default="scope">
  319. <el-tag :type="getTagType(scope.row.state)" :effect="scope.row.state === 3 ? 'light' : 'plain'">
  320. {{ getTagText(scope.row.state) }}
  321. </el-tag>
  322. </template>
  323. </el-table-column>
  324. <el-table-column prop="createTime" :label="t('common_export.createTime')">
  325. <template #default="scope">
  326. {{ moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}
  327. </template>
  328. </el-table-column>
  329. <el-table-column :label="t('common_export.operation')">
  330. <template #default="scope">
  331. <el-button type="primary" size="small" @click="downloadExportFile(scope.row)"
  332. :disabled="scope.row.state !== 2">
  333. {{ t('common_export.download') }}
  334. </el-button>
  335. </template>
  336. </el-table-column>
  337. </el-table>
  338. <template #footer>
  339. <div class="dialog-footer">
  340. <el-button text @click="exportListVisible = false">{{ t('common_export.close') }}</el-button>
  341. </div>
  342. </template>
  343. </el-dialog>
  344. </template>
  345. <script setup>
  346. import { ref, onMounted, computed, nextTick, watch, onBeforeUnmount } from 'vue'
  347. import { ElMessage } from 'element-plus'
  348. import API from '@/util/http.js'
  349. const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'
  350. import { useAdminStore } from "@/store/index.js"
  351. import { storeToRefs } from "pinia"
  352. import dayjs from 'dayjs'
  353. const adminStore = useAdminStore()
  354. const { adminData, menuTree } = storeToRefs(adminStore)
  355. import { permissionMapping, findMenuById, hasMenuPermission } from "@/utils/menuTreePermission.js"
  356. import moment from 'moment'
  357. import { productList, CurrencyForId } from '@/views/moneyManage/receiveDetail/utils/staticData.js'
  358. import RefundChargeBackground from '@/assets/images/refund-progress.png'
  359. import { isNumber } from 'lodash'
  360. import { useI18n } from 'vue-i18n'
  361. const { t } = useI18n()
  362. const currentStep = ref(0)// 进度图
  363. const searchForm = ref({
  364. jwcode: '',
  365. markets: []
  366. })
  367. const isHeadquarters = computed(() => {
  368. const m = adminData.value.markets
  369. return m === t('common.markets.headquarters') || m === '总部' || m === 'Headquarters'
  370. })
  371. const isReject = ref(false)// 进度图有没有驳回状态
  372. const rejectReason = ref('')// 驳回理由,进度图
  373. const addForm = ref({
  374. remark: ''
  375. })
  376. const showReject = ref(false)
  377. const auditRow = ref({})// 审核回显
  378. const dateRange = ref([])
  379. const pagination = ref({
  380. pageNum: 1,
  381. pageSize: 50,
  382. total: 0
  383. })
  384. const market = ref([])
  385. const showAudit2 = ref(false)
  386. const tableData = ref([])
  387. const tableRef = ref(null)
  388. const scrollTableTop = () => {
  389. tableRef.value?.setScrollTop?.(0)
  390. }
  391. const showSteps = ref(false)
  392. const submitter = ref('')// 提交人
  393. const areaFinance = ref('')// 地区财务
  394. const areaCharge = ref('')// 地区负责人
  395. const headFinance = ref('')// 总部财务
  396. const executor = ref('')// 指定执行人
  397. const uploadRef = ref(null)
  398. const exportListVisible = ref(false)
  399. const EXPORT_LIST_POLL_INTERVAL = 3000
  400. let exportListPollingTimer = null
  401. const exportList = ref([])
  402. // 导出列表加载状态
  403. const exportListLoading = ref(false)
  404. const exportListRequesting = ref(false)
  405. const sortExportList = (list = []) => {
  406. return [...list].sort((a, b) => {
  407. return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
  408. })
  409. }
  410. const hasPendingExportTask = (list = []) => {
  411. const latestTask = sortExportList(list)[0]
  412. return latestTask ? latestTask.state === 0 || latestTask.state === 1 : false
  413. }
  414. const stopExportListPolling = () => {
  415. if (exportListPollingTimer) {
  416. clearInterval(exportListPollingTimer)
  417. exportListPollingTimer = null
  418. }
  419. }
  420. const startExportListPolling = () => {
  421. if (exportListPollingTimer) {
  422. return
  423. }
  424. exportListPollingTimer = setInterval(() => {
  425. if (!exportListVisible.value) {
  426. stopExportListPolling()
  427. return
  428. }
  429. getExportList({ showLoading: false, silentError: true })
  430. }, EXPORT_LIST_POLL_INTERVAL)
  431. }
  432. const statusStepMap = {
  433. 10: [1, false],
  434. 12: [2, true],
  435. 20: [3, false],
  436. 22: [4, true],
  437. 30: [5, false],
  438. 32: [6, true],
  439. 40: [7, false],
  440. 41: [8, false]
  441. }
  442. const currencies = computed(() => [
  443. t('cash.currency.usd'),
  444. t('cash.currency.hkd'),
  445. t('cash.currency.sgd'),
  446. t('cash.currency.myr'),
  447. t('cash.currency.thb'),
  448. t('cash.currency.cad'),
  449. t('cash.currency.vnd'),
  450. t('cash.currency.krw')
  451. ])
  452. const channelOptions = computed(() => [
  453. t('cash.payMethods.stripe'),
  454. t('cash.payMethods.paymentAsia'),
  455. t('cash.payMethods.ipay88'),
  456. t('cash.payMethods.bankTransfer'),
  457. t('cash.payMethods.card'),
  458. t('cash.payMethods.cash'),
  459. t('cash.payMethods.check'),
  460. t('cash.payMethods.grabpay'),
  461. t('cash.payMethods.nets'),
  462. t('cash.payMethods.transfer'),
  463. t('cash.payMethods.iotPay'),
  464. t('cash.payMethods.stripe3'),
  465. t('cash.payMethods.paypal')
  466. ])
  467. const statusList = computed(() => [
  468. t('cash.statusList.pending'),
  469. t('cash.statusList.passed'),
  470. t('cash.statusList.rejected'),
  471. t('cash.refundSuccess')
  472. ])
  473. // 查全部
  474. const getRefund = async function () {
  475. if (!hasMenuPermission(menuTree.value, permissionMapping.view_area_manager_refund)) {
  476. ElMessage.error(t('elmessage.noPermission'))
  477. return
  478. }
  479. try {
  480. const payCurrencySelect = ref('')
  481. const statuses = ref([20, 22, 30, 32, 40, 41]) // 看不到进度没到这里的
  482. if (searchForm.value.statuses === t('cash.statusList.passed')) {
  483. statuses.value = [30, 40]
  484. } else if (searchForm.value.statuses === t('cash.statusList.rejected')) {
  485. statuses.value = [22, 32]
  486. } else if (searchForm.value.statuses === t('cash.statusList.pending')) {
  487. statuses.value = [20]
  488. } else if (searchForm.value.statuses === t('cash.refundSuccess')) {
  489. statuses.value = [41]
  490. } else {
  491. statuses.value = [20, 22, 30, 32, 40, 41]
  492. }
  493. const goodsName = searchForm.value.goodsName && searchForm.value.goodsName.length > 0
  494. ? searchForm.value.goodsName[searchForm.value.goodsName.length - 1] : ''
  495. if (searchForm.value.jwcode) {
  496. const isPositiveInteger = /^[1-9]\d*$/.test(searchForm.value.jwcode);
  497. if (!isPositiveInteger) {
  498. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  499. return;
  500. }
  501. }
  502. // 增加精网号长度限制,防止后端400错误
  503. if (searchForm.value.jwcode.length > 8) {
  504. ElMessage.error(t('elmessage.limitJwcodeLength'))
  505. return;
  506. }
  507. if (searchForm.value.paymentCurrency) {
  508. payCurrencySelect.value = CurrencyForId(searchForm.value.paymentCurrency)
  509. }
  510. const params = {
  511. pageNum: pagination.value.pageNum,
  512. pageSize: pagination.value.pageSize,
  513. cashRecordDTO: {
  514. jwcode: searchForm.value.jwcode,//精网号
  515. name: searchForm.value.name,//姓名
  516. markets: searchForm.value.markets && searchForm.value.markets.length > 0 ? [searchForm.value.markets[searchForm.value.markets.length - 1]] : [],
  517. goodsName: goodsName,//商品名
  518. statuses: statuses.value,//10:地区财务待审核;12:地区财务驳回;
  519. // 20:地区负责人待审核;22:地区负责人驳回;
  520. // 30:总部财务待审核;32:总部财务驳回;
  521. // 40:执行人待处理;41:执行人已处理,退款完成;
  522. paymentCurrency: payCurrencySelect.value,//付款币种
  523. payType: searchForm.value.payType,//支付方式
  524. startTime: dateRange.value && dateRange.value[0] ? dayjs(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : "",
  525. endTime: dateRange.value && dateRange.value[1] ? dayjs(dateRange.value[1]).format('YYYY-MM-DD HH:mm:ss') : "",
  526. adminId: adminData.value.id
  527. }
  528. }
  529. const result = await API({
  530. url: '/Money/select',
  531. method: 'POST',
  532. data: params
  533. })
  534. tableData.value = result.data.list || []
  535. await nextTick()
  536. scrollTableTop()
  537. pagination.value.total = result.data.total || 0
  538. } catch (error) {
  539. ElMessage.error(error.message || t('elmessage.searchFailed'))
  540. }
  541. }
  542. // 审核通过
  543. const handlePass = async function () {
  544. if (!hasMenuPermission(menuTree.value, permissionMapping.audit_area_manager_refund)) {
  545. ElMessage.error(t('elmessage.noPermission'))
  546. return
  547. }
  548. try {
  549. const params = {
  550. id: auditRow.value.id,
  551. status: 30,
  552. rejectReason: addForm.value.remark,
  553. areaCharge: adminData.value.adminName,
  554. auditId: auditRow.value.auditId,
  555. relatedId: auditRow.value.relatedId
  556. }
  557. const result = await API({
  558. url: '/Money/review',
  559. data: params
  560. })
  561. if (result.code === 200) {
  562. ElMessage.success(t('elmessage.approveSuccess'))
  563. showAudit2.value = false
  564. getRefund()
  565. }
  566. } catch (error) {
  567. ElMessage.error(error.message || t('elmessage.approveFailed'))
  568. }
  569. }
  570. // 审核驳回
  571. const handleReject = async function () {
  572. if (!hasMenuPermission(menuTree.value, permissionMapping.audit_area_manager_refund)) {
  573. ElMessage.error(t('elmessage.noPermission'))
  574. return
  575. }
  576. try {
  577. const params = {
  578. id: auditRow.value.id,
  579. status: 22,
  580. rejectReason: addForm.value.remark,
  581. areaCharge: adminData.value.adminName,
  582. auditId: auditRow.value.auditId,
  583. orderCode: auditRow.value.orderCode,
  584. relatedId: auditRow.value.relatedId
  585. }
  586. const result = await API({
  587. url: '/Money/review',
  588. data: params
  589. })
  590. if (result.code === 200) {
  591. ElMessage.success(t('elmessage.rejectSuccess'))
  592. getRefund()
  593. addForm.value.remark = ''
  594. showAudit2.value = false
  595. showReject.value = false
  596. }
  597. } catch (error) {
  598. ElMessage.error(error.message || t('elmessage.approveFailed'))
  599. }
  600. }
  601. const showStep = function (row) {
  602. if (!hasMenuPermission(menuTree.value, permissionMapping.track_area_manager_refund_progress)) {
  603. ElMessage.error(t('elmessage.noPermission'))
  604. return
  605. }
  606. rejectReason.value = row.rejectReason || ''
  607. isReject.value = false
  608. submitter.value = row.submitter || ''
  609. areaFinance.value = row.areaFinance || ''
  610. areaCharge.value = row.areaCharge || ''
  611. headFinance.value = row.headFinance || ''
  612. executor.value = row.executorName || ''
  613. currentStep.value = 1
  614. const status = row.status
  615. if (statusStepMap[status]) {
  616. const [step, reject] = statusStepMap[status]
  617. currentStep.value = step
  618. isReject.value = reject
  619. }
  620. console.log('步骤条状态', currentStep.value)
  621. showSteps.value = true
  622. }
  623. const getMarket = async function () {
  624. try {
  625. const result = await API({
  626. url: '/market/selectMarket',
  627. })
  628. console.log('看看地区树', result)
  629. const transformTree = (nodes) => {
  630. const allChildren = nodes.flatMap(node => node.children || []);
  631. return allChildren.map(child => {
  632. const grandchildren = child.children && child.children.length
  633. ? transformTree([child])
  634. : null;
  635. return {
  636. value: child.id,
  637. label: child.name,
  638. children: grandchildren
  639. };
  640. });
  641. };
  642. market.value = transformTree(result.data)
  643. console.log('转换后的地区树==============', market.value)
  644. } catch (error) {
  645. console.log('请求失败', error)
  646. }
  647. }
  648. //图片预览
  649. const previewImage = (imageUrl) => {
  650. if (!imageUrl) return;
  651. const imageElement = document.createElement('img');
  652. imageElement.src = imageUrl;
  653. imageElement.style.maxWidth = '90vw';
  654. imageElement.style.maxHeight = '90vh';
  655. imageElement.style.display = 'block';
  656. imageElement.style.transition = 'transform 0.2s ease-out';
  657. imageElement.style.cursor = 'zoom-in';
  658. imageElement.style.transformOrigin = 'center center'; // 缩放中心点
  659. const viewer = document.createElement('div');
  660. viewer.style.position = 'fixed';
  661. viewer.style.top = '0';
  662. viewer.style.left = '0';
  663. viewer.style.width = '100vw';
  664. viewer.style.height = '100vh';
  665. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  666. viewer.style.display = 'flex';
  667. viewer.style.justifyContent = 'center';
  668. viewer.style.alignItems = 'center';
  669. viewer.style.overflow = 'hidden';
  670. viewer.style.zIndex = '999999';
  671. viewer.appendChild(imageElement);
  672. let currentScale = 1;
  673. const scaleStep = 0.2;
  674. const handleWheel = (e) => {
  675. e.preventDefault();
  676. if (e.deltaY > 0) {
  677. currentScale -= scaleStep;
  678. } else {
  679. currentScale += scaleStep;
  680. }
  681. if (currentScale < 0.5) currentScale = 0.5;
  682. imageElement.style.transform = `scale(${currentScale})`;
  683. imageElement.style.cursor = currentScale > 1 ? 'zoom-out' : 'zoom-in';
  684. };
  685. viewer.addEventListener('wheel', handleWheel, { passive: false });
  686. viewer.addEventListener('click', (e) => {
  687. if (e.target === viewer) {
  688. document.body.removeChild(viewer);
  689. viewer.removeEventListener('wheel', handleWheel);
  690. }
  691. });
  692. document.body.appendChild(viewer);
  693. };
  694. const exportExcel = async function () {
  695. const payCurrencySelect = ref('')
  696. const statuses = ref([20, 22, 30, 32, 40, 41]) // 看不到进度没到这里的
  697. if (searchForm.value.statuses === t('cash.statusList.passed')) {
  698. statuses.value = [30, 40]
  699. } else if (searchForm.value.statuses === t('cash.statusList.rejected')) {
  700. statuses.value = [22, 32]
  701. } else if (searchForm.value.statuses === t('cash.statusList.pending')) {
  702. statuses.value = [20]
  703. } else if (searchForm.value.statuses === t('cash.refundSuccess')) {
  704. statuses.value = [41]
  705. } else {
  706. statuses.value = [20, 22, 30, 32, 40, 41]
  707. }
  708. const goodsName = searchForm.value.goodsName && searchForm.value.goodsName.length > 0
  709. ? searchForm.value.goodsName[searchForm.value.goodsName.length - 1] : ''
  710. if (searchForm.value.jwcode) {
  711. const isPositiveInteger = /^[1-9]\d*$/.test(searchForm.value.jwcode);
  712. if (!isPositiveInteger) {
  713. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  714. return
  715. }
  716. }
  717. // 增加精网号长度限制,防止后端400错误
  718. if (searchForm.value.jwcode.length > 8) {
  719. ElMessage.error(t('elmessage.limitJwcodeLength'))
  720. return;
  721. }
  722. if (searchForm.value.paymentCurrency) {
  723. payCurrencySelect.value = CurrencyForId(searchForm.value.paymentCurrency)
  724. }
  725. const params = {
  726. pageNum: pagination.value.pageNum,
  727. pageSize: pagination.value.pageSize,
  728. cashRecordDTO: {
  729. jwcode: searchForm.value.jwcode,//精网号
  730. name: searchForm.value.name,//姓名
  731. markets: searchForm.value.markets && searchForm.value.markets.length > 0 ? [searchForm.value.markets[searchForm.value.markets.length - 1]] : [],
  732. goodsName: goodsName,//商品名
  733. statuses: statuses.value,//10:地区财务待审核;12:地区财务驳回;
  734. // 20:地区负责人待审核;22:地区负责人驳回;
  735. // 30:总部财务待审核;32:总部财务驳回;
  736. // 40:执行人待处理;41:执行人已处理,退款完成;
  737. paymentCurrency: payCurrencySelect.value,//付款币种
  738. payType: searchForm.value.payType,//支付方式
  739. startTime: dateRange.value && dateRange.value[0] ? dayjs(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : "",
  740. endTime: dateRange.value && dateRange.value[1] ? dayjs(dateRange.value[1]).format('YYYY-MM-DD HH:mm:ss') : "",
  741. adminId: adminData.value.id
  742. }
  743. }
  744. const res = await API({ url: '/export/exportFinance', data: params })
  745. if (res.code === 200) {
  746. ElMessage.success(t('elmessage.exportSuccess'))
  747. }
  748. }
  749. const openExportList = () => {
  750. exportListVisible.value = true
  751. }
  752. const getExportList = async ({ showLoading = true, silentError = false } = {}) => {
  753. if (exportListRequesting.value) {
  754. return
  755. }
  756. if (showLoading) {
  757. exportListLoading.value = true
  758. }
  759. exportListRequesting.value = true
  760. try {
  761. const result = await API({ url: '/export/export' })
  762. if (result.code === 200) {
  763. const filteredData = result.data.filter(item => {
  764. return item.type === 12
  765. })
  766. exportList.value = sortExportList(filteredData)
  767. if (exportListVisible.value && hasPendingExportTask(exportList.value)) {
  768. startExportListPolling()
  769. } else {
  770. stopExportListPolling()
  771. }
  772. } else {
  773. stopExportListPolling()
  774. if (!silentError) {
  775. ElMessage.error(result.msg || t('elmessage.getExportListError'))
  776. }
  777. }
  778. } catch (error) {
  779. console.error('获取导出列表出错:', error)
  780. stopExportListPolling()
  781. if (!silentError) {
  782. ElMessage.error(t('elmessage.getExportListError'))
  783. }
  784. } finally {
  785. exportListRequesting.value = false
  786. if (showLoading) {
  787. exportListLoading.value = false
  788. }
  789. }
  790. }
  791. const downloadExportFile = (item) => {
  792. if (item.state === 2) {
  793. const link = document.createElement('a')
  794. link.href = item.url
  795. link.download = item.fileName
  796. link.click()
  797. } else {
  798. ElMessage.warning(t('elmessage.exportingInProgress'))
  799. }
  800. }
  801. //根据状态返回对应的标签类型
  802. const getTagType = (state) => {
  803. switch (state) {
  804. case 0:
  805. return 'info';
  806. case 1:
  807. return 'primary';
  808. case 2:
  809. return 'success';
  810. case 3:
  811. return 'danger';
  812. default:
  813. return 'info';
  814. }
  815. }
  816. //根据状态返回对应的标签文案
  817. const getTagText = (state) => {
  818. switch (state) {
  819. case 0:
  820. return t('elmessage.pendingExecution');
  821. case 1:
  822. return t('elmessage.executing');
  823. case 2:
  824. return t('elmessage.executed');
  825. case 3:
  826. return t('elmessage.errorExecution');
  827. default:
  828. return t('elmessage.unknownStatus');
  829. }
  830. }
  831. const hideReject = function () {
  832. showReject.value = false
  833. addForm.value.remark = ''
  834. }
  835. const reset = function () {
  836. searchForm.value = {
  837. jwcode: '',
  838. markets: [],
  839. statuses: []
  840. }
  841. // 重置页码
  842. pagination.value.pageNum = 1
  843. dateRange.value = []
  844. getRefund()
  845. }
  846. const showAudit = function (row) {
  847. auditRow.value = row
  848. showAudit2.value = true
  849. }
  850. const defaultTime = [
  851. new Date(2000, 1, 1, 0, 0, 0),
  852. new Date(2000, 2, 1, 23, 59, 59),
  853. ]
  854. const disabledDate = (time) => {
  855. const limitDate = new Date(2025, 0, 1);
  856. return time.getTime() < limitDate.getTime();
  857. }
  858. const handlePageSizeChange = function (val) {
  859. pagination.value.pageSize = val
  860. getRefund()
  861. }
  862. const handleCurrentChange = function (val) {
  863. pagination.value.pageNum = val
  864. getRefund()
  865. }
  866. onMounted(() => {
  867. getRefund()
  868. getMarket()
  869. })
  870. watch(exportListVisible, (visible) => {
  871. if (visible) {
  872. getExportList()
  873. } else {
  874. stopExportListPolling()
  875. }
  876. })
  877. onBeforeUnmount(() => {
  878. stopExportListPolling()
  879. })
  880. </script>
  881. <style scoped lang="scss">
  882. :deep(.el-table__header-wrapper),
  883. :deep(.el-table__body-wrapper),
  884. :deep(.el-table__cell),
  885. :deep(.el-table__body td) {
  886. background-color: #F3FAFE !important;
  887. }
  888. :deep(.el-table__header th) {
  889. background-color: #F3FAFE !important;
  890. }
  891. .condition {
  892. width: 90vw;
  893. display: flex;
  894. flex-direction: column;
  895. align-items: flex-start;
  896. gap: 0.8vh;
  897. .item1 {
  898. width: 16%;
  899. display: flex;
  900. align-items: center;
  901. margin-right: 1vw;
  902. }
  903. .item2 {
  904. width: 18%;
  905. display: flex;
  906. align-items: center;
  907. margin-right: 0.5vw;
  908. }
  909. .condition-row {
  910. display: flex;
  911. align-items: center;
  912. width: 100%;
  913. }
  914. .condition-actions {
  915. margin-left: 2vw;
  916. display: flex;
  917. align-items: center;
  918. gap: 0.5vw;
  919. }
  920. }
  921. .audit1 {
  922. height: 47vh;
  923. .audit-item {
  924. display: flex;
  925. align-items: center;
  926. margin-bottom: 1vh;
  927. }
  928. }
  929. .audit2 {
  930. display: flex;
  931. justify-content: center;
  932. height: auto;
  933. min-height: 40vh;
  934. .top {
  935. width: 30vw;
  936. height: 22vh;
  937. .top-item {
  938. display: flex;
  939. align-items: center;
  940. margin-bottom: 1vh;
  941. }
  942. }
  943. .smallTitle {
  944. background-color: white;
  945. color: rgb(64, 158, 255);
  946. border-color: rgb(64, 158, 255);
  947. margin-bottom: 0.5vh;
  948. }
  949. .center {
  950. display: flex;
  951. width: 30vw;
  952. height: 35vh;
  953. .dialog-item {
  954. display: flex;
  955. align-items: center;
  956. margin-bottom: 1vh;
  957. }
  958. .center-left {
  959. width: 60%;
  960. height: 35vh;
  961. .image {
  962. width: 4vw !important;
  963. height: 4vw !important;
  964. }
  965. :deep(.el-upload--picture-card) {
  966. width: 4vw !important;
  967. height: 4vw !important;
  968. padding: 0 !important;
  969. }
  970. .center-item {
  971. display: flex;
  972. align-items: center;
  973. margin-bottom: 1vh;
  974. }
  975. }
  976. .center-right {
  977. height: 35vh;
  978. .right-item {
  979. display: flex;
  980. align-items: center;
  981. margin-bottom: 1vh;
  982. }
  983. }
  984. }
  985. .bottom {
  986. width: 30vw;
  987. height: 12vh;
  988. .bottom-item {
  989. display: flex;
  990. align-items: center;
  991. margin-bottom: 1vh;
  992. }
  993. }
  994. }
  995. .steps {
  996. .steps-content {
  997. padding-top: 15vw;
  998. }
  999. .steps-status {
  1000. display: flex;
  1001. align-items: center;
  1002. justify-content: center;
  1003. }
  1004. .reject-reason {
  1005. margin-top: 2vh;
  1006. width: 40%;
  1007. margin-left: 30%;
  1008. background-color: white;
  1009. padding: 1vh;
  1010. border-radius: 10px;
  1011. margin-bottom: 10vh;
  1012. }
  1013. .steps-btn {
  1014. height: 15vh;
  1015. display: flex;
  1016. justify-content: center;
  1017. align-items: center;
  1018. }
  1019. }
  1020. </style>