uni-app 分段选择器组件

父组件


nsrsbh: '',

xm: '',

sfzjhm: '',

// 分段选择器数据

items: [{

title: "待缴税费"

},

{

title: "待缴凭证"

},

],

current: 0,

colorIndex: 0,

activeColor: '#168DE9',

//传递给页面数据

isShowClass: true,

isShowClassP: true,

cParamList: [],

cParamListP: [],

indexs: 0,

ztlx: '2'

}

},

methods: {

//获取查询数据 待缴

getdataSB () {

}

// 作废

seldelectP (e) {

console.log('作废成功', e)

this.getdataPZ()

},

//申报

selpayP (e) {

console.log('点击了申报e=====>', e)

var arrlist = this.cParamListP[e]

console.log('点击了申报arrlist=====>', arrlist)

// var canshu = '?pzxh=' + arrlist.dzsphm +

// '&nsrsbh=' + this.sfzjhm +

// '&swjgdm=' + arrlist.swjgDm +

// '&username=' + this.xm +

// '&djxh=' + this.djxh +

// '&SorF=' + arrlist.feiOrShui +

// '&navdelta=' + '1' +

// '&bqybtse=' + arrlist.yhdpzje;

var datas = {

"pzxh": arrlist.dzsphm,

"nsrsbh": this.sfzjhm,

"swjgdm": arrlist.swjgDm,

"username": this.xm,

"djxh": this.djxh,

"SorF": arrlist.feiOrShui,

"navdelta": '1',

"bqybtse": arrlist.yhdpzje

}

uni.navigateTo({

url: '../carinfo/paySelect/paySelect?params=' + this.aes_encrypt(JSON.stringify(datas))

})

},

// 隐私登录

getLogin () {

let url = this.configURL.hnserverUrl + '/dzswj/login'

var username = this.xm

var password = this.sfzjhm

const value = uni.getStorageSync('carinfo_key');

//判断当前是否有该存储值

if (value.isLogin) {

//读取存储对象对应的值

username = value.userInfo.xm

password = value.userInfo.sfzjhm

}

this.http.httpRequest(url, 'POST', {

username: username,

password: password,

mobileLogin: "on",

loginType: "1",

t: "30",

khdlx: "applet",

}).then(res => {

console.log("login接到的数据===", res)

if (res.status === "Y") {

const ures = res.o

var storeusers = {};

storeusers.loginName = ures.loginName;

storeusers.sfsmrz = ures.sfsmrz;

storeusers.sessionid = ures.sessionid;

if (ures.sfsmrz === 'Y' && ures.smrzBean) {

storeusers.djxh = this.aes_decrypt(ures.smrzBean.djxh);

storeusers.sfzjhm = this.aes_decrypt(ures.smrzBean.zjhm);

storeusers.xm = this.aes_decrypt(ures.smrzBean.xm);

}

uni.setStorage({

key: 'carinfo_key',

data: {

//保存的内容

userInfo: storeusers,

sessionid: ures.sessionid,

userid: storeusers.sfzjhm,

isLogin: true,

sessiontimeout: 'N'

},

success: () => {

this.getdataSB()

}

});

} else {

uni.showToast({

title: "暂无数据!",

duration: 2000

})

}

})

},

},

onLoad (option) {

console.log('onLoad=====>数据加载')

this.xm = this.aes_decrypt(option.xm);

this.sfzjhm = this.aes_decrypt(option.sfzjhm);

if (!this.configURL.isNullstr(option.ztlx)) {

this.ztlx = option.ztlx

}

},

onShow () {

//获取存储值

const value = uni.getStorageSync('carinfo_key');

//判断当前是否有该存储值

if (value.isLogin) {

if (value.userInfo.sfzjhm === this.sfzjhm) {

if (this.current === 0) {

console.log('待缴税费费onLoad')

this.getdataSB()

} else {

console.log('待缴凭证onLoad')

this.getdataPZ()

}

} else {

this.getLogin();

}

} else {

this.getLogin();

}

},

onReady () {

console.log('onReady=====>界面渲染完成')

}

}

你可能感兴趣的:(uni-app 分段选择器组件)