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.

996 lines
40 KiB

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