detailPage.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button
  6. type="danger"
  7. style="border: none;background: none;color: red"
  8. icon="el-icon-arrow-left"
  9. @click="backToList"
  10. >返回列表
  11. </el-button>
  12. </div>
  13. <div>
  14. <el-button
  15. class="el-button--small-yh add-customer-btn"
  16. type="success"
  17. v-if="goodsForm.status === 0"
  18. size="small"
  19. style="margin-right: 70px;"
  20. @click="submit(true)"
  21. >提交
  22. </el-button>
  23. <el-button
  24. class="el-button--small-yh add-customer-btn"
  25. type="success"
  26. v-if="goodsForm.status === 1"
  27. size="small"
  28. style="margin-right: 70px;"
  29. @click="submit(false)"
  30. >取消提交
  31. </el-button>
  32. <el-button
  33. class="el-button--small-yh add-customer-btn"
  34. type="primary"
  35. :disabled="goodsForm.status === 1"
  36. size="small"
  37. @click="editCustomer"
  38. >保存
  39. </el-button>
  40. </div>
  41. </div>
  42. <containerTitle
  43. title="起止地信息"
  44. style="margin-top: 50px"></containerTitle>
  45. <basic-container>
  46. <el-table
  47. ref="singleTable"
  48. :data="tableData"
  49. size="mini"
  50. :header-cell-style="{color:'#000',background:'#fafafa'}"
  51. style="width: 100%">
  52. <el-table-column
  53. align="center"
  54. v-if="goodsForm.status !== 1"
  55. width="40">
  56. <template slot-scope="scope">
  57. <el-tooltip className="item" v-if="scope.$index === tableData.length-1" effect="dark" content="增加途径地址"
  58. placement="top">
  59. <el-button type="primary" icon="el-icon-plus" size="mini" circle @click="addAddress"
  60. style="margin-right: 1.25rem;"></el-button>
  61. </el-tooltip>
  62. </template>
  63. </el-table-column>
  64. <el-table-column
  65. property="date"
  66. align="center"
  67. width="40">
  68. <template slot-scope="scope">
  69. <span v-if="scope.$index == 0">
  70. <el-button type="primary" size="mini" circle>起</el-button>
  71. </span>
  72. <span v-else-if="scope.$index === tableData.length-1">
  73. <el-button type="success" size="mini" circle>止</el-button>
  74. </span>
  75. <span v-else>
  76. <el-button v-if="goodsForm.status === 1" type="warning" size="mini" circle>途</el-button>
  77. <el-tooltip v-else class="item" effect="dark" content="删除" placement="right">
  78. <el-button type="danger" icon="el-icon-delete" size="mini" circle
  79. @click="deleteAddress(scope)"></el-button>
  80. </el-tooltip>
  81. </span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column
  85. type="index"
  86. label="序号"
  87. align="center"
  88. width="60">
  89. </el-table-column>
  90. <el-table-column
  91. property="corpId"
  92. label="发货工厂"
  93. align="center"
  94. :render-header="customTitle"
  95. width="280">
  96. <template slot-scope="scope">
  97. <crop-select
  98. :disabled="goodsForm.status === 1"
  99. v-model="scope.row.corpId"
  100. @getCorpData="(row)=>{withAddress(row,scope)}"/>
  101. </template>
  102. </el-table-column>
  103. <el-table-column
  104. property="province"
  105. label="省市区"
  106. align="center"
  107. :render-header="customTitle"
  108. width="280">
  109. <template slot-scope="scope">
  110. <el-cascader
  111. size="small"
  112. style="width: 100%;"
  113. :key="scope.row.key"
  114. :disabled="goodsForm.status === 1"
  115. :props="treeOption"
  116. v-model="scope.row.region"></el-cascader>
  117. </template>
  118. </el-table-column>
  119. <el-table-column
  120. property="address"
  121. align="center"
  122. :render-header="customTitle"
  123. label="详细地址">
  124. <template slot-scope="scope">
  125. <el-input v-model="scope.row.address" :disabled="goodsForm.status === 1" size="small"
  126. placeholder="请输入内容"></el-input>
  127. </template>
  128. </el-table-column>
  129. </el-table>
  130. </basic-container>
  131. <containerTitle title="箱信息"></containerTitle>
  132. <basic-container v-if="goodsForm.status === 0 || !goodsForm.status">
  133. <avue-crud :data="entrustList"
  134. :option="entrustOptionTwo"
  135. @row-save="(row,done,loading)=>{rowSave(row,0,done,loading)}"
  136. @row-update="rowSave"
  137. @row-del="rowDel">
  138. <template slot="ctnTypeHeader" slot-scope="{column}">
  139. {{column.label}}<span style="color:#F56C6C">*</span>
  140. </template>
  141. <template slot="ctnQuantityHeader" slot-scope="{column}">
  142. {{column.label}}<span style="color:#F56C6C">*</span>
  143. </template>
  144. <template slot="landWeightHeader" slot-scope="{column}">
  145. {{column.label}}<span style="color:#F56C6C">*</span>
  146. </template>
  147. <template slot="landAmountDHeader" slot-scope="{column}">
  148. {{column.label}}<span style="color:#F56C6C">*</span>
  149. </template>
  150. </avue-crud>
  151. </basic-container>
  152. <basic-container v-if="goodsForm.status !== 0 && goodsForm.status">
  153. <avue-crud
  154. :data="entrustList"
  155. :option="entrustOptionTwoT"
  156. ref="entrustTwoT"
  157. @row-save="(row,done,loading)=>{rowSaveT(row,0,done,loading)}"
  158. @row-update="rowSaveT">
  159. <template slot="fleetId" slot-scope="{ row, index }">
  160. <crop-select
  161. v-if="row.$cellEdit"
  162. v-model="row.fleetId"
  163. :cropIndex="index"
  164. @getCorpData="(data)=>{getfleetIdT(data,row)}"
  165. ></crop-select>
  166. <span v-else>{{ row.fleetName }}</span>
  167. </template>
  168. </avue-crud>
  169. </basic-container>
  170. <containerTitle title="委托信息"></containerTitle>
  171. <basic-container>
  172. <avue-form :option="goodsOptionForm" ref="goodsForm" v-model="goodsForm">
  173. <template slot-scope="scope" slot="corpId">
  174. <crop-select
  175. :disabled="goodsForm.status === 1"
  176. v-model="goodsForm.corpId"
  177. @getCorpData="getCorpData"
  178. ></crop-select>
  179. </template>
  180. </avue-form>
  181. </basic-container>
  182. <containerTitle title="费用明细"></containerTitle>
  183. <basic-container>
  184. <el-tabs v-model="activeIndex" @tab-click="handleSelect">
  185. <el-tab-pane label="应收" name="1"></el-tab-pane>
  186. <el-tab-pane label="应付" name="2"></el-tab-pane>
  187. </el-tabs>
  188. <avue-crud
  189. v-if="activeIndex === '1'"
  190. :data="collectionList"
  191. :option="collectionOption"
  192. ref="collection"
  193. @row-save="(row,done,loading)=>{rowSave(row,0,done,loading)}"
  194. @row-update="rowSave"
  195. @row-del="makeDel">
  196. <template slot-scope="{row}" slot="corpId">
  197. <crop-select
  198. v-if="row.$cellEdit"
  199. v-model="row.corpId"
  200. @getCorpData="(data)=>{getfleetId(data,row)}"
  201. ></crop-select>
  202. <span v-else>{{ row.corpName }}</span>
  203. </template>
  204. <template slot-scope="{row}" slot="feeId">
  205. <breakdown-select
  206. v-if="row.$cellEdit"
  207. v-model="row.feeId"
  208. @selectValue="(value) => selectValue(value,row)"
  209. :configuration="breakConfiguration"
  210. >
  211. </breakdown-select>
  212. <span v-else>{{ row.feeName }}</span>
  213. </template>
  214. <template slot-scope="{row,index}" slot="menu">
  215. <el-button
  216. type="text"
  217. size="small"
  218. :icon="row.$cellEdit?'el-icon-circle-plus-outline':'el-icon-edit'"
  219. @click="rowCell(row,index)"
  220. >{{ row.$cellEdit ? '保存' : '编辑' }}
  221. </el-button>
  222. <el-button type="text"
  223. icon="el-icon-delete"
  224. size="small"
  225. @click="$refs.collection.rowDel(row,index)"
  226. >删除
  227. </el-button>
  228. </template>
  229. <template slot="menuLeft">
  230. <el-button type="primary" icon="el-icon-plus" @click="addRowCollection" size="small">录入明细</el-button>
  231. </template>
  232. </avue-crud>
  233. <avue-crud
  234. v-if="activeIndex === '2'"
  235. :data="paymentList"
  236. :option="paymentOption"
  237. ref="payment"
  238. @row-save="(row,done,loading)=>{rowSave(row,0,done,loading)}"
  239. @row-update="rowSave"
  240. @row-del="feeDel"
  241. >
  242. <template slot-scope="{row}" slot="corpId">
  243. <crop-select
  244. v-if="row.$cellEdit"
  245. v-model="row.corpId"
  246. @getCorpData="(data)=>{getfleetId(data,row)}"
  247. ></crop-select>
  248. <span v-else>{{ row.corpName }}</span>
  249. </template>
  250. <template slot-scope="{row}" slot="feeId">
  251. <breakdown-select
  252. v-if="row.$cellEdit"
  253. v-model="row.feeId"
  254. @selectValue="(value) => selectValue(value,row)"
  255. :configuration="breakConfiguration"
  256. >
  257. </breakdown-select>
  258. <span v-else>{{ row.feeName }}</span>
  259. </template>
  260. <template slot-scope="{row,index}" slot="menu">
  261. <el-button
  262. type="text"
  263. size="small"
  264. :icon="row.$cellEdit?'el-icon-circle-plus-outline':'el-icon-edit'"
  265. @click="paymentRowCell(row,index)"
  266. >{{ row.$cellEdit ? '保存' : '编辑' }}
  267. </el-button>
  268. <el-button type="text"
  269. icon="el-icon-delete"
  270. size="small"
  271. @click="$refs.payment.rowDel(row,index)"
  272. >删除
  273. </el-button>
  274. </template>
  275. <template slot="menuLeft">
  276. <el-button type="primary" icon="el-icon-plus" @click="addRowPayment" size="small">录入明细</el-button>
  277. </template>
  278. </avue-crud>
  279. </basic-container>
  280. <containerTitle title="上传附件"></containerTitle>
  281. <c-upload
  282. typeUpload="CD"
  283. :data="orderFilesList"
  284. :enumerationValue="76"
  285. ></c-upload>
  286. </div>
  287. </template>
  288. <script>
  289. import {getLazyTree} from "@/api/base/region";
  290. import {
  291. saveDelegationList,
  292. detailDelegationList,
  293. removeCollection,
  294. saveSaveList,
  295. addressList, cancelSubmission
  296. } from "@/api/landTransportation";
  297. export default {
  298. props: {
  299. id: {
  300. type: String
  301. }
  302. },
  303. data() {
  304. return {
  305. activeIndex: '1',
  306. goodsForm: {},
  307. modelKey: 1,
  308. orderFilesList: [],
  309. roleName: localStorage.getItem("roleName").split(',')[0],
  310. breakConfiguration: {
  311. multipleChoices: false,
  312. multiple: false,
  313. disabled: false,
  314. searchShow: true,
  315. collapseTags: false,
  316. clearable: true,
  317. placeholder: '请点击右边按钮选择',
  318. dicData: []
  319. },
  320. advantageProjectData: [],
  321. treeOption: {
  322. label: 'title',
  323. value: 'id',
  324. lazy: true,
  325. lazyLoad(node, resolve) {
  326. const parentId = node.level === 0 ? '00' : node.data.id;
  327. getLazyTree(parentId).then(res => {
  328. resolve(
  329. res.data.data.map(item => {
  330. return {
  331. ...item,
  332. leaf: !item.hasChildren
  333. };
  334. })
  335. );
  336. });
  337. }
  338. },
  339. tableData: [],
  340. entrustListT: [],
  341. entrustOptionTwoT: {
  342. align: 'center',
  343. menuAlign: 'center',
  344. index: true,
  345. cellBtn: true,
  346. addBtn: false,
  347. addRowBtn: false,
  348. delBtn: false,
  349. showSummary: true,
  350. summaryText: "合计",
  351. sumColumnList: [
  352. {
  353. name: 'landWeight',
  354. type: 'sum',
  355. decimals: 6
  356. }, {
  357. name: 'landAmountC',
  358. type: 'sum',
  359. decimals: 2
  360. }, {
  361. name: 'landAmountD',
  362. type: 'sum',
  363. decimals: 2
  364. }, {
  365. name: 'ctnQuantity',
  366. type: 'sum',
  367. decimals: 0
  368. }],
  369. column: [{
  370. label: '尺寸箱型',
  371. width: 100,
  372. prop: 'ctnType'
  373. }, {
  374. label: '箱量',
  375. width: 50,
  376. prop: 'ctnQuantity'
  377. }, {
  378. label: '重量',
  379. width: 160,
  380. prop: 'landWeight',
  381. controls: false,
  382. precision: 6,
  383. type: 'number'
  384. }, {
  385. label: '应收陆运费',
  386. prop: 'landAmountD'
  387. }, {
  388. label: '备注',
  389. cell: true,
  390. prop: 'remarks'
  391. }
  392. ]
  393. },
  394. entrustList: [],
  395. goodsOptionForm: {
  396. menuBtn: false,
  397. disabled: false,
  398. column: [{
  399. label: '客户名称',
  400. formslot: true,
  401. prop: 'corpId',
  402. rules: [{
  403. required: true,
  404. message: " ",
  405. trigger: "change"
  406. }],
  407. }, {
  408. label: '所属公司',
  409. formslot: true,
  410. prop: 'belongCompany',
  411. rules: [{
  412. required: true,
  413. message: " ",
  414. trigger: "blur"
  415. }],
  416. }, {
  417. label: '订单号',
  418. prop: 'orderNo',
  419. disabled: true
  420. }, {
  421. label: '提单号',
  422. prop: 'billNo',
  423. rules: [{
  424. required: true,
  425. message: " ",
  426. trigger: "blur"
  427. }],
  428. }, {
  429. label: '场站',
  430. prop: 'station',
  431. rules: [{
  432. required: false,
  433. message: " ",
  434. trigger: "blur"
  435. }],
  436. }, {
  437. label: '到厂时间',
  438. type: "datetime",
  439. format: 'yyyy-MM-dd HH:mm:ss',
  440. valueFormat: 'yyyy-MM-dd HH:mm:ss',
  441. prop: 'arrivalTime',
  442. rules: [{
  443. required: true,
  444. message: " ",
  445. trigger: "blur"
  446. }],
  447. }, {
  448. label: '船名航次',
  449. prop: 'factory',
  450. rules: [{
  451. required: false,
  452. message: " ",
  453. trigger: "blur"
  454. }],
  455. }, {
  456. label: '货物名称',
  457. prop: 'goods',
  458. rules: [{
  459. required: false,
  460. message: " ",
  461. trigger: "blur"
  462. }],
  463. }, {
  464. label: '备注',
  465. prop: 'remarks'
  466. }
  467. ]
  468. },
  469. entrustOptionTwo: {
  470. align: 'center',
  471. menuAlign: 'center',
  472. addBtnText: '录入箱信息',
  473. index: true,
  474. cellBtn: true,
  475. addBtn: false,
  476. addRowBtn: true,
  477. showSummary: true,
  478. summaryText: "合计",
  479. sumColumnList: [
  480. {
  481. name: 'landWeight',
  482. type: 'sum',
  483. decimals: 6
  484. }, {
  485. name: 'landAmountD',
  486. type: 'sum',
  487. decimals: 2
  488. }, {
  489. name: 'ctnQuantity',
  490. type: 'sum',
  491. decimals: 0
  492. }],
  493. column: [{
  494. // label: '尺寸箱型',
  495. label: '尺寸箱型',
  496. cell: true,
  497. prop: 'ctnType',
  498. type: 'select',
  499. width: 100,
  500. dicUrl: "/api/blade-system/dict-biz/dictionary?code=boxType",
  501. props: {
  502. label: "dictValue",
  503. value: "dictValue"
  504. },
  505. }, {
  506. label: '箱量',
  507. cell: true,
  508. prop: 'ctnQuantity',
  509. controls: false,
  510. precision: 0,
  511. width: 100,
  512. maxRows:999,
  513. minRows:1,
  514. type: 'number'
  515. }, {
  516. label: '总重量(吨)',
  517. cell: true,
  518. prop: 'landWeight',
  519. controls: false,
  520. width: 200,
  521. precision: 6,
  522. type: 'number'
  523. }, {
  524. label: '应收陆运费',
  525. cell: true,
  526. prop: 'landAmountD',
  527. controls: false,
  528. width: 200,
  529. precision: 2,
  530. type: 'number'
  531. }, {
  532. label: '备注',
  533. cell: true,
  534. prop: 'remarks'
  535. }]
  536. },
  537. collectionList: [],
  538. collectionOption: {
  539. align: 'center',
  540. menuAlign: 'center',
  541. index: true,
  542. cancelBtn: false,
  543. editBtn: false,
  544. delBtn: false,
  545. cellBtn: false,
  546. addBtn: false,
  547. addRowBtn: false,
  548. showSummary: true,
  549. addBtnText: '录入明细',
  550. summaryText: "合计",
  551. sumColumnList: [{
  552. name: 'price',
  553. type: 'sum',
  554. decimals: 2
  555. }, {
  556. name: 'amount',
  557. type: 'sum',
  558. decimals: 2
  559. }, {
  560. name: 'quantity',
  561. type: 'sum',
  562. decimals: 1
  563. }],
  564. column: [{
  565. label: '客户名称',
  566. slot: true,
  567. prop: 'corpId'
  568. }, {
  569. label: '费用名称',
  570. slot: true,
  571. prop: 'feeId'
  572. }, {
  573. label: '计价单位',
  574. cell: true,
  575. prop: 'unit',
  576. type: "select",
  577. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
  578. props: {
  579. label: "dictValue",
  580. value: "dictKey"
  581. }
  582. }, {
  583. label: '数量',
  584. cell: true,
  585. prop: 'quantity'
  586. }, {
  587. label: '单价',
  588. cell: true,
  589. prop: 'price'
  590. }, {
  591. label: '金额',
  592. cell: true,
  593. prop: 'amount'
  594. }, {
  595. label: '税率(默认6)',
  596. cell: true,
  597. prop: 'taxRate'
  598. }, {
  599. label: '币别',
  600. cell: true,
  601. prop: 'currency',
  602. type: "select",
  603. dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
  604. props: {
  605. label: "dictValue",
  606. value: "dictKey"
  607. },
  608. }
  609. ]
  610. },
  611. paymentList: [],
  612. paymentOption: {
  613. align: 'center',
  614. menuAlign: 'center',
  615. index: true,
  616. cancelBtn: false,
  617. editBtn: false,
  618. delBtn: false,
  619. cellBtn: false,
  620. addBtn: false,
  621. addRowBtn: false,
  622. showSummary: true,
  623. addBtnText: '录入明细',
  624. summaryText: "合计",
  625. sumColumnList: [{
  626. name: 'price',
  627. type: 'sum',
  628. decimals: 2
  629. }, {
  630. name: 'amount',
  631. type: 'sum',
  632. decimals: 2
  633. }, {
  634. name: 'quantity',
  635. type: 'sum',
  636. decimals: 1
  637. }],
  638. column: [{
  639. label: '客户名称',
  640. slot: true,
  641. prop: 'corpId'
  642. }, {
  643. label: '费用名称',
  644. slot: true,
  645. prop: 'feeId'
  646. }, {
  647. label: '计价单位',
  648. cell: true,
  649. prop: 'unit',
  650. type: "select",
  651. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
  652. props: {
  653. label: "dictValue",
  654. value: "dictKey"
  655. }
  656. }, {
  657. label: '数量',
  658. cell: true,
  659. prop: 'quantity'
  660. }, {
  661. label: '单价',
  662. cell: true,
  663. prop: 'price'
  664. }, {
  665. label: '金额',
  666. cell: true,
  667. prop: 'amount'
  668. }, {
  669. label: '税率(默认6)',
  670. cell: true,
  671. prop: 'taxRate'
  672. }, {
  673. label: '币别(默认RMB)',
  674. cell: true,
  675. prop: 'currency',
  676. type: "select",
  677. dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
  678. props: {
  679. label: "dictValue",
  680. value: "dictKey"
  681. },
  682. }
  683. ]
  684. }
  685. };
  686. },
  687. created() {
  688. if (this.id) {
  689. detailDelegationList({id: this.id, kind: '1'}).then(res => {
  690. this.goodsForm = res.data.data
  691. this.tableData = res.data.data.orderAddressList
  692. this.entrustList = res.data.data.orderItemList
  693. this.goodsList = res.data.data.orderItemList
  694. if (res.data.data.orderFeeList.length > 0) {
  695. res.data.data.orderFeeList.forEach(item => {
  696. if (item.type == 1) {
  697. this.collectionList.push(item)
  698. } else {
  699. this.paymentList.push(item)
  700. }
  701. })
  702. }
  703. this.goodsOptionForm.disabled = this.goodsForm.status === 1
  704. delete this.goodsForm.orderAddressList
  705. delete this.goodsForm.orderItemList
  706. delete this.goodsForm.orderFeeList
  707. this.tableData.forEach(item => {
  708. if (item.region) item.region = item.region.split(',')
  709. })
  710. })
  711. } else {
  712. this.tableData = [{
  713. region: [],
  714. address: ''
  715. }, {
  716. region: [],
  717. address: ''
  718. }]
  719. this.entrustList = [{$cellEdit: true}]
  720. }
  721. },
  722. methods: {
  723. //刷新数据
  724. refreshData() {
  725. detailDelegationList({id: this.id, kind: '1'}).then(res => {
  726. this.goodsForm = res.data.data
  727. this.tableData = res.data.data.orderAddressList
  728. this.entrustList = res.data.data.orderItemList
  729. this.goodsList = res.data.data.orderItemList
  730. if (res.data.data.orderFeeList.length > 0) {
  731. res.data.data.orderFeeList.forEach(item => {
  732. if (item.type == 1) {
  733. this.collectionList.push(item)
  734. } else {
  735. this.paymentList.push(item)
  736. }
  737. })
  738. }
  739. this.goodsOptionForm.disabled = this.goodsForm.status === 1
  740. delete this.goodsForm.orderAddressList
  741. delete this.goodsForm.orderItemList
  742. delete this.goodsForm.orderFeeList
  743. this.tableData.forEach(item => {
  744. if (item.region) item.region = item.region.split(',')
  745. })
  746. })
  747. },
  748. //提交委托
  749. submit(type) {
  750. if (type){
  751. saveDelegationList({
  752. id: this.goodsForm.id
  753. }).then(res => {
  754. this.$message.success('提交成功');
  755. this.refreshData()
  756. })
  757. }else {
  758. cancelSubmission({
  759. id: this.goodsForm.id
  760. }).then(res => {
  761. this.$message.success('取消成功');
  762. this.refreshData()
  763. })
  764. }
  765. },
  766. //切换收付费
  767. handleSelect(tab, event) {
  768. this.activeIndex = tab.name
  769. },
  770. //箱信息保存
  771. rowSaveT(row, index, done, loading) {
  772. row.$cellEdit = false
  773. done()
  774. },
  775. //箱信息选择车队
  776. getfleetIdT(data, row) {
  777. this.$set(row, 'fleetName', data.cname)
  778. },
  779. //地址新增
  780. addAddress() {
  781. this.tableData.splice(this.tableData.length - 1, 0, {leas: 1111})
  782. },
  783. //返回主列表
  784. backToList() {
  785. this.goodsForm = {}
  786. this.$emit('backToList')
  787. },
  788. //删除途径地址
  789. deleteAddress(scope) {
  790. this.tableData.splice(scope.$index, 1);
  791. },
  792. //箱信息保存
  793. rowSave(row, index, done, loading) {
  794. row.$cellEdit = false
  795. done()
  796. },
  797. rowCell(row, index) {
  798. this.$refs.collection.rowCell(row, index)
  799. },
  800. paymentRowCell(row, index) {
  801. this.$refs.payment.rowCell(row, index)
  802. },
  803. //箱信息移除
  804. rowDel(row, index) {
  805. this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
  806. confirmButtonText: '确定',
  807. cancelButtonText: '取消',
  808. type: 'warning'
  809. }).then(() => {
  810. this.entrustList.splice(index, 1);
  811. }).catch(() => {
  812. this.$message({
  813. type: 'info',
  814. message: '已取消删除'
  815. });
  816. });
  817. },
  818. //保存
  819. editCustomer() {
  820. this.$refs['goodsForm'].validate((valid,done) => {done()})
  821. for (let item in this.tableData){
  822. if (!this.tableData[item].corpId) return this.$message.error('请选择第'+ Number(Number(item)+1) +'行发货工厂');
  823. if (!this.tableData[item].address) return this.$message.error('请输入第'+ Number(Number(item)+1) +'行详细地址');
  824. }
  825. for (let item in this.entrustList){
  826. if (!this.entrustList[item].ctnType) return this.$message.error('请选择第'+ Number(Number(item)+1) +'行尺寸箱型');
  827. if (!this.entrustList[item].ctnQuantity) return this.$message.error('请输入第'+ Number(Number(item)+1) +'行箱量');
  828. if (!this.entrustList[item].landWeight) return this.$message.error('请输入第'+ Number(Number(item)+1) +'行总重量');
  829. if (!this.entrustList[item].landAmountD) return this.$message.error('请输入第'+ Number(Number(item)+1) +'陆运费');
  830. }
  831. this.$refs['goodsForm'].validate((valid,done) => {
  832. done();
  833. if (valid) {
  834. let data = JSON.parse(JSON.stringify(this.tableData))
  835. data.forEach((item, index) => {
  836. item.sort = index + 1
  837. if (item.region.length !== 0) item.region = item.region.join(',')
  838. })
  839. saveSaveList({
  840. ...this.goodsForm,
  841. kind: '1',
  842. orderAddressList: data,
  843. orderItemList: this.entrustList,
  844. orderFeeList: this.collectionList.concat(this.paymentList)
  845. }).then(res => {
  846. this.$message.success('保存成功');
  847. this.goodsForm = {}
  848. if (!this.goodsForm.id) {
  849. this.id = res.data.data
  850. this.refreshData()
  851. } else {
  852. this.refreshData()
  853. }
  854. })
  855. } else {
  856. return false;
  857. }
  858. });
  859. },
  860. //收费新增
  861. addRowCollection() {
  862. this.$refs.collection.rowCellAdd({
  863. currency: '1',
  864. type: '1',
  865. $cellEdit: true
  866. });
  867. },
  868. //付费新增
  869. addRowPayment() {
  870. this.$refs.payment.rowCellAdd({
  871. currency: '1',
  872. type: '2',
  873. $cellEdit: true
  874. });
  875. },
  876. //选择费用
  877. selectValue(value, row) {
  878. this.$set(row, 'feeName', value.cname)
  879. },
  880. //选择客户信息触发
  881. getfleetId(data, row) {
  882. this.$set(row, 'corpName', data.cname)
  883. },
  884. //收款信息移除
  885. makeDel(row, index) {
  886. this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
  887. confirmButtonText: '确定',
  888. cancelButtonText: '取消',
  889. type: 'warning'
  890. }).then(() => {
  891. if (row.id) removeCollection(row.id)
  892. this.collectionList.splice(index, 1);
  893. }).catch(() => {
  894. this.$message({
  895. type: 'info',
  896. message: '已取消删除'
  897. });
  898. });
  899. },
  900. //付款信息移除
  901. feeDel(row, index) {
  902. this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
  903. confirmButtonText: '确定',
  904. cancelButtonText: '取消',
  905. type: 'warning'
  906. }).then(() => {
  907. if (row.id) removeCollection(row.id)
  908. this.paymentList.splice(index, 1);
  909. }).catch(() => {
  910. this.$message({
  911. type: 'info',
  912. message: '已取消删除'
  913. });
  914. });
  915. },
  916. //选择客户名称带出所属公司
  917. getCorpData(row) {
  918. this.goodsForm.belongCompany = row.belongCompany
  919. },
  920. //选择地址客户带出地址
  921. withAddress(row, scope) {
  922. if (!scope.row.key) scope.row.key = 0
  923. this.tableData[scope.$index].corpName = row.cname
  924. this.tableData[scope.$index].address = row.attn
  925. if (row.tel) {
  926. if (!row.attn) {
  927. this.tableData[scope.$index].address += row.tel
  928. } else {
  929. this.tableData[scope.$index].address += '—' + row.tel
  930. }
  931. }
  932. if (row.storageAddr) {
  933. if (!row.tel && !row.attn) {
  934. this.tableData[scope.$index].address += row.storageAddr
  935. } else {
  936. this.tableData[scope.$index].address += '—' + row.storageAddr
  937. }
  938. }
  939. if (row.belongtoarea) {
  940. addressList(row.belongtoarea).then(res => {
  941. this.tableData[scope.$index].region = [res.data.data.provinceCode, res.data.data.parentId, res.data.data.districtCode]
  942. scope.row.key++
  943. })
  944. }
  945. },
  946. //自定义表头
  947. renderHeader(h) {
  948. return (
  949. <div>
  950. <el-tooltip className="item" effect="dark" content="增加途径地址" placement="top">
  951. <el-button type="primary" icon="el-icon-plus" size="mini" circle onClick={() => this.addAddress()}
  952. style="margin-right: 1.25rem;"></el-button>
  953. </el-tooltip>
  954. </div>
  955. )
  956. },
  957. //自定义表头
  958. customTitle(h, { column, $index }) {
  959. let text = column.label
  960. return (
  961. <div>
  962. {{text}}<span style="color:#F56C6C">*</span>
  963. </div>
  964. )
  965. }
  966. }
  967. }
  968. </script>
  969. <style scoped>
  970. </style>