detailsPage.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <el-button type="success"
  10. class="el-button--small-yh add-customer-btn-two"
  11. :disabled="true"
  12. @click.stop="">复制新单
  13. </el-button>
  14. <el-button
  15. class="el-button--small-yh add-customer-btn"
  16. type="primary"
  17. :disabled="disabled"
  18. @click="editCustomer"
  19. :loading="butLoading"
  20. >{{form.id?'确认修改':'确认新增'}}
  21. </el-button>
  22. </div>
  23. <div style="margin-top: 60px">
  24. <el-form :model="form" ref="form" label-width="130px">
  25. <containerTitle title="基础信息"></containerTitle>
  26. <basic-container style="margin-bottom: 10px">
  27. <el-row>
  28. <el-col v-for="(item, index) in basicData.column" :span="item.span?item.span:8" :key="index">
  29. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  30. <el-date-picker v-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]" size="small" type="date" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
  31. <el-select v-else-if="item.type === 'select'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  32. <el-option
  33. v-for="(data, index) in item.dicData"
  34. :key="index"
  35. :label="data.label"
  36. :value="data.value"
  37. ></el-option>
  38. </el-select>
  39. <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" :configuration="configuration"/>
  40. <selectComponent v-else-if="item.prop === 'purchaserId'" v-model="form[item.prop]" :configuration="pConfiguration"/>
  41. <el-select v-else-if="item.prop === 'orderType'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  42. <el-option v-for="(item,index) in contractTypeDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  43. </el-select>
  44. <el-select v-else-if="item.prop === 'currency'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  45. <el-option v-for="(item,index) in currencyDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  46. </el-select>
  47. <el-select v-else-if="item.prop === 'paymentType'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  48. <el-option v-for="(item,index) in paymentTypeDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  49. </el-select>
  50. <el-input type="textarea" v-else-if="(item.prop === 'orderRemark')" v-model="form[item.prop]" size="small" autocomplete="off" placeholder="请输入"></el-input>
  51. <el-input type="age" v-else v-model="form[item.prop]" :disabled="item.disabled?true:false" size="small" autocomplete="off" placeholder="请输入"></el-input>
  52. </el-form-item>
  53. </el-col>
  54. </el-row>
  55. </basic-container>
  56. <!-- 采购明细-->
  57. <containerTitle title="采购明细"></containerTitle>
  58. <basic-container style="margin-bottom: 10px">
  59. <avue-crud
  60. :option="customerContact"
  61. v-model="contactsForm"
  62. :data="contactsData"
  63. ref="crudContact"
  64. @row-save="rowSave"
  65. @selection-change="selectionContact"
  66. @row-click="handleRowClick"
  67. @row-update="rowUpdate"
  68. @row-del="rowDel"
  69. >
  70. <template slot="price" slot-scope="{ row }">
  71. <el-input
  72. v-if="row.$cellEdit"
  73. v-model="row.price"
  74. placeholder="请输入"
  75. size="small"
  76. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  77. @input="priceChange(row)"
  78. ></el-input>
  79. <span v-else>{{ row.price }}</span>
  80. </template>
  81. <template slot="purchaseQuantity" slot-scope="{ row }">
  82. <el-input
  83. v-if="row.$cellEdit"
  84. v-model="row.purchaseQuantity"
  85. placeholder="请输入"
  86. size="small"
  87. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  88. @input="quantityChange(row)"
  89. ></el-input>
  90. <span v-else>{{ row.purchaseQuantity }}</span>
  91. </template>
  92. <template slot-scope="{row,index}" slot="menu">
  93. <el-button
  94. type="text"
  95. size="small"
  96. @click="rowCell(row,index)"
  97. >{{ row.$cellEdit ? '修改完成' : '修改' }}
  98. </el-button>
  99. </template>
  100. <template slot="menuLeft" slot-scope="{size}">
  101. <el-button type="primary"
  102. icon="el-icon-plus"
  103. size="small"
  104. @click="commoditySelection"
  105. >录入明细
  106. </el-button>
  107. <el-button type="warning"
  108. icon="el-icon-s-check"
  109. size="small"
  110. :disabled="selectContact.length == 0"
  111. @click="beforePage(true)"
  112. >申请付款(开证)
  113. </el-button>
  114. <el-button type="warning"
  115. size="small"
  116. :disabled="selectContact.length == 0"
  117. @click="beforePage(false)"
  118. >收货单
  119. </el-button>
  120. <el-button type="info"
  121. size="small"
  122. @click="applicationDialog = true"
  123. >查看申请记录
  124. </el-button>
  125. </template>
  126. <template slot="priceCategory" slot-scope="{row,index}">
  127. <span style="margin-left: 12px;padding-top: 2px">{{ row.priceCategoryNames }}</span>
  128. <el-button v-if="row.$cellEdit" type="text" size="mini" style="float: right" @click="choice(row)">选择</el-button>
  129. </template>
  130. </avue-crud>
  131. </basic-container>
  132. <fee-info
  133. ref="feeInfo"
  134. :orderFeesList="orderFeesList"
  135. feeUrl=""
  136. />
  137. <upload-file
  138. ref="uploadFile"
  139. title="合同附件"
  140. :orderFilesList="orderFilesList"
  141. delUrl=""
  142. />
  143. </el-form>
  144. </div>
  145. <el-dialog
  146. title="导入商品详情"
  147. append-to-body
  148. class="el-dialogDeep"
  149. :visible.sync="dialogVisible"
  150. width="80%"
  151. :close-on-click-modal="false"
  152. :destroy-on-close="true"
  153. :close-on-press-escape="false"
  154. v-dialog-drag>
  155. <el-row style="height: 0;">
  156. <el-col :span="5">
  157. <div>
  158. <el-scrollbar>
  159. <basic-container>
  160. <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
  161. </basic-container>
  162. </el-scrollbar>
  163. </div>
  164. </el-col>
  165. <el-col :span="19">
  166. <basic-container>
  167. <avue-crud :option="optionTwo"
  168. :table-loading="loading"
  169. :data="data"
  170. ref="crud"
  171. @refresh-change="refreshChange"
  172. @selection-change="selectionChange"
  173. :page.sync="page"
  174. @on-load="onLoad"></avue-crud>
  175. </basic-container>
  176. </el-col>
  177. </el-row>
  178. <span slot="footer" class="dialog-footer">
  179. <el-button @click="dialogVisible = false , selectKind = -1">取 消</el-button>
  180. <el-button type="primary" @click="commodityConfirm" v-if="selectKind != -1" :disabled="tableData.length !== 1">确定</el-button>
  181. <el-button type="primary" @click="importGoods" v-if="commodityData !== true && selectKind == -1" :disabled="tableData.length !== 1">导入</el-button>
  182. <el-button type="primary" @click="importChoice" v-if="commodityData === true && selectKind == -1"
  183. :disabled="tableData.length !== 1">导入<</el-button>
  184. </span>
  185. </el-dialog>
  186. <el-dialog
  187. title="查看申请记录"
  188. append-to-body
  189. class="el-dialogDeep"
  190. :visible.sync="applicationDialog"
  191. width="60%"
  192. :close-on-click-modal="false"
  193. :destroy-on-close="true"
  194. :close-on-press-escape="false"
  195. v-dialog-drag
  196. >
  197. <basic-container>
  198. <avue-crud :option="customerContact"
  199. :table-loading="applicationLoading"
  200. :data="applicationData"
  201. ref="applicationCrud"
  202. @refresh-change="applicationRefreshChange"
  203. :page.sync="applicationPage"
  204. @on-load="applicationOnLoad"></avue-crud>
  205. </basic-container>
  206. <span slot="footer" class="dialog-footer">
  207. <el-button @click="applicationDialog = false ">关 闭</el-button>
  208. </span>
  209. </el-dialog>
  210. </div>
  211. </template>
  212. <script>
  213. import customerContact from "./config/customerContact.json"
  214. import uploadList from './config/uploadList.json'
  215. import advantageProject from "./config/advantageProject.json"
  216. import {getDeptLazyTree,customerList} from "@/api/basicData/basicFeesDesc";
  217. import optionTwoCost from "./config/mainListCost.json"
  218. import {detailListData, submitData,getSysNo} from "@/api/importTrade/purchase";
  219. import commodity from "./config/commodity.json"
  220. import feeInfo from "@/components/fee-info/main";
  221. import uploadFile from "@/components/upload-file/main";
  222. //商品详情接口
  223. import {corpsattn, corpsbank, getDeptLazyTreeS} from "@/api/basicData/configuration"
  224. import { getList } from "@/api/basicData/commodityType"
  225. import { contrastObj,contrastList } from "@/util/contrastData";
  226. export default {
  227. name: "detailsPage",
  228. props: {
  229. detailData: {
  230. type: Object
  231. }
  232. },
  233. data() {
  234. return {
  235. form: {},
  236. disabled: false,
  237. customerContact: customerContact,
  238. contactsForm: {},
  239. contactsData: [],
  240. dialogVisible:false,
  241. commodityData: false,
  242. tableData: [],
  243. optionTwo: commodity,
  244. loading: false,
  245. data: [],
  246. page: {
  247. pageSize: 10,
  248. currentPage: 1,
  249. total: 0
  250. },
  251. contractTypeDic:[],
  252. currencyDic:[],
  253. selectContact:[],//选中采购明细
  254. selectKind: -1,//选择采购明细的货品
  255. paymentTypeDic:[],
  256. orderFeesList:[],
  257. orderFilesList:[],
  258. treeDeptId: '',
  259. treeOption: {
  260. nodeKey: 'id',
  261. lazy: true,
  262. treeLoad: function (node, resolve) {
  263. const parentId = (node.level === 0) ? 0 : node.data.id;
  264. getDeptLazyTreeS(parentId).then(res => {
  265. resolve(res.data.data.map(item => {
  266. return {
  267. ...item,
  268. leaf: !item.hasChildren
  269. }
  270. }))
  271. });
  272. },
  273. addBtn: false,
  274. menu: false,
  275. size: 'small',
  276. props: {
  277. labelText: '标题',
  278. label: 'title',
  279. value: 'value',
  280. children: 'children'
  281. }
  282. },
  283. configuration:{
  284. multipleChoices:false,
  285. multiple:false,
  286. disabled:false,
  287. searchShow:true,
  288. collapseTags:false,
  289. placeholder:'请点击右边按钮选择',
  290. dicData:[]
  291. },
  292. pConfiguration:{
  293. multipleChoices:false,
  294. multiple:false,
  295. disabled:false,
  296. searchShow:true,
  297. collapseTags:false,
  298. placeholder:'请点击右边按钮选择',
  299. dicData:[]
  300. },
  301. // 合同上传数据
  302. uploadList: uploadList,
  303. // 合同数据
  304. bankOfDepositData: [],
  305. bankOfDepositForm: {},
  306. // 其他费用
  307. advantageProject: advantageProject,
  308. advantageProjectData: [],
  309. advantageProjectForm: {},
  310. dialogCost: false,
  311. choiceData: false,
  312. treeOptionCost:{
  313. nodeKey: 'id',
  314. lazy: true,
  315. treeLoad: function (node, resolve) {
  316. const parentId = (node.level === 0) ? 0 : node.data.id;
  317. getDeptLazyTree(parentId).then(res => {
  318. resolve(res.data.data.map(item => {
  319. return {
  320. ...item,
  321. leaf: !item.hasChildren
  322. }
  323. }))
  324. });
  325. },
  326. addBtn: false,
  327. menu: false,
  328. size: 'small',
  329. props: {
  330. labelText: '标题',
  331. label: 'title',
  332. value: 'value',
  333. children: 'children'
  334. }
  335. },
  336. // 导入其他费用配置
  337. optionTwoCost: optionTwoCost,
  338. loadingCost: false,
  339. dataCost:[],
  340. pageCost:{
  341. pageSize: 10,
  342. currentPage: 1,
  343. total: 0
  344. },
  345. tableDataCost: [],
  346. treeDeptIdCost: '',
  347. choiceIndex: '',
  348. //查看申请记录
  349. applicationDialog:false,
  350. applicationLoading:false,
  351. applicationData:[],
  352. applicationPage:{
  353. pageSize: 10,
  354. currentPage: 1,
  355. total: 0
  356. },
  357. //对比新旧数据信息
  358. oldContactsData:[],
  359. oldForm:{},
  360. oldFeesList:[],
  361. oldFilesList:[],
  362. // 基础信息
  363. basicData: {
  364. column: [
  365. {
  366. label: '系统编号',
  367. prop: 'sysNo',
  368. disabled:true,
  369. rules: [
  370. {
  371. required: false,
  372. message: ' ',
  373. trigger: 'blur'
  374. }
  375. ]
  376. }, {
  377. label: '供应商',
  378. prop: 'corpId',
  379. dicData: [],
  380. rules: [
  381. {
  382. required: true,
  383. message: ' ',
  384. trigger: 'blur'
  385. }
  386. ]
  387. }, {
  388. label: '采购商',
  389. prop: 'purchaserId',
  390. dicData: [],
  391. rules: [
  392. {
  393. required: true,
  394. message: ' ',
  395. trigger: 'blur'
  396. }
  397. ]
  398. },{
  399. label: '合同号',
  400. prop: 'orderNo',
  401. rules: [
  402. {
  403. required: false,
  404. message: ' ',
  405. trigger: 'blur'
  406. }
  407. ]
  408. }, {
  409. label: '合同日期',
  410. prop: 'businesDate',
  411. type:'date',
  412. rules: [
  413. {
  414. required: false,
  415. message: ' ',
  416. trigger: 'blur'
  417. }
  418. ]
  419. }, {
  420. label: '合同类型',
  421. prop: 'orderType',
  422. // type:'select',
  423. dicData: [],
  424. rules: [
  425. {
  426. required: false,
  427. message: ' ',
  428. trigger: 'blur'
  429. }
  430. ]
  431. }, {
  432. label: '合同金额',
  433. prop: 'orderAmount',
  434. rules: [
  435. {
  436. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  437. message: ' ',
  438. trigger: 'blur'
  439. }
  440. ]
  441. }, {
  442. label: '合同重量',
  443. prop: 'contractWeight',
  444. rules: [
  445. {
  446. required: false,
  447. message: ' ',
  448. trigger: 'blur'
  449. }
  450. ]
  451. }, {
  452. label: '业务员',
  453. prop: 'salesName',
  454. dicData: [],
  455. rules: [
  456. {
  457. required: false,
  458. message: ' ',
  459. trigger: 'blur'
  460. }
  461. ]
  462. },{
  463. label: '要求发货日期',
  464. prop: 'requiredDeliveryDate',
  465. type:'date',
  466. rules: [
  467. {
  468. required: true,
  469. message: ' ',
  470. trigger: 'blur'
  471. }
  472. ]
  473. }, {
  474. label: '要求到货日期',
  475. prop: 'requiredArrivalDate',
  476. type:'date',
  477. rules: [
  478. {
  479. required: true,
  480. message: ' ',
  481. trigger: 'blur'
  482. }
  483. ]
  484. },{
  485. label: '到港日期',
  486. prop: 'dateOfArrival',
  487. type:'date',
  488. rules: [
  489. {
  490. required: false,
  491. message: ' ',
  492. trigger: 'blur'
  493. }
  494. ]
  495. }, {
  496. label: '单价',
  497. prop: 'salesPrice',
  498. rules: [
  499. {
  500. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  501. message: ' ',
  502. trigger: 'blur'
  503. }
  504. ]
  505. }, {
  506. label: '币别',
  507. prop: 'currency'
  508. }, {
  509. label: '汇率',
  510. prop: 'exchangeRate',
  511. }, {
  512. label: '人民币金额',
  513. prop: 'rmbAmount',
  514. rules: [
  515. {
  516. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  517. message: ' ',
  518. trigger: 'blur'
  519. }
  520. ]
  521. }, {
  522. label: '付款方式',
  523. prop: 'paymentType',
  524. }, {
  525. label: '付款/开证日期',
  526. prop: 'accountsCollectionDate',
  527. type:'date',
  528. rules: [
  529. {
  530. required: false,
  531. message: ' ',
  532. trigger: 'blur'
  533. }
  534. ]
  535. }, {
  536. label: '预付(保证)金额',
  537. prop: 'advancePayment',
  538. rules: [
  539. {
  540. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  541. message: ' ',
  542. trigger: 'blur'
  543. }
  544. ]
  545. },{
  546. label: '已付金额',
  547. prop: 'settlmentAmount',
  548. rules: [
  549. {
  550. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  551. message: ' ',
  552. trigger: 'blur'
  553. }
  554. ]
  555. }, {
  556. label: '信用证到期日',
  557. prop: 'creditDate',
  558. type:'date',
  559. rules: [
  560. {
  561. required: false,
  562. message: ' ',
  563. trigger: 'blur'
  564. }
  565. ]
  566. }, {
  567. label: '码单重量',
  568. prop: 'billWeight',
  569. rules: [
  570. {
  571. required: false,
  572. message: ' ',
  573. trigger: 'blur'
  574. }
  575. ]
  576. }, {
  577. label: "订单备注",
  578. span: 24,
  579. prop: "orderRemark",
  580. mock: {
  581. type: 'county'
  582. }
  583. }
  584. ],
  585. },
  586. }
  587. },
  588. created() {
  589. //币别
  590. this.getWorkDicts("currency").then(res =>{
  591. this.currencyDic = res.data.data
  592. })
  593. this.getWorkDicts("contractType").then(res =>{
  594. this.contractTypeDic = res.data.data
  595. })
  596. this.getWorkDicts("payment_term").then(res =>{
  597. this.paymentTypeDic = res.data.data
  598. })
  599. if (this.detailData.id) {
  600. let id = this.detailData.id.replace(/\"/g, "")
  601. detailListData(id).then(res => {
  602. this.form = res.data.data;
  603. this.oldForm = res.data.data;
  604. this.configuration.dicData = this.form.corpsName
  605. this.pConfiguration.dicData = this.form.purchaserName
  606. if(res.data.data.itemsVOList){
  607. this.contactsData = res.data.data.itemsVOList
  608. this.oldContactsData = res.data.data.itemsVOList
  609. }
  610. if(res.data.data.orderFeesList){
  611. this.orderFeesList = res.data.data.orderFeesList
  612. this.oldFeesList = res.data.data.orderFeesList
  613. }
  614. if( res.data.data.orderFilesList){
  615. this.orderFilesList = res.data.data.orderFilesList
  616. this.oldFilesList = res.data.data.orderFilesList
  617. }
  618. })
  619. }else{
  620. getSysNo("JK-CG").then(res =>{
  621. this.$set(this.form,"sysNo", res.data.data)
  622. })
  623. }
  624. },
  625. components: {
  626. feeInfo,
  627. uploadFile
  628. },
  629. methods: {
  630. //单价
  631. priceChange(row) {
  632. if (!row.price) {
  633. row.price = "";
  634. row.amount = 0
  635. } else {
  636. row.amount = (row.purchaseQuantity * row.price).toFixed(2);
  637. }
  638. },
  639. //件数
  640. quantityChange(row) {
  641. if (!row.purchaseQuantity) {
  642. row.purchaseQuantity = "";
  643. row.amount = 0
  644. } else {
  645. row.amount = (row.purchaseQuantity * row.price).toFixed(2);
  646. }
  647. },
  648. //修改提交触发
  649. editCustomer(status) {
  650. this.$refs["form"].validate((valid) => {
  651. if (valid) {
  652. let orderFeesList = this.$refs.feeInfo.submitData();
  653. for (let i = 0; i < orderFeesList.length; i++) {
  654. if (orderFeesList[i].corpId == null) {
  655. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  656. }
  657. if (orderFeesList[i].price == 0) {
  658. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  659. }
  660. if (orderFeesList[i].orderQuantity == 0) {
  661. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  662. }
  663. }
  664. const orderFilesList = this.$refs.uploadFile.submitData();
  665. for (let j = 0; j < this.contactsData.length; j++) {
  666. if (this.contactsData[j].billNo == null) {
  667. return this.$message.error(`请输入第${j + 1}行的提单号`);
  668. }
  669. }
  670. let submitDto = {
  671. ...this.form,
  672. tradeType:"JK",
  673. billType:"CG",
  674. itemsVOList: this.contactsData,
  675. orderFeesList: orderFeesList,
  676. orderFilesList: orderFilesList
  677. };
  678. submitData(submitDto).then(res => {
  679. if(res.data.success){
  680. this.form.id = res.data.data
  681. this.$message.success("操作成功!")
  682. detailListData(this.form.id).then(res => {
  683. this.form = res.data.data;
  684. this.oldForm = res.data.data;
  685. this.configuration.dicData = this.form.corpsName
  686. this.pConfiguration.dicData = this.form.purchaserName
  687. if(res.data.data.itemsVOList){
  688. this.contactsData = res.data.data.itemsVOList
  689. this.oldContactsData = res.data.data.itemsVOList
  690. }
  691. if(res.data.data.orderFeesList){
  692. this.orderFeesList = res.data.data.orderFeesList
  693. this.oldFeesList = res.data.data.orderFeesList
  694. }
  695. if( res.data.data.orderFilesList){
  696. this.orderFilesList = res.data.data.orderFilesList
  697. this.oldFilesList = res.data.data.orderFilesList
  698. }
  699. })
  700. }
  701. })
  702. setTimeout(() =>{
  703. },1000);
  704. this.butLoading = false;
  705. if(status === true){
  706. this.$emit("goBack");
  707. }
  708. } else {
  709. return false;
  710. }
  711. });
  712. },
  713. selectionContact(row){
  714. this.selectContact = row;
  715. },
  716. beforePage(type){
  717. let list = []
  718. for (let item in this.selectContact){
  719. if (!this.selectContact[item].id){
  720. return this.$confirm('商品信息有未保存数据, 是否立即保存?', '提示', {
  721. confirmButtonText: '确定',
  722. cancelButtonText: '取消',
  723. type: 'warning'
  724. }).then(() => {
  725. this.editCustomer();
  726. })
  727. }else {
  728. list.push(this.selectContact[item].$index)
  729. }
  730. }
  731. const params = {
  732. id:this.form.id,
  733. orderItemIds:list
  734. }
  735. if(type){
  736. this.$router.push({
  737. path: "/financialManagement/payment",
  738. query: {params: params},
  739. });
  740. }else{
  741. this.$router.push({
  742. path: "/importTrade/receipt/index",
  743. query: {params: params},
  744. });
  745. }
  746. },
  747. //选择货物品种
  748. choice(row){
  749. this.dialogVisible = true;
  750. this.selectKind = row.$index;
  751. },
  752. //选择货品
  753. commodityConfirm(){
  754. if(this.tableData){
  755. this.contactsData[this.selectKind].priceCategory = this.tableData[0].id;
  756. this.$set(this.contactsData[this.selectKind],'priceCategoryNames',this.tableData[0].cname)
  757. this.dialogVisible = !this.dialogVisible
  758. this.selectKind = -1
  759. }
  760. },
  761. //新增商品明细保存触发
  762. rowSave(row, done, loading) {
  763. // this.contactsData.push(row)
  764. done()
  765. },
  766. //修改商品信息触发
  767. rowUpdate(row, index, done, loading) {
  768. done(row);
  769. },
  770. //删除商品信息触发
  771. rowDel(row, index, donerowDel) {
  772. this.$confirm("确定将选择数据删除?", {
  773. confirmButtonText: "确定",
  774. cancelButtonText: "取消",
  775. type: "warning"
  776. }).then(() => {
  777. //商品判断是否需要调用删除接口
  778. if (row.id) {
  779. corpsattn(row.id).then(res => {
  780. this.$message({
  781. type: "success",
  782. message: "操作成功!"
  783. });
  784. this.contactsData.splice(index, 1);
  785. })
  786. } else {
  787. this.$message({
  788. type: "success",
  789. message: "操作成功!"
  790. });
  791. this.contactsData.splice(index, 1);
  792. }
  793. })
  794. },
  795. //刷新
  796. applicationRefreshChange(){
  797. },
  798. //申请记录
  799. applicationOnLoad(){
  800. },
  801. //点击商品明细选择触发
  802. commodityChoice(row) {
  803. this.dialogVisible = !this.dialogVisible
  804. this.commodityData = true
  805. this.choiceIndexT = row.$index
  806. },
  807. //商品编辑
  808. rowCell(row, index) {
  809. this.$refs.crudContact.rowCell(row, index)
  810. },
  811. //商品新增触发
  812. commoditySelection() {
  813. this.dialogVisible = !this.dialogVisible
  814. this.commodityData = false
  815. },
  816. //点击行可编辑
  817. handleRowClick(row, event, column) {
  818. },
  819. //刷新触发
  820. refreshChange() {
  821. this.treeDeptId = '';
  822. this.page.currentPage = 1;
  823. this.onLoad(this.page);
  824. },
  825. //选中触发
  826. selectionChange(list) {
  827. this.tableData = list
  828. },
  829. //导入页左商品类型查询
  830. nodeClick(data) {
  831. this.treeDeptId = data.id;
  832. this.page.currentPage = 1;
  833. this.onLoad(this.page);
  834. },
  835. //商品详情list
  836. onLoad(page, params = {}) {
  837. this.loading = true;
  838. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  839. const data = res.data.data;
  840. this.page.total = data.total;
  841. this.data = data.records;
  842. this.loading = false;
  843. });
  844. },
  845. //确认导入触发
  846. importGoods() {
  847. if (this.tableData.length > 0) {
  848. for (let item in this.tableData) {
  849. const params ={
  850. priceCategory:this.tableData[item].code,
  851. priceCategoryNames:this.tableData[item].cname,
  852. itemId:this.tableData[item].id,
  853. cname:this.tableData[item].cname
  854. }
  855. this.$refs.crudContact.rowCellAdd(params);
  856. this.$refs.crudContact.rowCell(params,this.contactsData.length - 1)
  857. }
  858. }
  859. this.tableData = []
  860. this.dialogVisible = false
  861. },
  862. //导入商品触发
  863. importChoice() {
  864. if (this.tableData.length === 1) {
  865. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  866. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  867. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  868. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
  869. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  870. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  871. }
  872. this.dialogVisible = !this.dialogVisible
  873. this.commodityData = false
  874. },
  875. //其他费用编辑
  876. rowCellTwo(row, index) {
  877. this.$refs.crudProject.rowCell(row, index)
  878. },
  879. //新增明细保存触发
  880. rowSaveProject(row, done, loading){
  881. // this.advantageProjectData.push(row)
  882. done()
  883. },
  884. //修改明细触发
  885. rowUpdateProject(row, index, done, loading) {
  886. done(row);
  887. },
  888. //删除明细触发
  889. rowDelProject(row, index, donerowDel) {
  890. this.$confirm("确定将选择数据删除?", {
  891. confirmButtonText: "确定",
  892. cancelButtonText: "取消",
  893. type: "warning"
  894. }).then(() => {
  895. if (row.id){
  896. // corpsitem(row.id).then(res=>{
  897. // this.$message({
  898. // type: "success",
  899. // message: "操作成功!"
  900. // });
  901. // this.detailedData.splice(index, 1);
  902. // })
  903. }else {
  904. this.$message({
  905. type: "success",
  906. message: "操作成功!"
  907. });
  908. this.detailedData.splice(index, 1);
  909. }
  910. })
  911. },
  912. // 修改其他费用明细
  913. rowUpdateAdvantageProject(row, index, done, loading) {
  914. done(row);
  915. },
  916. // 删除其他费用明细
  917. rowDelAdvantageProject(row, index, donerowDel) {
  918. this.$confirm("确定将选择数据删除?", {
  919. confirmButtonText: "确定",
  920. cancelButtonText: "取消",
  921. type: "warning"
  922. }).then(() => {
  923. if (row.id){
  924. // corpsitem(row.id).then(res=>{
  925. // this.$message({
  926. // type: "success",
  927. // message: "操作成功!"
  928. // });
  929. // this.detailedData.splice(index, 1);
  930. // })
  931. }else {
  932. this.$message({
  933. type: "success",
  934. message: "操作成功!"
  935. });
  936. this.advantageProjectData.splice(index, 1);
  937. }
  938. })
  939. },
  940. //其他费用新增触发
  941. costIncrease(){
  942. this.dialogCost = !this.dialogCost
  943. this.choiceData = false
  944. },
  945. //新增附件上传保存触发
  946. rowSaveBankOfDeposit(row, done, loading){
  947. this.bankOfDepositData.push(row)
  948. done()
  949. },
  950. //修改附件上传触发
  951. rowUpdateBankOfDeposit(row, index, done, loading) {
  952. done(row);
  953. },
  954. //删除附件上传触发
  955. rowDelBankOfDeposit(row, index, donerowDel) {
  956. this.$confirm("确定将选择数据删除?", {
  957. confirmButtonText: "确定",
  958. cancelButtonText: "取消",
  959. type: "warning"
  960. }).then(() => {
  961. if (row.id){
  962. corpsbank(row.id).then(res=>{
  963. this.$message({
  964. type: "success",
  965. message: "操作成功!"
  966. });
  967. this.bankOfDepositData.splice(index, 1);
  968. })
  969. }else {
  970. this.$message({
  971. type: "success",
  972. message: "操作成功!"
  973. });
  974. this.bankOfDepositData.splice(index, 1);
  975. }
  976. })
  977. },
  978. //费用查询
  979. onLoadCost(page, params = {}) {
  980. this.loadingCost = true;
  981. let queryParams = Object.assign({}, params, {pageSize: page.pageSize, pageNum: page.currentPage,parentId:0,feesTypeId:this.treeDeptIdCost})
  982. customerList(queryParams).then(res => {
  983. const data = res.data.data;
  984. this.pageCost.total = data.total;
  985. this.dataCost = data.records;
  986. this.loadingCost = false;
  987. });
  988. },
  989. nodeClickCost(data){
  990. this.treeDeptIdCost = data.id;
  991. this.pageCost.currentPage = 1;
  992. this.onLoadCost(this.pageCost);
  993. },
  994. //费用刷新触发
  995. refreshChangeCost() {
  996. this.treeDeptIdCost = '';
  997. this.pageCost.currentPage = 1;
  998. this.onLoadCost(this.pageCost);
  999. },
  1000. //费用选中触发
  1001. selectionChangeCost(list){
  1002. this.tableDataCost = list
  1003. },
  1004. //费用导入触发
  1005. importCost(){
  1006. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  1007. if (this.tableDataCost.length>0){
  1008. for(let item in this.tableDataCost){
  1009. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1010. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1011. delete this.tableDataCost[item].id
  1012. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1013. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length-1)
  1014. }
  1015. }
  1016. this.tableDataCost = []
  1017. this.dialogCost = false
  1018. },
  1019. //费用编辑导入触发
  1020. choiceCost(){
  1021. if (this.tableDataCost.length === 1){
  1022. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  1023. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  1024. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  1025. }
  1026. this.dialogCost = !this.dialogCost
  1027. this.choiceData = false
  1028. },
  1029. // 发货
  1030. sendHandle() {
  1031. this.$message.success('发货成功')
  1032. },
  1033. backToList() {
  1034. if(contrastObj(this.form,this.oldform) || contrastList(this.orderFeesList,this.olddata)){
  1035. this.$confirm("是否保存当前页面?", "提示", {
  1036. confirmButtonText: "保存",
  1037. cancelButtonText: "取消",
  1038. type: "warning",
  1039. }).then(() => {
  1040. this.editCustomer(true)
  1041. })
  1042. }else{
  1043. this.$emit("goBack");
  1044. }
  1045. },
  1046. }
  1047. }
  1048. </script>
  1049. <style scoped lang="scss">
  1050. .customer-head {
  1051. position: fixed;
  1052. top: 105px;
  1053. width: 100%;
  1054. margin-left: -10px;
  1055. height: 62px;
  1056. background: #ffffff;
  1057. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1058. z-index: 999;
  1059. /* display: flex;
  1060. justify-content: left; */
  1061. }
  1062. .customer-back {
  1063. cursor: pointer;
  1064. line-height: 62px;
  1065. font-size: 16px;
  1066. color: #323233;
  1067. font-weight: 400;
  1068. }
  1069. .add-customer-btn-two {
  1070. position: fixed;
  1071. right: 150px;
  1072. top: 115px;
  1073. }
  1074. .add-customer-btn {
  1075. position: fixed;
  1076. right: 36px;
  1077. top: 115px;
  1078. }
  1079. ::v-deep .el-form-item {
  1080. margin-bottom: 0;
  1081. }
  1082. //el-icon-plus avue-upload__icon
  1083. .avue-upload /deep/ .avue-upload__icon {
  1084. line-height: 178px !important;
  1085. }
  1086. </style>