addTransportPrice.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  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="287" v-model="form1" ref="from1"></dil-form>
  8. </div>
  9. <div class="liulan">
  10. <el-button type="primary" class="btn" @click="oilPriceFormulaClick">浏览</el-button>
  11. <el-button type="primary" class="btn1" @click="ondrawerOut">选择</el-button>
  12. <!-- <el-button type="primary" class="btn1" @click="addressClick">浏览</el-button> -->
  13. </div>
  14. </div>
  15. <div class="elForm">
  16. <el-form :inline="true" class="demo-form-inline" label-width="80px">
  17. <el-form-item label="所属承运商">
  18. <el-autocomplete
  19. class="inline-input"
  20. v-model="state"
  21. :fetch-suggestions="querySearch"
  22. placeholder="请输入承运商名称"
  23. :trigger-on-focus="false"
  24. @select="handleSelect"
  25. >
  26. <template slot-scope="{ item }">
  27. <div class="name" v-if="item.carrierName">
  28. {{ item.carrierName }}
  29. </div>
  30. </template>
  31. </el-autocomplete>
  32. </el-form-item>
  33. </el-form>
  34. </div>
  35. <div class="button_box">
  36. <el-button @click="cancel">取消</el-button>
  37. <el-button type="primary" @click="makeSure">确定</el-button>
  38. </div>
  39. <!-- 油价联动公式模态框 -->
  40. <el-drawer
  41. title="请选择油价联动公式"
  42. :visible.sync="oilPriceFormulaDrawer"
  43. :direction="direction"
  44. :before-close="handleClose"
  45. close-on-press-escape
  46. modal
  47. wrapperClosable
  48. size="70%"
  49. >
  50. <div class="selectText">
  51. <!-- <span></span> -->
  52. <el-input v-model="LineText" placeholder="请输入内容"></el-input>
  53. <el-button type="primary" @click="selectLineClick" :loading="selectLineLoading"><i class="el-icon-search"></i>查询</el-button>
  54. <el-button type="primary" @click="addoilPriceFormula">确定</el-button>
  55. </div>
  56. <div class="LineTable">
  57. <vue-scroll :ops="ops" style="width:100%;height:100%">
  58. <dilTable
  59. v-bind.sync="oilPriceFormula"
  60. @radio-change="currentRadioChange"
  61. :isKuang="isKuang"
  62. :loading="tableLoading"
  63. :drawer="oilPriceFormulaDrawer"
  64. @func="func"
  65. ></dilTable>
  66. </vue-scroll>
  67. </div>
  68. </el-drawer>
  69. <!-- 收货地址弹出框 -->
  70. <el-dialog title="收货地址" :visible.sync="drawer1" width="90%">
  71. <el-form :inline="true">
  72. <el-form-item>
  73. <label class="el-form-item__label" style="width: auto;">省</label>
  74. <el-select v-model="province" filterable placeholder="请选择" @change="onchangeProvince">
  75. <el-option v-for="item in provinceList" :key="item.id" :label="item.addressProvince" :value="item.id"></el-option>
  76. </el-select>
  77. </el-form-item>
  78. <el-form-item>
  79. <label class="el-form-item__label" style="width: auto;">市</label>
  80. <el-select v-model="city" filterable placeholder="请选择" @change="onchangeCity">
  81. <el-option v-for="item in cityList" :key="item.id" :label="item.addressDistrict" :value="item.id"></el-option>
  82. </el-select>
  83. </el-form-item>
  84. <el-form-item>
  85. <label class="el-form-item__label" style="width: auto;">县(区)</label>
  86. <el-select v-model="county" filterable placeholder="请选择" @change="onchangeCounty">
  87. <el-option v-for="item in countyList" :key="item.id" :label="item.addressTown" :value="item.id"></el-option>
  88. </el-select>
  89. </el-form-item>
  90. <el-form-item>
  91. <label class="el-form-item__label" style="width: auto;">具体收货地址</label>
  92. <el-autocomplete
  93. class="inline-input"
  94. v-model="place"
  95. :fetch-suggestions="querySearch1"
  96. placeholder="请输入具体收货地址"
  97. :trigger-on-focus="false"
  98. @select="handleSelect1"
  99. >
  100. </el-autocomplete>
  101. </el-form-item>
  102. </el-form>
  103. <div slot="footer" class="button-box">
  104. <el-button @click="drawer1 = false">取 消</el-button>
  105. <el-button type="primary" @click="specificAddress">确定</el-button>
  106. </div>
  107. </el-dialog>
  108. </div>
  109. </template>
  110. <script>
  111. import PageTitle from "@/components/Page/Title";
  112. import { sjTime,isNumber } from "@/utils/sharedJsFile";
  113. export default {
  114. components: { PageTitle },
  115. data() {
  116. return {
  117. //具体收货地址
  118. place:null,
  119. //承运商名称
  120. state: null,
  121. //承运商id
  122. carrierIds: null,
  123. //收货地址id
  124. addressId:null,
  125. //收货地址模态框数据
  126. addressDetailed :null,
  127. addres:{
  128. requestUrl:"",
  129. selectionType: "radio",
  130. },
  131. //是否打开收货地址弹出框
  132. drawer1:false,
  133. //所有省
  134. provinceList: [],
  135. //选中的省
  136. province: '',
  137. //所有市
  138. cityList: [],
  139. //选中的市
  140. city: '',
  141. //所有的县(区)
  142. countyList: [],
  143. //选中的县
  144. county: '',
  145. //是否点击查询
  146. isKuang:false,
  147. //表格加载状态
  148. tableLoading:false,
  149. //公式内容
  150. formulaString:null,
  151. //油价联动公式Id
  152. oilPriceFormulaId:null,
  153. //是否打开油价联动公式的模态窗口
  154. oilPriceFormulaDrawer:false,
  155. //油价联动公式查询条件
  156. LineText:null,
  157. //油价联动公式模态框查询按钮状态
  158. selectLineLoading:false,
  159. //油价联动公式模态窗口的数据
  160. oilPriceFormula:{
  161. requestUrl:"",
  162. selectionType: "radio",
  163. },
  164. //模态窗口的打开的方向
  165. direction: 'rtl',
  166. //表单数据
  167. form1: {
  168. shipperId:1,
  169. priceDate:new Date(),
  170. oilTypeId:10,
  171. capacityTypeId:1,
  172. },
  173. //提交给后端的数据
  174. // map:{},
  175. ops: {
  176. vuescroll: {},
  177. scrollPanel: {},
  178. rail: {
  179. keepShow: true
  180. },
  181. bar: {
  182. hoverStyle: true,
  183. onlyShowBarOnScroll: false, //是否只有滚动的时候才显示滚动条
  184. background: "#5f9ea0",//滚动条颜色
  185. opacity: 0.8,//滚动条透明度
  186. "overflow-x": "hidden"
  187. }
  188. }
  189. };
  190. },
  191. mounted() {
  192. this.axios
  193. .post(
  194. "/api/v1/rms/getCarrierNameBySSOId?carrierSSOId=" + this.carrierUserId
  195. )
  196. .then((res) => {
  197. if (res.data.code == "200") {
  198. if (res.data.data) {
  199. this.state = res.data.data.carrierName;
  200. this.carrierIds = res.data.data.carrierId;
  201. }
  202. }
  203. });
  204. },
  205. created(){
  206. //获取所有的省
  207. this.getAllProvince();
  208. },
  209. methods: {
  210. func(res){
  211. this.selectLineLoading = false;
  212. this.isKuang = false;
  213. this.tableLoading = false;
  214. },
  215. //点击外层收货地址选择事件
  216. ondrawerOut(){
  217. this.drawer1 = true;
  218. },
  219. //获取所有省数据
  220. getAllProvince(){
  221. this.axios.post('/api/v1/uc/getAllProvince').then((res)=>{
  222. this.provinceList = res.data.data;
  223. })
  224. },
  225. //省改变
  226. onchangeProvince(){
  227. this.axios.post('/api/v1/uc/getDistrictByProvince?addressProvince='+this.province).then((res)=>{
  228. this.cityList = res.data.data;
  229. })
  230. },
  231. //市改变
  232. onchangeCity(){
  233. this.axios.post('/api/v1/uc/getTownByDistrict?addressDistrict='+this.city).then((res)=>{
  234. this.countyList = res.data.data;
  235. })
  236. },
  237. //县(区)改变
  238. onchangeCounty(){
  239. let mapValue = {
  240. addressProvince : this.province,
  241. addressDistrict : this.city,
  242. addressTown : this.county
  243. }
  244. this.axios.post('/api/v1/uc/getPlaceByAllAddress',mapValue).then((res)=>{
  245. this.addressId = res.data.data[0].addressId;
  246. })
  247. },
  248. selectLineClick(){
  249. this.tableLoading = true;
  250. this.selectLineLoading = true;
  251. this.isKuang = true;
  252. if(this.LineText){
  253. this.oilPriceFormula.requestUrl = "api/v1/uc/getOilFormula?apiId=444&con="+this.LineText;
  254. }else{
  255. this.oilPriceFormula.requestUrl = "api/v1/uc/getOilFormula?apiId=444&i=" + new Date();
  256. }
  257. },
  258. //承运商弹出层
  259. handleSelect(item) {
  260. this.carrierIds = item.carrierId;
  261. item.carrierName = this.state;
  262. },
  263. //收货地址弹出层
  264. handleSelect1(item) {
  265. console.log("获取所有下拉值!");
  266. },
  267. //以下是承运商边输边查搜索
  268. querySearch(queryString, cb) {
  269. this.axios
  270. .post("/api/v1/uc/getCarrierMesByLike?index=" + queryString)
  271. .then((res) => {
  272. if (res.data.code == "200") {
  273. var restaurants = res.data.data;
  274. var results = queryString
  275. ? restaurants.filter(this.createFilter(queryString))
  276. : restaurants;
  277. // 调用 callback 返回建议列表的数据
  278. cb(results);
  279. }
  280. });
  281. },
  282. createFilter(queryString) {
  283. return (restaurants) => {
  284. return (
  285. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  286. -1
  287. );
  288. };
  289. },
  290. //以上是承运商边输边查搜索
  291. //以下是收货地址边输边查搜索
  292. querySearch1(queryString, cb){
  293. this.axios
  294. .post("/api/v1/ams/getRealAddressByLike?addressId="+this.addressId + "&index=" + queryString)
  295. .then((res) => {
  296. if (res.data.code == "200") {
  297. console.log(res.data.data);
  298. var restaurants = res.data.data;
  299. // console.log(restaurants, "restaurants");
  300. var results = queryString
  301. ? restaurants.filter(this.createFilter1(queryString))
  302. : restaurants;
  303. // 调用 callback 返回建议列表的数据
  304. cb(results);
  305. }
  306. });
  307. },
  308. createFilter1(queryString) {
  309. return (restaurants) => {
  310. return (
  311. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  312. -1
  313. );
  314. };
  315. },
  316. //以上是收货地址边输边查搜索
  317. //选定联动公式确定
  318. addoilPriceFormula(){
  319. let mapvalue = {
  320. shipperId : this.form1.shipperId,
  321. oilPriceFormula:this.formulaString,
  322. cargonameId : this.oilPriceFormulaId,
  323. capacityTypeId : this.form1.capacityTypeId,
  324. priceValue : this.form1.priceValue,
  325. priceDate : this.form1.priceDate,
  326. addressName:this.form1.addressName,
  327. type : this.form1.type,
  328. oilpriceBase : this.form1.oilpriceBase,
  329. oilTypeId : this.form1.oilTypeId,
  330. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
  331. }
  332. this.form1 = mapvalue;
  333. this.oilPriceFormulaDrawer = false;
  334. },
  335. currentRadioChange(val){
  336. this.formulaString = val.formulaString;
  337. this.oilPriceFormulaId = val.formulaId;
  338. },
  339. //具体地址确定
  340. specificAddress(){
  341. let mapvalue = {
  342. shipperId : this.form1.shipperId,
  343. oilPriceFormula:this.formulaString,
  344. capacityTypeId : this.form1.capacityTypeId,
  345. cargonameId : this.oilPriceFormulaId,
  346. priceValue : this.form1.priceValue,
  347. priceDate : this.form1.priceDate,
  348. addressName:this.province+this.city+this.county+this.place,
  349. type : this.form1.type,
  350. oilpriceBase : this.form1.oilpriceBase,
  351. oilTypeId : this.form1.oilTypeId,
  352. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
  353. }
  354. this.form1 = mapvalue;
  355. this.drawer1 = false;
  356. },
  357. //打开线路的模态窗口
  358. oilPriceFormulaClick(){
  359. this.oilPriceFormulaDrawer = true;
  360. this.oilPriceFormula.requestUrl = "/api/v1/uc/getOilFormula?apiId=444"
  361. },
  362. //模态窗口关闭时调用
  363. handleClose(){
  364. if(this.oilPriceFormulaDrawer){
  365. this.oilPriceFormulaDrawer = false;
  366. this.LineText = null;
  367. }
  368. },
  369. makeSure() {
  370. let mapValue={
  371. shipperId : this.form1.shipperId,
  372. carrierId : this.carrierIds,
  373. cargonameId : this.oilPriceFormulaId,
  374. capacityTypeId : this.form1.capacityTypeId,
  375. priceValue : this.form1.priceValue,
  376. priceDate : sjTime(this.form1.priceDate),
  377. addressId : this.addressId,
  378. type : this.form1.type,
  379. oilpriceBase : this.form1.oilpriceBase,
  380. oilTypeId : this.form1.oilTypeId,
  381. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold,
  382. place: this.place
  383. }
  384. this.axios.post("/api/v1/ams/addAmsContractTransportPrice", mapValue).then((res) => {
  385. if (res.data.code == "200") {
  386. this.$router.go(-1);
  387. }
  388. this.$message({
  389. type: "success",
  390. message: "新增运输单价成功!",
  391. });
  392. });
  393. },
  394. // 取消
  395. cancel() {
  396. this.$router.push('/transportPrice');
  397. },
  398. },
  399. };
  400. </script>
  401. <style lang='scss'>
  402. .elForm {
  403. margin-left: 30%;
  404. }
  405. .button-box{
  406. display: flex;
  407. text-align: center;
  408. align-items: center;
  409. justify-content: center;
  410. margin-top: 0.3125rem;
  411. margin-bottom: 1.25rem;
  412. }
  413. .addTransportPrice{
  414. .form{
  415. display: flex;
  416. .form_box{
  417. width: 320px;
  418. margin-left: 30%;
  419. margin-top: 30px;
  420. margin-right: 20px;
  421. .el-form{
  422. .preview-group{
  423. .el-form-item{
  424. .el-form-item__label{
  425. display: inline-block;
  426. width: 70px !important;
  427. }
  428. .el-form-item__content{
  429. .el-select{
  430. width: 250px;
  431. }
  432. .el-input{
  433. width: 250px;
  434. }
  435. }
  436. }
  437. }
  438. }
  439. }
  440. .liulan{
  441. width: 120px;
  442. margin-top: 30px;
  443. .el-button{
  444. width: 100px !important;
  445. margin: auto;
  446. }
  447. .btn{
  448. margin-top: 105px;
  449. }
  450. .btn1{
  451. margin-top: 13px;
  452. }
  453. .btn2{
  454. margin-top: 67px;
  455. }
  456. }
  457. }
  458. .button_box{
  459. margin-left: 45%;
  460. }
  461. .selectText{
  462. .el-input{
  463. width: 250px;
  464. }
  465. }
  466. .LineTable{
  467. width: 100%;
  468. height: 480px;
  469. overflow: hidden;
  470. margin-top: 10px;
  471. }
  472. }
  473. </style>
  474. <style lang='scss'>
  475. /deep/.__bar-is-vertical {
  476. right: -1px !important;
  477. }
  478. /deep/.__bar-is-horizontal {
  479. display: none !important;
  480. }
  481. </style>