<style> .busPriceConfig .busList { width: 230px; height: 270px; float: left; margin: 0 10px 10px 0; background-color: #fff; border-radius: 4px; font-size: 12px; overflow: hidden; } .busPriceConfig .busListTable { width: 98%; margin: 0px 2px 0px 2px; } .busPriceConfig .busListTable tr td { height: 20px; line-height: 20px; } .busPriceConfig .busListTop { width: 100%; position: relative; text-align: center; } .busPriceConfig .usePricediv { margin: 7px 0 0 20px; } .busPriceConfig .btmAddStore { border-top: 1px solid #d1d1d1; width: 100%; display: none; overflow-x: auto; overflow-y: auto; position: fixed; background: #f9f9f9; bottom: 0; } .busPriceConfig .changeMsg { width: 80%; } .busPriceConfig .changeMsg li { float: left; } .busPriceConfig .changeMsg li:first-child { margin-left: 20px; } .busPriceConfig .btmTitle { padding: 0 10px; margin: 20px 0 20px 25px; border-left: 3px solid #e95252; font-size: 14px; color: #000000; } .busPriceConfig .busUsePeople .el-input__inner { border-top-right-radius: 0; border-bottom-right-radius: 0; } .busPriceConfig .busType { margin: 10px 0 0 31px; font-size: 14px; display: inline-block; } .busPriceConfig .cityBtnList { margin: 10px 0 20px 20px; } .busPriceConfig .busUserBtnList { width: 100%; text-align: center; margin-top: 10px; } .busPriceConfig .busListTop img { width: 100%; } .busPriceConfig .BusTypeStr { position: absolute; top: 15px; color: #fff; font-size: 25px; left: 63px; } .busPriceConfig .UPBtn { width: 70px; height: 23px; } .busPriceConfig .topNotice { width: 100%; height: 20px; font-size: 12px; text-align: left; margin: 20px 0; } .busPriceConfig .delScien { position: absolute; right: 10px; top: 10px; display: none; } .busPriceConfig .delScien:hover { color: #f76f6f; cursor: pointer; } .busPriceConfig .busList:hover .delScien { display: block; } .busPriceConfig .busDiv { margin-top: 20px; } .busPriceConfig .busList:hover { box-shadow: 0px 0px 20px rgba(191, 191, 191, 1); transition: all linear 0.5s; } .Bus_BtnList { text-align: right; margin-bottom: 10px; } .Bus_Spacing { margin-left: 24px; } .busPriceConfig .combottomDiv .el-select { width: 100%; } .busPriceConfig .linkStrle { cursor: pointer; text-decoration: underline; color: blue; } .busUsePriceTable { width: 100%; font-size: 14px; color: #333; background-color: #fff; border-collapse: collapse; } .busUsePriceTable tr th { background: #e6e6e6; height: 30px; font-size: 14px; text-align: left; text-indent: 15px; border: 1px solid #cccccc; } .busUsePriceTable tr td { min-height: 60px; height: auto; padding: 10px; font-size: 14px !important; border: 1px solid #cccccc; } .busPriceConfig .busUsePriceTable .el-pagination { border-top: 0 !important; } </style> <template> <div class="flexOne busPriceConfig"> <div class="query-box"> <ul> <li> <span> <em>地区</em> <el-select filterable :placeholder="$t('pub.pleaseSel')" v-model="msg.AreaTypeId"> <el-option :label="$t('pub.unlimitedSel')" :value="0"></el-option> <el-option v-for="item in AreaList" :key="item.Id" :label="item.Name" :value="item.Id"></el-option> </el-select> </span> </li> <li> <span> <em>名称</em> <el-input v-model="msg.Trip" clearable="" /> </span> </li> <li> <input type="button" class="hollowFixedBtn" @click="msg.pageIndex=1,initData()" value="查询" /> <input type="button" class="normalBtn" @click="addPanel" :value="$t('pub.addBtn')" /> </li> </ul> </div> <div class="busDiv clearfix" v-loading="msg.loading"> <table class="busUsePriceTable"> <thead> <tr> <th> 编号 </th> <th> 地区 </th> <th> 行程 </th> <th> 越文行程 </th> <th> 计费方式 </th> <th> 详细 </th> <th> 操作人 </th> <th> 操作时间 </th> <th> {{$t('admin.admin_operate')}} </th> </tr> </thead> <tbody v-for="item in dataList" :key="item.subCode"> <tr> <td> {{item.Id}} </td> <td> {{item.AreaTypeIdStr}} </td> <td> {{item.Trip}} </td> <td> {{item.VietnamTrip}} </td> <td> <template v-if="item.CalcFeeType==1"> <span style="color:blue">公里计费</span> </template> <template v-if="item.CalcFeeType==2"> <span style="color:red">车资计费</span> </template> </td> <td> <template v-if="item.CalcFeeType==1"> <el-popover width="300" trigger="click"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr style="text-align:center;"> <th width="100">车型</th> <th width="100">公里价格</th> </tr> <tr v-for="(fItem,fIndex) in item.PriceList" :key="fIndex" style="text-align:center;"> <td> {{fItem.BusTypeStr}} </td> <td> {{fItem.KMPrice}} </td> </tr> </table> <span slot="reference" style="cursor:pointer;color:blue;" title="点击查看详情"> {{item.Kilometre}} 公里 <i class="iconfont icon-xiaotuziCduan_1"></i> </span> </el-popover> </template> <template v-if="item.CalcFeeType==2"> <el-popover width="300" trigger="click"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr style="text-align:center;"> <th width="100">车型</th> <th width="100">价格</th> </tr> <tr v-for="(fItem,fIndex) in item.ConfigDetailsList" :key="fIndex" style="text-align:center;"> <td> {{fItem.BusTypeName}} </td> <td> {{fItem.BusPrice}} </td> </tr> </table> <span slot="reference" style="cursor:pointer;color:red" title="点击查看详情">车资 <i class="iconfont icon-xiaotuziCduan_1"></i> </span> </el-popover> </template> </td> <td>{{item.UpdateByName}}</td> <td>{{item.UpdateDateStr}}</td> <td style="text-align:center;"> <el-button-group size='mini'> <el-tooltip class="item" effect="dark" :content="$t('ground.glbaojia')" placement="top-start"> <el-button type="primary" class="iconfont icon-bianji-smal" @click="managePrice(item.Id)"></el-button> </el-tooltip> <el-tooltip class="item" effect="dark" :content="$t('system.ph_shanchu')" placement="top-start"> <el-button type="danger" class="iconfont icon-img_delete_small" @click="isdelete(item.Id)"> </el-button> </el-tooltip> </el-button-group> </td> </tr> </tbody> <tfoot> <tr> <td colspan="9"> <el-pagination background @current-change="handleCurrentChange" :current-page.sync="msg.currentPage" layout="total,prev, pager, next, jumper" :page-size="this.msg.pageSize" :total="msg.total"> </el-pagination> </td> </tr> </tfoot> </table> </div> <div class="combottomDiv" v-if="isShow"> <el-row> <el-col :span="18"> <div class="combottomTitle">车资价格</div> </el-col> <el-col :span="4" class="Bus_BtnList"> <input type="button" class="hollowFixedBtn" @click="cancelPanel" :value="$t('pub.cancelBtn')" /> <input type="button" class="normalBtn" @click="submitForm('addMsg')" :value="$t('pub.saveBtn')" /> </el-col> </el-row> <el-form :model="addMsg" ref="addMsg" label-width="100px"> <el-row> <el-col :span="5"> <el-form-item label="地区"> <el-select filterable :placeholder="$t('pub.pleaseSel')" v-model="addMsg.AreaTypeId"> <el-option :label="$t('pub.unlimitedSel')" :value="0"></el-option> <el-option v-for="item in AreaList" :key="item.Id" :label="item.Name" :value="item.Id"></el-option> </el-select> </el-form-item> </el-col> <el-col :span="5"> <el-form-item label="行程"> <el-input type="textarea" autosize :placeholder="$t('pub.pleaseImport')" v-model="addMsg.Trip"> </el-input> </el-form-item> </el-col> <el-col :span="5"> <el-form-item label="越文行程"> <el-input type="textarea" autosize :placeholder="$t('pub.pleaseImport')" v-model="addMsg.VietnamTrip"> </el-input> </el-form-item> </el-col> <el-col :span="5"> <el-form-item label="计费方式"> <el-select filterable :placeholder="$t('pub.pleaseSel')" v-model="addMsg.CalcFeeType"> <el-option :label="$t('pub.unlimitedSel')" :value="0"></el-option> <el-option label="公里计费" :value="1"></el-option> <el-option label="车资计费" :value="2"></el-option> </el-select> </el-form-item> </el-col> <el-col :span="5" v-if="addMsg.CalcFeeType==1"> <el-form-item label="公里数"> <el-input v-model="addMsg.Kilometre" @keyup.native="checkInteger(addMsg,'Kilometre')"></el-input> </el-form-item> </el-col> <el-col :span="5" v-if="addMsg.CalcFeeType==2" v-for="(subItem,subIndex) in AreaTypeList" :key="subIndex"> <el-form-item :label="subItem.BusTypeName" > <el-input v-model="subItem.BusPrice" @keyup.native="checkInteger(subItem,'BusPrice')" maxlength="10"> </el-input> </el-form-item> </el-col> <el-col :span="5"> <el-form-item label="排序"> <el-input v-model="addMsg.SortNum" @keyup.native="checkInteger(addMsg,'SortNum')"></el-input> </el-form-item> </el-col> </el-row> </el-form> </div> </div> </template> <script> export default { data() { return { AreaList: [], //地区列表 dataList: [], isShow: false, msg: { pageIndex: 1, pageSize: 10, total: 0, currentPage: 1, loading: false, Trip: "", AreaTypeId: 0, //地区编号 }, //表单json addMsg: { Id: 0, //编号 Trip: '', //行程 VietnamTrip: '', //越文行程 Kilometre: 0, //公里数 SortNum: 0, //排序 AreaTypeId: 0, //地区编号 CalcFeeType: 0, //计费方式(1-公里计价,2-总车资计价) ConfigDetailsList: [], //报价详情 }, AreaTypeList: [], }; }, methods: { //获取车辆类型 getAreaTypeList() { this.apipost( "bus_get_GetBusAreaTypeListService", { Type: 2 }, res => { this.msg.loading = false; if (res.data.resultCode == 1) { var tempArray = res.data.data; if (tempArray && tempArray.length > 0) { tempArray.forEach(item => { var obj = { BusType: item.Id, BusTypeName: item.Name, BusPrice: 0, } this.AreaTypeList.push(obj); }); } } }, null ); }, handleCurrentChange(val) { this.msg.pageIndex = val; this.initData(); }, resetPageIndex() { this.msg.pageIndex = 1; this.msg.currentPage = 1; }, initData() { this.msg.loading = true; this.apipost( "buspriceconfig_get_GetBusPriceConfigPageList", this.msg, res => { this.msg.loading = false; if (res.data.resultCode == 1) { this.dataList = res.data.data.pageData; this.msg.total = res.data.data.count; } }, null ); }, saveInfo() { this.addMsg.ConfigDetailsList = this.AreaTypeList; this.apipost( "buspriceconfig_post_SetBusPriceConfig", this.addMsg, res => { if (res.data.resultCode == 1) { this.initData(); this.clearInfo(); this.Success("保存成功"); this.isShow = false; this.resetForm("addMsg"); } else { this.Error(res.data.message); } }, null ); }, //修改管理报价 managePrice(ID) { this.addMsg.ID = ID; this.isShow = true; let msg = { Id: ID }; this.apipost( "buspriceconfig_get_GetBusPriceConfig", msg, res => { var tempData = res.data.data; this.addMsg.Id = tempData.Id; this.addMsg.Trip = tempData.Trip; this.addMsg.VietnamTrip = tempData.VietnamTrip; this.addMsg.Kilometre = tempData.Kilometre; this.addMsg.SortNum = tempData.SortNum; this.addMsg.AreaTypeId = tempData.AreaTypeId; this.addMsg.CalcFeeType = tempData.CalcFeeType; if (tempData.ConfigDetailsList && tempData.ConfigDetailsList.length > 0) { tempData.ConfigDetailsList.forEach(subItem => { this.AreaTypeList.forEach(childItem => { if (subItem.BusType == childItem.BusType) { childItem.BusPrice = subItem.BusPrice; } }) }); } }, null ); }, //取消 cancelPanel() { this.isShow = false; this.resetForm("addMsg"); }, //添加 addPanel() { this.isShow = true; this.addMsg.ID = 0; this.clearInfo(); }, clearInfo() { this.addMsg.Id = 0; this.addMsg.Trip = ""; this.addMsg.VietnamTrip = ""; this.addMsg.Kilometre = 0; this.addMsg.SortNum = 0; this.addMsg.CalcFeeType = 0; this.addMsg.ConfigDetailsList = []; if (this.AreaTypeList && this.AreaTypeList.length > 0) { this.AreaTypeList.forEach(item => { item.BusPrice = 0; }) } }, submitForm(addMsg) { //提交创建、修改表单 let that = this; that.$refs[addMsg].validate(valid => { if (valid) { that.saveInfo(); } else { return false; } }); }, resetForm(formName) { this.$refs[formName].resetFields(); }, //删除 isdelete(ID) { var that = this; this.Confirm("是否删除?", function () { var msg = { Id: ID, Status: 1, }; that.apipost( "buspriceconfig_post_RemoveBusPriceConfig", msg, res => { if (res.data.resultCode == 1) { that.initData(); } }, null ); }); }, //获取地区下拉 getAreaList() { this.apipost( "busprice_get_GetBusAreaType", {}, res => { if (res.data.resultCode == 1) { this.AreaList = res.data.data; } }, null ); }, }, mounted() { this.getAreaTypeList(); this.getAreaList(); this.initData(); }, } </script>