小程序OFO编写我的钱包页

前端之家收集整理的这篇文章主要介绍了小程序OFO编写我的钱包页前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

编写我的钱包页

1.页面结构

tocharge" class="btn-charge">充值

2.页面样式

3.页面数据逻辑

页面加载
  onLoad:function(options){
     wx.setNavigationBarTitle({
       title: '我的钱包'
     })
  },// 页面加载完成,更新本地存储的overage
  onReady:function(){
     wx.getStorage({
      key: 'overage',      success: (res) => {
        this.setData({
          overage: res.data.overage
        })
      }
    })
  },// 页面显示完成,获取本地存储的overage
  onShow:function(){
    wx.getStorage({
      key: 'overage',      success: (res) => {
        this.setData({
          overage: res.data.overage
        })
      }
    }) 
  },// 余额说明
  overageDesc: function(){
    wx.showModal({
      title: "",      content: "充值余额0.00元+活动赠送余额0.00元",      showCancel: false,      confirmText: "我知道了",    })
  },// 跳转到充值页面
  movetocharge: function(){
    // 关闭当前页面跳转指定页面,返回时将不会回到当前页面
    wx.redirectTo({
      url: '../charge/index'
    })
  },// 用车券
  showTicket: function(){
    wx.showModal({
      title: "",      content: "你没有用车券了",      confirmText: "好吧",// 押金退还
  showDeposit: function(){
    wx.showModal({
      title: "",      content: "押金会立即退回,退款后,您将不能使用ofo共享单车确认要进行此退款吗?",      cancelText: "继续使用",      cancelColor: "#b9dd08",      confirmText: "押金退款",      confirmColor: "#ccc",      success: (res) => {
        if(res.confirm){
          wx.showToast({
            title: "退款成功",            icon: "success",            duration: 2000
          })
        }
      }
    })
  },// 关于ofo
  showInvcode: function(){
    wx.showModal({
      title: "ofo共享单车",      content: "微信服务号:ofobike,网址:m.ofo.so",      confirmText: "玩的6"
    })
  }
})
原文链接:https://www.f2er.com/weapp/422940.html

猜你在找的微信小程序相关文章