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.

959 lines
39 KiB

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