addAccountDialog.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :centered="true"
  5. :visible.sync="addAccountDialogFlag"
  6. :title="title"
  7. :append-to-body="true"
  8. :close-on-click-modal="false"
  9. :fullscreen="fullscreen"
  10. width="85%"
  11. :before-close="cancel"
  12. >
  13. <template slot="title">
  14. <modalTitle :title="title" @setFullscreen="fullscreen=!fullscreen"></modalTitle>
  15. </template>
  16. <!--销售表单-->
  17. <sale-form
  18. @handleSearch="handleSearch"
  19. :dataForm.sync="dataForm"
  20. :datasource.sync="datasource"
  21. :contactData="contactData"
  22. :saleOrderData="saleOrderData"
  23. :dialogType="dialogType"
  24. ref="saleFormRef"
  25. ></sale-form>
  26. <headerTitle title="对账明细" style="margin-top: 30px">
  27. <template v-slot>
  28. <el-row style="font-weight: 700; color: red">
  29. <el-divider direction="vertical"></el-divider>
  30. <span>总金额:</span>
  31. <span>{{ dataForm.amountTotalPrice || 0 }}</span>
  32. <el-divider direction="vertical"></el-divider>
  33. <span>应收金额:</span>
  34. <span>{{ dataForm.amountReceivablePrice || 0 }}</span>
  35. <el-divider direction="vertical"></el-divider>
  36. <span>应付金额:</span>
  37. <span>{{ dataForm.amountPayablePrice || 0 }}</span>
  38. </el-row>
  39. </template>
  40. </headerTitle>
  41. <inventoryTable
  42. ref="inventoryTableref"
  43. :dataForm="dataForm"
  44. :datasource.sync="datasource"
  45. :dialogType="dialogType"
  46. ></inventoryTable>
  47. <div slot="footer" class="footer">
  48. <el-button v-if="dialogType !== 'view'" type="primary" @click="save"
  49. >保存
  50. </el-button
  51. >
  52. <el-button
  53. v-if="dialogType !== 'view'"
  54. type="primary"
  55. @click="save('sub')"
  56. >提交
  57. </el-button
  58. >
  59. <el-button @click="cancel">返回</el-button>
  60. </div>
  61. <process-submit-dialog :processSubmitDialogFlag.sync="processSubmitDialogFlag" v-if="processSubmitDialogFlag" ref="processSubmitDialogRef" @reload="reload"></process-submit-dialog>
  62. </ele-modal>
  63. </template>
  64. <script>
  65. import InventoryTable from '@/views/saleManage/saleOrder/accountstatement/components/inventoryTable.vue';
  66. import saleForm from '@/views/saleManage/saleOrder/accountstatement/components/saleForm.vue';
  67. import {
  68. getSearchMergeListByTypeAPI,
  69. infoAccountStatementAPI,
  70. saveAccountStatementAPI,
  71. updateAccountStatementAPI
  72. } from '@/api/saleManage/accountstatement';
  73. import processSubmitDialog from "@/BIZComponents/processSubmitDialog/processSubmitDialog.vue";
  74. import modalTitle from '@/BIZComponents/modalTitle.vue';
  75. export default {
  76. name: 'addAccountDialog',
  77. components: {
  78. processSubmitDialog,
  79. InventoryTable,
  80. saleForm,modalTitle
  81. },
  82. //客户管理数据
  83. props: {
  84. addAccountDialogFlag: {
  85. type: Boolean,
  86. default: false
  87. },
  88. contactData: {
  89. type: Object,
  90. default: () => {
  91. return {};
  92. }
  93. },
  94. saleOrderData: {
  95. type: Object,
  96. default: () => {
  97. return {};
  98. }
  99. }
  100. },
  101. data() {
  102. return {
  103. fullscreen:false,
  104. datasource: [],
  105. dataForm: {
  106. sourceType: 1,
  107. dateType: 1,
  108. dateValue: '',
  109. contactId: '',
  110. contactName: '',
  111. sourceName: '',
  112. sourceId: '',
  113. type: '',
  114. year: '',
  115. quarter: '',
  116. month: '',
  117. dateTimeRange: [],
  118. orderNo: '',
  119. orderId: '',
  120. id: '',
  121. startDate: '',
  122. endDate: '',
  123. repliedFiles: []
  124. },
  125. title: '',
  126. processSubmitDialogFlag:false,
  127. dialogType: ''
  128. };
  129. },
  130. computed: {},
  131. methods: {
  132. open(dialogType, row, type = '') {
  133. this.dialogType = dialogType;
  134. this.title =
  135. dialogType == 'add' ? '新增' : dialogType == 'update' ? '修改' : '详情';
  136. this.dataForm.type = type;
  137. this.$nextTick(() => {
  138. if (this.contactData.id) {
  139. this.$refs.saleFormRef.getCusInfo(this.contactData);
  140. }
  141. if (this.saleOrderData.id) {
  142. this.$refs.saleFormRef.getOrderInfo(this.saleOrderData);
  143. }
  144. });
  145. if (this.dialogType !== 'add') {
  146. this.getInfo(row);
  147. }
  148. },
  149. //获取对账单详情
  150. async getInfo(row) {
  151. let data = await infoAccountStatementAPI(row.id);
  152. this.datasource = data.orderList;
  153. this.dataForm = data;
  154. switch (this.dataForm.dateType) {
  155. case 1:
  156. this.dataForm.year = this.dataForm.dateValue;
  157. break;
  158. case 2:
  159. //2023年-四季度
  160. let data = this.dataForm.dateValue.split('年-');
  161. this.dataForm.year = data[0];
  162. this.dataForm.quarter = data[1];
  163. break;
  164. case 3:
  165. this.dataForm.month = this.dataForm.dateValue;
  166. break;
  167. default:
  168. this.dataForm.dateValue = '';
  169. this.dataForm.dateTimeRange = [
  170. this.dataForm.startDate,
  171. this.dataForm.endDate
  172. ];
  173. }
  174. },
  175. //关闭弹窗
  176. cancel() {
  177. this.$emit('update:addAccountDialogFlag', false);
  178. },
  179. //查询获取订单数据
  180. async handleSearch(params) {
  181. let searchQuery = {
  182. endDate: params.endDate,
  183. sourceId: params.sourceId,
  184. sourceType: params.sourceType,
  185. startDate: params.startDate,
  186. type: 1
  187. };
  188. let data = await getSearchMergeListByTypeAPI(searchQuery);
  189. this.datasource = data.orderList || [];
  190. this.dataForm = {
  191. ...this.dataForm,
  192. amountPayablePrice: data.amountPayablePrice,
  193. amountReceivablePrice: data.amountReceivablePrice,
  194. amountTotalPrice: data.amountTotalPrice
  195. };
  196. if (!this.datasource.length) this.$message.warning('暂无订单信息');
  197. },
  198. //保存
  199. async save(is) {
  200. if (!this.datasource.length) return this.$message.warning('暂无订单信息');
  201. let api =
  202. this.dialogType == 'add'
  203. ? saveAccountStatementAPI
  204. : updateAccountStatementAPI;
  205. let params = {
  206. ...this.dataForm,
  207. orderList: this.datasource
  208. };
  209. let data = await api(params);
  210. if (is == 'sub') {
  211. await this.submitApprove(data)
  212. return
  213. // await submitAccountStatementApproveAPI({
  214. // businessId: data,
  215. // type: this.dataForm.type
  216. // });
  217. }
  218. this.$message.success('操作成功');
  219. this.reload()
  220. },
  221. async submitApprove(res) {
  222. let data = await infoAccountStatementAPI(res);
  223. this.processSubmitDialogFlag = true
  224. this.$nextTick(() => {
  225. let params = {
  226. businessId: res,
  227. businessKey: 'sales_account_statement_approve',
  228. formCreateUserId: data.createUserId,
  229. variables: {
  230. type: data.type,
  231. businessCode: data.statementNo
  232. },
  233. // callBackMethodType : '1',
  234. // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
  235. // pcHandle : '/bpm/handleTask/components/project-manage/plan-manage/submit.vue',
  236. // pcView : '/bpm/handleTask/components/project-manage/plan-manage/detailDialog.vue',
  237. // miniHandle : '',
  238. // miniView : '',
  239. }
  240. this.$refs.processSubmitDialogRef.init(params)
  241. })
  242. },
  243. reload(){
  244. this.cancel();
  245. //刷新主页面
  246. this.$emit('done');
  247. }
  248. }
  249. };
  250. </script>
  251. <style scoped lang="scss">
  252. ::v-deep.el-divider {
  253. margin: 10px;
  254. font-weight: bold;
  255. }
  256. </style>