Sanakey
2021-06-05 61abc9b654f78019a974c68916eb5718bc1c2992
提交 | 用户 | age
282d69 1
S 2 Page({
3   data: {
4     doccode:''
5   },
6   onLoad(options) {
7     let doccode = options.doccode || '';
8     this.setData({
9       doccode
10     })
11     if (!wx.globalData.OpenId){
12       wx.globalData.indexCallback = ()=>{
13         this.hasCheckedSeller();
f46177 14         console.log('初次打开小程序,直接进入验证页');
282d69 15       }
S 16     } else{
f46177 17       console.log('不是初次打开小程序或未完全关闭小程序,进入验证页');
282d69 18       this.hasCheckedSeller();
S 19     }
20
21
22     // this.getSellerList();
23   },
24   onShow() {
25
26   },
27
28   async hasCheckedSeller() {
29     let doccode = this.data.doccode;
30     let [error, result] = await wx.$utils.to(
31       wx.$http.request({
32         url:`/shopping/panicBuyingSeller.do?m=hasCheckedSeller`,
33         data:{
34           doccode
35         }
36       })
37     )
38     if (error){
39       console.log(error);
40       return;
41     }
42     console.log(result);
43     this.setData({
44       hasChecked:result.hasCheckedSeller,
45     })
46   },
47   async doCheckingSeller() {
48     let doccode = this.data.doccode;
49     let [error, result] = await wx.$utils.to(
50       wx.$http.request({
51         url:`/shopping/panicBuyingSeller.do?m=doCheckingSeller`,
52         data:{
53           doccode
54         }
55       })
56     )
57     if (error){
58       console.log(error);
59       return;
60     }
61     console.log(result);
62     wx.showToast({
63       title:`验证成功`,
64     })
65     setTimeout(() => {
d38be7 66       wx.redirectTo({
S 67         url:`/pages/detail/detail?from=sellerVerify&doccode=${doccode}`
282d69 68       })
S 69     },1000)
70   }
71 })
72 export {}