detailsPage.vue 33 KB

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