detailsPage.vue 35 KB

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