detailsPage.vue 39 KB

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