Commit d5b2bb8e6583455cd8747c17c0e3bd1e0b1c3b1a

Authored by wangfan
1 parent 39785136

模式切换

Showing 1 changed file with 24 additions and 8 deletions
@@ -10,16 +10,16 @@ Page({ @@ -10,16 +10,16 @@ Page({
10 data: { 10 data: {
11 hasSellerBook:false, 11 hasSellerBook:false,
12 }, 12 },
13 - enter_params:'',  
14 /** 13 /**
15 * 生命周期函数--监听页面加载 14 * 生命周期函数--监听页面加载
16 */ 15 */
17 onLoad: function (options) { 16 onLoad: function (options) {
18 App.Reserve.SellerForOpenid({openid:getApp().openid}).then(res=>{ 17 App.Reserve.SellerForOpenid({openid:getApp().openid}).then(res=>{
19 - this.enter_params=res.data;  
20 - this.setData({  
21 - hasSellerBook:res.data,  
22 - }) 18 + if(res.data && res.data.seller_id) {
  19 + this.setData({
  20 + hasSellerBook: res.data,
  21 + })
  22 + }
23 }) 23 })
24 }, 24 },
25 25
@@ -52,9 +52,25 @@ Page({ @@ -52,9 +52,25 @@ Page({
52 }, 52 },
53 53
54 gotoSellerBook(){ 54 gotoSellerBook(){
55 - util.cache('islove','book');  
56 - wx.reLaunch({  
57 - url:util.http_build_query(this.enter_params,'/pages/book/b_index') 55 + util.loading()
  56 + App.Reserve.SellerForOpenid({openid:getApp().openid}).then(res=>{
  57 + util.loading('clear');
  58 + if(res.data && res.data.seller_id){
  59 + this.setData({
  60 + hasSellerBook:res.data,
  61 + })
  62 + util.cache('islove','book');
  63 + wx.reLaunch({
  64 + url:util.http_build_query(res.data,'/pages/book/b_index')
  65 + })
  66 + }else{
  67 + this.setData({
  68 + hasSellerBook:false,
  69 + })
  70 + util.toast('已不是商家','none')
  71 + }
  72 +
58 }) 73 })
  74 +
59 } 75 }
60 }) 76 })