page.vue 8.1 KB

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