detailsPage.vue 37 KB

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