addTransportPriceNew.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <!-- 添加汽运单价 111-->
  3. <div class="addTransportPrice">
  4. <page-title>修改</page-title>
  5. <div class="form">
  6. <div class="form_box">
  7. <dil-form :formId="394" v-model="form1" ref="from1"></dil-form>
  8. <label>运输距离:</label><el-input type="number" v-model="haulDistance" class="el-input"></el-input>
  9. </div>
  10. <div id="liulan1">
  11. <el-button type="primary" class="btn" @click="updateAddressDeliveryAddress">提交</el-button>
  12. <el-button type="primary" class="btn1" @click="updatePriceValue">提交</el-button>
  13. </div>
  14. </div>
  15. <div class="elForm">
  16. <el-form :inline="true" class="demo-form-inline" label-width="80px">
  17. <el-button type="primary" id="cysbutton" @click="ondrawerOutcys">浏览所属承运商</el-button>
  18. </el-form>
  19. </div>
  20. <!-- 承运商模态框 -->
  21. <el-drawer
  22. title="选择承运商"
  23. :visible.sync="drawer"
  24. direction="rtl"
  25. size="40%"
  26. :show-close="false"
  27. >
  28. <el-input
  29. placeholder="请输入内容"
  30. v-model="index"
  31. style="margin-top: 10px; margin-left: 20px;width:250px"
  32. clearable
  33. >
  34. </el-input
  35. ><el-button
  36. type="primary"
  37. class="btn"
  38. @click="onclickCarrier"
  39. style="margin-left: 4px;"
  40. >
  41. <i class="el-icon-search"></i>查询
  42. </el-button>
  43. <!-- <el-button @click="open">取消</el-button> -->
  44. <el-button type="primary" @click="selectMakeSure">确定</el-button>
  45. <div class="tablecls">
  46. <!-- 查询所有的承运商 -->
  47. <dilTable
  48. v-bind.sync="carrier"
  49. @selection-change="currentRadioChangecys"
  50. :drawer="drawer"
  51. >
  52. </dilTable>
  53. </div>
  54. </el-drawer>
  55. <!-- 所属承运商表格 -->
  56. <div class="selectionTable from">
  57. <el-table
  58. :data="selectionList"
  59. border
  60. style="width: 100%"
  61. highlight-current-row
  62. >
  63. <el-table-column type="index" label="序号" width="50">
  64. </el-table-column>
  65. <el-table-column
  66. v-for="(item, i) in tableTop"
  67. :key="i"
  68. :prop="item.prop"
  69. :label="item.label"
  70. :width="item.width"
  71. align="center"
  72. show-overflow-tooltip
  73. >
  74. </el-table-column>
  75. <!-- 操作列 -->
  76. <el-table-column fixed="right" label="操作" width="100">
  77. <template slot-scope="scope">
  78. <el-button
  79. @click="deleteRow(scope.$index)"
  80. type="text"
  81. icon="el-icon-close"
  82. size="big"
  83. ></el-button>
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. </div>
  88. <div class="button_box">
  89. <el-button @click="cancel">取消</el-button>
  90. <el-button type="primary" @click="makeSure">确定</el-button>
  91. </div>
  92. </div>
  93. </template>
  94. <script>
  95. import PageTitle from "@/components/Page/Title";
  96. import { sjTime,isNumber } from "@/utils/sharedJsFile";
  97. export default {
  98. components: { PageTitle },
  99. data() {
  100. return {
  101. haulDistance:"",
  102. carrierIdArray:[],
  103. tableTop: [
  104. {
  105. prop: "carrierName",
  106. label: "承运商"
  107. }
  108. ],
  109. selectionList: [],
  110. carrierTypes:[],
  111. carrier: {
  112. requestUrl: "",
  113. selectionType: "select"
  114. },
  115. //是否显示承运商模态框
  116. drawer: false,
  117. index: "",
  118. //具体收货地址
  119. place:null,
  120. //承运商名称
  121. state: null,
  122. //承运商id
  123. carrierIds: null,
  124. //收货地址id
  125. addressId:null,
  126. //收货地址模态框数据
  127. addressDetailed :null,
  128. addres:{
  129. requestUrl:"",
  130. selectionType: "radio",
  131. },
  132. //是否打开收货地址弹出框
  133. drawer1:false,
  134. //所有省
  135. provinceList: [],
  136. //选中的省
  137. province: '',
  138. //所有市
  139. cityList: [],
  140. //选中的市
  141. city: '',
  142. //所有的县(区)
  143. countyList: [],
  144. //选中的县
  145. county: '',
  146. //是否点击查询
  147. isKuang:false,
  148. //表格加载状态
  149. tableLoading:false,
  150. //公式内容
  151. formulaString:null,
  152. //油价联动公式Id
  153. oilPriceFormulaId:null,
  154. //是否打开油价联动公式的模态窗口
  155. oilPriceFormulaDrawer:false,
  156. //油价联动公式查询条件
  157. LineText:null,
  158. //油价联动公式模态框查询按钮状态
  159. selectLineLoading:false,
  160. //油价联动公式模态窗口的数据
  161. oilPriceFormula:{
  162. requestUrl:"",
  163. selectionType: "radio",
  164. },
  165. //模态窗口的打开的方向
  166. direction: 'rtl',
  167. //表单数据
  168. form1: {
  169. shipperId:1,
  170. priceDate:new Date(),
  171. oilTypeId:10,
  172. capacityTypeId:1,
  173. type: "销售钢材"
  174. },
  175. //提交给后端的数据
  176. // map:{},
  177. ops: {
  178. vuescroll: {},
  179. scrollPanel: {},
  180. rail: {
  181. keepShow: true
  182. },
  183. bar: {
  184. hoverStyle: true,
  185. onlyShowBarOnScroll: false, //是否只有滚动的时候才显示滚动条
  186. background: "#5f9ea0",//滚动条颜色
  187. opacity: 0.8,//滚动条透明度
  188. "overflow-x": "hidden"
  189. }
  190. }
  191. };
  192. },
  193. mounted() {
  194. this.axios
  195. .post(
  196. "/api/v1/rms/getCarrierNameBySSOId?carrierSSOId=" + this.carrierUserId
  197. )
  198. .then((res) => {
  199. if (res.data.code == "200") {
  200. if (res.data.data) {
  201. this.state = res.data.data.carrierName;
  202. this.carrierIds = res.data.data.carrierId;
  203. }
  204. }
  205. });
  206. },
  207. created(){
  208. console.log(this.$route.params)
  209. this.form1=this.$route.params
  210. this.haulDistance=this.$route.params.haulDistance
  211. this.getCarrierNameList();
  212. //获取所有的省
  213. this.getAllProvince();
  214. },
  215. methods: {
  216. //获取已有的承运商
  217. async getCarrierNameList(){
  218. await this.axios.post("/api/v1/ams/getCarrierListByAddress",this.form1).then(res=>{
  219. if(res.data.code==200){
  220. console.log("进入了获取界面")
  221. this.selectionList=res.data.data
  222. }
  223. })
  224. console.log(this.selectionList)
  225. },
  226. //点击删除按钮删除当前点击的对象
  227. deleteRow(index) {
  228. this.selectionList.splice(index, 1);
  229. },
  230. ondrawerOutcys(){
  231. this.carrier.requestUrl =
  232. "/api/v1/uc/getCarrierListByLike?apiId=412&i=" + new Date();
  233. this.drawer = true;
  234. },
  235. currentRadioChangecys(selection) {
  236. console.log("选择获取到的数据")
  237. console.log(selection)
  238. this.carrierTypes=[];
  239. for (let i = 0; i < selection.length; i++) {
  240. if (this.carrierTypes.indexOf(selection[i]) === -1) {
  241. this.carrierTypes.push(selection[i]);
  242. }
  243. }
  244. console.log("this.carrierTypes "+JSON.stringify(this.carrierTypes));
  245. },
  246. //承运商确定按钮
  247. selectMakeSure() {
  248. console.log("进入了确定")
  249. console.log(this.selectionList)
  250. console.log(this.carrierTypes)
  251. var fatherNum;
  252. var sonNum;
  253. if (this.selectionList.length > this.carrierTypes.length) {
  254. fatherNum=this.selectionList
  255. sonNum=this.carrierTypes
  256. }else{
  257. fatherNum=this.carrierTypes
  258. sonNum=this.selectionList
  259. }
  260. var breaked = false;
  261. for (let i = 0; i < fatherNum.length; i++) {
  262. for (let j = 0; j <sonNum.length; j++) {
  263. if (fatherNum[i].carrierName==sonNum[j].carrierName){
  264. this.$message({
  265. type: "info",
  266. message: "已有【"+sonNum[j].carrierName+"】承运商,无法重复添加~",
  267. })
  268. breaked = true;
  269. break;
  270. }
  271. }
  272. if (breaked) {
  273. break;
  274. }
  275. }
  276. if (breaked) {
  277. return
  278. }
  279. for (let i = 0; i < this.carrierTypes.length; i++) {
  280. this.selectionList.push(this.carrierTypes[i])
  281. }
  282. this.index = null;
  283. this.drawer = false;
  284. },
  285. //模糊查询承运商
  286. onclickCarrier() {
  287. this.carrier.requestUrl =
  288. "/api/v1/uc/getCarrierListByLike?apiId=412&index=" +
  289. this.index +
  290. "&i=" +
  291. new Date();
  292. },
  293. func(res){
  294. this.selectLineLoading = false;
  295. this.isKuang = false;
  296. this.tableLoading = false;
  297. },
  298. //点击外层收货地址选择事件
  299. ondrawerOut(){
  300. this.drawer1 = true;
  301. },
  302. //获取所有省数据
  303. getAllProvince(){
  304. this.axios.post('/api/v1/uc/getAllProvince').then((res)=>{
  305. this.provinceList = res.data.data;
  306. })
  307. },
  308. //省改变
  309. onchangeProvince(){
  310. this.axios.post('/api/v1/uc/getDistrictByProvince?addressProvince='+this.province).then((res)=>{
  311. this.cityList = res.data.data;
  312. })
  313. },
  314. //市改变
  315. onchangeCity(){
  316. this.axios.post('/api/v1/uc/getTownByDistrict?addressDistrict='+this.city).then((res)=>{
  317. this.countyList = res.data.data;
  318. })
  319. },
  320. //县(区)改变
  321. onchangeCounty(){
  322. let mapValue = {
  323. addressProvince : this.province,
  324. addressDistrict : this.city,
  325. addressTown : this.county
  326. }
  327. this.axios.post('/api/v1/uc/getPlaceByAllAddress',mapValue).then((res)=>{
  328. this.addressId = res.data.data[0].addressId;
  329. })
  330. },
  331. selectLineClick(){
  332. this.tableLoading = true;
  333. this.selectLineLoading = true;
  334. this.isKuang = true;
  335. if(this.LineText){
  336. this.oilPriceFormula.requestUrl = "api/v1/uc/getOilFormula?apiId=444&con="+this.LineText;
  337. }else{
  338. this.oilPriceFormula.requestUrl = "api/v1/uc/getOilFormula?apiId=444&i=" + new Date();
  339. }
  340. },
  341. //承运商弹出层
  342. handleSelect(item) {
  343. this.carrierIds = item.carrierId;
  344. item.carrierName = this.state;
  345. },
  346. //收货地址弹出层
  347. handleSelect1(item) {
  348. console.log("获取所有下拉值!");
  349. },
  350. //以下是承运商边输边查搜索
  351. querySearch(queryString, cb) {
  352. this.axios
  353. .post("/api/v1/uc/getCarrierMesByLike?index=" + queryString)
  354. .then((res) => {
  355. if (res.data.code == "200") {
  356. var restaurants = res.data.data;
  357. var results = queryString
  358. ? restaurants.filter(this.createFilter(queryString))
  359. : restaurants;
  360. // 调用 callback 返回建议列表的数据
  361. cb(results);
  362. }
  363. });
  364. },
  365. createFilter(queryString) {
  366. return (restaurants) => {
  367. return (
  368. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  369. -1
  370. );
  371. };
  372. },
  373. //以上是承运商边输边查搜索
  374. //以下是收货地址边输边查搜索
  375. querySearch1(queryString, cb){
  376. this.axios
  377. .post("/api/v1/ams/getRealAddressByLike?addressId="+this.addressId + "&index=" + queryString)
  378. .then((res) => {
  379. if (res.data.code == "200") {
  380. console.log(res.data.data);
  381. var restaurants = res.data.data;
  382. // console.log(restaurants, "restaurants");
  383. var results = queryString
  384. ? restaurants.filter(this.createFilter1(queryString))
  385. : restaurants;
  386. // 调用 callback 返回建议列表的数据
  387. cb(results);
  388. }
  389. });
  390. },
  391. createFilter1(queryString) {
  392. return (restaurants) => {
  393. return (
  394. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  395. -1
  396. );
  397. };
  398. },
  399. //以上是收货地址边输边查搜索
  400. //选定联动公式确定
  401. addoilPriceFormula(){
  402. let mapvalue = {
  403. shipperId : this.form1.shipperId,
  404. oilPriceFormula:this.formulaString,
  405. cargonameId : this.oilPriceFormulaId,
  406. capacityTypeId : this.form1.capacityTypeId,
  407. priceValue : this.form1.priceValue,
  408. priceDate : this.form1.priceDate,
  409. addressName:this.form1.addressName,
  410. type : this.form1.type,
  411. oilpriceBase : this.form1.oilpriceBase,
  412. oilTypeId : this.form1.oilTypeId,
  413. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
  414. }
  415. this.form1 = mapvalue;
  416. this.oilPriceFormulaDrawer = false;
  417. },
  418. currentRadioChange(val){
  419. this.formulaString = val.formulaString;
  420. this.oilPriceFormulaId = val.formulaId;
  421. },
  422. //具体地址确定
  423. specificAddress(){
  424. let mapvalue = {
  425. shipperId : this.form1.shipperId,
  426. oilPriceFormula:this.formulaString,
  427. capacityTypeId : this.form1.capacityTypeId,
  428. cargonameId : this.oilPriceFormulaId,
  429. priceValue : this.form1.priceValue,
  430. priceDate : this.form1.priceDate,
  431. addressName:this.province+this.city+this.county+this.place,
  432. type : this.form1.type,
  433. oilpriceBase : this.form1.oilpriceBase,
  434. oilTypeId : this.form1.oilTypeId,
  435. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
  436. }
  437. this.form1 = mapvalue;
  438. this.drawer1 = false;
  439. },
  440. //打开线路的模态窗口
  441. oilPriceFormulaClick(){
  442. this.oilPriceFormulaDrawer = true;
  443. this.oilPriceFormula.requestUrl = "/api/v1/uc/getOilFormula?apiId=444"
  444. },
  445. //模态窗口关闭时调用
  446. handleClose(){
  447. if(this.oilPriceFormulaDrawer){
  448. this.oilPriceFormulaDrawer = false;
  449. this.LineText = null;
  450. }
  451. },
  452. makeSure() {
  453. if (this.haulDistance=="" || this.haulDistance==null){
  454. this.$message({
  455. type: "warning",
  456. message: "请输入运输距离!",});
  457. return;
  458. }
  459. for (let i = 0; i < this.selectionList.length; i++) {
  460. this.carrierIdArray.push(this.selectionList[i].carrierId)
  461. }
  462. this.form1.carrierIdArray=this.carrierIdArray
  463. this.form1.haulDistance=this.haulDistance
  464. // let mapValue={
  465. // shipperId : this.form1.shipperId,
  466. // carrierId : this.carrierIdArray,
  467. // cargonameId : this.oilPriceFormulaId,
  468. // capacityTypeId : this.form1.capacityTypeId,
  469. // priceValue : this.form1.priceValue,
  470. // priceDate : sjTime(this.form1.priceDate),
  471. // addressId : this.addressId,
  472. // type : this.form1.type,
  473. // oilpriceBase : this.form1.oilpriceBase,
  474. // oilTypeId : this.form1.oilTypeId,
  475. // oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold,
  476. // place: this.place,
  477. // haulDistance: this.haulDistance
  478. // }
  479. // this.axios.post("/api/v1/ams/addAmsContractTransportPrice", mapValue).then((res) => {
  480. // if (res.data.code == "200") {
  481. // this.$router.go(-1);
  482. // }
  483. // this.$message({
  484. // type: "success",
  485. // message: "新增运输单价成功!",
  486. // });
  487. // });
  488. this.axios.post("/api/v1/ams/updateCarrierName",this.form1).then(res=>{
  489. if(res.data.code==200){
  490. this.$message.success("修改承运商成功")
  491. }else{
  492. this.$message.warning("修改承运商失败")
  493. }
  494. })
  495. this.$router.push('/transportPrice');
  496. },
  497. // 取消
  498. cancel() {
  499. this.$router.push('/transportPrice');
  500. },
  501. //修改运价
  502. updatePriceValue(){
  503. console.log("查看数据")
  504. if(this.form1.priceValue==null||this.form1.priceValue==""){
  505. this.$message.warning("运价不能为空")
  506. return
  507. }
  508. console.log("进入了修改单价的方法")
  509. console.log(this.form1)
  510. this.axios.post("/api/v1/ams/updatePriceValue",this.form1).
  511. then(res=>{
  512. if(res.data.code==200){
  513. this.$message.success("修改运价成功")
  514. }else{
  515. this.$message.warning("修改运价失败")
  516. }
  517. })
  518. this.$router.push('/transportPrice');
  519. },
  520. //修改卸货地址
  521. updateAddressDeliveryAddress(){
  522. if(this.form1.addressDeliveryAddress==null||this.form1.addressDeliveryAddress==""){
  523. this.$message.warning("卸货地址不能为空")
  524. return
  525. }
  526. console.log("进入了修改卸货地址的方法")
  527. console.log(this.form1)
  528. this.axios.post("/api/v1/ams/updateaddressDeliveryAddress",this.form1).
  529. then(res=>{
  530. console.log(res)
  531. if(res.data.code==200){
  532. this.$message.success("修改卸货成功")
  533. }else{
  534. this.$message.warning("修改卸货失败")
  535. }
  536. })
  537. this.$router.push('/transportPrice');
  538. },
  539. },
  540. };
  541. </script>
  542. <style lang='scss'>
  543. .elForm {
  544. margin-left: 38%;
  545. }
  546. .button-box{
  547. display: flex;
  548. text-align: center;
  549. align-items: center;
  550. justify-content: center;
  551. margin-top: 0.3125rem;
  552. margin-bottom: 1.25rem;
  553. }
  554. .addTransportPrice{
  555. .form{
  556. display: flex;
  557. .form_box{
  558. width: 320px;
  559. margin-left: 38%;
  560. margin-top: 30px;
  561. margin-right: 20px;
  562. .el-form{
  563. .preview-group{
  564. .el-form-item{
  565. .el-form-item__label{
  566. display: inline-block;
  567. width: 70px !important;
  568. }
  569. .el-form-item__content{
  570. .el-select{
  571. width: 250px;
  572. }
  573. .el-input{
  574. width: 250px;
  575. }
  576. }
  577. }
  578. }
  579. }
  580. label{
  581. display: inline-block;
  582. width: 70px !important;
  583. }
  584. .el-input{
  585. width: 250px;
  586. }
  587. }
  588. #liulan1{
  589. width: 120px;
  590. margin-top: 80px;
  591. .el-button{
  592. width: 100px !important;
  593. margin-top: 14px;
  594. }
  595. .btn{
  596. margin-top: 106px;
  597. }
  598. .btn1{
  599. margin-top: 13px;
  600. margin-left: 0px;
  601. }
  602. .btn2{
  603. margin-top: 67px;
  604. }
  605. }
  606. }
  607. .button_box{
  608. margin-left: 45%;
  609. }
  610. .selectText{
  611. .el-input{
  612. width: 250px;
  613. }
  614. }
  615. .LineTable{
  616. width: 100%;
  617. height: 480px;
  618. overflow: hidden;
  619. margin-top: 10px;
  620. }
  621. #cysbutton{
  622. margin-left: 70px;
  623. }
  624. }
  625. </style>
  626. <style lang='scss'>
  627. /deep/.__bar-is-vertical {
  628. right: -1px !important;
  629. }
  630. /deep/.__bar-is-horizontal {
  631. display: none !important;
  632. }
  633. </style>