addAccountDialog.vue 8.9 KB

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