page.vue 9.2 KB

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