page.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <div>
  3. <purchase-form @handleSearch="handleSearch"
  4. ref="saleFormRef"
  5. :taskDefinitionKey="taskDefinitionKey"
  6. :dataForm.sync="dataForm"
  7. :datasource.sync="datasource"
  8. :dialogType="permissionType"></purchase-form>
  9. <headerTitle title="应付信息" style="margin-top: 30px"></headerTitle>
  10. <payablesInfo
  11. ref="payablesInfoRef"
  12. :dataForm.sync="dataForm"
  13. :payablesList="payablesList"
  14. :dialogType="permissionType"
  15. statementAdvanceTotalPriceTitle="总对账预付款确付金额"
  16. columnsTitle="本次对账预付款确付金额"
  17. ></payablesInfo>
  18. <headerTitle title="对账明细" style="margin-top: 30px">
  19. <!-- <template v-slot>
  20. <el-row style="font-weight: 700; color: red">
  21. <span>订单总金额:</span>
  22. <span>{{ dataForm.orderTotalAmount || 0 }}</span>
  23. <el-divider direction="vertical"></el-divider>
  24. <span>已对账金额:</span>
  25. <span>{{ dataForm.amountCompletePrice || 0 }}</span>
  26. <el-divider direction="vertical"></el-divider>
  27. <span>未对账金额:</span>
  28. <span>{{ dataForm.amountUnCompletePrice || 0 }}</span>
  29. <el-divider direction="vertical"></el-divider>
  30. <span>本次对账总金额:</span>
  31. <span>{{ dataForm.amountTotalPrice || 0 }}</span>
  32. </el-row>
  33. </template> -->
  34. </headerTitle>
  35. <!-- <recorpayTableList
  36. ref="recorpayListRef"
  37. :dataForm="dataForm"
  38. :recorpayList.sync="recorpayList"
  39. :dialogType="permissionType"
  40. ></recorpayTableList> -->
  41. <!-- <InventoryTable ref="inventoryTableref" type="purchase" :priceObj="priceObj" :dataForm="dataForm" :datasource.sync="datasource" :dialogType="permissionType" :taskDefinitionKey="taskDefinitionKey"></InventoryTable> -->
  42. <AccountDetailTable
  43. ref="accountDetailTableRef"
  44. :datasource.sync="datasource"
  45. dialogType="view"
  46. tableTitle="采购订单编码"
  47. tableReceiptTitle="收货单编码"
  48. ></AccountDetailTable>
  49. </div>
  50. </template>
  51. <script>
  52. import InventoryTable from "@/views/bpm/handleTask/components/saleOrder/accountstatement/inventoryTable.vue";
  53. import purchaseForm from "./purchaseForm.vue";
  54. import {getSearchMergeListByTypeAPI, infoAccountStatementAPI, accountstatementInfoAPI} from "@/api/bpm/components/saleManage/saleorder";
  55. import recorpayTableList from '@/views/bpm/handleTask/components/saleOrder/accountstatement/recorpayTableList.vue';
  56. import AccountDetailTable from '@/views/bpm/handleTask/components/saleOrder/accountstatement/accountDetailTable.vue';
  57. import payablesInfo from './payablesInfo.vue';
  58. export default {
  59. name: 'page',
  60. props: ['permissionType', 'businessId', 'taskDefinitionKey'],
  61. components: {
  62. InventoryTable,
  63. purchaseForm,
  64. recorpayTableList,
  65. AccountDetailTable,
  66. payablesInfo,
  67. },
  68. data() {
  69. return {
  70. datasource: [],
  71. payablesList: [],
  72. dataForm: {
  73. sourceType: '',
  74. dateType: '',
  75. queryDimension: '',
  76. dateValue: '',
  77. contactId: '',
  78. contactName: '',
  79. sourceName: '',
  80. sourceId: '',
  81. type: '',
  82. year: '',
  83. quarter: '',
  84. month: '',
  85. dateTimeRange: [],
  86. orderNo: '',
  87. orderId: '',
  88. id: '',
  89. startDate: '',
  90. endDate: '',
  91. repliedFiles: [],
  92. BQYSKZE: undefined,
  93. },
  94. recorpayList:[],
  95. title: '',
  96. quarterList: {
  97. '一季度': ['-01-01 00:00:00', '-03-31 12:59:59'],
  98. '二季度': ['-04-01 00:00:00', '-06-30 12:59:59'],
  99. '三季度': ['-07-01 00:00:00', '-09-30 12:59:59'],
  100. '四季度': ['-10-01 00:00:00', '-12-31 12:59:59'],
  101. },
  102. startTime: '-01-01 00:00:00',
  103. endTime: '12:59:59',
  104. }
  105. },
  106. computed: {
  107. priceObj() {
  108. // return this.datasource.reduce((obj, row) => {
  109. // //已开票合计金额
  110. // obj.amountInvoicedPrice = ((obj.amountInvoicedPrice * 1) + (row.invoicedPrice * 1)).toFixed(2)
  111. // //未开票合计金额
  112. // obj.amountNotInvoicedPrice = ((obj.amountNotInvoicedPrice * 1) + (row.notInvoicedPrice * 1)).toFixed(2)
  113. // //应付款合计金额
  114. // obj.amountNotPaidPrice = ((obj.amountNotPaidPrice * 1) + (row.notPaidPrice * 1)).toFixed(2)
  115. // //已付款合计金额
  116. // obj.amountPaidPrice = ((obj.amountPaidPrice * 1) + (row.paidPrice * 1)).toFixed(2)
  117. // //已收货总金额
  118. // obj.amountTotalPrice = ((obj.amountTotalPrice * 1) + (row.totalPrice * 1)).toFixed(2)
  119. // return obj
  120. // }, {
  121. // amountInvoicedPrice: 0,
  122. // amountNotInvoicedPrice: 0,
  123. // amountNotPaidPrice: 0,
  124. // amountPaidPrice: 0,
  125. // amountTotalPrice: 0,
  126. // })
  127. }
  128. },
  129. watch: {},
  130. mounted() {
  131. this.getInfo(this.businessId)
  132. },
  133. methods: {
  134. //获取对账单详情
  135. async getInfo(id) {
  136. let data = await accountstatementInfoAPI(id)
  137. console.log(data,'获取对账单详情')
  138. this.datasource = data?.productList || [];
  139. this.datasource.forEach(item=>{
  140. item.color = item.colorKey || ''
  141. })
  142. // this.recorpayList=data?.recorpayList||[]
  143. // data.orderTotalAmount = data.orderList.reduce((pre, cur) => pre + Math.round(+cur.orderAmount * 100), 0) / 100;
  144. // data.amountTotalPrice = data.orderList.reduce((pre, cur) => pre + Math.round(+cur.statementAmount * 100), 0) / 100;
  145. // data.amountCompletePrice = data.orderList.reduce((pre, cur) => pre + Math.round(+cur.statementedAmount * 100), 0) / 100;
  146. // data.amountUnCompletePrice = data.orderList.reduce((pre, cur) => pre + Math.round(+cur.unStatementAmount * 100), 0) / 100;
  147. this.dataForm = data
  148. this.payablesList = data?.statPayable?.statPayableDetailList || []
  149. // this.priceObj.amountNotInvoicedPrice = data.amountNotInvoicedPrice
  150. switch (this.dataForm.dateType) {
  151. case 1:
  152. this.dataForm.year = this.dataForm.dateValue
  153. break;
  154. case 2:
  155. //2023年-四季度
  156. let data = this.dataForm.dateValue.split('年-')
  157. this.dataForm.year = data[0]
  158. this.dataForm.quarter = data[1]
  159. break
  160. case 3:
  161. this.dataForm.month = this.dataForm.dateValue
  162. break
  163. default:
  164. this.dataForm.dateValue = ''
  165. this.dataForm.dateTimeRange = [this.dataForm.startDate, this.dataForm.endDate]
  166. }
  167. },
  168. updateData() {
  169. switch (this.dataForm.dateType) {
  170. case 1:
  171. this.dataForm.dateValue = this.dataForm.year
  172. this.dataForm.startDate = this.dataForm.year + this.startTime
  173. this.dataForm.endDate = this.dataForm.year + '-12-31 12:59:59'
  174. break;
  175. case 2:
  176. this.dataForm.dateValue = this.dataForm.year + '年-' + this.dataForm.quarter
  177. this.dataForm.startDate = this.dataForm.year + this.quarterList[this.dataForm.quarter][0]
  178. this.dataForm.endDate = this.dataForm.year + this.quarterList[this.dataForm.quarter][1]
  179. break
  180. case 3:
  181. this.dataForm.dateValue = this.dataForm.month
  182. this.dataForm.startDate = this.dataForm.month + '-01 00:00:00'
  183. let data = this.dataForm.month.split('-')
  184. let days = new Date(data[0], data[1], 0).getDate()
  185. this.dataForm.endDate = this.dataForm.month + '-' + days + ' 12:59:59'
  186. break
  187. default:
  188. this.dataForm.dateValue = ''
  189. this.dataForm.startDate = this.dataForm.dateTimeRange[0] + ' 00:00:00'
  190. this.dataForm.endDate = this.dataForm.dateTimeRange[1] + ' 12:59:59'
  191. }
  192. },
  193. //查询获取订单数据
  194. async handleSearch(params) {
  195. let searchQuery = {
  196. endDate: params.endDate,
  197. sourceId: params.sourceId,
  198. sourceType: params.sourceType,
  199. startDate: params.startDate,
  200. type: 2,
  201. }
  202. this.updateData()
  203. if (!await this.getFormValidate()) return
  204. let data = await getSearchMergeListByTypeAPI(searchQuery)
  205. this.datasource = data?.productList || [];
  206. this.datasource.forEach(item=>{
  207. item.color = item.colorKey || ''
  208. })
  209. this.dataForm = {
  210. ...this.dataForm,
  211. amountPayablePrice: data.amountPayablePrice,
  212. amountReceivablePrice: data.amountReceivablePrice,
  213. amountTotalPrice: data.amountTotalPrice,
  214. amountPayablePass: data.amountPayablePass,
  215. amountReceivablePass: data.amountReceivablePass,
  216. }
  217. if (!this.datasource.length) this.$message.warning('暂无订单信息')
  218. },
  219. getFormValidate() {
  220. return new Promise((resolve) => {
  221. this.$refs.saleFormRef.$refs.form.validate(validate => {
  222. resolve(validate)
  223. })
  224. })
  225. },
  226. //
  227. getTableValue() {
  228. return new Promise(async (resolve) => {
  229. if (!this.datasource.length) {
  230. this.$message.warning('暂无订单信息')
  231. resolve(false)
  232. }
  233. if (!await this.getFormValidate()) {
  234. resolve(false)
  235. }
  236. let params = {
  237. ...this.dataForm,
  238. orderList: this.datasource,
  239. ...this.priceObj,
  240. }
  241. resolve(params)
  242. })
  243. },
  244. }
  245. };
  246. </script>
  247. <style scoped lang="scss">
  248. </style>