detailsPage.vue 35 KB

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