123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640 |
- <template>
- <!-- 添加汽运单价 111-->
- <div class="addTransportPrice">
- <page-title>修改</page-title>
- <div class="form">
- <div class="form_box">
- <dil-form :formId="394" v-model="form1" ref="from1"></dil-form>
- <label>运输距离:</label><el-input type="number" v-model="haulDistance" class="el-input"></el-input>
- </div>
- <div id="liulan1">
- <el-button type="primary" class="btn" @click="updateAddressDeliveryAddress">提交</el-button>
- <el-button type="primary" class="btn1" @click="updatePriceValue">提交</el-button>
- </div>
- </div>
- <div class="elForm">
- <el-form :inline="true" class="demo-form-inline" label-width="80px">
- <el-button type="primary" id="cysbutton" @click="ondrawerOutcys">浏览所属承运商</el-button>
- </el-form>
- </div>
- <!-- 承运商模态框 -->
- <el-drawer
- title="选择承运商"
- :visible.sync="drawer"
- direction="rtl"
- size="40%"
- :show-close="false"
- >
- <el-input
- placeholder="请输入内容"
- v-model="index"
- style="margin-top: 10px; margin-left: 20px;width:250px"
- clearable
- >
- </el-input
- ><el-button
- type="primary"
- class="btn"
- @click="onclickCarrier"
- style="margin-left: 4px;"
- >
- <i class="el-icon-search"></i>查询
- </el-button>
- <!-- <el-button @click="open">取消</el-button> -->
- <el-button type="primary" @click="selectMakeSure">确定</el-button>
- <div class="tablecls">
- <!-- 查询所有的承运商 -->
- <dilTable
- v-bind.sync="carrier"
- @selection-change="currentRadioChangecys"
- :drawer="drawer"
- >
- </dilTable>
- </div>
- </el-drawer>
- <!-- 所属承运商表格 -->
- <div class="selectionTable from">
- <el-table
- :data="selectionList"
- border
- style="width: 100%"
- highlight-current-row
- >
- <el-table-column type="index" label="序号" width="50">
- </el-table-column>
- <el-table-column
- v-for="(item, i) in tableTop"
- :key="i"
- :prop="item.prop"
- :label="item.label"
- :width="item.width"
- align="center"
- show-overflow-tooltip
- >
- </el-table-column>
- <!-- 操作列 -->
- <el-table-column fixed="right" label="操作" width="100">
- <template slot-scope="scope">
- <el-button
- @click="deleteRow(scope.$index)"
- type="text"
- icon="el-icon-close"
- size="big"
- ></el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="button_box">
- <el-button @click="cancel">取消</el-button>
- <el-button type="primary" @click="makeSure">确定</el-button>
- </div>
- </div>
- </template>
- <script>
- import PageTitle from "@/components/Page/Title";
- import { sjTime,isNumber } from "@/utils/sharedJsFile";
- export default {
- components: { PageTitle },
- data() {
- return {
- haulDistance:"",
- carrierIdArray:[],
- tableTop: [
- {
- prop: "carrierName",
- label: "承运商"
- }
- ],
- selectionList: [],
- carrierTypes:[],
- carrier: {
- requestUrl: "",
- selectionType: "select"
- },
- //是否显示承运商模态框
- drawer: false,
- index: "",
- //具体收货地址
- place:null,
- //承运商名称
- state: null,
- //承运商id
- carrierIds: null,
- //收货地址id
- addressId:null,
- //收货地址模态框数据
- addressDetailed :null,
- addres:{
- requestUrl:"",
- selectionType: "radio",
- },
- //是否打开收货地址弹出框
- drawer1:false,
- //所有省
- provinceList: [],
- //选中的省
- province: '',
- //所有市
- cityList: [],
- //选中的市
- city: '',
- //所有的县(区)
- countyList: [],
- //选中的县
- county: '',
- //是否点击查询
- isKuang:false,
- //表格加载状态
- tableLoading:false,
- //公式内容
- formulaString:null,
- //油价联动公式Id
- oilPriceFormulaId:null,
- //是否打开油价联动公式的模态窗口
- oilPriceFormulaDrawer:false,
- //油价联动公式查询条件
- LineText:null,
- //油价联动公式模态框查询按钮状态
- selectLineLoading:false,
- //油价联动公式模态窗口的数据
- oilPriceFormula:{
- requestUrl:"",
- selectionType: "radio",
- },
- //模态窗口的打开的方向
- direction: 'rtl',
- //表单数据
- form1: {
- shipperId:1,
- priceDate:new Date(),
- oilTypeId:10,
- capacityTypeId:1,
- type: "销售钢材"
- },
- //提交给后端的数据
- // 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") {
- if (res.data.data) {
- this.state = res.data.data.carrierName;
- this.carrierIds = res.data.data.carrierId;
- }
- }
- });
- },
- created(){
- console.log(this.$route.params)
- this.form1=this.$route.params
- this.haulDistance=this.$route.params.haulDistance
- this.getCarrierNameList();
- //获取所有的省
- this.getAllProvince();
- },
- methods: {
- //获取已有的承运商
- async getCarrierNameList(){
- await this.axios.post("/api/v1/ams/getCarrierListByAddress",this.form1).then(res=>{
- if(res.data.code==200){
- console.log("进入了获取界面")
- this.selectionList=res.data.data
- }
- })
- console.log(this.selectionList)
- },
- //点击删除按钮删除当前点击的对象
- deleteRow(index) {
- this.selectionList.splice(index, 1);
- },
- ondrawerOutcys(){
- this.carrier.requestUrl =
- "/api/v1/uc/getCarrierListByLike?apiId=412&i=" + new Date();
- this.drawer = true;
- },
- currentRadioChangecys(selection) {
- console.log("选择获取到的数据")
- console.log(selection)
- this.carrierTypes=[];
- for (let i = 0; i < selection.length; i++) {
- if (this.carrierTypes.indexOf(selection[i]) === -1) {
- this.carrierTypes.push(selection[i]);
- }
- }
- console.log("this.carrierTypes "+JSON.stringify(this.carrierTypes));
- },
- //承运商确定按钮
- selectMakeSure() {
- console.log("进入了确定")
- console.log(this.selectionList)
- console.log(this.carrierTypes)
- var fatherNum;
- var sonNum;
- if (this.selectionList.length > this.carrierTypes.length) {
- fatherNum=this.selectionList
- sonNum=this.carrierTypes
- }else{
- fatherNum=this.carrierTypes
- sonNum=this.selectionList
- }
- var breaked = false;
- for (let i = 0; i < fatherNum.length; i++) {
- for (let j = 0; j <sonNum.length; j++) {
- if (fatherNum[i].carrierName==sonNum[j].carrierName){
- this.$message({
- type: "info",
- message: "已有【"+sonNum[j].carrierName+"】承运商,无法重复添加~",
- })
- breaked = true;
- break;
- }
- }
- if (breaked) {
- break;
- }
- }
- if (breaked) {
- return
- }
- for (let i = 0; i < this.carrierTypes.length; i++) {
- this.selectionList.push(this.carrierTypes[i])
- }
- this.index = null;
- this.drawer = false;
- },
- //模糊查询承运商
- onclickCarrier() {
- this.carrier.requestUrl =
- "/api/v1/uc/getCarrierListByLike?apiId=412&index=" +
- this.index +
- "&i=" +
- new Date();
- },
- func(res){
- this.selectLineLoading = false;
- this.isKuang = false;
- this.tableLoading = false;
- },
- //点击外层收货地址选择事件
- ondrawerOut(){
- this.drawer1 = true;
- },
- //获取所有省数据
- getAllProvince(){
- this.axios.post('/api/v1/uc/getAllProvince').then((res)=>{
- this.provinceList = res.data.data;
- })
- },
- //省改变
- onchangeProvince(){
- this.axios.post('/api/v1/uc/getDistrictByProvince?addressProvince='+this.province).then((res)=>{
- this.cityList = res.data.data;
- })
- },
- //市改变
- onchangeCity(){
- this.axios.post('/api/v1/uc/getTownByDistrict?addressDistrict='+this.city).then((res)=>{
- this.countyList = res.data.data;
- })
- },
- //县(区)改变
- onchangeCounty(){
- let mapValue = {
- addressProvince : this.province,
- addressDistrict : this.city,
- addressTown : this.county
- }
- this.axios.post('/api/v1/uc/getPlaceByAllAddress',mapValue).then((res)=>{
- this.addressId = res.data.data[0].addressId;
- })
- },
- selectLineClick(){
- this.tableLoading = true;
- this.selectLineLoading = true;
- this.isKuang = true;
- if(this.LineText){
- this.oilPriceFormula.requestUrl = "api/v1/uc/getOilFormula?apiId=444&con="+this.LineText;
- }else{
- this.oilPriceFormula.requestUrl = "api/v1/uc/getOilFormula?apiId=444&i=" + new Date();
- }
- },
- //承运商弹出层
- handleSelect(item) {
- this.carrierIds = item.carrierId;
- item.carrierName = this.state;
- },
- //收货地址弹出层
- handleSelect1(item) {
- console.log("获取所有下拉值!");
- },
- //以下是承运商边输边查搜索
- querySearch(queryString, cb) {
- this.axios
- .post("/api/v1/uc/getCarrierMesByLike?index=" + queryString)
- .then((res) => {
- if (res.data.code == "200") {
- var restaurants = res.data.data;
- var results = queryString
- ? restaurants.filter(this.createFilter(queryString))
- : restaurants;
- // 调用 callback 返回建议列表的数据
- cb(results);
- }
- });
- },
- createFilter(queryString) {
- return (restaurants) => {
- return (
- restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
- -1
- );
- };
- },
- //以上是承运商边输边查搜索
- //以下是收货地址边输边查搜索
- querySearch1(queryString, cb){
- this.axios
- .post("/api/v1/ams/getRealAddressByLike?addressId="+this.addressId + "&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.createFilter1(queryString))
- : restaurants;
- // 调用 callback 返回建议列表的数据
- cb(results);
- }
- });
- },
- createFilter1(queryString) {
- return (restaurants) => {
- return (
- restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
- -1
- );
- };
- },
- //以上是收货地址边输边查搜索
- //选定联动公式确定
- addoilPriceFormula(){
- let mapvalue = {
- shipperId : this.form1.shipperId,
- oilPriceFormula:this.formulaString,
- cargonameId : this.oilPriceFormulaId,
- capacityTypeId : this.form1.capacityTypeId,
- 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.oilPriceFormulaDrawer = false;
- },
- currentRadioChange(val){
- this.formulaString = val.formulaString;
- this.oilPriceFormulaId = val.formulaId;
- },
- //具体地址确定
- specificAddress(){
- let mapvalue = {
- shipperId : this.form1.shipperId,
- oilPriceFormula:this.formulaString,
- capacityTypeId : this.form1.capacityTypeId,
- cargonameId : this.oilPriceFormulaId,
- priceValue : this.form1.priceValue,
- priceDate : this.form1.priceDate,
- addressName:this.province+this.city+this.county+this.place,
- type : this.form1.type,
- oilpriceBase : this.form1.oilpriceBase,
- oilTypeId : this.form1.oilTypeId,
- oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
- }
- this.form1 = mapvalue;
- this.drawer1 = false;
- },
- //打开线路的模态窗口
- oilPriceFormulaClick(){
- this.oilPriceFormulaDrawer = true;
- this.oilPriceFormula.requestUrl = "/api/v1/uc/getOilFormula?apiId=444"
- },
- //模态窗口关闭时调用
- handleClose(){
- if(this.oilPriceFormulaDrawer){
- this.oilPriceFormulaDrawer = false;
- this.LineText = null;
- }
- },
- makeSure() {
- if (this.haulDistance=="" || this.haulDistance==null){
- this.$message({
- type: "warning",
- message: "请输入运输距离!",});
- return;
- }
- for (let i = 0; i < this.selectionList.length; i++) {
- this.carrierIdArray.push(this.selectionList[i].carrierId)
- }
- this.form1.carrierIdArray=this.carrierIdArray
- this.form1.haulDistance=this.haulDistance
- // let mapValue={
- // shipperId : this.form1.shipperId,
- // carrierId : this.carrierIdArray,
- // cargonameId : this.oilPriceFormulaId,
- // capacityTypeId : this.form1.capacityTypeId,
- // 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,
- // place: this.place,
- // haulDistance: this.haulDistance
- // }
- // this.axios.post("/api/v1/ams/addAmsContractTransportPrice", mapValue).then((res) => {
- // if (res.data.code == "200") {
- // this.$router.go(-1);
- // }
- // this.$message({
- // type: "success",
- // message: "新增运输单价成功!",
- // });
- // });
- this.axios.post("/api/v1/ams/updateCarrierName",this.form1).then(res=>{
- if(res.data.code==200){
- this.$message.success("修改承运商成功")
- }else{
- this.$message.warning("修改承运商失败")
- }
- })
- this.$router.push('/transportPrice');
- },
- // 取消
- cancel() {
- this.$router.push('/transportPrice');
- },
- //修改运价
- updatePriceValue(){
- console.log("查看数据")
- if(this.form1.priceValue==null||this.form1.priceValue==""){
- this.$message.warning("运价不能为空")
- return
- }
- console.log("进入了修改单价的方法")
- console.log(this.form1)
- this.axios.post("/api/v1/ams/updatePriceValue",this.form1).
- then(res=>{
- if(res.data.code==200){
- this.$message.success("修改运价成功")
- }else{
- this.$message.warning("修改运价失败")
- }
- })
- this.$router.push('/transportPrice');
- },
- //修改卸货地址
- updateAddressDeliveryAddress(){
- if(this.form1.addressDeliveryAddress==null||this.form1.addressDeliveryAddress==""){
- this.$message.warning("卸货地址不能为空")
- return
- }
- console.log("进入了修改卸货地址的方法")
- console.log(this.form1)
- this.axios.post("/api/v1/ams/updateaddressDeliveryAddress",this.form1).
- then(res=>{
- console.log(res)
- if(res.data.code==200){
- this.$message.success("修改卸货成功")
- }else{
- this.$message.warning("修改卸货失败")
- }
- })
- this.$router.push('/transportPrice');
- },
- },
- };
- </script>
- <style lang='scss'>
- .elForm {
- margin-left: 38%;
- }
- .button-box{
- display: flex;
- text-align: center;
- align-items: center;
- justify-content: center;
- margin-top: 0.3125rem;
- margin-bottom: 1.25rem;
- }
- .addTransportPrice{
- .form{
- display: flex;
- .form_box{
- width: 320px;
- margin-left: 38%;
- 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;
- }
- }
- }
- }
- }
- label{
- display: inline-block;
- width: 70px !important;
- }
- .el-input{
- width: 250px;
- }
- }
- #liulan1{
- width: 120px;
- margin-top: 80px;
- .el-button{
- width: 100px !important;
- margin-top: 14px;
- }
- .btn{
- margin-top: 106px;
- }
- .btn1{
- margin-top: 13px;
- margin-left: 0px;
- }
- .btn2{
- margin-top: 67px;
- }
- }
- }
- .button_box{
- margin-left: 45%;
- }
- .selectText{
- .el-input{
- width: 250px;
- }
- }
- .LineTable{
- width: 100%;
- height: 480px;
- overflow: hidden;
- margin-top: 10px;
- }
- #cysbutton{
- margin-left: 70px;
- }
- }
- </style>
- <style lang='scss'>
- /deep/.__bar-is-vertical {
- right: -1px !important;
- }
- /deep/.__bar-is-horizontal {
- display: none !important;
- }
- </style>
|