zhuli_test.js
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var e = getApp(),
  a = e.globalData.setting,
  os = a;
var regeneratorRuntime = require('../../utils/runtime.js');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    iurl: a.imghost, //图片地址前缀\
    taskId:0,
    mobile:0,
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    wx.setNavigationBarTitle({
      title: "测试帮忙助力",
    })
    var th = this;
    var taskId=options.taskId;
    this.data.taskId=taskId;
  },
  getphoneValue:function(e){
     this.data.mobile=e.detail.value;
  },
  //测试正在进行任务
  bindReg:async function () {
    var userinfo=null;
    await getApp().request.promiseGet("/api/weshop/users/page",{
        data:{mobile:this.data.mobile,store_id:os.stoid}
    }).then(res=>{
      userinfo=res.data.data.pageData[0];
    })
    if(!userinfo)  {
      getApp().my_warnning("未找到会员",0,this); return false;
    }
    var task=null;
    await getApp().request.promiseGet("/api/weshop/marketing/help/help/task/get",{
      data:{taskId:this.data.taskId,storeId:os.stoid,userId:userinfo.user_id}
    }).then(res=>{
      task=res.data.data;
    })
    if(!task)  {
      getApp().my_warnning("未找任务",0,this); return false;
    }
    if(task.status!=0){
      getApp().my_warnning("任务不是进行中",0,this); return false;
    }
    var taking=task.id;
    getApp().goto("/pages/user/assistance/friend_assistance?tasking=" + taking + "&userId=" + userinfo.user_id);
  },
})