|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- // pages/getMerchant/index.js
- const config = require('../../config/config.js')
- const Http = require('../../utils/HttpBasics.js')
- const util = require('../../utils/util.js')
- const app = getApp();
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- phone:'',
- paramData:[]
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- console.log(options)
- this.setData({
- paramData: options
- })
- if (options.a == 2){
- tt.setNavigationBarTitle({
- title: '会员赠券'
- })
- }else{
- tt.setNavigationBarTitle({
- title: '会员积分'
- })
- }
-
-
- },//204391258
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
- checkMerchant(e) {
- let id = e.target.id;
- this.data.selectList.map((item, index) => {
- if (id == item.id) {
- this.setData({
- selectMerchant: item``
- })
- }
- })
- },
- submitForm() {
- const reg = /^1[0|1|2|3|4|5|6|7|8|9]\d{9}$/;
- let _this=this;
- if (!reg.test(this.data.phone)) {
- tt.showToast({
- title: '抱歉,请输入正确的手机号',
- icon: 'none',
- duration: 2000,
- mask: false
- });
- return;
- }
- Http.get({
- url: config.api.findByPhone,
- data: {
- phone: _this.data.phone,
- }
- })
- .then(res => {
- if (res.data.id){
- if(res.data.status == 1){
- tt.showModal({
- title: "抱歉",
- content: "会员已被锁定",
- showCancel: false
- })
- return;
- }
- if (this.data.paramData.a == 1){
- tt.setStorageSync("avatarUrl", res.data.avatarUrl?res.data.avatarUrl:'');
- tt.navigateTo({
- url: `/pages/Add/index?id=${res.data.id}&levelName=${res.data.level}&nickName=${res.data.nickName}&name=${res.data.name}&phone=${res.data.phone}&score=${res.data.score}&credit=${res.data.credit}`
- })
- }
- if (this.data.paramData.a == 2) {
- tt.setStorageSync("avatarUrl", res.data.avatarUrl?res.data.avatarUrl:'');
- tt.navigateTo({
- url: `/pages/giveCoupon/index?id=${res.data.id}&levelName=${res.data.level}&nickName=${res.data.nickName}&name=${res.data.name}&phone=${res
- .data.phone}&score=${res.data.score}&credit=${res.data.credit}`
- })
- }
- }else{
- tt.showToast({
- title: '抱歉,会员信息不存在!',
- icon: 'none',
- duration: 2000,
- mask: false
- });
- }
- })
- .catch(err => {
- tt.showToast({
- title: err.message,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- });
- },
- getList(e) {
- console.log(e.detail.value)
- this.setData({
- phone: e.detail.value
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- }
- })
|