detailsPage.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  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. label: '合同号',
  342. prop: 'orderNo',
  343. disabled:true,
  344. rules: [
  345. {
  346. required: false,
  347. message: ' ',
  348. trigger: 'blur'
  349. }
  350. ]
  351. }, {
  352. label: '合同日期',
  353. prop: 'businesDate',
  354. type:'datetime',
  355. data: [],
  356. rules: [
  357. {
  358. required: false,
  359. message: ' ',
  360. trigger: 'blur'
  361. }
  362. ]
  363. }, {
  364. label: '客户名称',
  365. prop: 'corpId',
  366. rules: [
  367. {
  368. required: true,
  369. message: ' ',
  370. trigger: 'blur'
  371. }
  372. ]
  373. },{
  374. label: '业务员',
  375. prop: 'salesName',
  376. dicData: [],
  377. rules: [
  378. {
  379. required: false,
  380. message: ' ',
  381. trigger: 'blur'
  382. }
  383. ]
  384. }, {
  385. label: '计划交期',
  386. prop: 'plannedDeliveryDate',
  387. type: 'datetime',
  388. rules: [
  389. {
  390. required: false,
  391. message: ' ',
  392. trigger: 'blur'
  393. }
  394. ]
  395. },{
  396. label: '合同金额',
  397. prop: 'orderAmount',
  398. rules: [
  399. {
  400. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  401. message: ' ',
  402. trigger: 'blur'
  403. }
  404. ]
  405. }, {
  406. label: '收款金额',
  407. prop: 'settlmentAmount',
  408. rules: [
  409. {
  410. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  411. message: ' ',
  412. trigger: 'blur'
  413. }
  414. ]
  415. },
  416. {
  417. label: '销售单价',
  418. prop: 'salesPrice',
  419. rules: [
  420. {
  421. required: false,
  422. message: ' ',
  423. trigger: 'blur'
  424. }
  425. ]
  426. },
  427. {
  428. label: '首付比例',
  429. prop: 'downPayment',
  430. rules: [
  431. {
  432. required: false,
  433. message: ' ',
  434. trigger: 'blur'
  435. }
  436. ]
  437. },
  438. {
  439. label: '首付金额',
  440. prop: 'advancePayment',
  441. rules: [
  442. {
  443. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  444. message: ' ',
  445. trigger: 'blur'
  446. }
  447. ]
  448. },
  449. {
  450. label: '客户首付日期',
  451. prop: 'advanceCollectionDate',
  452. type: 'datetime',
  453. rules: [
  454. {
  455. required: false,
  456. message: ' ',
  457. trigger: 'blur'
  458. }
  459. ]
  460. },
  461. {
  462. label: '码单重量',
  463. prop: 'billWeight',
  464. disabled: true,
  465. rules: [
  466. {
  467. required: false,
  468. message: ' ',
  469. trigger: 'blur'
  470. }
  471. ]
  472. },{
  473. label: '发票重量',
  474. prop: 'invoiceWeight',
  475. disabled: true,
  476. rules: [
  477. {
  478. required: false,
  479. message: ' ',
  480. trigger: 'blur'
  481. }
  482. ]
  483. }, {
  484. label: '包装要求',
  485. prop: 'packageRemarks',
  486. rules: [
  487. {
  488. required: false,
  489. message: ' ',
  490. trigger: 'blur'
  491. }
  492. ]
  493. }, {
  494. label: '币别',
  495. prop: 'currency',
  496. }, {
  497. label: '汇率',
  498. prop: 'exchangeRate',
  499. disabled: true,
  500. rules: [
  501. {
  502. required: false,
  503. message: ' ',
  504. trigger: 'blur'
  505. }
  506. ]
  507. },
  508. {
  509. label: '提成标准',
  510. prop: 'commissionRate',
  511. rules: [
  512. {
  513. required: false,
  514. message: ' ',
  515. trigger: 'blur'
  516. }
  517. ]
  518. },{
  519. label: "备注",
  520. span: 24,
  521. prop: "orderRemark",
  522. mock: {
  523. type: 'county'
  524. }
  525. }
  526. ],
  527. },
  528. //收款记录
  529. payeeDialog:false,
  530. payeeLoading:false,
  531. payeeData:[],
  532. payeePage:{
  533. pageSize: 10,
  534. currentPage: 1,
  535. total: 0
  536. },
  537. // 导入库存配置
  538. importInventory: {},
  539. importInventoryForm: {},
  540. importInventoryData: [],
  541. dialogStock: false,
  542. // 其他费用
  543. advantageProject: advantageProject,
  544. advantageProjectData: [],
  545. advantageProjectForm: {},
  546. dialogCost: false,
  547. choiceData: false,
  548. treeOptionCost:{
  549. nodeKey: 'id',
  550. lazy: true,
  551. treeLoad: function (node, resolve) {
  552. const parentId = (node.level === 0) ? 0 : node.data.id;
  553. getDeptLazyTree(parentId).then(res => {
  554. resolve(res.data.data.map(item => {
  555. return {
  556. ...item,
  557. leaf: !item.hasChildren
  558. }
  559. }))
  560. });
  561. },
  562. addBtn: false,
  563. menu: false,
  564. size: 'small',
  565. props: {
  566. labelText: '标题',
  567. label: 'title',
  568. value: 'value',
  569. children: 'children'
  570. }
  571. },
  572. treeOption: {
  573. nodeKey: 'id',
  574. lazy: true,
  575. treeLoad: function (node, resolve) {
  576. const parentId = (node.level === 0) ? 0 : node.data.id;
  577. getDeptLazyTreeTwo(parentId).then(res => {
  578. resolve(res.data.data.map(item => {
  579. return {
  580. ...item,
  581. leaf: !item.hasChildren
  582. }
  583. }))
  584. });
  585. },
  586. addBtn: false,
  587. menu: false,
  588. size: 'small',
  589. props: {
  590. labelText: '标题',
  591. label: 'title',
  592. value: 'value',
  593. children: 'children'
  594. }
  595. },
  596. // 导入商品配置
  597. optionGoods: [],
  598. loadingGoods: false,
  599. dataGoods:[],
  600. pageGoods:{
  601. pageSize: 10,
  602. currentPage: 1,
  603. total: 0
  604. },
  605. // 导入其他费用配置
  606. optionTwoCost: optionTwoCost,
  607. loadingCost: false,
  608. dataCost:[],
  609. pageCost:{
  610. pageSize: 10,
  611. currentPage: 1,
  612. total: 0
  613. },
  614. tableDataCost: [],
  615. treeDeptId: '',
  616. treeDeptIdCost: '',
  617. choiceIndex: '',
  618. // 合同上传数据
  619. uploadList: uploadList,
  620. // 合同数据
  621. bankOfDepositForm: {},
  622. optionTwo: commodity,
  623. loading: false,
  624. data: [],
  625. page: {
  626. pageSize: 10,
  627. currentPage: 1,
  628. total: 0
  629. },
  630. tableData: [],
  631. commodityData: false,
  632. selection: [],
  633. //新旧数据对比
  634. oldForm:{},
  635. oldInventoryData:[],
  636. oldFeesList:[],
  637. oldFilesList:[],
  638. }
  639. },
  640. async created() {
  641. this.importInventory = await this.getColumnData(this.getColumnName(39), importInventory);
  642. //币别
  643. this.getWorkDicts("entrance_currency").then(res =>{
  644. this.currencyDic = res.data.data
  645. })
  646. if (this.detailData.id) {
  647. let id = this.detailData.id.replace(/\"/g, "")
  648. detailSaleList(id).then(res => {
  649. this.form = res.data.data;
  650. this.oldForm = Object.assign({},res.data.data);
  651. this.configuration.dicData = this.form.corpName
  652. this.bConfiguration.dicData = this.form.belongToCorpList
  653. if(this.form.orderItemsList){
  654. this.importInventoryData = this.form.orderItemsList
  655. this.oldInventoryData = this.deepClone(this.form.orderItemsList)
  656. }
  657. if(this.form.orderFeesList){
  658. this.orderFeesList = this.form.orderFeesList
  659. this.oldFeesList = this.deepClone(this.form.orderFeesList)
  660. }
  661. if(this.form.orderFilesList){
  662. this.orderFilesList = this.form.orderFilesList
  663. this.oldFilesList = this.deepClone(this.form.orderFilesList)
  664. }
  665. })
  666. }else{
  667. this.$set(this.form,"currency","USD")
  668. this.$set(this.form,"exchangeRate",6.3843)
  669. }
  670. },
  671. components: {
  672. feeInfo,
  673. uploadFile
  674. },
  675. methods: {
  676. //首付比例 带出金额
  677. downPaymentChange(){
  678. if(this.form.orderAmount){
  679. this.form.advancePayment = _.multiply(this.form.orderAmount,(this.form.downPayment*0.01)).toFixed(2)
  680. }
  681. },
  682. //合计
  683. totalChange(){
  684. let invoiceList = this.importInventoryData.map(item => {
  685. if(item.invoiceWeight){
  686. return parseFloat(item.invoiceWeight);
  687. }else return 0
  688. });
  689. let billList = this.importInventoryData.map(item => {
  690. if(item.billWeight){
  691. return parseFloat(item.billWeight);
  692. }else return 0
  693. });
  694. this.$set(this.form,"invoiceWeight", invoiceList.reduce((n,m) => n + m))
  695. this.$set(this.form,"billWeight", billList.reduce((n,m) => n + m))
  696. },
  697. //汇率
  698. currencyChange(value){
  699. if(this.form.orderAmount){
  700. if(value === "CNY"){
  701. this.form.exchangeRate = 1
  702. // this.form.rmbAmount = this.form.orderAmount
  703. }else{
  704. this.form.exchangeRate = 6.3843
  705. // this.form.rmbAmount = _.multiply(this.form.orderAmount, 6.3843)
  706. }
  707. }
  708. },
  709. //单价
  710. priceChange(row) {
  711. if (!row.price) {
  712. row.price = "";
  713. row.amount = 0
  714. } else {
  715. row.amount = _.multiply(row.invoiceWeight, row.price).toFixed(2);
  716. }
  717. },
  718. //数量
  719. invoiceWeightChange(row) {
  720. if (!row.invoiceWeight) {
  721. row.invoiceWeight = "";
  722. row.amount = 0
  723. } else {
  724. row.amount =_.multiply(row.invoiceWeight,row.price).toFixed(2);
  725. }
  726. },
  727. editCustomer(status) {
  728. this.$refs["form"].validate((valid) => {
  729. if (valid) {
  730. let orderFeesList = this.$refs.feeInfo.submitData();
  731. for (let i = 0; i < orderFeesList.length; i++) {
  732. if (orderFeesList[i].corpId == null) {
  733. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  734. }
  735. if (orderFeesList[i].price == 0) {
  736. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  737. }
  738. if (orderFeesList[i].orderQuantity == 0) {
  739. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  740. }
  741. }
  742. let orderUpLoadList = this.$refs.uploadFile.submitData();
  743. for (let j = 0; j < this.importInventoryData.length; j++) {
  744. if (this.importInventoryData[j].billNo === "") {
  745. return this.$message.error(`请输入销售明细第${j + 1}行的提单号`);
  746. }
  747. if (this.importInventoryData[j].orgOrderNo === "") {
  748. return this.$message.error(`请输入销售明细第${j + 1}行的合同号`);
  749. }
  750. if (this.importInventoryData[j].priceCategory === "") {
  751. return this.$message.error(`请输入销售明细第${j + 1}行的货品物种`);
  752. }
  753. if (this.importInventoryData[j].orderQuantity === "") {
  754. return this.$message.error(`请输入销售明细第${j + 1}行的数量`);
  755. }
  756. if (this.importInventoryData[j].orderQuantity == 0) {
  757. return this.$message.error(`销售明细第${j + 1}行的数量不能为0`);
  758. }
  759. }
  760. this.form.billNo = this.importInventoryData.map(item =>{return item.billNo}).join(",")
  761. let submitDto = {
  762. ...this.form,
  763. orderItemsList: this.importInventoryData,
  764. orderFeesList: orderFeesList,
  765. orderUpLoadList:orderUpLoadList,
  766. };
  767. submitData(submitDto).then(res => {
  768. if(res.data.success){
  769. this.$message.success("操作成功!")
  770. detailSaleList(res.data.data.id).then(res => {
  771. this.form = res.data.data;
  772. this.oldForm = Object.assign({},res.data.data);
  773. this.configuration.dicData = this.form.corpName
  774. this.bConfiguration.dicData = this.form.belongToCorpList
  775. this.importInventoryData = this.form.orderItemsList
  776. if(this.form.orderItemsList){
  777. this.importInventoryData = this.form.orderItemsList
  778. this.oldInventoryData = this.deepClone(this.form.orderItemsList)
  779. }
  780. if(this.form.orderFeesList){
  781. this.orderFeesList = this.form.orderFeesList
  782. this.oldFeesList = this.deepClone(this.form.orderFeesList)
  783. }
  784. if(this.form.orderFilesList){
  785. this.orderFilesList = this.form.orderFilesList
  786. this.oldFilesList = this.deepClone(this.form.orderFilesList)
  787. }
  788. })
  789. }
  790. })
  791. if(status === true){
  792. this.$emit("goBack");
  793. }
  794. } else {
  795. return false;
  796. }
  797. });
  798. },
  799. //刷新
  800. payeeRefreshChange(){
  801. },
  802. //申请记录
  803. payeeOnLoad(){
  804. },
  805. //商品选中触发
  806. productSelection(selection){
  807. this.selection = selection
  808. },
  809. //生成发货单
  810. generateShipmentD(){
  811. let id = this.selection.map(item=>{
  812. return item.id ? true : false
  813. })
  814. if(id.findIndex(item => item != true) == -1){
  815. const params = {
  816. id:this.form.id,
  817. orderItemIds:this.selection.map(i=>{return i.id})
  818. }
  819. if(contrastObj(this.form,this.oldForm) || contrastList(this.importInventoryData,this.oldInventoryData)
  820. || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
  821. ){
  822. this.$confirm("您已改动数据,是否先保存在进行操作!", {
  823. confirmButtonText: "保存",
  824. cancelButtonText: "取消",
  825. type: "warning"
  826. }).then(() => {
  827. this.editCustomer();
  828. })
  829. }else{
  830. if(this.$store.getters.goStatus){
  831. this.$alert("发货单已存在,请保存发货单再进行操作", "温馨提示", {
  832. confirmButtonText: "确定",
  833. type: 'warning',
  834. callback: action => {
  835. }
  836. });
  837. }else{
  838. generateShipment(params).then(res=>{
  839. this.$router.push({
  840. path: "/importTrade/invoice/index",
  841. query: {form: JSON.stringify(res.data.data)},
  842. });
  843. })
  844. }
  845. }
  846. }else{
  847. this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
  848. confirmButtonText: "确定",
  849. cancelButtonText: "取消",
  850. type: "warning"
  851. }).then(() => {
  852. this.editCustomer();
  853. })
  854. }
  855. },
  856. //提单号带出合同号
  857. bingOut(row){
  858. getOrgOrderNo(row.billNo).then(res =>{
  859. if(res.data.length != 0){
  860. this.contractDic = res.data;
  861. row.orgOrderNo = res.data[0].orderNo
  862. row.priceCategoryNames = res.data[0].itemName[0].cname
  863. row.priceCategory = res.data[0].itemName[0].id
  864. }else{
  865. this.$message.warning("无此提单号记录!");
  866. this.contractDic = [];
  867. row.orgOrderNo = ''
  868. row.priceCategoryNames = ''
  869. row.priceCategory = ''
  870. }
  871. }).catch(()=>{
  872. row.orgOrderNo = ''
  873. })
  874. },
  875. //商品明细导入
  876. newDetails(){
  877. this.$refs.importInventory.rowCellAdd();
  878. },
  879. //商品编辑
  880. rowCell(row, index) {
  881. // row.$cellEdit = !row.$cellEdit
  882. this.$refs.importInventory.rowCell(row, index)
  883. },
  884. //其他费用编辑
  885. rowCellTwo(row, index) {
  886. this.$refs.crudProject.rowCell(row, index)
  887. },
  888. //其他费用新增触发
  889. costIncrease(){
  890. this.dialogCost = !this.dialogCost
  891. this.choiceData = false
  892. },
  893. //费用查询
  894. onLoadCost(page, params = {}) {
  895. this.loadingCost = true;
  896. let queryParams = Object.assign({}, params, {pageSize: page.pageSize, pageNum: page.currentPage,parentId:0,feesTypeId:this.treeDeptIdCost})
  897. customerList(queryParams).then(res => {
  898. const data = res.data.data;
  899. this.pageCost.total = data.total;
  900. this.dataCost = data.records;
  901. this.loadingCost = false;
  902. });
  903. },
  904. //商品列表查询
  905. onLoad(page, params = {}) {
  906. this.loading = true;
  907. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  908. const data = res.data.data;
  909. this.page.total = data.total;
  910. this.data = data.records;
  911. if (this.page.total) {
  912. this.option.height = window.innerHeight - 350;
  913. } else {
  914. this.option.height = window.innerHeight - 305;
  915. }
  916. }).finally(()=>{
  917. this.loading = false;
  918. });
  919. },
  920. rateChange(row) {
  921. if (row >= 100) {
  922. this.$set(this.form,"exchangeRate", 0)
  923. this.$message.error("汇率不能超过100%");
  924. }
  925. },
  926. //选择货物品种
  927. choice(row){
  928. this.dialogVisible = true;
  929. this.selectKind = row.$index;
  930. },
  931. //选择货品
  932. commodityConfirm(){
  933. if(this.tableData){
  934. this.importInventoryData[this.selectKind].priceCategory = this.tableData[0].id;
  935. this.importInventoryData[this.selectKind].itemId = this.tableData[0].id;
  936. this.$set(this.importInventoryData[this.selectKind],'priceCategoryNames',this.tableData[0].cname)
  937. this.dialogVisible = !this.dialogVisible
  938. this.selectKind = -1
  939. }
  940. },
  941. //刷新触发
  942. refreshChange() {
  943. this.treeDeptId = '';
  944. this.page.currentPage = 1;
  945. this.onLoad(this.page);
  946. },
  947. //选中触发
  948. selectionChange(list) {
  949. this.tableData = list
  950. },
  951. //确认导入触发
  952. importGoods() {
  953. if (this.tableData.length > 0) {
  954. for (let item in this.tableData) {
  955. const params ={
  956. priceCategory:this.tableData[item].code,
  957. priceCategoryNames:this.tableData[item].cname,
  958. itemId:this.tableData[item].id,
  959. cname:this.tableData[item].cname,
  960. orderQuantity:0,
  961. price:0,
  962. amount:0.00,
  963. }
  964. this.$refs.importInventory.rowCellAdd(params);
  965. this.$refs.importInventory.rowCell(params,this.importInventoryData.length - 1)
  966. }
  967. }
  968. this.tableData = []
  969. this.dialogVisible = false
  970. },
  971. //导入页左商品类型查询
  972. nodeClick(data) {
  973. this.treeDeptId = data.id;
  974. this.page.currentPage = 1;
  975. this.onLoad(this.page);
  976. },
  977. //导入商品触发
  978. importChoice() {
  979. if (this.tableData.length === 1) {
  980. this.importInventoryData[this.choiceIndexT].cname = this.tableData[0].cname
  981. this.importInventoryData[this.choiceIndexT].code = this.tableData[0].code
  982. this.importInventoryData[this.choiceIndexT].typeno = this.tableData[0].typeno
  983. this.importInventoryData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
  984. this.importInventoryData[this.choiceIndexT].itemId = this.tableData[0].id
  985. this.importInventoryData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  986. }
  987. this.dialogVisible = !this.dialogVisible
  988. this.commodityData = false
  989. },
  990. //新增明细保存触发
  991. rowSaveList(row, done, loading){
  992. // this.advantageProjectData.push(row)
  993. done()
  994. },
  995. //修改明细触发
  996. rowUpdateList(row, index, done, loading) {
  997. done(row);
  998. },
  999. //删除商品明细触发
  1000. rowDelList(row, index, donerowDel) {
  1001. this.$confirm("确定将选择数据删除?", {
  1002. confirmButtonText: "确定",
  1003. cancelButtonText: "取消",
  1004. type: "warning"
  1005. }).then(() => {
  1006. if (row.id){
  1007. goodsListRemove(row.id).then(res=>{
  1008. this.$message({
  1009. type: "success",
  1010. message: "操作成功!"
  1011. });
  1012. this.importInventoryData.splice(index, 1);
  1013. })
  1014. }else {
  1015. this.$message({
  1016. type: "success",
  1017. message: "操作成功!"
  1018. });
  1019. this.importInventoryData.splice(index, 1);
  1020. }
  1021. })
  1022. },
  1023. backToList() {
  1024. if(contrastObj(this.form,this.oldForm) || contrastList(this.importInventoryData,this.oldInventoryData)
  1025. || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
  1026. ){
  1027. this.$confirm("是否保存当前页面?", "提示", {
  1028. confirmButtonText: "保存",
  1029. cancelButtonText: "取消",
  1030. type: "warning",
  1031. }).then(() => {
  1032. this.editCustomer(true)
  1033. }).catch(()=>{
  1034. this.$emit("goBack");
  1035. })
  1036. }else{
  1037. this.$emit("goBack");
  1038. }
  1039. },
  1040. //列保存触发
  1041. async saveColumn() {
  1042. const inSave = await this.saveColumnData(
  1043. this.getColumnName(39),
  1044. this.importInventory
  1045. );
  1046. if (inSave) {
  1047. this.$message.success("保存成功");
  1048. //关闭窗口
  1049. this.$refs.importInventory.$refs.dialogColumn.columnBox = false;
  1050. }
  1051. },
  1052. },
  1053. }
  1054. </script>
  1055. <style scoped lang="scss">
  1056. .customer-head {
  1057. position: fixed;
  1058. top: 105px;
  1059. width: 100%;
  1060. margin-left: -10px;
  1061. height: 62px;
  1062. background: #ffffff;
  1063. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1064. z-index: 999;
  1065. /* display: flex;
  1066. justify-content: left; */
  1067. }
  1068. .add-customer-btn-two {
  1069. position: fixed;
  1070. right: 150px;
  1071. top: 115px;
  1072. }
  1073. .customer-back {
  1074. cursor: pointer;
  1075. line-height: 62px;
  1076. font-size: 16px;
  1077. color: #323233;
  1078. font-weight: 400;
  1079. }
  1080. .required_fields{
  1081. color: #F56C6C;
  1082. display:inline-block;
  1083. width: 7%
  1084. }
  1085. .add-customer-btn-three {
  1086. position: fixed;
  1087. right: 266px;
  1088. top: 115px;
  1089. }
  1090. .add-customer-btn {
  1091. position: fixed;
  1092. right: 36px;
  1093. top: 115px;
  1094. }
  1095. ::v-deep .el-form-item {
  1096. margin-bottom: 0;
  1097. }
  1098. ::v-deep .el-form-item__content{
  1099. line-height: 32px;
  1100. }
  1101. </style>