E企盈营销工具技术服务商 热线:4006-838-530

微信小程序免密代扣

E企盈直播平台营销卖货系统

1.定义好pay.wxml<view class=’btn_box’>          <navigator target=’miniProgram’ extra-data='{{extraData}}’ path=’pages/index/index’ app-id=’wxbd687630cd02ce1d’ hover-class=”none”>            <view class=’btn_btn nor_linear_bg’>开通免密支付</view>          </navigator>        </view>2.设置好pay.js参数处理var util = require(‘../../utils/util.js’);const app = getApp();Page({  onShow: function (options) {    console.log(options,’pay.js start’);          },  data:{      extraData:”,      localCity:”  },  onLoad: function() {      this.setData({          extraData:util.getextraData(),          localCity:wx.getStorageSync(util.key.cityName) || app.globalData.baseInfo.cityName      })  }})绑定免密签证参数设置:function getextraData() {  const app = getApp();  var extraDataValue = {    appid: app.globalData.baseInfo.appId,    mch_id: app.globalData.baseInfo.mchId,    sub_mch_id: app.globalData.baseInfo.subMchId,    notify_url: app.globalData.baseInfo.notifyUrl,    contract_code: config.contractCode,    contract_display_account: app.globalData.baseInfo.contractDisplayAccount,    plan_id: app.globalData.baseInfo.planId,    request_serial: config.requestSerial,    timestamp: config.timestamp,    sub_appid: app.globalData.baseInfo.subAppId  };  var extraDataSortValue = getSort(extraDataValue);  var signValue = getSign(extraDataSortValue, app.globalData.baseInfo.appSecret);  extraDataValue[‘sign’] = signValue;  log(TAG, “signSign=[” + signValue + “]length=” + String(signValue).length);  return extraDataValue;}例如:3.app.js中 处理绑定后返回值onShow: function (options) {    let that = this;    var bindStatus = wx.getStorageSync(util.key.bindStatus) || 0;      if (options.scene == 1038) {        var errorCode = options.referrerInfo && options.referrerInfo.extraData && options.referrerInfo.extraData.return_code ? options.referrerInfo.extraData.return_code:”;        if (errorCode == ‘SUCCESS’) {          var appid = options.referrerInfo.appId;          var contractId = options.referrerInfo.extraData.contract_id;          console.log(“签约成功”);          that.globalData.baseInfo.appid = appid;          that.globalData.baseInfo.contractId = contractId;          that.globalData.baseInfo.contractIds = contractId;          that.globalData.baseInfo.bindStatus = 1;          wx.setStorageSync(util.key.bindStatus, 1);                    //add by wupeng for jump scan          //认证绑定后通过navigateBack跳转到首页scan可以直接退出          var pagelist = getCurrentPages();          var len = pagelist.length;          var init = 0;          var index = 0;          for (var i = 0; i < len; i++) {            if (pagelist[i].route.indexOf(“scan/scan”) >= 0) {//看路由里面是否有首页              init = 1;              index = i;            }          }          if (init == 1) {            wx.navigateBack({              delta: len – index – 1            });          } else {            wx.reLaunch({              url: “../scan/scan”//这个是默认的单页            });          }          //end add by wupeng 20180921        } else {          var msg = options.referrerInfo.extraData.return_msg;          wx.showModal({            title: errorCode,            content: msg,          });          console.log(TAG + ‘:签约失败’);        }      }    // }  },

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 微信小程序免密代扣
分享到: 更多 (0)
E企盈小程序直播营销卖货系统
E企盈直播平台营销卖货系统

评论 抢沙发

E企盈小程序开发

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏