addTransportPrice.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <!-- 添加汽运单价 -->
  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="lineClick">浏览</el-button>
  11. <el-button type="primary" class="btn1" @click="addressClick">浏览</el-button>
  12. <!-- <el-button type="primary" class="btn2">浏览</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="LineDrawer"
  43. :direction="direction"
  44. :before-close="handleClose"
  45. close-on-press-escape
  46. modal
  47. wrapperClosable
  48. size="40%"
  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. </div>
  55. <div class="LineTable">
  56. <vue-scroll :ops="ops" style="width:100%;height:100%">
  57. <dilTable
  58. v-bind.sync="line"
  59. @radio-change="currentRadioChange"
  60. :isKuang="isKuang"
  61. :loading="tableLoading"
  62. :drawer="LineDrawer"
  63. @func="func"
  64. ></dilTable>
  65. </vue-scroll>
  66. </div>
  67. </el-drawer>
  68. <!-- 地址模态框 -->
  69. <el-drawer
  70. title="请选择收货地址"
  71. :visible.sync="addresDrawer"
  72. :direction="direction"
  73. :before-close="handleClose"
  74. close-on-press-escape
  75. wrapperClosable
  76. modal
  77. size="40%"
  78. >
  79. <div class="selectText">
  80. <!-- <span></span> -->
  81. <el-input v-model="addresText" placeholder="请输入内容"></el-input>
  82. <el-button type="primary" @click="selectAddresClick" :loading="selectLineLoading"><i class="el-icon-search"></i>查询</el-button>
  83. </div>
  84. <div class="LineTable">
  85. <vue-scroll :ops="ops" style="width:100%;height:100%">
  86. <dilTable
  87. v-bind.sync="addres"
  88. @radio-change="currentRadioChange1"
  89. :isKuang="isKuang"
  90. :loading="tableLoading"
  91. :drawer="addresDrawer"
  92. @func="func"
  93. ></dilTable>
  94. </vue-scroll>
  95. </div>
  96. </el-drawer>
  97. </div>
  98. </template>
  99. <script>
  100. import PageTitle from "@/components/Page/Title";
  101. import { sjTime,isNumber } from "@/utils/sharedJsFile";
  102. export default {
  103. components: { PageTitle },
  104. data() {
  105. return {
  106. //承运商名称
  107. state: null,
  108. //承运商id
  109. carrierIds: null,
  110. //是否打开收货地址模态框
  111. addresDrawer:false,
  112. //收货地址查询条件
  113. addresText:null,
  114. //收货地址id
  115. addressId:null,
  116. //收货地址模态框数据
  117. addressDetailed :null,
  118. addres:{
  119. requestUrl:"",
  120. selectionType: "radio",
  121. },
  122. //是否点击查询
  123. isKuang:false,
  124. //表格加载状态
  125. tableLoading:false,
  126. //是否打开线路的模态窗口
  127. LineDrawer:false,
  128. //线路查询条件
  129. LineText:null,
  130. //线路Id
  131. lineId:null,
  132. //线路模态框查询按钮状态
  133. selectLineLoading:false,
  134. //线路模态窗口的数据
  135. line:{
  136. requestUrl:"",
  137. selectionType: "radio",
  138. },
  139. //模态窗口的打开的方向
  140. direction: 'rtl',
  141. //表单数据
  142. form1: {
  143. priceDate:new Date(),
  144. oilTypeId:10,
  145. },
  146. //提交给后端的数据
  147. // map:{},
  148. ops: {
  149. vuescroll: {},
  150. scrollPanel: {},
  151. rail: {
  152. keepShow: true
  153. },
  154. bar: {
  155. hoverStyle: true,
  156. onlyShowBarOnScroll: false, //是否只有滚动的时候才显示滚动条
  157. background: "#5f9ea0",//滚动条颜色
  158. opacity: 0.8,//滚动条透明度
  159. "overflow-x": "hidden"
  160. }
  161. }
  162. };
  163. },
  164. mounted() {
  165. this.axios
  166. .post(
  167. "/api/v1/rms/getCarrierNameBySSOId?carrierSSOId=" + this.carrierUserId
  168. )
  169. .then((res) => {
  170. if (res.data.code == "200") {
  171. console.log(res.data.data);
  172. if (res.data.data) {
  173. this.state = res.data.data.carrierName;
  174. this.carrierIds = res.data.data.carrierId;
  175. }
  176. }
  177. });
  178. },
  179. methods: {
  180. func(res){
  181. this.selectLineLoading = false;
  182. this.isKuang = false;
  183. this.tableLoading = false;
  184. },
  185. selectAddresClick(){
  186. this.tableLoading = true;
  187. this.selectLineLoading = true;
  188. this.isKuang = true;
  189. if(this.addresText){
  190. this.addres.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con="+this.addresText;
  191. }else{
  192. this.addres.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
  193. }
  194. },
  195. selectLineClick(){
  196. this.tableLoading = true;
  197. this.selectLineLoading = true;
  198. this.isKuang = true;
  199. if(this.LineText){
  200. this.line.requestUrl = "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con="+this.LineText;
  201. }else{
  202. this.line.requestUrl = "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&i=" + new Date();
  203. }
  204. },
  205. //承运商弹出层
  206. handleSelect(item) {
  207. this.carrierIds = item.carrierId;
  208. item.carrierName = this.state;
  209. },
  210. //以下是承运商边输边查搜索
  211. querySearch(queryString, cb) {
  212. this.axios
  213. .post("/api/v1/uc/getCarrierMesByLike?index=" + queryString)
  214. .then((res) => {
  215. if (res.data.code == "200") {
  216. console.log(res.data.data);
  217. var restaurants = res.data.data;
  218. // console.log(restaurants, "restaurants");
  219. var results = queryString
  220. ? restaurants.filter(this.createFilter(queryString))
  221. : restaurants;
  222. // 调用 callback 返回建议列表的数据
  223. cb(results);
  224. }
  225. });
  226. },
  227. createFilter(queryString) {
  228. return (restaurants) => {
  229. return (
  230. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  231. -1
  232. );
  233. };
  234. },
  235. //以上是承运商边输边查搜索
  236. currentRadioChange(val){
  237. let mapvalue = {
  238. shipperId : this.form1.shipperId,
  239. lineName:val.lineName,
  240. capacityTypeId : this.form1.capacityTypeId,
  241. cargonameId : this.form1.cargonameId,
  242. priceValue : this.form1.priceValue,
  243. priceDate : this.form1.priceDate,
  244. addressName:this.form1.addressName,
  245. type : this.form1.type,
  246. oilpriceBase : this.form1.oilpriceBase,
  247. oilTypeId : this.form1.oilTypeId,
  248. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
  249. }
  250. this.form1 = mapvalue;
  251. this.lineId = val.lineId;
  252. },
  253. currentRadioChange1(val){
  254. let mapvalue = {
  255. shipperId : this.form1.shipperId,
  256. lineName:this.form1.lineName,
  257. capacityTypeId : this.form1.capacityTypeId,
  258. cargonameId : this.form1.cargonameId,
  259. priceValue : this.form1.priceValue,
  260. priceDate : this.form1.priceDate,
  261. addressName:val.address,
  262. type : this.form1.type,
  263. oilpriceBase : this.form1.oilpriceBase,
  264. oilTypeId : this.form1.oilTypeId,
  265. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
  266. }
  267. this.form1 = mapvalue;
  268. this.addressId = val.addressId;
  269. },
  270. //打开线路的模态窗口
  271. lineClick(){
  272. this.LineDrawer = true;
  273. this.line.requestUrl = "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3"
  274. },
  275. addressClick(){
  276. this.addresDrawer = true;
  277. this.addres.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255"
  278. },
  279. //模态窗口关闭时调用
  280. handleClose(){
  281. if(this.LineDrawer){
  282. this.LineDrawer = false;
  283. this.LineText = null;
  284. }
  285. if(this.addresDrawer){
  286. this.addresDrawer = false;
  287. this.addresText = null;
  288. }
  289. },
  290. makeSure() {
  291. let amsContractTransportPrice={
  292. shipperId : this.form1.shipperId,
  293. carrierId : this.carrierIds,
  294. lineId : this.lineId,
  295. capacityTypeId : this.form1.capacityTypeId,
  296. cargonameId : this.form1.cargonameId,
  297. priceValue : this.form1.priceValue,
  298. priceDate : sjTime(this.form1.priceDate),
  299. addressId : this.addressId,
  300. type : this.form1.type,
  301. oilpriceBase : this.form1.oilpriceBase,
  302. oilTypeId : this.form1.oilTypeId,
  303. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
  304. }
  305. // console.log("amsContractTransportPrice",amsContractTransportPrice)
  306. this.axios.post("/api/v1/ams/addAmsContractTransportPrice", amsContractTransportPrice).then((res) => {
  307. if (res.data.code == "200") {
  308. this.$router.go(-1);
  309. }
  310. this.$message({
  311. type: "success",
  312. message: "新增运输单价成功!",
  313. });
  314. });
  315. },
  316. // 取消
  317. cancel() {
  318. this.$router.push('/transportPrice');
  319. },
  320. },
  321. };
  322. </script>
  323. <style lang='scss'>
  324. .elForm {
  325. margin-left: 30%;
  326. }
  327. .addTransportPrice{
  328. .form{
  329. display: flex;
  330. .form_box{
  331. width: 320px;
  332. margin-left: 30%;
  333. margin-top: 30px;
  334. margin-right: 20px;
  335. .el-form{
  336. .preview-group{
  337. .el-form-item{
  338. .el-form-item__label{
  339. display: inline-block;
  340. width: 70px !important;
  341. }
  342. .el-form-item__content{
  343. .el-select{
  344. width: 250px;
  345. }
  346. .el-input{
  347. width: 250px;
  348. }
  349. }
  350. }
  351. }
  352. }
  353. }
  354. .liulan{
  355. width: 120px;
  356. margin-top: 30px;
  357. .el-button{
  358. width: 100px !important;
  359. margin: auto;
  360. }
  361. .btn{
  362. margin-top: 105px;
  363. }
  364. .btn1{
  365. margin-top: 13px;
  366. }
  367. .btn2{
  368. margin-top: 67px;
  369. }
  370. }
  371. }
  372. .button_box{
  373. margin-left: 45%;
  374. }
  375. .selectText{
  376. .el-input{
  377. width: 250px;
  378. }
  379. }
  380. .LineTable{
  381. width: 100%;
  382. height: 480px;
  383. overflow: hidden;
  384. margin-top: 10px;
  385. }
  386. }
  387. </style>
  388. <style lang='scss'>
  389. /deep/.__bar-is-vertical {
  390. right: -1px !important;
  391. }
  392. /deep/.__bar-is-horizontal {
  393. display: none !important;
  394. }
  395. </style>