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.

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