detailsPage.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874
  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: "sysNo",
  195. disabled: true,
  196. span: 8,
  197. },
  198. {
  199. label: "退款单号",
  200. prop: "srcOrderNo",
  201. disabled: true,
  202. span: 8,
  203. }, {
  204. label: "订单来源",
  205. prop: "orderSource",
  206. disabled: true,
  207. type: 'select',
  208. dataType: 'number',
  209. dicData: [
  210. {
  211. label: "APP/PC",
  212. value: 1
  213. },
  214. {
  215. label: "小程序",
  216. value: 2
  217. }],
  218. props: {
  219. label: 'label',
  220. value: 'value'
  221. },
  222. span: 8,
  223. }, {
  224. label: "联系人",
  225. prop: "corpAttn",
  226. disabled: true,
  227. span: 8,
  228. }, {
  229. label: "联系电话",
  230. prop: "corpTel",
  231. disabled: true,
  232. span: 8,
  233. }, {
  234. label: "送货地址",
  235. prop: "arrivalAddress",
  236. type: 'select',
  237. dicData: [],
  238. props: {
  239. label: 'detailedAddress',
  240. value: 'detailedAddress'
  241. },
  242. allowCreate: true,
  243. filterable: true,
  244. span: 16,
  245. }, {
  246. label: "销售日期",
  247. prop: "businesDate",
  248. type: "datetime",
  249. format: "yyyy-MM-dd HH:mm:ss",
  250. valueFormat: "yyyy-MM-dd HH:mm:ss",
  251. span: 8,
  252. }, {
  253. label: "计划收款日期",
  254. prop: "advanceCollectionDate",
  255. type: "date",
  256. format: "yyyy-MM-dd",
  257. valueFormat: "yyyy-MM-dd HH:mm:ss",
  258. span: 8,
  259. }, {
  260. label: "送货日期",
  261. prop: "requiredDeliveryDate",
  262. type: "date",
  263. format: "yyyy-MM-dd",
  264. valueFormat: "yyyy-MM-dd 00:00:00",
  265. span: 8,
  266. }, {
  267. label: "快递公司",
  268. prop: "courierCorporation",
  269. disabled: true,
  270. span: 8,
  271. },
  272. {
  273. label: "快递单号",
  274. prop: "courierNumber",
  275. disabled: true,
  276. span: 8,
  277. },
  278. {
  279. label: "仓库",
  280. prop: "storageId",
  281. rules: [
  282. {
  283. required: true,
  284. message: "",
  285. trigger: "blur"
  286. }
  287. ],
  288. span: 8,
  289. },
  290. {
  291. label: "备注",
  292. prop: "orderRemark",
  293. placeholder: "打印时显示",
  294. type: "textarea",
  295. minRows: 3,
  296. span: 24,
  297. }
  298. ]
  299. },
  300. option2: {
  301. menuBtn: false,
  302. labelWidth: 80,
  303. disabled: false,
  304. column: [
  305. {
  306. label: "订单金额",
  307. prop: "purchaseAmount",
  308. disabled: true,
  309. span: 4,
  310. },
  311. {
  312. label: "优惠金额",
  313. prop: "thisUsedProfit",
  314. span: 4,
  315. },
  316. {
  317. label: "税率",
  318. prop: "exchangeRate",
  319. type: "select",
  320. props: {
  321. label: "dictValue",
  322. value: "dictKey"
  323. },
  324. dicUrl: "/api/blade-system/dict-biz/dictionary?code=tax_rate",
  325. span: 4,
  326. },
  327. {
  328. label: "销售总数量",
  329. prop: "storageQuantity",
  330. disabled: true,
  331. span: 4,
  332. },
  333. {
  334. label: "成本",
  335. prop: "costAmount",
  336. disabled: true,
  337. span: 4,
  338. },
  339. {
  340. label: "毛利",
  341. prop: "grossProfit",
  342. disabled: true,
  343. span: 4,
  344. },
  345. {
  346. label: "已收金额",
  347. prop: "settlmentAmount",
  348. disabled: true,
  349. span: 8,
  350. },
  351. {
  352. label: "合同金额",
  353. prop: "orderAmount",
  354. disabled: true,
  355. span: 8,
  356. },
  357. {
  358. label: "应收金额",
  359. prop: "balanceAmount",
  360. disabled: true,
  361. span: 8,
  362. }
  363. ]
  364. },
  365. optiontabs1: {
  366. menuBtn: false,
  367. labelWidth: 90,
  368. column: [
  369. {
  370. label: "简称",
  371. prop: "a",
  372. type: "select",
  373. span: 24,
  374. },
  375. {
  376. label: "地址",
  377. prop: "b",
  378. type: "select",
  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. type: 'textarea',
  395. minRows: 3,
  396. span: 24,
  397. },
  398. {
  399. label: "地址智能识别",
  400. prop: "ad",
  401. placeholder: "例:上海市徐汇区枫林街道斜土路100号",
  402. type: "textarea",
  403. minRows: 3,
  404. span: 24,
  405. }
  406. ]
  407. },
  408. optiontabs2: {
  409. menuBtn: false,
  410. labelWidth: 80,
  411. column: [
  412. {
  413. label: "目的地",
  414. prop: "a",
  415. type: "select",
  416. rules: [
  417. {
  418. required: true,
  419. message: "",
  420. trigger: "blur"
  421. }
  422. ],
  423. span: 24,
  424. },
  425. {
  426. label: "物流公司",
  427. prop: "b",
  428. span: 24,
  429. },
  430. {
  431. label: "电话",
  432. prop: "c",
  433. span: 24,
  434. },
  435. {
  436. label: "地址",
  437. prop: "d",
  438. span: 24,
  439. },
  440. {
  441. label: "详细地址",
  442. prop: "e",
  443. span: 24,
  444. },
  445. {
  446. label: "邮编",
  447. prop: "f",
  448. span: 24,
  449. },
  450. {
  451. label: "备注",
  452. prop: "remarks",
  453. type: "textarea",
  454. minRows: 3,
  455. span: 24,
  456. },
  457. {
  458. label: "地址智能识别",
  459. prop: "g",
  460. type: "textarea",
  461. minRows: 3,
  462. span: 24,
  463. }
  464. ]
  465. },
  466. optionList: {},
  467. goodsoptions: [],
  468. settlementList: [],
  469. orderFilesList: [],
  470. storageoptions: []
  471. };
  472. },
  473. props: {
  474. detailData: {
  475. type: Object
  476. }
  477. },
  478. components: {
  479. feeInfo,
  480. check,
  481. reportDialog
  482. },
  483. async created() {
  484. // console.log(this.detailData)
  485. this.optionList = await this.getColumnData(
  486. this.getColumnName(212),
  487. optionList
  488. );
  489. if (this.detailData.id) {
  490. this.getDetail(this.detailData.id);
  491. }
  492. if (this.detailData.status == 1) {
  493. this.option.disabled = true;
  494. this.option2.disabled = true;
  495. }
  496. this.getAllWorkDicts()
  497. getAllgoods().then(res => {
  498. this.goodsoptions = res.data.data
  499. });
  500. },
  501. methods: {
  502. //打开审核
  503. openCheckDialog() {
  504. this.checkData = this.detailData.check;
  505. this.checkDialog = true;
  506. },
  507. //关闭审核
  508. choceCheckFun() {
  509. this.checkDialog = false;
  510. },
  511. openReport() {
  512. this.switchDialog = !this.switchDialog;
  513. },
  514. onClose(val) {
  515. this.switchDialog = val;
  516. },
  517. getAllWorkDicts() {
  518. this.getWorkDicts("unit").then(res => {
  519. this.findObject(this.optionList.column, "unit").dicData = res.data.data;
  520. });
  521. getStoragelist().then(res => {
  522. this.storageoptions = res.data;
  523. this.findObject(this.optionList.column, "storageId").dicData = res.data;
  524. })
  525. this.$refs.crud.init();
  526. },
  527. cellStyle() {
  528. return "padding:0;height:40px;";
  529. },
  530. cnameChange(row) {
  531. if (row.cname) {
  532. this.goodsoptions.forEach(e => {
  533. if (e.cname == row.cname) {
  534. row.itemId = e.id
  535. row.unit = e.unit
  536. row.price = e.standardPrice
  537. row.storageInQuantity = 1
  538. row.amount = e.standardPrice
  539. row.purchasePrice = e.purchasePrice
  540. row.storageAmount = e.purchasePrice
  541. }
  542. })
  543. } else {
  544. row.itemId = null
  545. row.unit = null
  546. row.price = null
  547. row.storageInQuantity = null
  548. row.amount = null
  549. row.purchasePrice = null
  550. row.storageAmount = null
  551. }
  552. this.countChange(row)
  553. },
  554. amountChange() {
  555. let val = 0
  556. this.data.forEach(e => {
  557. val = sum(val, e.amount)
  558. this.form.purchaseAmount = val
  559. this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
  560. })
  561. },
  562. countChange(row) {
  563. row.amount = multiply(row.price, row.storageInQuantity)
  564. row.storageAmount = multiply(row.purchaseAmount, row.storageInQuantity)
  565. let val = 0
  566. this.data.forEach(e => {
  567. val = sum(val, e.amount)
  568. this.form.purchaseAmount = val
  569. this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
  570. })
  571. this.$refs.crud.refreshTable();
  572. },
  573. getDetail(id) {
  574. this.loadingBtn = true
  575. getDetails({ id: id })
  576. .then(res => {
  577. this.form = res.data.data;
  578. this.data = res.data.data.orderItemsList;
  579. this.settlementList = res.data.data.settlementList;
  580. this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
  581. this.getAddress(res.data.data)
  582. }).finally(() => {
  583. this.loadingBtn = false;
  584. });
  585. },
  586. getCorpData(row) {
  587. if (row) {
  588. this.form.corpsName = row.cname
  589. this.form.corpTel = row.tel
  590. getCorpDetails({ id: row.id }).then(res => {
  591. this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
  592. })
  593. } else {
  594. this.form.corpsName = null
  595. this.form.corpTel = null
  596. this.findObject(this.option.column, "arrivalAddress").dicData = []
  597. }
  598. },
  599. storageChange(row) {
  600. // console.log(row)
  601. },
  602. getAddress(row) {
  603. getCorpDetails({ id: row.corpId }).then(res => {
  604. this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
  605. })
  606. if (this.form.billType == "XS"){
  607. this.findObject(this.option.column, "sysNo").label = "销售单号";
  608. this.findObject(this.option.column, "srcOrderNo").label = "退款单号";
  609. }else if (this.form.billType == "XSTH"){
  610. this.findObject(this.option.column, "sysNo").label = "退款单号";
  611. this.findObject(this.option.column, "srcOrderNo").label = "销售单号";
  612. }
  613. },
  614. addRow() {
  615. this.$refs["form"].validate((valid, done) => {
  616. done();
  617. if (valid) {
  618. this.data.push({ $cellEdit: true, storageId: this.form.storageId })
  619. } else {
  620. return false;
  621. }
  622. });
  623. },
  624. rowCell(row, index) {
  625. if (row.$cellEdit == true) {
  626. this.$set(row, "$cellEdit", false);
  627. } else {
  628. this.$set(row, "$cellEdit", true);
  629. }
  630. },
  631. rowDel(row, index) {
  632. this.$confirm("确定删除数据?", {
  633. confirmButtonText: "确定",
  634. cancelButtonText: "取消",
  635. type: "warning"
  636. }).then(() => {
  637. if (row.id) {
  638. remove(row.id).then(res => {
  639. this.$message({
  640. type: "success",
  641. message: "删除成功!"
  642. });
  643. this.data.splice(index, 1);
  644. });
  645. } else {
  646. this.$message({
  647. type: "success",
  648. message: "删除成功!"
  649. });
  650. this.data.splice(index, 1);
  651. }
  652. });
  653. },
  654. getPay(row) {
  655. // this.form = row;
  656. // this.data = row.orderItemsList;
  657. // this.settlementList = row.settlementList
  658. this.getDetail(row.id);
  659. },
  660. //修改提交触发
  661. editCustomer() {
  662. this.$refs["form"].validate((valid, done) => {
  663. done();
  664. if (valid) {
  665. if (this.data.length == 0) {
  666. return this.$message.error('请添加一条商品信息');
  667. }
  668. if (this.settlementList.length > 0) {
  669. for (let i = 0; i < this.settlementList.length; i++) {
  670. if (!this.settlementList[i].id) {
  671. return this.$message.error(`请保存第${i + 1}行的费用明细`);
  672. }
  673. }
  674. }
  675. this.loadingBtn = true;
  676. save({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
  677. .then(res => {
  678. this.$message.success("保存成功");
  679. this.form = res.data.data;
  680. this.data = res.data.data.orderItemsList;
  681. this.settlementList = res.data.data.settlementList;
  682. this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
  683. this.detailData.status = 1
  684. this.option.disabled = true;
  685. this.option2.disabled = true;
  686. this.$refs.crud.refreshTable();
  687. this.$refs.feeInfo.refreshTable();
  688. })
  689. .finally(() => {
  690. this.loadingBtn = false;
  691. });
  692. } else {
  693. return false;
  694. }
  695. });
  696. },
  697. fixSave() {
  698. this.$refs["form"].validate((valid, done) => {
  699. done();
  700. if (valid) {
  701. if (this.data.length == 0) {
  702. return this.$message.error('请添加一条商品信息');
  703. }
  704. if (this.settlementList.length > 0) {
  705. for (let i = 0; i < this.settlementList.length; i++) {
  706. if (!this.settlementList[i].id) {
  707. return this.$message.error(`请保存第${i + 1}行的费用明细`);
  708. }
  709. }
  710. }
  711. this.loadingBtn = true;
  712. fixSave({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
  713. .then(res => {
  714. this.$message.success("修改成功");
  715. this.form = res.data.data;
  716. this.data = res.data.data.orderItemsList;
  717. this.settlementList = res.data.data.settlementList
  718. this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
  719. })
  720. .finally(() => {
  721. this.loadingBtn = false;
  722. });
  723. } else {
  724. return false;
  725. }
  726. });
  727. },
  728. submit() {
  729. this.$refs["form"].validate((valid, done) => {
  730. done();
  731. if (valid) {
  732. if (this.data.length == 0) {
  733. return this.$message.error('请添加一条商品信息');
  734. }
  735. if (this.settlementList.length > 0) {
  736. for (let i = 0; i < this.settlementList.length; i++) {
  737. if (!this.settlementList[i].id) {
  738. return this.$message.error(`请保存第${i + 1}行的费用明细`);
  739. }
  740. }
  741. }
  742. this.loadingBtn = true;
  743. submit({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
  744. .then(res => {
  745. this.$message.success("提交成功");
  746. this.form = res.data.data;
  747. this.data = res.data.data.orderItemsList;
  748. this.settlementList = res.data.data.settlementList;
  749. this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
  750. this.$emit("goBack");
  751. })
  752. .finally(() => {
  753. this.loadingBtn = false;
  754. });
  755. } else {
  756. return false;
  757. }
  758. });
  759. },
  760. revokeOrder() {
  761. this.$confirm('此操作将会撤销单子, 是否继续?', '提示', {
  762. confirmButtonText: '确定',
  763. cancelButtonText: '取消',
  764. type: 'warning'
  765. }).then(() => {
  766. this.loadingBtn = true;
  767. revoke({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
  768. .then(res => {
  769. this.$message.success("撤销成功");
  770. this.form = res.data.data;
  771. this.data = res.data.data.orderItemsList;
  772. this.settlementList = res.data.data.settlementList
  773. this.openEdit()
  774. })
  775. .finally(() => {
  776. this.loadingBtn = false;
  777. });
  778. }).catch(() => {
  779. });
  780. },
  781. async saveColumn() {
  782. const inSave = await this.saveColumnData(
  783. this.getColumnName(212),
  784. this.optionList
  785. );
  786. if (inSave) {
  787. this.$nextTick(() => {
  788. this.$refs.crud.doLayout();
  789. });
  790. this.$message.success("保存成功");
  791. //关闭窗口
  792. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  793. }
  794. },
  795. async resetColumn() {
  796. this.optionList = optionList;
  797. const inSave = await this.delColumnData(
  798. this.getColumnName(212),
  799. optionList
  800. );
  801. if (inSave) {
  802. this.$nextTick(() => {
  803. this.$refs.crud.doLayout();
  804. });
  805. this.getAllWorkDicts()
  806. this.$message.success("重置成功");
  807. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  808. }
  809. },
  810. openEdit() {
  811. this.detailData.status = 2
  812. this.option = this.$options.data().option;
  813. this.option2 = this.$options.data().option2;
  814. this.$refs.crud.refreshTable();
  815. this.$refs.feeInfo.refreshTable();
  816. },
  817. //返回列表
  818. backToList() {
  819. this.$emit("goBack");
  820. }
  821. },
  822. };
  823. </script>
  824. <style lang="scss" scoped>
  825. .trading-form ::v-deep .el-form-item {
  826. margin-bottom: 8px !important;
  827. }
  828. ::v-deep .el-dialog__body {
  829. padding: 0px 20px 15px 20px;
  830. }
  831. ::v-deep .el-form-item__error {
  832. display: none !important;
  833. }
  834. .img-form ::v-deep .el-form-item {
  835. height: 150px;
  836. line-height: 150px;
  837. margin-bottom: 8px !important;
  838. }
  839. .img-form ::v-deep .avue-upload__icon {
  840. font-size: 20px;
  841. width: 150px;
  842. height: 150px;
  843. line-height: 150px;
  844. }
  845. ::v-deep .el-table .cell {
  846. padding: 0 2px !important;
  847. }
  848. ::v-deep .avue-crud .el-table .el-form-item__label {
  849. left: -1px;
  850. }
  851. .addressTabs {
  852. display: flex;
  853. justify-content: center;
  854. span {
  855. width: 100px;
  856. font-size: 18px;
  857. font-weight: 600;
  858. text-align: center;
  859. }
  860. }
  861. </style>