user_spsy.js 1.59 KB
// pages/user/usersy/usersy.js
var e = getApp(),os = e.globalData.setting;
var utils = require('../../../utils/util.js');
var regeneratorRuntime = require('../../../utils/runtime.js');

Page({
  /**
   * 页面的初始数据
   */
  data: {
    qr_code_object:{val:"12121",content:"请将二维码展示给核销员,取货更快捷!"},
    xp_list:null,
    iurl:os.imghost,
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) { },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow:async function () {
    var th = this;
    var xp_list=null;
    //--获取列表--
    await getApp().request.promiseGet("http://172.20.3.102:8080/api/user_qy/xp_list", {
      1: 1
    }).then(res => {
      xp_list = res.data;
    })
    th.setData({xp_list:xp_list});
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },


  /*-- 打开服务项目 --*/
  open_xp:function (e) {
    var th=this;
    var qc_com = this.selectComponent("#qc_com"); //组件的id
    qc_com.open(th.data.qr_code_object)
  },

  //--领取商品--
  get_xp:function (e) {
      var th=this,index=e.currentTarget.dataset.ind;
      getApp().request.post("http://172.20.3.102:8080/api/user_qy/get_gd",{
          data:{},
          success:function (e) {
              if(e.data.code==0){
                    var txt="xp_list["+index+"].is_get"
                    var obj={};obj[txt]=1;
                    th.setData(obj);
              }
          }
      })
  }


})