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.

1026 lines
41 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
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
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 } 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 exportList = ref([])
  400. // 导出列表加载状态
  401. const exportListLoading = ref(false)
  402. const statusStepMap = {
  403. 10: [1, false],
  404. 12: [2, true],
  405. 20: [3, false],
  406. 22: [4, true],
  407. 30: [5, false],
  408. 32: [6, true],
  409. 40: [7, false],
  410. 41: [8, false]
  411. }
  412. const currencies = computed(() => [
  413. t('cash.currency.usd'),
  414. t('cash.currency.hkd'),
  415. t('cash.currency.sgd'),
  416. t('cash.currency.myr'),
  417. t('cash.currency.thb'),
  418. t('cash.currency.cad'),
  419. t('cash.currency.vnd'),
  420. t('cash.currency.krw')
  421. ])
  422. const channelOptions = computed(() => [
  423. t('cash.payMethods.stripe'),
  424. t('cash.payMethods.paymentAsia'),
  425. t('cash.payMethods.ipay88'),
  426. t('cash.payMethods.bankTransfer'),
  427. t('cash.payMethods.card'),
  428. t('cash.payMethods.cash'),
  429. t('cash.payMethods.check'),
  430. t('cash.payMethods.grabpay'),
  431. t('cash.payMethods.nets'),
  432. t('cash.payMethods.transfer'),
  433. t('cash.payMethods.iotPay'),
  434. t('cash.payMethods.stripe3'),
  435. t('cash.payMethods.paypal')
  436. ])
  437. const statusList = computed(() => [
  438. t('cash.statusList.pending'),
  439. t('cash.statusList.passed'),
  440. t('cash.statusList.rejected'),
  441. t('cash.refundSuccess')
  442. ])
  443. // 查全部
  444. const getRefund = async function () {
  445. if (!hasMenuPermission(menuTree.value, permissionMapping.view_area_manager_refund)) {
  446. ElMessage.error(t('elmessage.noPermission'))
  447. return
  448. }
  449. try {
  450. const payCurrencySelect = ref('')
  451. const statuses = ref([20, 22, 30, 32, 40, 41]) // 看不到进度没到这里的
  452. if (searchForm.value.statuses === t('cash.statusList.passed')) {
  453. statuses.value = [30, 40]
  454. } else if (searchForm.value.statuses === t('cash.statusList.rejected')) {
  455. statuses.value = [22, 32]
  456. } else if (searchForm.value.statuses === t('cash.statusList.pending')) {
  457. statuses.value = [20]
  458. } else if (searchForm.value.statuses === t('cash.refundSuccess')) {
  459. statuses.value = [41]
  460. } else {
  461. statuses.value = [20, 22, 30, 32, 40, 41]
  462. }
  463. const goodsName = searchForm.value.goodsName && searchForm.value.goodsName.length > 0
  464. ? searchForm.value.goodsName[searchForm.value.goodsName.length - 1] : ''
  465. if (searchForm.value.jwcode) {
  466. const isPositiveInteger = /^[1-9]\d*$/.test(searchForm.value.jwcode);
  467. if (!isPositiveInteger) {
  468. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  469. return;
  470. }
  471. }
  472. // 增加精网号长度限制,防止后端400错误
  473. if (searchForm.value.jwcode.length > 8) {
  474. ElMessage.error(t('elmessage.limitJwcodeLength'))
  475. return;
  476. }
  477. if (searchForm.value.paymentCurrency) {
  478. payCurrencySelect.value = CurrencyForId(searchForm.value.paymentCurrency)
  479. }
  480. const params = {
  481. pageNum: pagination.value.pageNum,
  482. pageSize: pagination.value.pageSize,
  483. cashRecordDTO: {
  484. jwcode: searchForm.value.jwcode,//精网号
  485. name: searchForm.value.name,//姓名
  486. markets: searchForm.value.markets && searchForm.value.markets.length > 0 ? [searchForm.value.markets[searchForm.value.markets.length - 1]] : [],
  487. goodsName: goodsName,//商品名
  488. statuses: statuses.value,//10:地区财务待审核;12:地区财务驳回;
  489. // 20:地区负责人待审核;22:地区负责人驳回;
  490. // 30:总部财务待审核;32:总部财务驳回;
  491. // 40:执行人待处理;41:执行人已处理,退款完成;
  492. paymentCurrency: payCurrencySelect.value,//付款币种
  493. payType: searchForm.value.payType,//支付方式
  494. startTime: dateRange.value && dateRange.value[0] ? dayjs(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : "",
  495. endTime: dateRange.value && dateRange.value[1] ? dayjs(dateRange.value[1]).format('YYYY-MM-DD HH:mm:ss') : "",
  496. adminId: adminData.value.id
  497. }
  498. }
  499. const result = await API({
  500. url: '/Money/select',
  501. method: 'POST',
  502. data: params
  503. })
  504. tableData.value = result.data.list || []
  505. await nextTick()
  506. scrollTableTop()
  507. pagination.value.total = result.data.total || 0
  508. } catch (error) {
  509. ElMessage.error(error.message || t('elmessage.searchFailed'))
  510. }
  511. }
  512. // 审核通过
  513. const handlePass = async function () {
  514. if (!hasMenuPermission(menuTree.value, permissionMapping.audit_area_manager_refund)) {
  515. ElMessage.error(t('elmessage.noPermission'))
  516. return
  517. }
  518. try {
  519. const params = {
  520. id: auditRow.value.id,
  521. status: 30,
  522. rejectReason: addForm.value.remark,
  523. areaCharge: adminData.value.adminName,
  524. auditId: auditRow.value.auditId,
  525. relatedId: auditRow.value.relatedId
  526. }
  527. const result = await API({
  528. url: '/Money/review',
  529. data: params
  530. })
  531. if (result.code === 200) {
  532. ElMessage.success(t('elmessage.approveSuccess'))
  533. showAudit2.value = false
  534. getRefund()
  535. }
  536. } catch (error) {
  537. ElMessage.error(error.message || t('elmessage.approveFailed'))
  538. }
  539. }
  540. // 审核驳回
  541. const handleReject = async function () {
  542. if (!hasMenuPermission(menuTree.value, permissionMapping.audit_area_manager_refund)) {
  543. ElMessage.error(t('elmessage.noPermission'))
  544. return
  545. }
  546. try {
  547. const params = {
  548. id: auditRow.value.id,
  549. status: 22,
  550. rejectReason: addForm.value.remark,
  551. areaCharge: adminData.value.adminName,
  552. auditId: auditRow.value.auditId,
  553. orderCode: auditRow.value.orderCode,
  554. relatedId: auditRow.value.relatedId
  555. }
  556. const result = await API({
  557. url: '/Money/review',
  558. data: params
  559. })
  560. if (result.code === 200) {
  561. ElMessage.success(t('elmessage.rejectSuccess'))
  562. getRefund()
  563. addForm.value.remark = ''
  564. showAudit2.value = false
  565. showReject.value = false
  566. }
  567. } catch (error) {
  568. ElMessage.error(error.message || t('elmessage.approveFailed'))
  569. }
  570. }
  571. const showStep = function (row) {
  572. if (!hasMenuPermission(menuTree.value, permissionMapping.track_area_manager_refund_progress)) {
  573. ElMessage.error(t('elmessage.noPermission'))
  574. return
  575. }
  576. rejectReason.value = row.rejectReason || ''
  577. isReject.value = false
  578. submitter.value = row.submitter || ''
  579. areaFinance.value = row.areaFinance || ''
  580. areaCharge.value = row.areaCharge || ''
  581. headFinance.value = row.headFinance || ''
  582. executor.value = row.executorName || ''
  583. currentStep.value = 1
  584. const status = row.status
  585. if (statusStepMap[status]) {
  586. const [step, reject] = statusStepMap[status]
  587. currentStep.value = step
  588. isReject.value = reject
  589. }
  590. console.log('步骤条状态', currentStep.value)
  591. showSteps.value = true
  592. }
  593. const getMarket = async function () {
  594. try {
  595. const result = await API({
  596. url: '/market/selectMarket',
  597. })
  598. console.log('看看地区树', result)
  599. const transformTree = (nodes) => {
  600. const allChildren = nodes.flatMap(node => node.children || []);
  601. return allChildren.map(child => {
  602. const grandchildren = child.children && child.children.length
  603. ? transformTree([child])
  604. : null;
  605. return {
  606. value: child.id,
  607. label: child.name,
  608. children: grandchildren
  609. };
  610. });
  611. };
  612. market.value = transformTree(result.data)
  613. console.log('转换后的地区树==============', market.value)
  614. } catch (error) {
  615. console.log('请求失败', error)
  616. }
  617. }
  618. //图片预览
  619. const previewImage = (imageUrl) => {
  620. if (!imageUrl) return;
  621. const imageElement = document.createElement('img');
  622. imageElement.src = imageUrl;
  623. imageElement.style.maxWidth = '90vw';
  624. imageElement.style.maxHeight = '90vh';
  625. imageElement.style.display = 'block';
  626. imageElement.style.transition = 'transform 0.2s ease-out';
  627. imageElement.style.cursor = 'zoom-in';
  628. imageElement.style.transformOrigin = 'center center'; // 缩放中心点
  629. const viewer = document.createElement('div');
  630. viewer.style.position = 'fixed';
  631. viewer.style.top = '0';
  632. viewer.style.left = '0';
  633. viewer.style.width = '100vw';
  634. viewer.style.height = '100vh';
  635. viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  636. viewer.style.display = 'flex';
  637. viewer.style.justifyContent = 'center';
  638. viewer.style.alignItems = 'center';
  639. viewer.style.overflow = 'hidden';
  640. viewer.style.zIndex = '999999';
  641. viewer.appendChild(imageElement);
  642. let currentScale = 1;
  643. const scaleStep = 0.2;
  644. const handleWheel = (e) => {
  645. e.preventDefault();
  646. if (e.deltaY > 0) {
  647. currentScale -= scaleStep;
  648. } else {
  649. currentScale += scaleStep;
  650. }
  651. if (currentScale < 0.5) currentScale = 0.5;
  652. imageElement.style.transform = `scale(${currentScale})`;
  653. imageElement.style.cursor = currentScale > 1 ? 'zoom-out' : 'zoom-in';
  654. };
  655. viewer.addEventListener('wheel', handleWheel, { passive: false });
  656. viewer.addEventListener('click', (e) => {
  657. if (e.target === viewer) {
  658. document.body.removeChild(viewer);
  659. viewer.removeEventListener('wheel', handleWheel);
  660. }
  661. });
  662. document.body.appendChild(viewer);
  663. };
  664. const exportExcel = async function () {
  665. const payCurrencySelect = ref('')
  666. const statuses = ref([20, 22, 30, 32, 40, 41]) // 看不到进度没到这里的
  667. if (searchForm.value.statuses === t('cash.statusList.passed')) {
  668. statuses.value = [30, 40]
  669. } else if (searchForm.value.statuses === t('cash.statusList.rejected')) {
  670. statuses.value = [22, 32]
  671. } else if (searchForm.value.statuses === t('cash.statusList.pending')) {
  672. statuses.value = [20]
  673. } else if (searchForm.value.statuses === t('cash.refundSuccess')) {
  674. statuses.value = [41]
  675. } else {
  676. statuses.value = [20, 22, 30, 32, 40, 41]
  677. }
  678. const goodsName = searchForm.value.goodsName && searchForm.value.goodsName.length > 0
  679. ? searchForm.value.goodsName[searchForm.value.goodsName.length - 1] : ''
  680. if (searchForm.value.jwcode) {
  681. const isPositiveInteger = /^[1-9]\d*$/.test(searchForm.value.jwcode);
  682. if (!isPositiveInteger) {
  683. ElMessage.error(t('elmessage.checkJwcodeFormat'))
  684. return
  685. }
  686. }
  687. // 增加精网号长度限制,防止后端400错误
  688. if (searchForm.value.jwcode.length > 8) {
  689. ElMessage.error(t('elmessage.limitJwcodeLength'))
  690. return;
  691. }
  692. if (searchForm.value.paymentCurrency) {
  693. payCurrencySelect.value = CurrencyForId(searchForm.value.paymentCurrency)
  694. }
  695. const params = {
  696. pageNum: pagination.value.pageNum,
  697. pageSize: pagination.value.pageSize,
  698. cashRecordDTO: {
  699. jwcode: searchForm.value.jwcode,//精网号
  700. name: searchForm.value.name,//姓名
  701. markets: searchForm.value.markets && searchForm.value.markets.length > 0 ? [searchForm.value.markets[searchForm.value.markets.length - 1]] : [],
  702. goodsName: goodsName,//商品名
  703. statuses: statuses.value,//10:地区财务待审核;12:地区财务驳回;
  704. // 20:地区负责人待审核;22:地区负责人驳回;
  705. // 30:总部财务待审核;32:总部财务驳回;
  706. // 40:执行人待处理;41:执行人已处理,退款完成;
  707. paymentCurrency: payCurrencySelect.value,//付款币种
  708. payType: searchForm.value.payType,//支付方式
  709. startTime: dateRange.value && dateRange.value[0] ? dayjs(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : "",
  710. endTime: dateRange.value && dateRange.value[1] ? dayjs(dateRange.value[1]).format('YYYY-MM-DD HH:mm:ss') : "",
  711. adminId: adminData.value.id
  712. }
  713. }
  714. const res = await API({ url: '/export/exportFinance', data: params })
  715. if (res.code === 200) {
  716. ElMessage.success(t('elmessage.exportSuccess'))
  717. }
  718. }
  719. const openExportList = () => {
  720. getExportList()
  721. exportListVisible.value = true
  722. }
  723. const getExportList = async () => {
  724. exportListLoading.value = true
  725. try {
  726. const result = await API({ url: '/export/export' })
  727. if (result.code === 200) {
  728. const filteredData = result.data.filter(item => {
  729. return item.type === 12
  730. })
  731. exportList.value = filteredData
  732. } else {
  733. ElMessage.error(result.msg || t('elmessage.getExportListError'))
  734. }
  735. } catch (error) {
  736. console.error('获取导出列表出错:', error)
  737. ElMessage.error(t('elmessage.getExportListError'))
  738. } finally {
  739. exportListLoading.value = false
  740. }
  741. }
  742. const downloadExportFile = (item) => {
  743. if (item.state === 2) {
  744. const link = document.createElement('a')
  745. link.href = item.url
  746. link.download = item.fileName
  747. link.click()
  748. } else {
  749. ElMessage.warning(t('elmessage.exportingInProgress'))
  750. }
  751. }
  752. //根据状态返回对应的标签类型
  753. const getTagType = (state) => {
  754. switch (state) {
  755. case 0:
  756. return 'info';
  757. case 1:
  758. return 'primary';
  759. case 2:
  760. return 'success';
  761. case 3:
  762. return 'danger';
  763. default:
  764. return 'info';
  765. }
  766. }
  767. //根据状态返回对应的标签文案
  768. const getTagText = (state) => {
  769. switch (state) {
  770. case 0:
  771. return t('elmessage.pendingExecution');
  772. case 1:
  773. return t('elmessage.executing');
  774. case 2:
  775. return t('elmessage.executed');
  776. case 3:
  777. return t('elmessage.errorExecution');
  778. default:
  779. return t('elmessage.unknownStatus');
  780. }
  781. }
  782. const hideReject = function () {
  783. showReject.value = false
  784. addForm.value.remark = ''
  785. }
  786. const reset = function () {
  787. searchForm.value = {
  788. jwcode: '',
  789. markets: [],
  790. statuses: []
  791. }
  792. // 重置页码
  793. pagination.value.pageNum = 1
  794. dateRange.value = []
  795. getRefund()
  796. }
  797. const showAudit = function (row) {
  798. auditRow.value = row
  799. showAudit2.value = true
  800. }
  801. const defaultTime = [
  802. new Date(2000, 1, 1, 0, 0, 0),
  803. new Date(2000, 2, 1, 23, 59, 59),
  804. ]
  805. const disabledDate = (time) => {
  806. const limitDate = new Date(2025, 0, 1);
  807. return time.getTime() < limitDate.getTime();
  808. }
  809. const handlePageSizeChange = function (val) {
  810. pagination.value.pageSize = val
  811. getRefund()
  812. }
  813. const handleCurrentChange = function (val) {
  814. pagination.value.pageNum = val
  815. getRefund()
  816. }
  817. onMounted(() => {
  818. getRefund()
  819. getMarket()
  820. })
  821. </script>
  822. <style scoped lang="scss">
  823. :deep(.el-table__header-wrapper),
  824. :deep(.el-table__body-wrapper),
  825. :deep(.el-table__cell),
  826. :deep(.el-table__body td) {
  827. background-color: #F3FAFE !important;
  828. }
  829. :deep(.el-table__header th) {
  830. background-color: #F3FAFE !important;
  831. }
  832. .condition {
  833. width: 90vw;
  834. display: flex;
  835. flex-direction: column;
  836. align-items: flex-start;
  837. gap: 0.8vh;
  838. .item1 {
  839. width: 16%;
  840. display: flex;
  841. align-items: center;
  842. margin-right: 1vw;
  843. }
  844. .item2 {
  845. width: 18%;
  846. display: flex;
  847. align-items: center;
  848. margin-right: 0.5vw;
  849. }
  850. .condition-row {
  851. display: flex;
  852. align-items: center;
  853. width: 100%;
  854. }
  855. .condition-actions {
  856. margin-left: 2vw;
  857. display: flex;
  858. align-items: center;
  859. gap: 0.5vw;
  860. }
  861. }
  862. .audit1 {
  863. height: 47vh;
  864. .audit-item {
  865. display: flex;
  866. align-items: center;
  867. margin-bottom: 1vh;
  868. }
  869. }
  870. .audit2 {
  871. display: flex;
  872. justify-content: center;
  873. height: auto;
  874. min-height: 40vh;
  875. .top {
  876. width: 30vw;
  877. height: 22vh;
  878. .top-item {
  879. display: flex;
  880. align-items: center;
  881. margin-bottom: 1vh;
  882. }
  883. }
  884. .smallTitle {
  885. background-color: white;
  886. color: rgb(64, 158, 255);
  887. border-color: rgb(64, 158, 255);
  888. margin-bottom: 0.5vh;
  889. }
  890. .center {
  891. display: flex;
  892. width: 30vw;
  893. height: 35vh;
  894. .dialog-item {
  895. display: flex;
  896. align-items: center;
  897. margin-bottom: 1vh;
  898. }
  899. .center-left {
  900. width: 60%;
  901. height: 35vh;
  902. .image {
  903. width: 4vw !important;
  904. height: 4vw !important;
  905. }
  906. :deep(.el-upload--picture-card) {
  907. width: 4vw !important;
  908. height: 4vw !important;
  909. padding: 0 !important;
  910. }
  911. .center-item {
  912. display: flex;
  913. align-items: center;
  914. margin-bottom: 1vh;
  915. }
  916. }
  917. .center-right {
  918. height: 35vh;
  919. .right-item {
  920. display: flex;
  921. align-items: center;
  922. margin-bottom: 1vh;
  923. }
  924. }
  925. }
  926. .bottom {
  927. width: 30vw;
  928. height: 12vh;
  929. .bottom-item {
  930. display: flex;
  931. align-items: center;
  932. margin-bottom: 1vh;
  933. }
  934. }
  935. }
  936. .steps {
  937. .steps-content {
  938. padding-top: 15vw;
  939. }
  940. .steps-status {
  941. display: flex;
  942. align-items: center;
  943. justify-content: center;
  944. }
  945. .reject-reason {
  946. margin-top: 2vh;
  947. width: 40%;
  948. margin-left: 30%;
  949. background-color: white;
  950. padding: 1vh;
  951. border-radius: 10px;
  952. margin-bottom: 10vh;
  953. }
  954. .steps-btn {
  955. height: 15vh;
  956. display: flex;
  957. justify-content: center;
  958. align-items: center;
  959. }
  960. }
  961. </style>