addAccountDialog.vue 9.1 KB

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