index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div class="h-full flex p-3 flex-col businessDetail" v-loading="pageLoading">
  3. <div class="w-full bg-white p-2 mb-2 shadow-md rounded-md flex items-center">
  4. <div class="icon mr-4">
  5. <el-link :underline="false" @click="backPath()">
  6. <el-icon class="el-icon--right"><icon-view /></el-icon> 返回销售订单列表
  7. </el-link>
  8. </div>
  9. <div class="mr-8">
  10. <el-select v-model="values" placeholder="请选择" style="width: 300px" @change="getAll('')">
  11. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  12. </el-select>
  13. </div>
  14. </div>
  15. <div class="flex-1 flex flex-col overflow-y-auto overflow-x-hidden scroll-bar" v-loading="pageLoading">
  16. <div class="w-full h-auto flex justify-between">
  17. <div class="bg-white shadow-md rounded-md" style="width: 46%;">
  18. <Information :data="information" @refreshData="getAll" />
  19. </div>
  20. <div class="bg-white ml-2 shadow-md rounded-md flex-1">
  21. <Attachment :data="attachment" :information="information" @refreshData="getAll" />
  22. </div>
  23. </div>
  24. <div class="w-full h-auto flex justify-between mt-2">
  25. <div class="bg-white shadow-md rounded-md" style="width: 65%;">
  26. <Detailcompinents :data="relatedTasks" :information="information" :formTaskType="2" :filed="'orderId'"
  27. :disabled-list="['taskType', 'orderId']" @refreshData="refreshData" />
  28. </div>
  29. <div class="bg-white ml-2 shadow-md rounded-md flex-1">
  30. <OperationRecord :data="operationRecord" />
  31. </div>
  32. </div>
  33. <div class="w-full h-auto flex justify-between mt-2">
  34. <div class="bg-white shadow-md rounded-md" style="width: 65%;">
  35. <Products :data="relatedProducts" :information="information" @refreshData="getAll" />
  36. </div>
  37. <div class="bg-white ml-2 shadow-md rounded-md flex-1" style="width: 33%;">
  38. <Rebate :data="paymentCollectionList" :information="information" @refreshData="getAll" />
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </template>
  44. <script lang="ts" setup>
  45. import { ref, reactive, onMounted, inject } from "vue";
  46. import { Edit, ArrowLeft as IconView } from '@element-plus/icons-vue'
  47. import { backPath } from '../../../utils/tools'
  48. import { useRoute } from "vue-router";
  49. import { post } from "@/utils/request";
  50. import { GETTABLELIST, IMPORTMOD, URL_DETEALORDER, URL_FERDETAILTASK, URL_PAYLIST, URL_PRODUTWITHORDER } from "../api";
  51. import Information from '../component/information.vue'
  52. import Attachment from '../component/attachment.vue'
  53. import OperationRecord from '../component/operationRecord.vue'
  54. import Products from '../component/products.vue'
  55. import Rebate from '../component/rebate.vue'
  56. import Detailcompinents from '@/components/detailcompinents/relatedTasks.vue'
  57. import { GETATTACHMENT, GETCENTERLIST } from "@/pages/product/api";
  58. const route = useRoute()
  59. const globalPopup = inject<GlobalPopup>('globalPopup')
  60. const pageLoading = ref(false)
  61. const rowId = ref(+(route.query.id || ''))
  62. const values = ref<number | string>('')
  63. const options = ref<optionType[]>([])
  64. const information = ref({}) // 基本信息
  65. const attachment = ref<any[]>([]) // 附件信息
  66. const relatedTasks = ref<any[]>([]) // 相关任务
  67. const operationRecord = ref<any[]>([]) // 操作记录
  68. const relatedProducts = ref<any[]>([]) // 相关产品
  69. const paymentCollectionList = ref<any[]>([]) // 回款
  70. // 获取基本信息
  71. function getDetail() {
  72. post(URL_DETEALORDER, { id: values.value }).then(({ data }) => {
  73. information.value = data
  74. })
  75. }
  76. // 获取附件
  77. function getFileList() {
  78. post(GETATTACHMENT, { moduleId: values.value, moduleCode: IMPORTMOD }).then((res) => {
  79. attachment.value = res.data
  80. })
  81. }
  82. // 获取所有销售订单
  83. function getAllContacts() {
  84. post(GETTABLELIST, { pageIndex: -1, pageSize: -1 }).then(({ data }) => {
  85. options.value = (data.record || []).map((item: any) => ({ value: item.id, label: item.orderName }))
  86. values.value = rowId.value
  87. }).catch((err) => {
  88. globalPopup?.showError(err.message)
  89. })
  90. }
  91. // 获取相关任务
  92. function getRelatedTasks() {
  93. post(URL_FERDETAILTASK, { id: values.value }).then(({ data }) => {
  94. relatedTasks.value = data
  95. })
  96. }
  97. function refreshData() {
  98. getAll('getRelatedTasks')
  99. }
  100. // 获取操作记录
  101. function getOperationRecord() {
  102. post(GETCENTERLIST, { id: values.value, moduleCode: 'SalesOrder' }).then(({ data }) => {
  103. operationRecord.value = data
  104. })
  105. }
  106. function getPaymentCollectionList() {
  107. post(URL_PAYLIST, { orderId: values.value }).then(({ data }) => {
  108. paymentCollectionList.value = data || []
  109. })
  110. }
  111. // 获取相关产品
  112. function getRelatedProducts() {
  113. post(URL_PRODUTWITHORDER, { id: values.value }).then(({ data }) => {
  114. const list = (data || []).map((item: any) => {
  115. const { id, productName, productCode, unit, unitName, typeName, type, price, inventory, orderProductDetail } = item
  116. return {
  117. id, productId: id, productName, productCode, unit, unitName, typeName, type, price, inventory,
  118. quantity: +orderProductDetail?.num,
  119. discount: +orderProductDetail?.discount,
  120. sellingPrice: +orderProductDetail?.sealPrice,
  121. totalPrice: +orderProductDetail?.totalPrice
  122. }
  123. })
  124. relatedProducts.value = list
  125. })
  126. }
  127. type allTypeStr = 'getDetail' | 'getFileList' | 'getRelatedTasks' | 'getOperationRecord' | 'getRelatedProducts' | 'getPaymentCollectionList' | ''
  128. async function getAll(event: allTypeStr) {
  129. try {
  130. pageLoading.value = true
  131. if (!event) {
  132. await Promise.all([
  133. getDetail(),
  134. getFileList(),
  135. getRelatedTasks(),
  136. getOperationRecord(),
  137. getRelatedProducts(),
  138. getPaymentCollectionList()
  139. ])
  140. } else if (event == 'getDetail') {
  141. await getDetail()
  142. } else if (event == 'getFileList') {
  143. await getFileList()
  144. } else if (event == 'getRelatedTasks') {
  145. await getFileList()
  146. } else if (event == 'getOperationRecord') {
  147. await getOperationRecord()
  148. } else if (event == 'getRelatedProducts') {
  149. await getRelatedProducts()
  150. } else if (event == 'getPaymentCollectionList') {
  151. await getPaymentCollectionList()
  152. }
  153. pageLoading.value = false
  154. } catch {
  155. pageLoading.value = false
  156. }
  157. }
  158. onMounted(() => {
  159. values.value = rowId.value
  160. getAllContacts()
  161. getAll('')
  162. })
  163. </script>