123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- <template>
- <!-- 添加汽运单价 -->
- <div class="addTransportPrice">
- <page-title>新增</page-title>
- <div class="form">
- <div class="form_box">
- <dil-form :formId="287" v-model="form1" ref="from1"></dil-form>
- </div>
- <div class="liulan">
- <el-button type="primary" class="btn" @click="lineClick">浏览</el-button>
- <el-button type="primary" class="btn1" @click="addressClick">浏览</el-button>
- <!-- <el-button type="primary" class="btn2">浏览</el-button> -->
- </div>
- </div>
- <div class="elForm">
- <el-form :inline="true" class="demo-form-inline" label-width="80px">
- <el-form-item label="所属承运商">
- <el-autocomplete
- class="inline-input"
- v-model="state"
- :fetch-suggestions="querySearch"
- placeholder="请输入承运商名称"
- :trigger-on-focus="false"
- @select="handleSelect"
- >
- <template slot-scope="{ item }">
- <div class="name" v-if="item.carrierName">
- {{ item.carrierName }}
- </div>
- </template>
- </el-autocomplete>
- </el-form-item>
- </el-form>
- </div>
- <div class="button_box">
- <el-button @click="cancel">取消</el-button>
- <el-button type="primary" @click="makeSure">确定</el-button>
- </div>
- <!-- 线路模态框 -->
- <el-drawer
- title="请选择线路"
- :visible.sync="LineDrawer"
- :direction="direction"
- :before-close="handleClose"
- close-on-press-escape
- modal
- wrapperClosable
- size="40%"
- >
- <div class="selectText">
- <!-- <span></span> -->
- <el-input v-model="LineText" placeholder="请输入内容"></el-input>
- <el-button type="primary" @click="selectLineClick" :loading="selectLineLoading"><i class="el-icon-search"></i>查询</el-button>
- </div>
- <div class="LineTable">
- <vue-scroll :ops="ops" style="width:100%;height:100%">
- <dilTable
- v-bind.sync="line"
- @radio-change="currentRadioChange"
- :isKuang="isKuang"
- :loading="tableLoading"
- :drawer="LineDrawer"
- @func="func"
- ></dilTable>
- </vue-scroll>
- </div>
- </el-drawer>
- <!-- 地址模态框 -->
- <el-drawer
- title="请选择收货地址"
- :visible.sync="addresDrawer"
- :direction="direction"
- :before-close="handleClose"
- close-on-press-escape
- wrapperClosable
- modal
- size="40%"
- >
- <div class="selectText">
- <!-- <span></span> -->
- <el-input v-model="addresText" placeholder="请输入内容"></el-input>
- <el-button type="primary" @click="selectAddresClick" :loading="selectLineLoading"><i class="el-icon-search"></i>查询</el-button>
- </div>
- <div class="LineTable">
- <vue-scroll :ops="ops" style="width:100%;height:100%">
- <dilTable
- v-bind.sync="addres"
- @radio-change="currentRadioChange1"
- :isKuang="isKuang"
- :loading="tableLoading"
- :drawer="addresDrawer"
- @func="func"
- ></dilTable>
- </vue-scroll>
- </div>
- </el-drawer>
- </div>
- </template>
- <script>
- import PageTitle from "@/components/Page/Title";
- import { sjTime,isNumber } from "@/utils/sharedJsFile";
- export default {
- components: { PageTitle },
- data() {
- return {
- //承运商名称
- state: null,
- //承运商id
- carrierIds: null,
- //是否打开收货地址模态框
- addresDrawer:false,
- //收货地址查询条件
- addresText:null,
- //收货地址id
- addressId:null,
- //收货地址模态框数据
- addressDetailed :null,
- addres:{
- requestUrl:"",
- selectionType: "radio",
- },
- //是否点击查询
- isKuang:false,
- //表格加载状态
- tableLoading:false,
- //是否打开线路的模态窗口
- LineDrawer:false,
- //线路查询条件
- LineText:null,
- //线路Id
- lineId:null,
- //线路模态框查询按钮状态
- selectLineLoading:false,
- //线路模态窗口的数据
- line:{
- requestUrl:"",
- selectionType: "radio",
- },
- //模态窗口的打开的方向
- direction: 'rtl',
- //表单数据
- form1: {
- priceDate:new Date(),
- oilTypeId:10,
- },
- //提交给后端的数据
- // map:{},
- ops: {
- vuescroll: {},
- scrollPanel: {},
- rail: {
- keepShow: true
- },
- bar: {
- hoverStyle: true,
- onlyShowBarOnScroll: false, //是否只有滚动的时候才显示滚动条
- background: "#5f9ea0",//滚动条颜色
- opacity: 0.8,//滚动条透明度
- "overflow-x": "hidden"
- }
- }
- };
- },
- mounted() {
- this.axios
- .post(
- "/api/v1/rms/getCarrierNameBySSOId?carrierSSOId=" + this.carrierUserId
- )
- .then((res) => {
- if (res.data.code == "200") {
- console.log(res.data.data);
- if (res.data.data) {
- this.state = res.data.data.carrierName;
- this.carrierIds = res.data.data.carrierId;
- }
- }
- });
- },
- methods: {
- func(res){
- this.selectLineLoading = false;
- this.isKuang = false;
- this.tableLoading = false;
- },
- selectAddresClick(){
- this.tableLoading = true;
- this.selectLineLoading = true;
- this.isKuang = true;
- if(this.addresText){
- this.addres.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con="+this.addresText;
- }else{
- this.addres.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
- }
- },
- selectLineClick(){
- this.tableLoading = true;
- this.selectLineLoading = true;
- this.isKuang = true;
- if(this.LineText){
- this.line.requestUrl = "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con="+this.LineText;
- }else{
- this.line.requestUrl = "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&i=" + new Date();
- }
- },
- //承运商弹出层
- handleSelect(item) {
- this.carrierIds = item.carrierId;
- item.carrierName = this.state;
- },
- //以下是承运商边输边查搜索
- querySearch(queryString, cb) {
- this.axios
- .post("/api/v1/uc/getCarrierMesByLike?index=" + queryString)
- .then((res) => {
- if (res.data.code == "200") {
- console.log(res.data.data);
- var restaurants = res.data.data;
- // console.log(restaurants, "restaurants");
- var results = queryString
- ? restaurants.filter(this.createFilter(queryString))
- : restaurants;
- // 调用 callback 返回建议列表的数据
- cb(results);
- }
- });
- },
- createFilter(queryString) {
- return (restaurants) => {
- return (
- restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
- -1
- );
- };
- },
- //以上是承运商边输边查搜索
- currentRadioChange(val){
- let mapvalue = {
- shipperId : this.form1.shipperId,
- lineName:val.lineName,
- capacityTypeId : this.form1.capacityTypeId,
- cargonameId : this.form1.cargonameId,
- priceValue : this.form1.priceValue,
- priceDate : this.form1.priceDate,
- addressName:this.form1.addressName,
- type : this.form1.type,
- oilpriceBase : this.form1.oilpriceBase,
- oilTypeId : this.form1.oilTypeId,
- oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
- }
- this.form1 = mapvalue;
- this.lineId = val.lineId;
- },
- currentRadioChange1(val){
- let mapvalue = {
- shipperId : this.form1.shipperId,
- lineName:this.form1.lineName,
- capacityTypeId : this.form1.capacityTypeId,
- cargonameId : this.form1.cargonameId,
- priceValue : this.form1.priceValue,
- priceDate : this.form1.priceDate,
- addressName:val.address,
- type : this.form1.type,
- oilpriceBase : this.form1.oilpriceBase,
- oilTypeId : this.form1.oilTypeId,
- oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
- }
- this.form1 = mapvalue;
- this.addressId = val.addressId;
- },
- //打开线路的模态窗口
- lineClick(){
- this.LineDrawer = true;
- this.line.requestUrl = "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3"
- },
- addressClick(){
- this.addresDrawer = true;
- this.addres.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255"
- },
- //模态窗口关闭时调用
- handleClose(){
- if(this.LineDrawer){
- this.LineDrawer = false;
- this.LineText = null;
- }
- if(this.addresDrawer){
- this.addresDrawer = false;
- this.addresText = null;
- }
- },
- makeSure() {
- let amsContractTransportPrice={
- shipperId : this.form1.shipperId,
- carrierId : this.carrierIds,
- lineId : this.lineId,
- capacityTypeId : this.form1.capacityTypeId,
- cargonameId : this.form1.cargonameId,
- priceValue : this.form1.priceValue,
- priceDate : sjTime(this.form1.priceDate),
- addressId : this.addressId,
- type : this.form1.type,
- oilpriceBase : this.form1.oilpriceBase,
- oilTypeId : this.form1.oilTypeId,
- oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
- }
- // console.log("amsContractTransportPrice",amsContractTransportPrice)
- this.axios.post("/api/v1/ams/addAmsContractTransportPrice", amsContractTransportPrice).then((res) => {
- if (res.data.code == "200") {
- this.$router.go(-1);
- }
- this.$message({
- type: "success",
- message: "新增运输单价成功!",
- });
- });
- },
- // 取消
- cancel() {
- this.$router.push('/transportPrice');
- },
- },
- };
- </script>
- <style lang='scss'>
- .elForm {
- margin-left: 30%;
- }
- .addTransportPrice{
- .form{
- display: flex;
- .form_box{
- width: 320px;
- margin-left: 30%;
- margin-top: 30px;
- margin-right: 20px;
- .el-form{
- .preview-group{
- .el-form-item{
- .el-form-item__label{
- display: inline-block;
- width: 70px !important;
- }
- .el-form-item__content{
- .el-select{
- width: 250px;
- }
- .el-input{
- width: 250px;
- }
- }
- }
- }
- }
- }
- .liulan{
- width: 120px;
- margin-top: 30px;
- .el-button{
- width: 100px !important;
- margin: auto;
- }
- .btn{
- margin-top: 105px;
- }
- .btn1{
- margin-top: 13px;
- }
- .btn2{
- margin-top: 67px;
- }
- }
- }
- .button_box{
- margin-left: 45%;
- }
- .selectText{
- .el-input{
- width: 250px;
- }
- }
- .LineTable{
- width: 100%;
- height: 480px;
- overflow: hidden;
- margin-top: 10px;
- }
- }
- </style>
- <style lang='scss'>
- /deep/.__bar-is-vertical {
- right: -1px !important;
- }
- /deep/.__bar-is-horizontal {
- display: none !important;
- }
- </style>
|