detailsPage.vue 36 KB

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