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.

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