index.js 923 Bytes
import App from '../../../utils/api.js'
import util from '../../../utils/util.js'
Page({
	onLoad(){
		this.setData({
			headerHeight:util.cache('headerHeight')
		})
		this.getsellerlist();
	},
	getsellerlist(){
		App.Seller.GetSystemByOpenid({openid:util.cache('openid')}).then((json)=>{
			console.log(json)
			if(json.ret==200){
				if(json.data.auth==0){
					
				}else{
					this.setData({
						sellerlist:json.data
					})
				}
				
			}
		})
	},
	switchseller(){
		if(util.cache('sellerid')){
			wx.reLaunch({
				url:'../../me/s_index?sellerid='+util.cache('sellerid')
			})
		}else{
			if(this.data.sellerlist){
				if(this.data.sellerlist.length==1){
					wx.reLaunch({
						url:'../../me/s_index?sellerid='+this.data.sellerlist[0].seller.id
					})
				}else{
					wx.reLaunch({
						url:'../../currency/c_store'
					})
				}
			}else{
				wx.reLaunch({
					url:'../../me/s_index'
				})
			}
			
		}
	}
})