index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <div class="switch" v-if="!contactData?.id">
  5. <div class="switch_left">
  6. <ul>
  7. <li
  8. v-for="item in tabOptions"
  9. :key="item.key"
  10. :class="{ active: activeComp == item.key }"
  11. @click="activeComp = item.key"
  12. >
  13. {{ item.name }}
  14. </li>
  15. </ul>
  16. </div>
  17. </div>
  18. <div class="main" style="padding: 0 10px">
  19. <div v-if="activeComp == 'saleorder'">
  20. <div class="ele-border-lighter form-content" v-loading="loading">
  21. <search-table @search="reload"></search-table>
  22. <!-- 数据表格 -->
  23. <ele-pro-table
  24. ref="table"
  25. :columns="columns"
  26. :datasource="datasource"
  27. height="calc(100vh - 350px)"
  28. style="margin-bottom: 10px"
  29. full-height="calc(100vh - 116px)"
  30. tool-class="ele-toolbar-form"
  31. :selection.sync="selection"
  32. :page-size="20"
  33. @columns-change="handleColumnChange"
  34. :cache-key="cacheKeyUrl"
  35. >
  36. <!-- 表头工具栏 -->
  37. <template v-slot:toolbar>
  38. <el-button
  39. size="small"
  40. type="primary"
  41. icon="el-icon-plus"
  42. class="ele-btn-icon"
  43. @click="openEdit('add', {})"
  44. >
  45. 新建
  46. </el-button>
  47. <el-button
  48. size="small"
  49. type="danger"
  50. el-icon-delete
  51. class="ele-btn-icon"
  52. @click="allDelBtn"
  53. :disabled="selection?.length === 0"
  54. >
  55. 批量删除
  56. </el-button>
  57. <el-button
  58. type="primary"
  59. size="small"
  60. icon="el-icon-upload2"
  61. @click="uploadFile"
  62. >导入</el-button
  63. >
  64. <exportButton
  65. fileName="销售订单"
  66. apiUrl="/eom/saleorder/export"
  67. :params="params"
  68. ></exportButton>
  69. </template>
  70. <!-- 查看详情列 -->
  71. <template v-slot:contractNo="{ row }">
  72. <el-link
  73. type="primary"
  74. :underline="false"
  75. @click="opencontractDetail(row)"
  76. >
  77. {{ row.contractNo }}
  78. </el-link>
  79. </template>
  80. <template v-slot:orderNo="{ row }">
  81. <el-link
  82. type="primary"
  83. :underline="false"
  84. @click="openorderDetail(row)"
  85. >
  86. {{ row.orderNo }}
  87. </el-link>
  88. </template>
  89. <!-- 操作列 -->
  90. <template v-slot:action="{ row }">
  91. <el-link
  92. type="primary"
  93. :underline="false"
  94. icon="el-icon-edit"
  95. @click="openEdit('edit', row)"
  96. v-if="
  97. (isNeed_process_is_close &&
  98. [0, 3].includes(row.orderStatus)) ||
  99. !isNeed_process_is_close
  100. "
  101. >
  102. 修改
  103. </el-link>
  104. <el-link
  105. type="primary"
  106. :underline="false"
  107. icon="el-icon-plus"
  108. @click="saleOrderSubmitOrGenerate(row)"
  109. v-if="
  110. isNeed_process_is_close && [0, 3].includes(row.orderStatus)
  111. "
  112. >
  113. 提交
  114. </el-link>
  115. <!-- <el-link
  116. type="primary"
  117. :underline="false"
  118. icon="el-icon-plus"
  119. @click="handleAutoGenerate(row.id)"
  120. v-if="
  121. [2].includes(row.orderStatus) &&
  122. row.needProduce &&
  123. !!!row.purchasePlanNum
  124. "
  125. >
  126. 生成采购计划
  127. </el-link> -->
  128. <el-popconfirm
  129. class="ele-action"
  130. title="确定要删除此信息吗?"
  131. @confirm="remove([row.id])"
  132. v-if="
  133. (isNeed_process_is_close &&
  134. [0, 3].includes(row.orderStatus)) ||
  135. !isNeed_process_is_close
  136. "
  137. >
  138. <template v-slot:reference>
  139. <el-link
  140. type="danger"
  141. :underline="false"
  142. icon="el-icon-delete"
  143. >
  144. 删除
  145. </el-link>
  146. </template>
  147. </el-popconfirm>
  148. <el-link
  149. type="primary"
  150. :underline="false"
  151. icon="el-icon-plus"
  152. @click="handleCommand('invoice', row)"
  153. v-if="[2].includes(row.orderStatus)"
  154. >
  155. 创建发货单
  156. </el-link>
  157. <el-link
  158. type="primary"
  159. :underline="false"
  160. icon="el-icon-plus"
  161. @click="handleCommand('saleOrderReminder', row)"
  162. v-if="[2].includes(row.orderStatus)"
  163. >
  164. 催单
  165. </el-link>
  166. <el-link
  167. type="primary"
  168. :underline="false"
  169. icon="el-icon-plus"
  170. @click="handleCommand('invoiceManage', row)"
  171. v-if="[2].includes(row.orderStatus) && !row.hasInvoiceApply"
  172. >
  173. 新增发票
  174. </el-link>
  175. </template>
  176. </ele-pro-table>
  177. </div>
  178. </div>
  179. <div v-if="activeComp == 'invoice'">
  180. <invoice></invoice>
  181. </div>
  182. <div v-if="activeComp == 'invoiceConfirm'">
  183. <invoice-confirm></invoice-confirm>
  184. </div>
  185. <div v-if="activeComp == 'entrustedReceive'">
  186. <entrustedReceive></entrustedReceive>
  187. </div>
  188. <div v-if="activeComp == 'returnorder'" class="returnorder">
  189. <return-goods></return-goods>
  190. </div>
  191. <div v-if="activeComp == 'accountstatement'">
  192. <accountstatement></accountstatement>
  193. </div>
  194. <div v-if="activeComp == 'customerReturnOrder'">
  195. <customerReturnOrder></customerReturnOrder>
  196. </div>
  197. <div v-if="activeComp == 'exceptionList'">
  198. <exceptionList></exceptionList>
  199. </div>
  200. <div v-if="activeComp == 'trayList'">
  201. <palletManagement></palletManagement>
  202. </div>
  203. </div>
  204. </el-card>
  205. <add-dialog
  206. ref="addDialogRef"
  207. @done="reload"
  208. :contactData="contactData"
  209. ></add-dialog>
  210. <add-invoice-dialog
  211. ref="invoiceDialogRef"
  212. @done="reload"
  213. :contactData="contactData"
  214. ></add-invoice-dialog>
  215. <add-return-goods-dialog
  216. ref="addReturnGoodsRef"
  217. :contactData="contactData"
  218. @done="reload"
  219. ></add-return-goods-dialog>
  220. <contractr-detail ref="contractDetailRef"></contractr-detail>
  221. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  222. <autogenerate-dialog
  223. ref="autogenerateDialogRef"
  224. @handleSubmit="saleOrderSubmit"
  225. @reload="reload"
  226. ></autogenerate-dialog>
  227. <!-- 多选删除弹窗 -->
  228. <pop-modal
  229. :visible.sync="delVisible"
  230. content="是否确定删除?"
  231. @done="commitBtn"
  232. />
  233. <drawer ref="drawerRef"></drawer>
  234. <process-submit-dialog
  235. :isNotNeedProcess="false"
  236. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  237. v-if="processSubmitDialogFlag"
  238. ref="processSubmitDialogRef"
  239. @reload="reload"
  240. ></process-submit-dialog>
  241. <addInvoiceManage
  242. :add-or-edit-dialog-flag.sync="addOrEditDialogFlag1"
  243. ref="addOrEditDialogRef"
  244. v-if="addOrEditDialogFlag1"
  245. @reload="reload"
  246. ></addInvoiceManage>
  247. <importDialog
  248. ref="importDialogRef"
  249. @success="reload"
  250. :fileUrl="'/eos/importTemplate/销售订单导入模板.xlsx'"
  251. fileName="销售订单导入模板"
  252. apiUrl="/eom/saleorder/importFile"
  253. />
  254. </div>
  255. </template>
  256. <script>
  257. import searchTable from './components/searchTable.vue';
  258. import addDialog from './components/addDialog.vue';
  259. import invoice from './invoice/index.vue';
  260. import invoiceConfirm from './invoiceConfirm/index.vue';
  261. import detailDialog from './components/detailDialog.vue';
  262. import exceptionList from './exceptionManagement/exceptionList';
  263. import drawer from './components/drawer.vue';
  264. import contractrDetail from '@/views/contractManage/contractBook/components/detailDialog.vue';
  265. import addInvoiceDialog from '@/views/saleManage/saleOrder/invoice/components/addInvoiceDialog';
  266. import addReturnGoodsDialog from '@/views/saleManage/saleOrder/returnGoods/components/addReturnGoodsDialog';
  267. import popModal from '@/components/pop-modal';
  268. import accountstatement from './accountstatement/index.vue';
  269. import customerReturnOrder from './customerReturnOrder/index.vue';
  270. import returnGoods from './returnGoods/index.vue';
  271. import palletManagement from './palletManagement/index.vue';
  272. import addInvoiceManage from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue';
  273. import {
  274. deleteInformation,
  275. getSaleOrderDetail,
  276. getTableList,
  277. saleOrderReminder
  278. } from '@/api/saleManage/saleorder';
  279. import { exportSaleorder } from '@/api/system/file/index.js';
  280. import dictMixins from '@/mixins/dictMixins';
  281. import { reviewStatus, saleOrderProgressStatusEnum } from '@/enum/dict';
  282. import entrustedReceive from '@/views/saleManage/saleOrder/entrustedReceive/index.vue';
  283. import autogenerateDialog from '@/BIZComponents/autogenerateDialog.vue';
  284. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  285. import tabMixins from '@/mixins/tableColumnsMixin';
  286. import importDialog from '@/components/upload/import-dialog.vue';
  287. import exportButton from '@/components/upload/exportButton.vue';
  288. export default {
  289. mixins: [dictMixins, tabMixins],
  290. components: {
  291. processSubmitDialog,
  292. autogenerateDialog,
  293. searchTable,
  294. returnGoods,
  295. accountstatement,
  296. popModal,
  297. contractrDetail,
  298. addReturnGoodsDialog,
  299. addInvoiceDialog,
  300. invoice,
  301. addDialog,
  302. detailDialog,
  303. customerReturnOrder,
  304. entrustedReceive,
  305. invoiceConfirm,
  306. drawer,
  307. exceptionList,
  308. addInvoiceManage,
  309. palletManagement,
  310. exportButton,
  311. importDialog
  312. },
  313. //客户管理数据
  314. props: {
  315. contactData: {
  316. type: Object,
  317. default: () => {
  318. return {};
  319. }
  320. }
  321. },
  322. data() {
  323. return {
  324. activeComp: 'saleorder',
  325. tabOptions: [
  326. { key: 'saleorder', name: '销售订单' },
  327. { key: 'entrustedReceive', name: '受托收货单' },
  328. { key: 'invoice', name: '发货单' },
  329. { key: 'invoiceConfirm', name: '收货确认单' },
  330. { key: 'trayList', name: '托盘清单' },
  331. { key: 'exceptionList', name: '异常列表' },
  332. { key: 'returnorder', name: '退货单' },
  333. { key: 'customerReturnOrder', name: '退货处理单' },
  334. { key: 'accountstatement', name: '对账单' }
  335. ],
  336. selection: [], //单选中集合
  337. delVisible: false, //批量删除弹框状态
  338. loading: false, // 加载状态
  339. processSubmitDialogFlag: false, // 加载状态
  340. addOrEditDialogFlag1: false,
  341. params: {},
  342. columns: [
  343. {
  344. width: 45,
  345. type: 'selection',
  346. columnKey: 'selection',
  347. align: 'center'
  348. },
  349. {
  350. columnKey: 'index',
  351. label: '序号',
  352. type: 'index',
  353. width: 55,
  354. align: 'center',
  355. showOverflowTooltip: true,
  356. fixed: 'left'
  357. },
  358. {
  359. prop: 'orderNo',
  360. label: '订单编码',
  361. align: 'center',
  362. slot: 'orderNo',
  363. showOverflowTooltip: true,
  364. sortable: true,
  365. minWidth: 200,
  366. fixed: 'left'
  367. },
  368. {
  369. prop: 'needProduce',
  370. label: '订单类型',
  371. align: 'center',
  372. showOverflowTooltip: true,
  373. minWidth: 150,
  374. formatter: (_row, _column, cellValue) => {
  375. return cellValue == 1
  376. ? '生产性订单'
  377. : cellValue == 2
  378. ? '无客户生产性订单'
  379. : cellValue == 4
  380. ? '不定向订单'
  381. : '库存式订单';
  382. }
  383. },
  384. {
  385. prop: 'preOrderNo',
  386. label: '预销售订单编码',
  387. align: 'center',
  388. showOverflowTooltip: true,
  389. sortable: true,
  390. minWidth: 200,
  391. fixed: 'left'
  392. },
  393. {
  394. prop: 'progress',
  395. label: '订单进度',
  396. align: 'center',
  397. showOverflowTooltip: true,
  398. formatter: (_row, _column, cellValue) => {
  399. return saleOrderProgressStatusEnum.find(
  400. (val) => val.value == _row.progress
  401. )?.label;
  402. },
  403. minWidth: 120
  404. },
  405. // {
  406. // prop: 'deliveryDate',
  407. // label: '交货日期',
  408. // align: 'center',
  409. // showOverflowTooltip: true,
  410. // minWidth: 200
  411. // },
  412. {
  413. prop: 'productNames',
  414. label: '产品名称',
  415. align: 'center',
  416. showOverflowTooltip: true,
  417. minWidth: 140
  418. },
  419. {
  420. prop: 'productCodes',
  421. label: '编码',
  422. align: 'center',
  423. showOverflowTooltip: true,
  424. minWidth: 140
  425. },
  426. {
  427. prop: 'batchNo',
  428. label: '批次号',
  429. align: 'center',
  430. showOverflowTooltip: true,
  431. minWidth: 140
  432. },
  433. {
  434. prop: 'saleTypeName',
  435. label: '销售类型',
  436. align: 'center',
  437. showOverflowTooltip: true,
  438. minWidth: 140
  439. },
  440. {
  441. prop: 'projectName',
  442. label: '项目名称',
  443. align: 'center',
  444. showOverflowTooltip: true,
  445. minWidth: 180
  446. },
  447. {
  448. prop: 'partaName',
  449. label: '客户名称',
  450. align: 'center',
  451. showOverflowTooltip: true,
  452. minWidth: 180
  453. },
  454. {
  455. prop: 'partaLinkName',
  456. label: '客户联系人',
  457. align: 'center',
  458. showOverflowTooltip: true,
  459. minWidth: 130
  460. },
  461. {
  462. prop: 'partaTel',
  463. label: '客户联系电话',
  464. align: 'center',
  465. showOverflowTooltip: true,
  466. minWidth: 130
  467. },
  468. {
  469. prop: 'partbName',
  470. label: '售出方名称',
  471. align: 'center',
  472. showOverflowTooltip: true,
  473. minWidth: 130
  474. },
  475. {
  476. prop: 'partbLinkName',
  477. label: '售出方联系人',
  478. align: 'center',
  479. showOverflowTooltip: true,
  480. minWidth: 130
  481. },
  482. {
  483. prop: 'partbTel',
  484. label: '售出方联系电话',
  485. align: 'center',
  486. showOverflowTooltip: true,
  487. minWidth: 130
  488. },
  489. {
  490. prop: 'payAmount',
  491. label: '金额(元)',
  492. align: 'center',
  493. showOverflowTooltip: true,
  494. minWidth: 170
  495. },
  496. {
  497. prop: 'orderStatus',
  498. label: '审核状态',
  499. align: 'center',
  500. showOverflowTooltip: true,
  501. minWidth: 100,
  502. formatter: (_row, _column, cellValue) => {
  503. return reviewStatus[_row.orderStatus];
  504. }
  505. },
  506. {
  507. prop: 'contractNo',
  508. label: '来源单据',
  509. align: 'center',
  510. slot: 'contractNo',
  511. showOverflowTooltip: true,
  512. minWidth: 200,
  513. formatter: (_row, _column, cellValue) => {
  514. return (
  515. _row.contractNo +
  516. (_row.contractNumber && ',' + _row.contractNumber)
  517. );
  518. }
  519. },
  520. {
  521. prop: 'createUserName',
  522. label: '创建人',
  523. align: 'center',
  524. showOverflowTooltip: true,
  525. minWidth: 80
  526. },
  527. {
  528. prop: 'createTime',
  529. label: '创建时间',
  530. align: 'center',
  531. showOverflowTooltip: true,
  532. minWidth: 170
  533. },
  534. {
  535. columnKey: 'action',
  536. label: '操作',
  537. width: 250,
  538. align: 'center',
  539. resizable: false,
  540. slot: 'action',
  541. showOverflowTooltip: true,
  542. fixed: 'right'
  543. }
  544. ],
  545. cacheKeyUrl: 'eos-c2e9664a-saleManage-saleOrder'
  546. };
  547. },
  548. computed: {},
  549. created() {
  550. this.requestDict('客户状态');
  551. // if (!('Notification' in window)) {
  552. // console.log('此浏览器不支持桌面通知');
  553. // } else if (Notification.permission === 'granted') {
  554. // // 如果用户已经授权,直接创建通知
  555. // var notification = new Notification('标题', {
  556. // body: '这是通知的内容。'
  557. // });
  558. // } else if (Notification.permission !== 'denied') {
  559. // // 请求权限
  560. // Notification.requestPermission().then(function (permission) {
  561. // if (permission === 'granted') {
  562. // var notification = new Notification('标题', {
  563. // body: '消息提醒1'
  564. // });
  565. // }
  566. // });
  567. // }
  568. },
  569. methods: {
  570. //更多菜单
  571. handleCommand(command, row) {
  572. if (command === 'invoice') {
  573. this.$refs.invoiceDialogRef.open('add', {}, row.id);
  574. }
  575. if (command === 'returnOrder') {
  576. this.$refs.addReturnGoodsRef.open('add', {});
  577. }
  578. if (command === 'saleOrderReminder') {
  579. saleOrderReminder(row.id).then((res) => {
  580. this.$message.success('催单成功');
  581. });
  582. }
  583. if (command === 'invoiceManage') {
  584. this.addOrEditDialogFlag1 = true;
  585. this.$nextTick(() => {
  586. this.$refs.addOrEditDialogRef.createInvoice1(row, 1, 3);
  587. });
  588. }
  589. },
  590. //点击左边分类
  591. handleNodeClick(data, node) {
  592. // this.curNodeData = data;
  593. this.reload({ categoryId: data.id });
  594. },
  595. /* 表格数据源 */
  596. datasource({ page, limit, where, order }) {
  597. if (this.contactData.id) {
  598. where['contactId'] = this.contactData.id;
  599. }
  600. this.params = {
  601. pageNum: page,
  602. size: limit,
  603. ...where
  604. };
  605. return getTableList(this.params);
  606. },
  607. /* 刷新表格 */
  608. reload(where) {
  609. this.$refs.table.reload({ page: 1, where });
  610. },
  611. //新增编辑
  612. openEdit(type, row) {
  613. this.$refs.addDialogRef.open(type, row, row.id);
  614. this.$refs.addDialogRef.$refs.form &&
  615. this.$refs.addDialogRef.$refs.form.clearValidate();
  616. },
  617. //批量删除
  618. allDelBtn() {
  619. if (this.selection.length === 0) return;
  620. let flag = this.selection.some((item) =>
  621. [1, 2].includes(item.orderStatus)
  622. );
  623. if (flag)
  624. return this.$message.warning(
  625. '抱歉已审核、审核中的数据不能删除,请检查'
  626. );
  627. this.delVisible = true;
  628. },
  629. //删除接口
  630. remove(delData) {
  631. deleteInformation(delData).then((res) => {
  632. this.$message.success('删除成功!');
  633. this.reload();
  634. });
  635. },
  636. //删除弹框确定
  637. commitBtn() {
  638. const dataId = this.selection.map((v) => v.id);
  639. this.remove(dataId);
  640. },
  641. //查看详情
  642. openorderDetail(row) {
  643. // this.$refs.contactDetailDialogRef.open(row);
  644. this.$refs.drawerRef.open(row);
  645. },
  646. async saleOrderSubmit(id) {
  647. this.$refs.addDialogRef && this.$refs.addDialogRef.cancel();
  648. const data = await getSaleOrderDetail(id);
  649. this.processSubmitDialogFlag = true;
  650. this.$nextTick(() => {
  651. let params = {
  652. businessId: id,
  653. businessKey: 'sales_order_approve',
  654. formCreateUserId: data.createUserId,
  655. variables: {
  656. businessCode: data.orderNo,
  657. businessName: data.partaName,
  658. businessType: data.saleTypeName
  659. }
  660. };
  661. this.$refs.processSubmitDialogRef.init(params);
  662. });
  663. },
  664. saleOrderSubmitOrGenerate(res) {
  665. this.saleOrderSubmit(res.id);
  666. // if (res.needProduce == 1) {
  667. // this.handleAutoGenerate(res.id, true);
  668. // } else {
  669. // this.saleOrderSubmit(res.id);
  670. // }
  671. },
  672. //生成
  673. handleAutoGenerate(id, isAuto = false) {
  674. this.$refs.autogenerateDialogRef.init(id, isAuto);
  675. },
  676. //查看合同详情
  677. opencontractDetail(row) {
  678. let data = {
  679. id: row.contractId
  680. };
  681. this.$refs.contractDetailRef.open(data);
  682. },
  683. uploadFile() {
  684. this.$refs.importDialogRef.open();
  685. },
  686. exportFn() {
  687. console.log(this.params);
  688. exportSaleorder(this.params);
  689. }
  690. }
  691. };
  692. </script>
  693. <style lang="scss" scoped>
  694. :deep .el-card__body {
  695. padding: 0;
  696. }
  697. :deep(.el-link--inner) {
  698. margin-left: 0px !important;
  699. }
  700. .sys-organization-list {
  701. height: calc(100vh - 264px);
  702. box-sizing: border-box;
  703. border-width: 1px;
  704. border-style: solid;
  705. overflow: auto;
  706. }
  707. .sys-organization-list :deep(.el-tree-node__content) {
  708. height: 40px;
  709. & > .el-tree-node__expand-icon {
  710. margin-left: 10px;
  711. }
  712. }
  713. .el-dropdown-link {
  714. cursor: pointer;
  715. color: var(--color-primary-5);
  716. }
  717. .el-icon-arrow-down {
  718. font-size: 12px;
  719. }
  720. </style>