index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <script setup lang="ts">
  2. import { ref } from "vue";
  3. import { utils, writeFile } from "xlsx";
  4. import { useRouter } from "vue-router";
  5. import { PageSearch, usePageSearch } from "/@/components/PageSearch";
  6. import { PageContent } from "/@/components/PageContent";
  7. import PagePower from "/@/components/PagePower/PagePower.vue";
  8. import ExeclUpload from "./components/execl-files-upload/index.vue";
  9. import searchFormConfig from "./config/search.config";
  10. import contentConfig from "./config/content.config";
  11. import { template } from "./config/xls-template";
  12. import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
  13. import {
  14. xs_order_source_options,
  15. xs_order_type_options
  16. } from "/@/utils/status";
  17. import { usePermission } from "/@/hooks/core/usePermission";
  18. import { useUserInfo } from "/@/hooks/core/useUser";
  19. import { useAsync } from "/@/hooks/core/useAsync";
  20. import { CAPITAL_STATUS } from "/@/utils/details/tragelog";
  21. import { httpWithdraw } from "/@/api/InvoiceSales/capitalClaim";
  22. const { push } = useRouter();
  23. const execlUploadRef = ref<InstanceType<typeof ExeclUpload>>(null);
  24. const pageName = "capitalClaim";
  25. const { run: withDraw } = useAsync({
  26. success: () => pageContentRef.value.onSearch()
  27. });
  28. // { code: "009", name: "撤销资金认领" },
  29. // { code: "029", name: "下载资金导入模板" },
  30. // { code: "030", name: "批量导入客户付款资金数据" }
  31. const { hasPermissionWithCode, permissions } = usePermission(pageName);
  32. const { isSuperUser } = useUserInfo();
  33. const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(
  34. undefined,
  35. undefined,
  36. searchFormConfig
  37. );
  38. const handleWithDraw = data => withDraw(httpWithdraw(data));
  39. //导出模板
  40. function onDownloadTemplate() {
  41. //创建数据表
  42. const workBook = utils.book_new();
  43. const workSheet = utils.json_to_sheet([template]);
  44. utils.book_append_sheet(workBook, workSheet, "sheet");
  45. //导出模板
  46. writeFile(workBook, "资金认领模板.xlsx", {
  47. bookType: "xlsx"
  48. });
  49. }
  50. </script>
  51. <template>
  52. <div class="main role">
  53. <PagePower :is-show="hasPermissionWithCode('001')">
  54. <div w-full>
  55. <PageSearch
  56. :form-config="searchFormConfig"
  57. @search-btn-click="handleSearchClick"
  58. @reset-btn-click="handleResetClick"
  59. >
  60. <template #action>
  61. <el-button
  62. v-if="!isSuperUser && hasPermissionWithCode('029')"
  63. @click="onDownloadTemplate"
  64. >下载资金导入模板
  65. </el-button>
  66. <el-button
  67. v-if="!isSuperUser && hasPermissionWithCode('030')"
  68. type="primary"
  69. @click="() => execlUploadRef.onDisplay()"
  70. >批量导入客户付款资金数据
  71. </el-button>
  72. </template>
  73. </PageSearch>
  74. <PageContent
  75. ref="pageContentRef"
  76. :content-config="contentConfig"
  77. :powers="permissions"
  78. @preview-btn-click="
  79. row => push('/InvoiceSales/claimDetail?id=' + row.tradNo)
  80. "
  81. >
  82. <template #expand="row">
  83. <el-table
  84. v-if="row.child.length > 0"
  85. size="small"
  86. :data="row.child"
  87. border
  88. style="width: 100%"
  89. >
  90. <el-table-column
  91. label="资金认领编号"
  92. prop="logNo"
  93. width="188"
  94. fixed="left"
  95. show-overflow-tooltip
  96. />
  97. <el-table-column
  98. label="认领状态"
  99. prop="status"
  100. width="100"
  101. show-overflow-tooltip
  102. >
  103. <template #="{ $index }">
  104. <el-tag
  105. >{{
  106. CAPITAL_STATUS.find(
  107. t => t.value === row.child[$index].status
  108. )?.label || "--"
  109. }}
  110. </el-tag>
  111. </template>
  112. </el-table-column>
  113. <el-table-column
  114. label="订单编号"
  115. prop="orderCode"
  116. width="160"
  117. show-overflow-tooltip
  118. />
  119. <el-table-column
  120. label="订单来源"
  121. prop="qrdSource"
  122. width="90"
  123. show-overflow-tooltip
  124. >
  125. <template #="{ $index }">
  126. <el-tag
  127. >{{
  128. xs_order_source_options.find(
  129. t => t.value === row.child[$index].qrdSource
  130. )?.label
  131. }}
  132. </el-tag>
  133. </template>
  134. </el-table-column>
  135. <el-table-column
  136. label="平台单号"
  137. prop="poCode"
  138. width="180"
  139. show-overflow-tooltip
  140. />
  141. <el-table-column
  142. label="商品编号"
  143. prop="goodNo"
  144. width="160"
  145. show-overflow-tooltip
  146. />
  147. <el-table-column
  148. label="商品来源"
  149. prop="qrdType"
  150. width="90"
  151. show-overflow-tooltip
  152. >
  153. <template #="{ $index }">
  154. <el-tag
  155. >{{
  156. xs_order_type_options.find(
  157. t => t.value === row.child[$index].qrdType
  158. )?.label
  159. }}
  160. </el-tag>
  161. </template>
  162. </el-table-column>
  163. <el-table-column
  164. label="商品名称"
  165. prop="goodName"
  166. minWidth="180"
  167. show-overflow-tooltip
  168. />
  169. <el-table-column
  170. label="订单创建人"
  171. prop="ownerName"
  172. width="80"
  173. show-overflow-tooltip
  174. />
  175. <el-table-column
  176. label="认领人"
  177. prop="apply_name"
  178. width="80"
  179. show-overflow-tooltip
  180. />
  181. <el-table-column
  182. label="认领时间"
  183. prop="addtime"
  184. width="145"
  185. show-overflow-tooltip
  186. />
  187. <el-table-column fixed="right" label="操作" width="60px">
  188. <template #default="{ row }">
  189. <el-button
  190. :icon="useRenderIcon('eye-view')"
  191. @click="
  192. () => push('/InvoiceSales/capitalDetail?id=' + row.logNo)
  193. "
  194. type="primary"
  195. link
  196. />
  197. <el-popconfirm
  198. v-if="
  199. hasPermissionWithCode('009') && String(row.status) === '1'
  200. "
  201. placement="top"
  202. title="是否确认撤销资金认领?"
  203. :on-confirm="() => handleWithDraw({ logNo: row.logNo })"
  204. >
  205. <template #reference>
  206. <el-button
  207. :icon="useRenderIcon('refresh-right')"
  208. type="primary"
  209. link
  210. />
  211. </template>
  212. </el-popconfirm>
  213. </template>
  214. </el-table-column>
  215. </el-table>
  216. </template>
  217. </PageContent>
  218. </div>
  219. </PagePower>
  220. <ExeclUpload ref="execlUploadRef" @onSuccess="handleResetClick" />
  221. </div>
  222. </template>
  223. <style scoped lang="scss">
  224. :deep(.el-dropdown-menu__item i) {
  225. margin: 0;
  226. }
  227. :deep(.el-button + .el-button) {
  228. margin-left: 0px !important;
  229. }
  230. .star {
  231. color: red;
  232. }
  233. </style>