import * as API from '@/apis/remind.js' import * as API_index from '@/apis/index.js' export default { data() { return { readyBl:false, list: [ { name: '提前1站', isRemind: "1", }, { name: '提前2站', isRemind: "2", } ], upList:[], downList:[], // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中 value: 'orange', } }, methods: { passengerRemindList(){ this.$refs.common.showLoading() var obj={ openId:this.carhelp.getOpenId() } API.passengerRemindList(obj).then((response) => { var list= response.data; for(var i in list){ var item=list[i]; if(item.remindType=="1"){ this.upList.push(item); }else{ this.downList.push(item); } } this.$refs.common.showLoading(false) }).catch(error => { this.$refs.common.showLoading(false,error) }) }, // 选中某个单选框时,由radio时触发 radioChange(e) { console.log(e); }, // 选中任一radio时,由radio-group触发 radioGroupChange(item) { var obj={ id:item.id, num:item.stopInAdvance } API.updateStationNum(obj).then((res) => { this.$refs.common.alert( "设置成功"); }).catch(error => { this.$refs.common.alert( error); }) },del(id){ API_index.cancelRemind(id).then((res) => { this.$refs.common.alert( "设置成功"); }).catch(error => { this.$refs.common.alert( error); }) }, add(){ var item= this.remindInfo var obj={ startStationId:item.startStationId, remindStationId :item.ticketDownStationId, stopInAdvance:item.isRemind, remindType:"2", vehicleShiftId:item.vehicleShiftId, openId:this.carhelp.getOpenId() } API_index.saveRemind(obj).then((res) => { item.remindId=res.data.id this.$refs.common.alert( "设置成功"); }).catch(error => { this.$refs.common.alert( error); }) }, delBtn(item){ this.$refs.common.setFnc(()=>{ item.del=true; this.del(item.id); this.$forceUpdate() }) this.$refs.common.confirm('是否删除当前提醒?') }, },onReady(){ this.readyBl=true; this.passengerRemindList(); },onShow(){ if(this.readyBl){ this.upList=[]; this.downList=[]; this.passengerRemindList(); } } }