detailsPage.vue 35 KB

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