transferOrderForm.vue 31 KB

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