detailsPage.vue 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  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="priceCategory" slot-scope="{row,index}">
  71. <span v-if="row.$cellEdit" class="required_fields">*</span>
  72. <el-input
  73. v-if="row.$cellEdit"
  74. v-model="row.priceCategoryNames"
  75. size="small"
  76. placeholder="请点击右侧按钮选择"
  77. :disabled="true"
  78. style="width: 63%"
  79. ></el-input>
  80. <el-button v-if="row.$cellEdit" size="small" icon="el-icon-search" @click="choice(row)"></el-button>
  81. <span v-else>{{ row.priceCategoryNames }}</span>
  82. </template>
  83. <template slot="itemType" slot-scope="{row,index}">
  84. <span v-if="row.$cellEdit" class="required_fields">*</span>
  85. <el-select
  86. v-if="row.$cellEdit"
  87. v-model="row.itemType"
  88. size="small"
  89. style="width:90% !important;"
  90. clearable
  91. filterable
  92. >
  93. <el-option
  94. v-for="(item,index) in row.specificationList"
  95. :key="index"
  96. :label="item.value"
  97. :value="item.value"
  98. >
  99. </el-option>
  100. </el-select>
  101. <span v-else>{{ row.itemType }}</span>
  102. </template>
  103. <template slot="purchaseQuantity" slot-scope="{ row }">
  104. <span v-if="row.$cellEdit" class="required_fields">*</span>
  105. <el-input
  106. v-if="row.$cellEdit"
  107. v-model="row.purchaseQuantity"
  108. placeholder="请输入"
  109. size="small"
  110. style="width: 93%"
  111. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  112. @input="quantityChange(row)"
  113. ></el-input>
  114. <span v-else>{{ row.purchaseQuantity }}</span>
  115. </template>
  116. <template slot="price" slot-scope="{ row }">
  117. <el-input
  118. v-if="row.$cellEdit"
  119. v-model="row.price"
  120. placeholder="请输入"
  121. size="small"
  122. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  123. @input="priceChange(row)"
  124. ></el-input>
  125. <span v-else>{{ row.price }}</span>
  126. </template>
  127. <template slot="invoiceWeight" slot-scope="{ row }">
  128. <el-input
  129. v-if="row.$cellEdit"
  130. v-model="row.invoiceWeight"
  131. placeholder="请输入"
  132. size="small"
  133. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  134. @input="totalChange(row.invoiceWeight)"
  135. ></el-input>
  136. <span v-else>{{ row.invoiceWeight }}</span>
  137. </template>
  138. <template slot="billWeight" slot-scope="{ row }">
  139. <el-input
  140. v-if="row.$cellEdit"
  141. v-model="row.billWeight"
  142. placeholder="请输入"
  143. size="small"
  144. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  145. @input="totalChange(row.billWeight)"
  146. ></el-input>
  147. <span v-else>{{ row.billWeight }}</span>
  148. </template>
  149. <template slot-scope="{row,index}" slot="menu">
  150. <el-button
  151. type="text"
  152. size="small"
  153. :disabled="row.actualQuantity !=0"
  154. @click="rowCell(row,index)"
  155. >{{ row.$cellEdit ? '修改完成' : '修改' }}
  156. </el-button>
  157. <el-button
  158. type="text"
  159. size="small"
  160. :disabled="row.actualQuantity !=0"
  161. @click="rowDel(row,index)"
  162. >删除
  163. </el-button>
  164. </template>
  165. <template slot="menuLeft" slot-scope="{size}">
  166. <el-button type="primary"
  167. icon="el-icon-plus"
  168. size="small"
  169. @click="commoditySelection"
  170. >录入明细
  171. </el-button>
  172. <el-button type="warning"
  173. icon="el-icon-s-check"
  174. size="small"
  175. :disabled="selectContact.length == 0"
  176. @click="beforePage(true)"
  177. >申请付款(开证)
  178. </el-button>
  179. <el-button type="warning"
  180. size="small"
  181. :disabled="selectContact.length == 0"
  182. @click="beforePage(false)"
  183. >生成收货单
  184. </el-button>
  185. <el-button type="info"
  186. size="small"
  187. @click="applicationDialog = true,applicationData = contactsData"
  188. >查看申请记录
  189. </el-button>
  190. <el-button type="info"
  191. size="small"
  192. @click=""
  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. }
  791. let submitDto = {
  792. ...this.form,
  793. tradeType:"JK",
  794. billType:"CG",
  795. itemsVOList: this.contactsData,
  796. orderFeesList: orderFeesList,
  797. orderFilesList: orderFilesList
  798. };
  799. submitData(submitDto).then(res => {
  800. if(res.data.success){
  801. this.form.id = res.data.data
  802. this.$message.success("操作成功!")
  803. detailListData(this.form.id).then(res => {
  804. this.form = res.data.data;
  805. this.oldForm = Object.assign({},res.data.data);
  806. this.configuration.dicData = this.form.corpsName
  807. this.pConfiguration.dicData = this.form.purchaserName
  808. if(res.data.data.itemsVOList){
  809. this.contactsData = res.data.data.itemsVOList
  810. this.oldContactsData = this.deepClone(res.data.data.itemsVOList)
  811. }
  812. if(res.data.data.orderFeesList){
  813. this.orderFeesList = res.data.data.orderFeesList
  814. this.oldFeesList = this.deepClone(res.data.data.orderFeesList)
  815. }
  816. if( res.data.data.orderFilesList){
  817. this.orderFilesList = res.data.data.orderFilesList
  818. this.oldFilesList = this.deepClone(res.data.data.orderFilesList)
  819. }
  820. })
  821. }
  822. })
  823. setTimeout(() =>{
  824. },1000);
  825. this.butLoading = false;
  826. if(status === true){
  827. this.$emit("goBack");
  828. }
  829. } else {
  830. return false;
  831. }
  832. });
  833. },
  834. selectionContact(row){
  835. this.selectContact = row;
  836. },
  837. beforePage(type){
  838. let id = this.selectContact.map(item=>{
  839. return item.id ? true : false
  840. })
  841. if(id.findIndex(item => item != true) == -1){
  842. const params = {
  843. id:this.form.id,
  844. orderItemIds:this.selectContact.map(i=>{return i.$index})
  845. }
  846. if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
  847. || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
  848. ){
  849. this.$confirm("您已改动数据,是否先保存在进行操作!", {
  850. confirmButtonText: "保存",
  851. cancelButtonText: "取消",
  852. type: "warning"
  853. }).then(() => {
  854. this.editCustomer();
  855. })
  856. }else{
  857. if(type){
  858. //进入付款管理
  859. if(this.$store.getters.payStatus){
  860. this.$alert("付款页面已存在,请关闭付款页面再进行操作", "温馨提示", {
  861. confirmButtonText: "确定",
  862. type: 'warning',
  863. callback: action => {
  864. }
  865. });
  866. }else{
  867. this.$router.$avueRouter.closeTag('/financialManagement/payment');
  868. this.$router.push({
  869. path: "/financialManagement/payment",
  870. query: {params: params},
  871. });
  872. }
  873. }else{
  874. //进入收货单
  875. if(this.$store.getters.takeStatus){
  876. this.$alert("收货单页面已存在,请关闭收货单再进行操作", "温馨提示", {
  877. confirmButtonText: "确定",
  878. type: 'warning',
  879. callback: action => {
  880. }
  881. });
  882. }else{
  883. //关闭一下存在的列表页
  884. this.$router.$avueRouter.closeTag('/importTrade/receipt/index');
  885. this.$router.push({
  886. path: "/importTrade/receipt/index",
  887. query: {params: params},
  888. });
  889. }
  890. }
  891. }
  892. }else{
  893. this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
  894. confirmButtonText: "保存",
  895. cancelButtonText: "取消",
  896. type: "warning"
  897. }).then(() => {
  898. this.editCustomer();
  899. })
  900. }
  901. },
  902. //选择货物品种
  903. choice(row){
  904. this.dialogVisible = true;
  905. this.selectKind = row.$index;
  906. },
  907. //选择货品
  908. commodityConfirm(){
  909. if(this.tableData){
  910. this.contactsData[this.selectKind].priceCategory = this.tableData[0].id;
  911. this.contactsData[this.selectKind].itemId = this.tableData[0].id;
  912. this.$set(this.contactsData[this.selectKind],'priceCategoryNames',this.tableData[0].cname)
  913. getSpecification({ goodId: this.tableData[0].id}).then(res =>{
  914. this.$set(this.contactsData[this.selectKind],'itemType',res.data.data.map(item =>item)[0])
  915. this.$set(this.contactsData[this.selectKind],'specificationList',res.data.data.map(item => ({ value: item })))
  916. }).finally(()=>{
  917. this.selectKind = -1
  918. })
  919. this.dialogVisible = !this.dialogVisible
  920. }
  921. },
  922. //新增商品明细保存触发
  923. rowSave(row, done, loading) {
  924. // this.contactsData.push(row)
  925. done()
  926. },
  927. //修改商品信息触发
  928. rowUpdate(row, index, done, loading) {
  929. done(row);
  930. },
  931. //删除商品信息触发
  932. rowDel(row, index, donerowDel) {
  933. this.$confirm("确定将选择数据删除?", {
  934. confirmButtonText: "确定",
  935. cancelButtonText: "取消",
  936. type: "warning"
  937. }).then(() => {
  938. //商品判断是否需要调用删除接口
  939. if (row.id) {
  940. corpsattn(row.id).then(res => {
  941. this.$message({
  942. type: "success",
  943. message: "操作成功!"
  944. });
  945. this.contactsData.splice(index, 1);
  946. })
  947. } else {
  948. this.$message({
  949. type: "success",
  950. message: "操作成功!"
  951. });
  952. this.contactsData.splice(index, 1);
  953. }
  954. })
  955. },
  956. //刷新
  957. applicationRefreshChange(){
  958. },
  959. //申请记录
  960. applicationOnLoad(){
  961. },
  962. //点击商品明细选择触发
  963. commodityChoice(row) {
  964. this.dialogVisible = !this.dialogVisible
  965. this.commodityData = true
  966. this.choiceIndexT = row.$index
  967. },
  968. //商品编辑
  969. rowCell(row, index) {
  970. this.$refs.crudContact.rowCell(row, index)
  971. },
  972. //商品新增触发
  973. commoditySelection() {
  974. const params ={
  975. billWeight:0,
  976. invoiceWeight:0,
  977. price:0,
  978. purchaseQuantity:0,
  979. }
  980. this.$refs.crudContact.rowCellAdd(params);
  981. // this.dialogVisible = !this.dialogVisible
  982. // this.commodityData = false
  983. },
  984. //点击行可编辑
  985. handleRowClick(row, event, column) {
  986. },
  987. //刷新触发
  988. refreshChange() {
  989. this.treeDeptId = '';
  990. this.page.currentPage = 1;
  991. this.onLoad(this.page);
  992. },
  993. //选中触发
  994. selectionChange(list) {
  995. this.tableData = list
  996. },
  997. //导入页左商品类型查询
  998. nodeClick(data) {
  999. this.treeDeptId = data.id;
  1000. this.page.currentPage = 1;
  1001. this.onLoad(this.page);
  1002. },
  1003. //商品详情list
  1004. onLoad(page, params = {}) {
  1005. if (this.page.total) {
  1006. this.optionTwo.height = window.innerHeight - 520;
  1007. } else {
  1008. this.optionTwo.height = window.innerHeight - 475;
  1009. }
  1010. this.loading = true;
  1011. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1012. const data = res.data.data;
  1013. this.page.total = data.total;
  1014. this.data = data.records;
  1015. this.loading = false;
  1016. });
  1017. },
  1018. //确认导入触发
  1019. importGoods() {
  1020. if (this.tableData.length > 0) {
  1021. for (let item in this.tableData) {
  1022. const params ={
  1023. priceCategory:this.tableData[item].code,
  1024. priceCategoryNames:this.tableData[item].cname,
  1025. itemId:this.tableData[item].id,
  1026. cname:this.tableData[item].cname,
  1027. purchaseQuantity:0,
  1028. price:0,
  1029. amount:0.00
  1030. }
  1031. this.$refs.crudContact.rowCellAdd(params);
  1032. this.$refs.crudContact.rowCell(params,this.contactsData.length - 1)
  1033. }
  1034. }
  1035. this.tableData = []
  1036. this.dialogVisible = false
  1037. },
  1038. //导入商品触发
  1039. importChoice() {
  1040. if (this.tableData.length === 1) {
  1041. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  1042. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  1043. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  1044. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
  1045. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  1046. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  1047. }
  1048. this.dialogVisible = !this.dialogVisible
  1049. this.commodityData = false
  1050. },
  1051. backToList() {
  1052. if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
  1053. || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
  1054. ){
  1055. this.$confirm("是否保存当前页面?", "提示", {
  1056. confirmButtonText: "保存",
  1057. cancelButtonText: "取消",
  1058. type: "warning",
  1059. }).then(() => {
  1060. this.editCustomer(true)
  1061. }).catch(()=>{
  1062. this.$emit("goBack");
  1063. })
  1064. }else{
  1065. this.$emit("goBack");
  1066. }
  1067. },
  1068. }
  1069. }
  1070. </script>
  1071. <style scoped lang="scss">
  1072. .customer-head {
  1073. position: fixed;
  1074. top: 105px;
  1075. width: 100%;
  1076. margin-left: -10px;
  1077. height: 62px;
  1078. background: #ffffff;
  1079. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1080. z-index: 999;
  1081. /* display: flex;
  1082. justify-content: left; */
  1083. }
  1084. .customer-back {
  1085. cursor: pointer;
  1086. line-height: 62px;
  1087. font-size: 16px;
  1088. color: #323233;
  1089. font-weight: 400;
  1090. }
  1091. .add-customer-btn-two {
  1092. position: fixed;
  1093. right: 150px;
  1094. top: 115px;
  1095. }
  1096. .required_fields{
  1097. color: #F56C6C;
  1098. display:inline-block;
  1099. width: 7%
  1100. }
  1101. .add-customer-btn {
  1102. position: fixed;
  1103. right: 36px;
  1104. top: 115px;
  1105. }
  1106. ::v-deep .el-form-item {
  1107. margin-bottom: 0;
  1108. }
  1109. //el-icon-plus avue-upload__icon
  1110. .avue-upload /deep/ .avue-upload__icon {
  1111. line-height: 178px !important;
  1112. }
  1113. ::v-deep .el-form-item__content{
  1114. line-height: 32px;
  1115. }
  1116. </style>