transferOrderForm.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. <template>
  2. <div>
  3. <zj-form-container ref="formRef" :form-data="formData" :form-rules="formRules">
  4. <zj-form-module title="调拨单" :form-data="formData" :form-items="formItems" label-width="100px" :column="3" />
  5. <zj-form-module title="调拨单明细" :form-items="detailData" label-width="0" :column="3" />
  6. <zj-form-module
  7. v-if="moduleType === 2"
  8. title="物流费用"
  9. :form-items="formLogisticsData"
  10. label-width="0"
  11. :column="3"
  12. />
  13. <zj-form-module
  14. v-if="moduleType === 3"
  15. title="审核信息"
  16. :form-data="formData"
  17. :form-items="formExamine"
  18. label-width="100px"
  19. :column="3"
  20. />
  21. </zj-form-container>
  22. <el-dialog title="添加产品" :visible.sync="visible" width="60%" :append-to-body="true" @close="visible = false">
  23. <div style="height: 600px">
  24. <template-page
  25. ref="pageRef"
  26. style="height: 100%"
  27. :get-list="getList"
  28. :column-parsing="columnParsing"
  29. :table-attributes="tableAttributes"
  30. :table-events="tableEvents"
  31. />
  32. </div>
  33. <span slot="footer">
  34. <el-button type="primary" @click="handleAddData">提交</el-button>
  35. </span>
  36. </el-dialog>
  37. <!-- 新增 -->
  38. <div v-if="!comDisabled">
  39. <template v-if="moduleType === 1">
  40. <el-button type="primary" size="mini" @click="onSubmit('WAIT')">提交</el-button>
  41. <el-button size="mini" @click="onSubmit('SAVE')">保存</el-button>
  42. </template>
  43. <template v-else>
  44. <el-button type="primary" size="mini" @click="onSubmit">编辑</el-button>
  45. </template>
  46. <el-button size="mini" @click="onReset">重置</el-button>
  47. </div>
  48. <!-- 审核 /详情-->
  49. <div v-if="moduleType === 3 || moduleType === 2">
  50. <el-button v-if="moduleType === 3" type="primary" size="mini" @click="onExamine('OK')">同意</el-button>
  51. <el-button v-if="formData.status === 'OK'" size="mini" @click="onInvoice('WAIT')">反审</el-button>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import TemplatePage from '@/components/template/template-page-1.vue'
  57. import { getcustomerFrontList } from '@/api/stock'
  58. import { getListCostBillV2 } from '@/api/logisticsBill'
  59. import { debounce } from '@/utils/common'
  60. import { getStagecustomerListV2, getDealerListV2 } from '@/api/basic_data/dealer'
  61. import {
  62. addCustomerTransfer,
  63. updateCustomerTransfer,
  64. getCustomerTransferDetail,
  65. examineCustomerTransfer,
  66. setNeExamine
  67. } from '@/api/transferOrder'
  68. import { mapGetters } from 'vuex'
  69. export default {
  70. components: { TemplatePage },
  71. props: {
  72. edit: {
  73. type: Boolean,
  74. default: false
  75. },
  76. detailsId: {
  77. type: String,
  78. default: null
  79. },
  80. moduleType: {
  81. type: Number,
  82. default: null
  83. }
  84. },
  85. data() {
  86. return {
  87. visible: false,
  88. // 表格属性
  89. tableAttributes: {
  90. // 启用勾选列
  91. selectColumn: true,
  92. selectable: this.selectable
  93. }, // 关闭新增弹窗
  94. // 表格事件
  95. tableEvents: {
  96. 'selection-change': this.selectionChange
  97. },
  98. itemTableEvents: { 'selection-change': this.itemSelectionChange },
  99. defaultTableAttributes: {
  100. border: true,
  101. headerCellClassName: 'headerRowColor',
  102. size: 'mini',
  103. 'summary-method': this.$getSummaries,
  104. 'show-summary': true
  105. },
  106. recordSelected: [],
  107. formData: {
  108. customerNumber: '',
  109. customerName: '',
  110. transferTime: '',
  111. createBy: '',
  112. transferCustomerNumber: '',
  113. transferCustomerName: '',
  114. stockType: '',
  115. createTime: '',
  116. notes: ''
  117. },
  118. formRules: {
  119. customerNumber: [{ required: true, message: '请输入', trigger: 'blur' }],
  120. customerName: [{ required: true, message: '请输入', trigger: 'blur' }],
  121. transferTime: [{ required: true, message: '请选择', trigger: 'change' }],
  122. transferCustomerNumber: [{ required: true, message: '请输入', trigger: 'blur' }],
  123. transferCustomerName: [{ required: true, message: '请选择', trigger: 'change' }],
  124. stockType: [{ required: true, message: '请输入', trigger: 'blur' }]
  125. },
  126. fileType: ['word', 'excel', 'ppt', 'pdf'],
  127. fileList: [],
  128. fileList2: [],
  129. srcList: [],
  130. dict: [],
  131. mainContractList: [],
  132. serviceProviderList: [],
  133. filetype: [],
  134. authList: [],
  135. selectData: [],
  136. itemRecordSelected: [],
  137. sonCustomerList: [],
  138. logisticsData: [],
  139. sonCustomerNumberList: [],
  140. sonCustomerNameList: [],
  141. setDisabled: {
  142. disabledDate: time => {
  143. return time.getTime() < new Date() - 24 * 3600 * 1000
  144. }
  145. }
  146. }
  147. },
  148. computed: {
  149. ...mapGetters(['customerNumber', 'customerName']),
  150. comDisabled() {
  151. // 禁止
  152. return !!~[2, 3].indexOf(this.moduleType || 1)
  153. },
  154. formItems() {
  155. return [
  156. {
  157. name: 'el-input',
  158. md: 6,
  159. attributes: { disabled: true, placeholder: '请输入' },
  160. formItemAttributes: { label: '商家编号', prop: 'customerNumber' }
  161. },
  162. {
  163. name: 'el-input',
  164. md: 6,
  165. attributes: { disabled: true, placeholder: '请输入' },
  166. formItemAttributes: { label: '商家名称', prop: 'customerName' }
  167. },
  168. {
  169. name: 'el-date-picker',
  170. md: 6,
  171. attributes: {
  172. type: 'datetime',
  173. style: { width: '100%' },
  174. placeholder: '选择日期时间',
  175. valueFormat: 'yyyy-MM-dd HH:mm:ss',
  176. disabled: this.comDisabled,
  177. pickerOptions: this.setDisabled
  178. },
  179. formItemAttributes: { label: '调整日期', prop: 'transferTime' }
  180. },
  181. {
  182. name: 'el-input',
  183. md: 6,
  184. attributes: { disabled: true, placeholder: '系统自动生成' },
  185. formItemAttributes: { label: '制单人', prop: 'createBy' }
  186. },
  187. {
  188. name: 'el-select',
  189. options: this.sonCustomerNumberList,
  190. events: {
  191. change: e => this.handleChange(e, 'transferCustomerNumber')
  192. },
  193. md: 6,
  194. attributes: {
  195. clearable: true,
  196. filterable: true,
  197. disabled: this.comDisabled
  198. },
  199. formItemAttributes: { label: '商家编号', prop: 'transferCustomerNumber' }
  200. },
  201. {
  202. name: 'el-select',
  203. options: this.sonCustomerNameList,
  204. md: 6,
  205. events: {
  206. change: e => this.handleChange(e, 'transferCustomerName')
  207. },
  208. attributes: {
  209. clearable: true,
  210. filterable: true,
  211. disabled: this.comDisabled
  212. },
  213. formItemAttributes: { label: '商家名称', prop: 'transferCustomerName' }
  214. },
  215. {
  216. name: 'el-select',
  217. md: 6,
  218. options: [
  219. { label: '嘉贤前置仓', value: 'JIAXIAN' }
  220. // { label: '商家仓', value: 'SHANGJIA' }
  221. ],
  222. attributes: { disabled: this.comDisabled, placeholder: '请输入' },
  223. formItemAttributes: { label: '调拨仓库', prop: 'stockType' }
  224. },
  225. {
  226. name: 'el-input',
  227. md: 6,
  228. attributes: { disabled: true, placeholder: '系统自动生成' },
  229. formItemAttributes: { label: '制单时间', prop: 'createTime' }
  230. },
  231. {
  232. name: 'el-input',
  233. md: 24,
  234. attributes: { type: 'textarea', style: { width: '100%' }, disabled: this.comDisabled, placeholder: '请输入' },
  235. formItemAttributes: { label: '备注', prop: 'notes' }
  236. }
  237. ]
  238. },
  239. formExamine() {
  240. return [
  241. {
  242. name: 'el-input',
  243. md: 6,
  244. attributes: { disabled: true },
  245. formItemAttributes: { label: '审核人', prop: 'approvalName' }
  246. },
  247. {
  248. name: 'el-input',
  249. md: 6,
  250. attributes: { disabled: true },
  251. formItemAttributes: { label: '审核时间', prop: 'approvalTime' }
  252. },
  253. {
  254. name: 'el-input',
  255. md: 24,
  256. attributes: { type: 'textarea', style: { width: '100%' }, placeholder: '请输入' },
  257. formItemAttributes: { label: '备注', prop: 'approvalRemark' }
  258. }
  259. ]
  260. },
  261. columns() {
  262. return [
  263. {
  264. columnAttributes: {
  265. label: '产品名称',
  266. prop: 'materialName'
  267. }
  268. },
  269. {
  270. columnAttributes: {
  271. label: '产品编码',
  272. prop: 'materialOldNumber'
  273. }
  274. },
  275. {
  276. columnAttributes: {
  277. label: '规格型号',
  278. prop: 'specification',
  279. width: 300
  280. }
  281. },
  282. ...(() => {
  283. if (~[1].indexOf(this.moduleType)) {
  284. return [
  285. {
  286. columnAttributes: {
  287. label: '可调拨库存数',
  288. prop: 'frontStockNum'
  289. }
  290. }
  291. ]
  292. }
  293. return []
  294. })(),
  295. {
  296. columnAttributes: {
  297. label: '调拨数量',
  298. prop: 'qty'
  299. },
  300. render: (h, { column, row, index }) => {
  301. return (
  302. <div style='margin:0 20px'>
  303. <el-input
  304. type='number'
  305. disabled={this.comDisabled}
  306. value={row.qty}
  307. // onInput={e => (row.qty = e)}
  308. onInput={value => {
  309. row.qty = value
  310. this.debounceChange(value, index)
  311. }}
  312. placeholder='调拨数量'
  313. size='mini'
  314. ></el-input>
  315. </div>
  316. )
  317. }
  318. },
  319. {
  320. columnAttributes: {
  321. label: '备注',
  322. prop: 'notes'
  323. },
  324. render: (h, { column, row, index }) => {
  325. return (
  326. <el-input
  327. type='text'
  328. value={row.notes}
  329. disabled={this.comDisabled}
  330. onInput={e => (row.notes = e)}
  331. placeholder='备注'
  332. size='mini'
  333. ></el-input>
  334. )
  335. }
  336. },
  337. {
  338. columnAttributes: {
  339. label: '调拨仓库',
  340. prop: 'stockName'
  341. }
  342. },
  343. {
  344. columnAttributes: {
  345. label: '操作',
  346. prop: ''
  347. },
  348. render: (h, { column, row, index }) => {
  349. return (
  350. <div>
  351. {!this.comDisabled ? (
  352. <el-button
  353. type='text'
  354. size='default'
  355. onClick={() => {
  356. this.handleDel(index)
  357. }}
  358. >
  359. 删除
  360. </el-button>
  361. ) : null}
  362. </div>
  363. )
  364. }
  365. }
  366. ]
  367. },
  368. detailData() {
  369. return [
  370. ...[
  371. !this.comDisabled
  372. ? {
  373. name: 'slot-component',
  374. md: 24,
  375. attributes: { disabled: false },
  376. formItemAttributes: { label: '', prop: '' },
  377. render: (h, { props, onInput }) => {
  378. return (
  379. <div>
  380. <el-button
  381. size='mini'
  382. onClick={() => {
  383. this.visible = true
  384. this.recordSelected = []
  385. }}
  386. >
  387. 添加
  388. </el-button>
  389. <el-button size='mini' onClick={() => this.handleAllDel()}>
  390. 删除
  391. </el-button>
  392. </div>
  393. )
  394. }
  395. }
  396. : {}
  397. ],
  398. {
  399. name: 'slot-component',
  400. md: 24,
  401. attributes: { disabled: false },
  402. formItemAttributes: { label: '', prop: '' },
  403. render: (h, { props, onInput }) => {
  404. var { value } = props
  405. return (
  406. <zj-table
  407. isDrop={true}
  408. columns={this.columns}
  409. tableData={this.selectData}
  410. tableAttributes={{ border: true, selectColumn: !this.comDisabled }}
  411. tableEvents={this.itemTableEvents}
  412. ></zj-table>
  413. )
  414. }
  415. }
  416. ]
  417. },
  418. formLogistics() {
  419. return [
  420. {
  421. columnAttributes: {
  422. label: '补贴费用',
  423. prop: 'allowanceCost',
  424. width: 200
  425. }
  426. },
  427. {
  428. columnAttributes: {
  429. label: '所属销售公司类型',
  430. prop: 'belongCompanyType',
  431. width: 200
  432. }
  433. },
  434. {
  435. columnAttributes: {
  436. label: '运费结算系数',
  437. prop: 'coefficient',
  438. width: 200
  439. }
  440. },
  441. {
  442. columnAttributes: {
  443. label: '备注',
  444. prop: 'comment',
  445. width: 200
  446. }
  447. },
  448. {
  449. columnAttributes: {
  450. label: '最终运费',
  451. prop: 'cost',
  452. width: 200
  453. }
  454. },
  455. {
  456. columnAttributes: {
  457. label: '客户名称',
  458. prop: 'customerName',
  459. width: 200
  460. }
  461. },
  462. {
  463. columnAttributes: {
  464. label: '客户电话',
  465. prop: 'customerPhone',
  466. width: 200
  467. }
  468. },
  469. {
  470. columnAttributes: {
  471. label: '无法生成的原因',
  472. prop: 'errorResult',
  473. width: 200
  474. }
  475. },
  476. {
  477. columnAttributes: {
  478. label: '是否已经对过帐',
  479. prop: 'isAccountChecking',
  480. width: 200
  481. }
  482. },
  483. {
  484. columnAttributes: {
  485. label: '是否已经审核',
  486. prop: 'isAudit',
  487. width: 200
  488. }
  489. },
  490. {
  491. columnAttributes: {
  492. label: '是否完结',
  493. prop: 'isFinish',
  494. width: 200
  495. }
  496. },
  497. {
  498. columnAttributes: {
  499. label: '实际是否卸货',
  500. prop: 'isRealUnload',
  501. width: 200
  502. }
  503. },
  504. {
  505. columnAttributes: {
  506. label: '实际是否上楼',
  507. prop: 'isRealUpstairs',
  508. width: 200
  509. }
  510. },
  511. {
  512. columnAttributes: {
  513. label: '是否卸货',
  514. prop: 'isUnload',
  515. width: 200
  516. }
  517. },
  518. {
  519. columnAttributes: {
  520. label: '是否上楼',
  521. prop: 'isUpstairs',
  522. width: 200
  523. }
  524. },
  525. {
  526. columnAttributes: {
  527. label: '物料名称',
  528. prop: 'materialCode',
  529. width: 200
  530. }
  531. },
  532. {
  533. columnAttributes: {
  534. label: '计费分类',
  535. prop: 'materialCostType',
  536. width: 200
  537. }
  538. },
  539. {
  540. columnAttributes: {
  541. label: '产品名称',
  542. prop: 'materialName',
  543. width: 200
  544. }
  545. },
  546. {
  547. columnAttributes: {
  548. label: '规格型号',
  549. prop: 'materialSpecification',
  550. width: 350
  551. }
  552. },
  553. {
  554. columnAttributes: {
  555. label: '物料类型',
  556. prop: 'materialType',
  557. width: 200
  558. }
  559. },
  560. {
  561. columnAttributes: {
  562. label: '商家编码',
  563. prop: 'merchantCode',
  564. width: 200
  565. }
  566. },
  567. {
  568. columnAttributes: {
  569. label: '商家名称',
  570. prop: 'merchantName',
  571. width: 200
  572. }
  573. },
  574. {
  575. columnAttributes: {
  576. label: '订单号',
  577. prop: 'orderCode',
  578. width: 200
  579. }
  580. },
  581. {
  582. columnAttributes: {
  583. label: '订单时间',
  584. prop: 'orderDate',
  585. width: 200
  586. }
  587. },
  588. {
  589. columnAttributes: {
  590. label: '订单类型',
  591. prop: 'orderType',
  592. width: 200
  593. }
  594. },
  595. {
  596. columnAttributes: {
  597. label: '订单类型细分',
  598. prop: 'orderTypeDetail',
  599. width: 200
  600. }
  601. },
  602. {
  603. columnAttributes: {
  604. label: '收货送货地址',
  605. prop: 'receiptAddress',
  606. width: 200
  607. }
  608. },
  609. {
  610. columnAttributes: {
  611. label: '退货单号',
  612. prop: 'returnOrderCode',
  613. width: 200
  614. }
  615. },
  616. {
  617. columnAttributes: {
  618. label: '补贴结算系数',
  619. prop: 'subsidyCoefficient',
  620. width: 200
  621. }
  622. },
  623. {
  624. columnAttributes: {
  625. label: '嘉贤创建时间',
  626. prop: 'time',
  627. width: 200
  628. }
  629. },
  630. {
  631. columnAttributes: {
  632. label: '费用汇总',
  633. prop: 'totalCost',
  634. width: 200
  635. }
  636. },
  637. {
  638. columnAttributes: {
  639. label: '单价计算',
  640. prop: 'unitPrice',
  641. width: 200
  642. }
  643. },
  644. {
  645. columnAttributes: {
  646. label: '卸货上楼结算系数',
  647. prop: 'unloadUpstairsCoefficient',
  648. width: 200
  649. }
  650. },
  651. {
  652. columnAttributes: {
  653. label: '上楼卸货费用',
  654. prop: 'unloadUpstairsCost',
  655. width: 200
  656. }
  657. },
  658. {
  659. columnAttributes: {
  660. label: '发货仓库编码',
  661. prop: 'warehouseCode',
  662. width: 200
  663. }
  664. },
  665. {
  666. columnAttributes: {
  667. label: '发货仓库名称',
  668. prop: 'warehouseName',
  669. width: 200
  670. }
  671. }
  672. ]
  673. },
  674. formOutbound() {
  675. return [
  676. {
  677. columnAttributes: {
  678. label: '条码',
  679. prop: 'barCode',
  680. width: 200
  681. }
  682. },
  683. {
  684. columnAttributes: {
  685. label: '出库时间',
  686. prop: 'consignerTime',
  687. width: 200
  688. }
  689. },
  690. {
  691. columnAttributes: {
  692. label: '出库时间',
  693. prop: 'consignerTimeV2',
  694. width: 200
  695. }
  696. },
  697. {
  698. columnAttributes: {
  699. label: '创建人',
  700. prop: 'createBy',
  701. width: 200
  702. }
  703. },
  704. {
  705. columnAttributes: {
  706. label: '创建时间',
  707. prop: 'createTime',
  708. width: 200
  709. }
  710. },
  711. {
  712. columnAttributes: {
  713. label: '送货时间',
  714. prop: 'deliveryTime',
  715. width: 200
  716. }
  717. },
  718. {
  719. columnAttributes: {
  720. label: '送货时间',
  721. prop: 'deliveryTimeV2',
  722. width: 200
  723. }
  724. },
  725. {
  726. columnAttributes: {
  727. label: '条码唯一id',
  728. prop: 'id',
  729. width: 200
  730. }
  731. },
  732. {
  733. columnAttributes: {
  734. label: '物料代码',
  735. prop: 'materialCode',
  736. width: 200
  737. }
  738. },
  739. {
  740. columnAttributes: {
  741. label: '物料类型',
  742. prop: 'materialType',
  743. width: 200
  744. }
  745. },
  746. {
  747. columnAttributes: {
  748. label: '销售订单号',
  749. prop: 'orderNumber',
  750. width: 200
  751. }
  752. },
  753. {
  754. columnAttributes: {
  755. label: '收货人',
  756. prop: 'receiptCompany',
  757. width: 200
  758. }
  759. },
  760. {
  761. columnAttributes: {
  762. label: '商家名称',
  763. prop: 'salesCompany',
  764. width: 200
  765. }
  766. },
  767. {
  768. columnAttributes: {
  769. label: '规格',
  770. prop: 'specification',
  771. width: 350
  772. }
  773. },
  774. {
  775. columnAttributes: {
  776. label: '更新人',
  777. prop: 'updateBy',
  778. width: 200
  779. }
  780. },
  781. {
  782. columnAttributes: {
  783. label: '修改时间',
  784. prop: 'updateTime',
  785. width: 200
  786. }
  787. },
  788. {
  789. columnAttributes: {
  790. label: '发货仓库名称',
  791. prop: 'warehouse',
  792. width: 200
  793. }
  794. }
  795. ]
  796. },
  797. formLogisticsData() {
  798. return [
  799. {
  800. name: 'slot-component',
  801. md: 24,
  802. attributes: { disabled: false },
  803. formItemAttributes: { label: '', prop: '' },
  804. render: (h, { props, onInput }) => {
  805. var { value } = props
  806. return (
  807. <zj-table
  808. style='height: 600px;'
  809. tableAttributes={{ ...this.defaultTableAttributes }}
  810. isDrop={true}
  811. columns={this.formLogistics}
  812. tableData={this.logisticsData}
  813. tableEvents={this.itemTableEvents}
  814. ></zj-table>
  815. )
  816. }
  817. }
  818. ]
  819. }
  820. },
  821. mounted() {
  822. this.getStagecustomerListV2()
  823. if (this.detailsId) {
  824. getCustomerTransferDetail({ id: this.detailsId }).then(res => {
  825. this.formData = res.data
  826. this.selectData = res.data.orders.map(k => {
  827. k.disabledId = k.customerStockId
  828. k.stockName = '嘉贤前置仓'
  829. return k
  830. })
  831. delete this.formData.orders
  832. if (this.detailsId && this.moduleType === 2) {
  833. getListCostBillV2({
  834. pageNum: 1,
  835. pageSize: -1,
  836. params: [
  837. {
  838. param: 'order_code',
  839. compare: '=',
  840. value: this.formData.jiaxianOrderId
  841. }
  842. ]
  843. }).then(res => {
  844. res.data.records.forEach(item => {
  845. item.sums1 = ['orderHasSendQty', 'subsidyCoefficient', 'unloadUpstairsCoefficient', 'coefficient']
  846. item.sums2 = ['cost', 'unitPrice', 'totalCost', 'allowanceCost']
  847. })
  848. this.logisticsData = res.data.records
  849. })
  850. }
  851. })
  852. }
  853. },
  854. methods: {
  855. debounceChange: debounce(function(val, index) {
  856. if (val <= 0) {
  857. this.selectData[index].qty = 1
  858. } else {
  859. this.selectData[index].qty = parseInt(val)
  860. }
  861. }, 500),
  862. // 列表请求函数
  863. getList(...p) {
  864. this.recordSelected = []
  865. return getcustomerFrontList(...p)
  866. },
  867. // 表格列解析渲染数据更改
  868. columnParsing(item, defaultData) {
  869. return defaultData
  870. }, // 监听勾选变化
  871. selectionChange(data) {
  872. this.recordSelected = data
  873. },
  874. itemSelectionChange(data) {
  875. this.itemRecordSelected = data
  876. },
  877. selectable(row, index) {
  878. if (this.selectData.length) {
  879. for (let j = 0; j < this.selectData.length; j++) {
  880. if (row.id === this.selectData[j].disabledId) {
  881. this.$set(row, 'disabledId', this.selectData[j].disabledId)
  882. }
  883. }
  884. }
  885. if (!row.disabledId) {
  886. return true
  887. } else {
  888. return false
  889. }
  890. },
  891. getStagecustomerListV2() {
  892. this.formData.customerNumber = this.customerNumber
  893. this.formData.customerName = this.customerName
  894. getStagecustomerListV2({
  895. pageNum: 1,
  896. pageSize: -1,
  897. params: [
  898. {
  899. param: 'a.higher_prant_number',
  900. compare: '=',
  901. value: this.customerNumber || ''
  902. }
  903. ]
  904. }).then(res => {
  905. this.sonCustomerList = res.data.records
  906. this.sonCustomerNameList = res.data.records.map(k => {
  907. return {
  908. label: k.name,
  909. value: k.id
  910. }
  911. })
  912. this.sonCustomerNumberList = res.data.records.map(k => {
  913. return {
  914. label: k.number,
  915. value: k.id
  916. }
  917. })
  918. if (this.detailsId && this.sonCustomerList.length) {
  919. const transfer = this.sonCustomerList.find(k => k.number === this.formData.transferCustomerNumber)
  920. this.formData.transferCustomerNumber = transfer.id
  921. this.formData.transferCustomerName = transfer.id
  922. }
  923. })
  924. },
  925. handleAddData() {
  926. this.selectData = [...this.selectData, ...this.recordSelected]
  927. for (let i = 0; i < this.$refs.pageRef.$children[0].tableData.length; i++) {
  928. for (let j = 0; j < this.selectData.length; j++) {
  929. if (this.$refs.pageRef.$children[0].tableData[i].id == this.selectData[j].id) {
  930. this.$set(this.$refs.pageRef.$children[0].tableData[i], 'disabledId', this.selectData[j].id)
  931. }
  932. }
  933. }
  934. this.selectData = this.selectData.map(k => {
  935. return {
  936. materialCode: k.materialCode,
  937. materialId: '',
  938. materialName: k.materialName,
  939. materialOldNumber: k.materialOldNumber,
  940. notes: '',
  941. qty: 0,
  942. frontStockNum: k.frontStockNum,
  943. specification: k.specification,
  944. disabledId: k.disabledId,
  945. stockName: '嘉贤前置仓',
  946. customerStockId: k.disabledId
  947. }
  948. })
  949. this.visible = false
  950. this.handleClearSelection()
  951. },
  952. handleAllDel() {
  953. if (this.itemRecordSelected.length) {
  954. if (this.$refs.pageRef) {
  955. for (let i = 0; i < this.$refs.pageRef.$children[0].tableData.length; i++) {
  956. for (let j = 0; j < this.itemRecordSelected.length; j++) {
  957. if (this.$refs.pageRef.$children[0].tableData[i].id === this.itemRecordSelected[j].disabledId) {
  958. this.$set(this.$refs.pageRef.$children[0].tableData[i], 'disabledId', null)
  959. }
  960. }
  961. }
  962. }
  963. for (let j = 0; j < this.itemRecordSelected.length; j++) {
  964. for (let k = 0; k < this.selectData.length; k++) {
  965. if (this.selectData[k].disabledId === this.itemRecordSelected[j].disabledId) {
  966. this.selectData.splice(k, 1)
  967. }
  968. }
  969. }
  970. this.handleClearSelection()
  971. } else {
  972. this.$errorMsg('请选择删除项')
  973. }
  974. },
  975. handleDel(index) {
  976. if (this.$refs.pageRef) {
  977. for (let i = 0; i < this.$refs.pageRef.$children[0].tableData.length; i++) {
  978. if (this.$refs.pageRef.$children[0].tableData[i].id === this.selectData[index].disabledId) {
  979. this.$set(this.$refs.pageRef.$children[0].tableData[i], 'disabledId', null)
  980. }
  981. }
  982. }
  983. this.selectData.splice(index, 1)
  984. this.handleClearSelection()
  985. },
  986. handleClearSelection() {
  987. this.recordSelected = []
  988. this.$refs.pageRef &&
  989. this.$refs.pageRef.$children[0].$children[0].$children[2].$children[0].$children[0].clearSelection()
  990. },
  991. handleChange(e, type) {
  992. if (e) {
  993. this.formData.transferCustomerName = e
  994. this.formData.transferCustomerNumber = e
  995. } else {
  996. this.formData.transferCustomerNumber = ''
  997. this.formData.transferCustomerName = ''
  998. }
  999. },
  1000. handlerefreshList() {
  1001. this.$emit('refresh')
  1002. this.onClose()
  1003. },
  1004. onClose() {
  1005. this.formData = {}
  1006. this.selectData = []
  1007. this.$emit('close')
  1008. },
  1009. onReset() {
  1010. this.$refs.formRef.resetFields()
  1011. this.selectData = []
  1012. },
  1013. onSubmit(type = null) {
  1014. this.$refs.formRef.validate(valid => {
  1015. for (let i = 0; i < this.selectData.length; i++) {
  1016. if (this.selectData[i].qty <= 0) {
  1017. this.$errorMsg('调拨数量不能小于1')
  1018. return
  1019. }
  1020. }
  1021. const transfer = this.sonCustomerList.find(k => k.id === (this.formData.transferCustomerNumber || this.formData.transferCustomerName))
  1022. console.log(transfer, 999)
  1023. if (valid) {
  1024. const params = {
  1025. ...this.formData,
  1026. orders: this.selectData,
  1027. transferCustomerNumber: transfer.number,
  1028. transferCustomerName: transfer.name
  1029. }
  1030. if (this.moduleType === 1) {
  1031. params.status = type
  1032. addCustomerTransfer(params).then(res => {
  1033. this.$successMsg(type === 'SAVE' ? '保存成功' : '新增成功')
  1034. this.handlerefreshList()
  1035. })
  1036. } else {
  1037. updateCustomerTransfer(params).then(res => {
  1038. this.$successMsg('编辑成功')
  1039. this.handlerefreshList()
  1040. })
  1041. }
  1042. } else {
  1043. console.log('error submit!!')
  1044. return false
  1045. }
  1046. })
  1047. },
  1048. onExamine(type = null) {
  1049. examineCustomerTransfer({
  1050. id: this.detailsId,
  1051. status: type
  1052. }).then(res => {
  1053. this.$successMsg('审核成功')
  1054. this.handlerefreshList()
  1055. })
  1056. },
  1057. onInvoice(type = null) {
  1058. setNeExamine({
  1059. id: this.detailsId,
  1060. status: type
  1061. }).then(res => {
  1062. this.$successMsg('反审成功')
  1063. this.handlerefreshList()
  1064. })
  1065. }
  1066. }
  1067. }
  1068. </script>
  1069. <style lang="scss" scoped>
  1070. .header1style {
  1071. text-align: right;
  1072. font-size: 12px;
  1073. color: red;
  1074. line-height: 18px;
  1075. }
  1076. </style>