detailsPage.vue 39 KB

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