detailsPage.vue 34 KB

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