detailsPage.vue 37 KB

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