detailsPage.vue 40 KB

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