detailsPage.vue 37 KB

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