微信小程序商城源码最新更新2018-4-14

微信小程序商城源码最新更新2018-4-14
资源下载需要积分:5
  • 2577***@qq.com 开通了 永久会员
    11小时前
  • 9766***@qq.com 开通了 黄金会员
    21小时前
  • 1316***@qq.com 开通了 钻石会员
    1天前
  • 8702***@qq.com 开通了 钻石会员
    1天前
  • 3482***@qq.com 开通了 铂金会员
    1天前
  • 5801***@qq.com 开通了 永久会员
    1天前
  • 2116***@qq.com 开通了 永久会员
    1天前
  • 9446***@qq.com 开通了 铂金会员
    1天前
  • 4124***@qq.com 开通了 钻石会员
    2天前
  • 6385***@qq.com 开通了 钻石会员
    2天前
  • 6794***@qq.com 开通了 永久会员
    2天前
  • 1306***@qq.com 开通了 铂金会员
    2天前
  • 4986***@qq.com 开通了 钻石会员
    2天前
  • 2340***@qq.com 开通了 永久会员
    2天前
  • 1862***@qq.com 开通了 钻石会员
    3天前
  • 9206***@qq.com 开通了 黄金会员
    3天前
  • 6546***@qq.com 开通了 永久会员
    3天前
  • 7955***@qq.com 开通了 铂金会员
    3天前
  • 源码分类:网站源码
  • 发布日期:2019-07-14 15:03
  • 展示次数:3667
  • 下载次数:3
  • 收藏次数:2
  • 分享人员:本站会员

var qcloud = require('../../vendor/wafer2-client-sdk/index') var config = require('../../config') var util = require('../../utils/util.js') const App = getApp() Page({     data: {         userInfo: {},         items: [             {                 icon: '../../assets/images/iconfont-order.png',                 text: '我的订单',                 path: '/pages/order/list/index'             },              {                 icon: '../../assets/images/iconfont-addr.png',                 text: '收货地址',                 path: '/pages/address/list/index'             },              {                 icon: '../../assets/images/iconfont-kefu.png',                 text: '联系客服',                 path: '15219941518',             }         ],         settings: [             {                 icon: '../../assets/images/iconfont-clear.png',                 text: '清除缓存',                 path: '0.0KB'             },              {                 icon: '../../assets/images/iconfont-about.png',                 text: '关于我们',                 path: '/pages/about/about'             }         ]     },     onLoad:function(options){         const openId = wx.getStorageSync('Session3rd')              if(openId){    //如果登录             this.getuserInfo()             this.getStorageInfo()         }else{             this.login()         }     },     login:function(){        wx.redirectTo({             URL:"/pages/login/login"         });     },        getUserInfo:function() {         var that=this                console.log(App.globalData.userInfo);         if (App.globalData.userInfo) {                       this.setData({                 userInfo:App.globalData.userInfo             })             return         }else{             wx.getUserInfo({                 success: function(res) {                                    var userInfo = res.userInfo                     that.setData({                        userInfo: userInfo                    })                 }             })         }              },     getStorageInfo:function() {         var that=this         wx.getStorageInfo({             success: function(res) {                that.setData({     'settings[0].path': `${res.currentSize}KB`        })             }         })              },     navigateTo:function(e) {         const index = e.currentTarget.dataset.index         const path = e.currentTarget.dataset.path         switch(index) {             case 2:                 wx.makePhoneCall({                     phoneNumber: path                 })                 break             DEFAULT:                 wx.navigateTo({                     URL:path                 })         }     },     bindtap:function(e) {     const index = e.currentTarget.dataset.index         const path = e.currentTarget.dataset.path         switch(index) {             case 0:                 wx.showModal({                     title: '友情提示',                     content: '确定要清除缓存吗?',                     success: function(res) {                       if (res.confirm) {                          wx.clearStorage()                       } else if (res.cancel) {                          console.log('用户点击取消')                       }                     }                   })                                break             DEFAULT:                 wx.navigateTo({                     url:path                 })         }     },     LOGOut:function() {         var that=this     wx.showModal({             title: '友情提示',              content: '确定要登出吗?',              success: function(res) {                 if (res.confirm) {                    that.signOut()                 } else if (res.cancel) {                    console.log('用户点击取消')                 }               }         })               },     signOut:function() {     wx.request({             url:config.service.signOutUrl,             data:{Session3rd:'session3rd'},             success:function(res){                 if (res.Meta.code == 0) {                     wx.removeStorageSync('session3rd')                     wx.redirectTo({                         url:"/pages/login/login"                     })     }             }         })         }, }) 【核心代码】 var qcloud = require('../../vendor/wafer2-client-sdk/index') var config = require('../../config') var util = require('../../utils/util.js') const App = getApp() Page({     data: {         logged: !1,         LOGO:'http://lib.diygw.com/static/img/Favicon.png',         title: '小商场'     },     onLoad() {},     onShow() {       const openId = wx.getStorageSync('session3rd')     this.setData({     logged: !!openId     })     openId && setTimeout(this.goIndex, 1500)     },     login() {              this.wechatDecryptData(this.goIndex)           },     goIndex() {     wx.switchTab({       url: '/pages/start/start'     })     },     showModal() {          wx.showModal({             title: '友情提示',              content: '获取用户登录状态失败,请重新登录',              showCancel: !1,          })     },     wechatDecryptData(cb) {                var that= this;               let code;         wx.login({             success: function(res) {               if (res.code) {                   wx.getUserInfo({                     success:function(result){                        // 可以将 res 发送给后台解码出 unionId                          App.globalData.userInfo = result.userInfo                        wx.request({                             url: config.service.sessionUrl,                             data: {code: res.code},                             header:{'content-type': 'application/json'},                              success: function (res) {                                                           wx.setStorageSync('session3rd', res.data.session3rd)                               cb();                             }                       })                                       }                   });               }             }         });             }                    }) var qcloud = require('../../vendor/wafer2-client-sdk/index') var config = require('../../config') var util = require('../../utils/util.js') const App = getApp() Page({     data: {         canEdit: !1,         totalPrice:0,         hasList:false,          // 列表是否有数据         selectAllStatus:true,    // 全选状态,默认全选         obj:{             name:"hello"         },         carts: {             items: [],             params: {                                    page : 1,                 limit: 10,             },             total:1         }           },       onShow() {         this.getCarts()     },     /**      * 加载购物车商品列表      */     getCarts() {         var that=this         const session3rd = wx.getStorageSync('session3rd')           const carts = this.data.carts;         const params = carts.params;         wx.request({            url:config.service.cartUrl,            data:{act:'list',session3rd:session3rd,page:params.page,limit:params.limit},            success:function(result){                  var totalprice=0;                if (result.data.code == 0) {                     result.data.data.items.forEach(function(n){                                             n.num=Math.abs(n.num)                        totalprice=totalprice (n.price*n.num);                     });                     that.setData({                       totalPrice:totalprice,                       hasList: result.data.data.total,                       'carts.items': result.data.data.items,                                         });                 }else if(result.data.code == -4){                     that.showToast(result.data.msg)                     wx.removeStorageSync('session3rd');                                     }             }          })     },     /**      * 加载更多商品      */     onPullDownRefresh() {         this.getCarts()     },     /**      * 查看商品详情      */     navigateTo(e) {            wx.navigateTo({             url:'/pages/goods/detail/index?id=' e.currentTarget.dataset.id                     })     },          /**      * 删除商品      */     del(e) {         var that=this;         const session3rd = wx.getStorageSync('session3rd')           const id = e.currentTarget.dataset.id         wx.showModal({             title: '友情提示',              content: '确定要删除这个宝贝吗?',              success:function(res){                 if (res.confirm == 1) {                     wx.request({                       url: config.service.cartUrl,                       data:{act:'del',id:id,session3rd:session3rd},                       success:function(result){                            if (result.data.code == 0) {                                 that.getCarts()                             }                       }                     });                 }             }         });              },          /**     * 提示     */     showToast(message) {       wx.showToast({         title: message,         icon: 'success',         duration: 1500,       })     },      /**      * 商品数量改变价格重新计算      * id    商品id      * total 商品数量      */     chanGECartTotal:function(id,total){           var that=this         var totalprice=0;         var items = this.data.carts.items;         console.log(id)                 items.forEach(function (n) {             if(n.selected){  //选中                 if(n.id==id){                    n.num=total;                                   totalprice=totalprice (n.price*n.num);                 }else{       &nb

微信小程序商城源码最新更新2018-4-14

评论


亲,登录后才可以留言!

来源:微信小程序商城源码最新更新2018-4-14

源码坊所有素材均为本站用户上传,仅供学习与参考,请勿用于商业用途,如有侵犯您的版权请联系客服服务QQ
本站提供各类程序源码素材。
如果对本站有任何意见请点击右侧侧边栏的反馈意见,我们会及时处理。

本站会员

这个家伙很懒未写签名~