123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- const app = getApp()
- const util = require("../../../utils/util");
- const api = require('../../../api/api.js');
- const user = require('../../../utils/user.js');
- Page({
- data: {
- finishedSubmit:false,
- masterName:'',
- rid:'',
- name:'',
- mobile:'',
- city:'',
- showPicker:false,
- columns:[
- '上海市',
- '北京市',
- '深圳市',
- '南京市',
- '苏州市',
- '无锡市',
- '杭州市',
- '青岛市',
- '宜昌市',
- '重庆市',
- '成都市',
- '广州市',
- '昆山市',
- '长沙市',
- '西安市',
- '武汉市'
- ],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- console.log(options);
- if(options.scene){
- var scene = decodeURIComponent(options.scene);
- console.log(scene);
- var sceneStr=scene.split(',')[1];
- console.log(sceneStr);
- this.setData({
- rid:sceneStr
- });
- this.getMasterInfo();
- }
- // this.getMasterInfo()
- },
- getMasterInfo(){
- util.request(api.getTransferIntroductionInfo, {
- transferSponsorNo:this.data.rid
- }, 'GET').then(res=> {
- if (res.errno === 0) {
- this.setData({
- masterName:res.data
- });
- }else{
- // wx.showToast({
- // title: res.errmsg,
- // icon: 'none'
- // });
- }
- })
- },
- bindName(e){
- this.setData({
- name: e.detail.value
- });
- },
- bindMobile(e){
- this.setData({
- mobile: e.detail.value
- });
- },
- cityTap(){
- this.setData({
- showPicker:true,
- });
- },
- pickerCancel(){
- this.setData({
- showPicker:false,
- })
- },
- pickerConfirm(e){
- console.log(e);
-
- this.setData({
- city:e.detail.value,
- showPicker:false,
- });
-
-
- },
- onReachBottom() {
-
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
-
- },
-
- onHide: function () {
- },
- onUnload: function () {
- },
- submit(){
- if(this.data.finishedSubmit){
- return false;
- }
- if(this.data.name==''){
- wx.showToast({
- title: '请输入姓名',
- icon: 'none'
- });
- return false;
- }else if(this.data.mobile==''){
- wx.showToast({
- title: '请输入手机号码',
- icon: 'none'
- });
- return false;
- }else if (!/^1\d{10}$/.test(this.data.mobile)) {
- wx.showToast({
- title: '请输入正确的手机号码',
- icon: 'none'
- });
-
- return false;
- }else if(this.data.city==''){
- wx.showToast({
- title: '请选择城市',
- icon: 'none'
- });
- return false;
- }else{
- wx.showLoading({
- title: '加载中...',
- });
- util.request(api.transferIntroduction, {
- city: this.data.city,
- name: this.data.name,
- tel:this.data.mobile,
- transferSponsorNo:this.data.rid
- }, 'POST').then(res=> {
- wx.hideLoading();
- if (res.errno === 0) {
- this.setData({
- finishedSubmit:true
- });
- wx.showToast({
- title: '提交成功'
- });
-
- }else{
- wx.showToast({
- title: res.errmsg,
- icon: 'none'
- });
- }
- }).catch(err=>{
- wx.hideLoading();
- });
- }
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh:function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
-
- })
|