detailsPage.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832
  1. <template>
  2. <div>
  3. <div class="borderless">
  4. <div class="customer-head">
  5. <div class="customer-back">
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <el-button v-if="detailData.check" type="primary" size="small" class="el-button--small-yh"
  12. @click.stop="openCheckDialog">
  13. 审批
  14. </el-button>
  15. <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印
  16. </el-button>
  17. <el-button type="primary" size="small" v-if="detailData.status == 1 && form.confirmStatus == 0"
  18. class="el-button--small-yh " @click.stop="openEdit">编辑
  19. </el-button>
  20. <el-button type="primary" size="small" v-if="!form.id && detailData.status != 1" @click="editCustomer">
  21. 保存数据
  22. </el-button>
  23. <el-button type="primary" size="small" v-if="form.id && detailData.status != 1 && form.confirmStatus == 0"
  24. @click="fixSave">
  25. 保存数据
  26. </el-button>
  27. <el-button type="primary" size="small" v-if="form.id && detailData.status != 1 && form.confirmStatus == 0"
  28. @click="submit">
  29. 提交
  30. </el-button>
  31. <el-button type="primary" size="small" v-if="form.confirmStatus == 1" @click="revokeOrder">
  32. 撤销
  33. </el-button>
  34. </div>
  35. </div>
  36. <!-- <containerTitle title="基础资料" style="margin-top: 60px"></containerTitle> -->
  37. <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
  38. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  39. <template slot="corpId">
  40. <crop-select v-model="form.corpId" corpType="KH" :disabled="detailData.status == 1"
  41. @getCorpData="getCorpData"></crop-select>
  42. </template>
  43. <template slot="storageId">
  44. <el-select v-model="form.storageId" placeholder="请选择" size="small" filterable @change="storageChange"
  45. :disabled="detailData.status == 1 || data.length > 0">
  46. <el-option v-for="item in storageoptions" :key="item.id" :label="item.cname" :value="item.id">
  47. </el-option>
  48. </el-select>
  49. </template>
  50. </avue-form>
  51. </trade-card>
  52. <trade-card title="商品信息" v-loading="loadingBtn">
  53. <avue-form class="trading-form" v-model="form" :option="option2">
  54. <template slot="thisUsedProfit">
  55. <el-input-number v-model="form.thisUsedProfit" :disabled="detailData.status == 1" @change="amountChange"
  56. placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input-number>
  57. </template>
  58. </avue-form>
  59. <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
  60. @resetColumn="resetColumn" :cell-style="cellStyle">
  61. <template slot="headerSerial">
  62. <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
  63. :disabled="detailData.status == 1" circle></el-button>
  64. </template>
  65. <template slot="cname" slot-scope="{ row, index }">
  66. <el-select v-if="row.$cellEdit" v-model="row.cname" placeholder="请选择" size="small" filterable
  67. @change="cnameChange(row, index)">
  68. <el-option v-for="item in goodsoptions" :key="item.itemId" :label="item.cname" :value="item.cname"
  69. :disabled="item.status == 1">
  70. </el-option>
  71. </el-select>
  72. <span v-else>{{ row.cname }}</span>
  73. </template>
  74. <template slot="unitHeader" slot-scope="{column}">
  75. <span style="color: #409EFF;cursor: pointer" @click.stop="$refs.dictbiz.open()">单位
  76. </span>
  77. </template>
  78. <template slot="storageInQuantity" slot-scope="{ row, index }">
  79. <el-input-number v-if="row.$cellEdit" v-model="row.storageInQuantity" @change="countChange(row)"
  80. placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input-number>
  81. <span v-else>{{ row.storageInQuantity }}</span>
  82. </template>
  83. <template slot="price" slot-scope="{ row, index }">
  84. <el-input-number v-if="row.$cellEdit" v-model="row.price" @change="countChange(row)" placeholder="请输入"
  85. size="small" :controls="false" style="width:100%;"></el-input-number>
  86. <span v-else>{{ row.price }}</span>
  87. </template>
  88. <template slot="purchaseAmount" slot-scope="{ row, index }">
  89. <el-input-number v-if="row.$cellEdit" v-model="row.purchaseAmount" @change="countChange(row)"
  90. placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input-number>
  91. <span v-else>{{ row.purchaseAmount }}</span>
  92. </template>
  93. <template slot="menu" slot-scope="{ row, index }">
  94. <el-button size="small" type="text" :disabled="detailData.status == 1" @click="rowCell(row, index)">{{
  95. row.$cellEdit ? "保存" : "修改"
  96. }}</el-button>
  97. <el-button size="small" type="text" :disabled="detailData.status == 1" @click="rowDel(row, index)">删除
  98. </el-button>
  99. </template>
  100. </avue-crud>
  101. </trade-card>
  102. <fee-info ref="feeInfo" :data="settlementList" :form="form" :detailData="detailData" @getPay="getPay"
  103. v-loading="loadingBtn">
  104. </fee-info>
  105. <containerTitle title="上传附件"></containerTitle>
  106. <c-upload v-loading="loadingBtn" typeUpload="CD"
  107. deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="orderFilesList" display
  108. :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
  109. <el-dialog :title="addressTitle" v-dialogDrag :visible.sync="addressVisible" class="avue-dialog avue-dialog--top"
  110. width="50%" append-to-body>
  111. <span>
  112. <el-tabs v-model="activeName">
  113. <el-tab-pane label="客户地址" name="first">
  114. <avue-form class="trading-form" v-model="form2" :option="optiontabs1"></avue-form>
  115. </el-tab-pane>
  116. <el-tab-pane label="物流地址" name="second">
  117. <avue-form class="trading-form" v-model="form3" :option="optiontabs2"></avue-form>
  118. </el-tab-pane>
  119. </el-tabs>
  120. </span>
  121. <div class="avue-dialog__footer">
  122. <el-button @click="addressVisible = false">取 消</el-button>
  123. <el-button @click="addressVisible = false" type="primary">确 定</el-button>
  124. </div>
  125. </el-dialog>
  126. <dictbiz-dialog ref="dictbiz" title="添加单位" code="unit" parentId="1585962784498225154"
  127. @closed="getAllWorkDicts">
  128. </dictbiz-dialog>
  129. <report-dialog :switchDialog="switchDialog" :reportId="form.id" reportName="配件系统-销售单" @onClose="onClose()">
  130. </report-dialog>
  131. </div>
  132. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  133. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  134. <check :checkData="checkData" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
  135. </check>
  136. </el-dialog>
  137. </div>
  138. </template>
  139. <script>
  140. import {optionList} from "./js/optionList";
  141. import {
  142. getDetails,
  143. submit,
  144. getCorpDetails,
  145. remove,
  146. getAllgoods,
  147. save,
  148. fixSave,
  149. revoke,
  150. collectPayment,
  151. getStoragelist,
  152. offset
  153. } from "@/api/basicData/salesOrder";
  154. import feeInfo from "./components/feeInfo.vue";
  155. import reportDialog from "@/components/report-dialog/main";
  156. import { multiply, sum, subtract } from "@/util/calculate";
  157. import {fdatasync} from "fs";
  158. import check from "@/components/check/check";
  159. export default {
  160. name: "index",
  161. data() {
  162. return {
  163. checkDialog: false,
  164. checkData: {},
  165. switchDialog: false,
  166. activeName: 'first',
  167. loadingBtn: false,
  168. addressTitle: null,
  169. addressVisible: false,
  170. form: {},
  171. form2: {},
  172. form3: {
  173. },
  174. data: [],
  175. option: {
  176. menuBtn: false,
  177. labelWidth: 90,
  178. disabled: false,
  179. column: [
  180. {
  181. label: "客户名称",
  182. prop: "corpId",
  183. rules: [
  184. {
  185. required: true,
  186. message: "",
  187. trigger: "blur"
  188. }
  189. ],
  190. span: 8,
  191. },
  192. {
  193. label: "送货地址",
  194. prop: "arrivalAddress",
  195. type: 'select',
  196. dicData: [],
  197. props: {
  198. label: 'detailedAddress',
  199. value: 'detailedAddress'
  200. },
  201. allowCreate: true,
  202. filterable: true,
  203. span: 16,
  204. },
  205. {
  206. label: "销售日期",
  207. prop: "businesDate",
  208. type: "date",
  209. format: "yyyy-MM-dd",
  210. valueFormat: "yyyy-MM-dd 00:00:00",
  211. span: 8,
  212. },
  213. {
  214. label: "计划收款日期",
  215. prop: "advanceCollectionDate",
  216. type: "date",
  217. format: "yyyy-MM-dd",
  218. valueFormat: "yyyy-MM-dd 00:00:00",
  219. span: 8,
  220. },
  221. {
  222. label: "送货日期",
  223. prop: "requiredDeliveryDate",
  224. type: "date",
  225. format: "yyyy-MM-dd",
  226. valueFormat: "yyyy-MM-dd 00:00:00",
  227. span: 8,
  228. },
  229. {
  230. label: "仓库",
  231. prop: "storageId",
  232. rules: [
  233. {
  234. required: true,
  235. message: "",
  236. trigger: "blur"
  237. }
  238. ],
  239. span: 8,
  240. },
  241. {
  242. label: "备注",
  243. prop: "orderRemark",
  244. placeholder: "打印时显示",
  245. type: "textarea",
  246. minRows: 3,
  247. span: 16,
  248. }
  249. ]
  250. },
  251. option2: {
  252. menuBtn: false,
  253. labelWidth: 80,
  254. disabled: false,
  255. column: [
  256. {
  257. label: "税率",
  258. prop: "exchangeRate",
  259. type: "select",
  260. props: {
  261. label: "dictValue",
  262. value: "dictKey"
  263. },
  264. dicUrl: "/api/blade-system/dict-biz/dictionary?code=tax_rate",
  265. span: 4,
  266. },
  267. {
  268. label: "销售总数量",
  269. prop: "storageQuantity",
  270. disabled: true,
  271. span: 4,
  272. },
  273. {
  274. label: "成本",
  275. prop: "costAmount",
  276. disabled: true,
  277. span: 4,
  278. },
  279. {
  280. label: "毛利",
  281. prop: "grossProfit",
  282. disabled: true,
  283. span: 4,
  284. },
  285. {
  286. label: "订单金额",
  287. prop: "purchaseAmount",
  288. disabled: true,
  289. span: 4,
  290. },
  291. {
  292. label: "优惠金额",
  293. prop: "thisUsedProfit",
  294. span: 4,
  295. },
  296. {
  297. label: "合同金额",
  298. prop: "orderAmount",
  299. disabled: true,
  300. span: 8,
  301. },
  302. {
  303. label: "应收金额",
  304. prop: "balanceAmount",
  305. disabled: true,
  306. span: 8,
  307. },
  308. {
  309. label: "已收金额",
  310. prop: "settlmentAmount",
  311. disabled: true,
  312. span: 8,
  313. }
  314. ]
  315. },
  316. optiontabs1: {
  317. menuBtn: false,
  318. labelWidth: 90,
  319. column: [
  320. {
  321. label: "简称",
  322. prop: "a",
  323. type: "select",
  324. span: 24,
  325. },
  326. {
  327. label: "地址",
  328. prop: "b",
  329. type: "select",
  330. span: 24,
  331. },
  332. {
  333. label: "详细地址",
  334. prop: "c",
  335. span: 24,
  336. },
  337. {
  338. label: "邮编",
  339. prop: "d",
  340. span: 24,
  341. },
  342. {
  343. label: "备注",
  344. prop: "e",
  345. type: 'textarea',
  346. minRows: 3,
  347. span: 24,
  348. },
  349. {
  350. label: "地址智能识别",
  351. prop: "ad",
  352. placeholder: "例:上海市徐汇区枫林街道斜土路100号",
  353. type: "textarea",
  354. minRows: 3,
  355. span: 24,
  356. }
  357. ]
  358. },
  359. optiontabs2: {
  360. menuBtn: false,
  361. labelWidth: 80,
  362. column: [
  363. {
  364. label: "目的地",
  365. prop: "a",
  366. type: "select",
  367. rules: [
  368. {
  369. required: true,
  370. message: "",
  371. trigger: "blur"
  372. }
  373. ],
  374. span: 24,
  375. },
  376. {
  377. label: "物流公司",
  378. prop: "b",
  379. span: 24,
  380. },
  381. {
  382. label: "电话",
  383. prop: "c",
  384. span: 24,
  385. },
  386. {
  387. label: "地址",
  388. prop: "d",
  389. span: 24,
  390. },
  391. {
  392. label: "详细地址",
  393. prop: "e",
  394. span: 24,
  395. },
  396. {
  397. label: "邮编",
  398. prop: "f",
  399. span: 24,
  400. },
  401. {
  402. label: "备注",
  403. prop: "remarks",
  404. type: "textarea",
  405. minRows: 3,
  406. span: 24,
  407. },
  408. {
  409. label: "地址智能识别",
  410. prop: "g",
  411. type: "textarea",
  412. minRows: 3,
  413. span: 24,
  414. }
  415. ]
  416. },
  417. optionList: {},
  418. goodsoptions: [],
  419. settlementList: [],
  420. orderFilesList: [],
  421. storageoptions: []
  422. };
  423. },
  424. props: {
  425. detailData: {
  426. type: Object
  427. }
  428. },
  429. components: {
  430. feeInfo,
  431. check,
  432. reportDialog
  433. },
  434. async created() {
  435. // console.log(this.detailData)
  436. this.optionList = await this.getColumnData(
  437. this.getColumnName(212),
  438. optionList
  439. );
  440. if (this.detailData.id) {
  441. this.getDetail(this.detailData.id);
  442. }
  443. if (this.detailData.status == 1) {
  444. this.option.disabled = true;
  445. this.option2.disabled = true;
  446. }
  447. this.getAllWorkDicts()
  448. getAllgoods().then(res => {
  449. this.goodsoptions = res.data.data
  450. });
  451. },
  452. methods: {
  453. //打开审核
  454. openCheckDialog() {
  455. offset({id: this.form.id}).then(res => {
  456. if (res.data.data == '操作成功') {
  457. this.checkData = this.detailData.check;
  458. this.checkDialog = true;
  459. } else {
  460. this.$confirm(res.data.data, {
  461. confirmButtonText: "确定",
  462. cancelButtonText: "取消",
  463. type: "warning"
  464. }).then(() => {
  465. this.checkData = this.detailData.check;
  466. this.checkDialog = true;
  467. })
  468. }
  469. })
  470. },
  471. //关闭审核
  472. choceCheckFun() {
  473. this.checkDialog = false;
  474. },
  475. openReport() {
  476. this.switchDialog = !this.switchDialog;
  477. },
  478. onClose(val) {
  479. this.switchDialog = val;
  480. },
  481. getAllWorkDicts() {
  482. this.getWorkDicts("unit").then(res => {
  483. this.findObject(this.optionList.column, "unit").dicData = res.data.data;
  484. });
  485. getStoragelist().then(res => {
  486. this.storageoptions = res.data;
  487. this.findObject(this.optionList.column, "storageId").dicData = res.data;
  488. })
  489. this.$refs.crud.init();
  490. },
  491. cellStyle() {
  492. return "padding:0;height:40px;";
  493. },
  494. cnameChange(row) {
  495. if (row.cname) {
  496. this.goodsoptions.forEach(e => {
  497. if (e.cname == row.cname) {
  498. row.itemId = e.id
  499. row.unit = e.unit
  500. row.price = e.standardPrice
  501. row.storageInQuantity = 1
  502. row.amount = e.standardPrice
  503. row.purchasePrice = e.purchasePrice
  504. row.storageAmount = e.purchasePrice
  505. }
  506. })
  507. } else {
  508. row.itemId = null
  509. row.unit = null
  510. row.price = null
  511. row.storageInQuantity = null
  512. row.amount = null
  513. row.purchasePrice = null
  514. row.storageAmount = null
  515. }
  516. this.countChange(row)
  517. },
  518. amountChange() {
  519. let val = 0
  520. this.data.forEach(e => {
  521. val = sum(val, e.amount)
  522. this.form.purchaseAmount = val
  523. this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
  524. })
  525. },
  526. countChange(row) {
  527. row.amount = multiply(row.price, row.storageInQuantity)
  528. row.storageAmount = multiply(row.purchaseAmount, row.storageInQuantity)
  529. let val = 0
  530. this.data.forEach(e => {
  531. val = sum(val, e.amount)
  532. this.form.purchaseAmount = val
  533. this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
  534. })
  535. this.$refs.crud.refreshTable();
  536. },
  537. getDetail(id) {
  538. this.loadingBtn = true
  539. getDetails({ id: id })
  540. .then(res => {
  541. this.form = res.data.data;
  542. this.data = res.data.data.orderItemsList;
  543. this.settlementList = res.data.data.settlementList;
  544. this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
  545. this.getAddress(res.data.data)
  546. })
  547. .finally(() => {
  548. this.loadingBtn = false;
  549. });
  550. },
  551. getCorpData(row) {
  552. if (row) {
  553. this.form.corpsName = row.cname
  554. this.form.corpTel = row.tel
  555. getCorpDetails({ id: row.id }).then(res => {
  556. this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
  557. })
  558. } else {
  559. this.form.corpsName = null
  560. this.form.corpTel = null
  561. this.findObject(this.option.column, "arrivalAddress").dicData = []
  562. }
  563. },
  564. storageChange(row) {
  565. // console.log(row)
  566. },
  567. getAddress(row) {
  568. getCorpDetails({ id: row.corpId }).then(res => {
  569. this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
  570. })
  571. },
  572. addRow() {
  573. this.$refs["form"].validate((valid, done) => {
  574. done();
  575. if (valid) {
  576. this.data.push({ $cellEdit: true, storageId: this.form.storageId })
  577. } else {
  578. return false;
  579. }
  580. });
  581. },
  582. rowCell(row, index) {
  583. if (row.$cellEdit == true) {
  584. this.$set(row, "$cellEdit", false);
  585. } else {
  586. this.$set(row, "$cellEdit", true);
  587. }
  588. },
  589. rowDel(row, index) {
  590. this.$confirm("确定删除数据?", {
  591. confirmButtonText: "确定",
  592. cancelButtonText: "取消",
  593. type: "warning"
  594. }).then(() => {
  595. if (row.id) {
  596. remove(row.id).then(res => {
  597. this.$message({
  598. type: "success",
  599. message: "删除成功!"
  600. });
  601. this.data.splice(index, 1);
  602. });
  603. } else {
  604. this.$message({
  605. type: "success",
  606. message: "删除成功!"
  607. });
  608. this.data.splice(index, 1);
  609. }
  610. });
  611. },
  612. getPay(row) {
  613. // this.form = row;
  614. // this.data = row.orderItemsList;
  615. // this.settlementList = row.settlementList
  616. this.getDetail(row.id);
  617. },
  618. //修改提交触发
  619. editCustomer() {
  620. this.$refs["form"].validate((valid, done) => {
  621. done();
  622. if (valid) {
  623. if (this.data.length == 0) {
  624. return this.$message.error('请添加一条商品信息');
  625. }
  626. if (this.settlementList.length > 0) {
  627. for (let i = 0; i < this.settlementList.length; i++) {
  628. if (!this.settlementList[i].id) {
  629. return this.$message.error(`请保存第${i + 1}行的费用明细`);
  630. }
  631. }
  632. }
  633. this.loadingBtn = true;
  634. save({ ...this.form, billType: 'XSJH', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
  635. .then(res => {
  636. this.$message.success("保存成功");
  637. this.form = res.data.data;
  638. this.data = res.data.data.orderItemsList;
  639. this.settlementList = res.data.data.settlementList;
  640. this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
  641. this.detailData.status = 1
  642. this.option.disabled = true;
  643. this.option2.disabled = true;
  644. this.$refs.crud.refreshTable();
  645. this.$refs.feeInfo.refreshTable();
  646. })
  647. .finally(() => {
  648. this.loadingBtn = false;
  649. });
  650. } else {
  651. return false;
  652. }
  653. });
  654. },
  655. fixSave() {
  656. this.$refs["form"].validate((valid, done) => {
  657. done();
  658. if (valid) {
  659. if (this.data.length == 0) {
  660. return this.$message.error('请添加一条商品信息');
  661. }
  662. if (this.settlementList.length > 0) {
  663. for (let i = 0; i < this.settlementList.length; i++) {
  664. if (!this.settlementList[i].id) {
  665. return this.$message.error(`请保存第${i + 1}行的费用明细`);
  666. }
  667. }
  668. }
  669. this.loadingBtn = true;
  670. fixSave({ ...this.form, billType: 'XSJH', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
  671. .then(res => {
  672. this.$message.success("修改成功");
  673. this.form = res.data.data;
  674. this.data = res.data.data.orderItemsList;
  675. this.settlementList = res.data.data.settlementList
  676. this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
  677. })
  678. .finally(() => {
  679. this.loadingBtn = false;
  680. });
  681. } else {
  682. return false;
  683. }
  684. });
  685. },
  686. submit() {
  687. this.$refs["form"].validate((valid, done) => {
  688. done();
  689. if (valid) {
  690. if (this.data.length == 0) {
  691. return this.$message.error('请添加一条商品信息');
  692. }
  693. if (this.settlementList.length > 0) {
  694. for (let i = 0; i < this.settlementList.length; i++) {
  695. if (!this.settlementList[i].id) {
  696. return this.$message.error(`请保存第${i + 1}行的费用明细`);
  697. }
  698. }
  699. }
  700. this.loadingBtn = true;
  701. submit({ ...this.form, billType: 'XSJH', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
  702. .then(res => {
  703. this.$message.success("提交成功");
  704. this.form = res.data.data;
  705. this.data = res.data.data.orderItemsList;
  706. this.settlementList = res.data.data.settlementList;
  707. this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
  708. this.$emit("goBack");
  709. })
  710. .finally(() => {
  711. this.loadingBtn = false;
  712. });
  713. } else {
  714. return false;
  715. }
  716. });
  717. },
  718. revokeOrder() {
  719. this.$confirm('此操作将会撤销单子, 是否继续?', '提示', {
  720. confirmButtonText: '确定',
  721. cancelButtonText: '取消',
  722. type: 'warning'
  723. }).then(() => {
  724. this.loadingBtn = true;
  725. revoke({ ...this.form, billType: 'XSJH', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
  726. .then(res => {
  727. this.$message.success("撤销成功");
  728. this.form = res.data.data;
  729. this.data = res.data.data.orderItemsList;
  730. this.settlementList = res.data.data.settlementList
  731. this.openEdit()
  732. })
  733. .finally(() => {
  734. this.loadingBtn = false;
  735. });
  736. }).catch(() => {
  737. });
  738. },
  739. async saveColumn() {
  740. const inSave = await this.saveColumnData(
  741. this.getColumnName(212),
  742. this.optionList
  743. );
  744. if (inSave) {
  745. this.$nextTick(() => {
  746. this.$refs.crud.doLayout();
  747. });
  748. this.$message.success("保存成功");
  749. //关闭窗口
  750. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  751. }
  752. },
  753. async resetColumn() {
  754. this.optionList = optionList;
  755. const inSave = await this.delColumnData(
  756. this.getColumnName(212),
  757. optionList
  758. );
  759. if (inSave) {
  760. this.$nextTick(() => {
  761. this.$refs.crud.doLayout();
  762. });
  763. this.getAllWorkDicts()
  764. this.$message.success("重置成功");
  765. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  766. }
  767. },
  768. openEdit() {
  769. this.detailData.status = 2
  770. this.option = this.$options.data().option;
  771. this.option2 = this.$options.data().option2;
  772. this.$refs.crud.refreshTable();
  773. this.$refs.feeInfo.refreshTable();
  774. },
  775. //返回列表
  776. backToList() {
  777. this.$emit("goBack");
  778. }
  779. },
  780. };
  781. </script>
  782. <style lang="scss" scoped>
  783. .trading-form ::v-deep .el-form-item {
  784. margin-bottom: 8px !important;
  785. }
  786. ::v-deep .el-dialog__body {
  787. padding: 0px 20px 15px 20px;
  788. }
  789. ::v-deep .el-form-item__error {
  790. display: none !important;
  791. }
  792. .img-form ::v-deep .el-form-item {
  793. height: 150px;
  794. line-height: 150px;
  795. margin-bottom: 8px !important;
  796. }
  797. .img-form ::v-deep .avue-upload__icon {
  798. font-size: 20px;
  799. width: 150px;
  800. height: 150px;
  801. line-height: 150px;
  802. }
  803. ::v-deep .el-table .cell {
  804. padding: 0 2px !important;
  805. }
  806. ::v-deep .avue-crud .el-table .el-form-item__label {
  807. left: -1px;
  808. }
  809. .addressTabs {
  810. display: flex;
  811. justify-content: center;
  812. span {
  813. width: 100px;
  814. font-size: 18px;
  815. font-weight: 600;
  816. text-align: center;
  817. }
  818. }
  819. </style>