From 085ffd1349ba84a6952f215e3f5d8bd2bbeb6347 Mon Sep 17 00:00:00 2001 From: taiyuan Date: Tue, 6 Apr 2021 14:15:52 +0800 Subject: [PATCH] 分销首页放在主包 --- pages/distribution/distribution.js | 204 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pages/distribution/distribution.json | 5 +++++ pages/distribution/distribution.wxml | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pages/distribution/distribution.wxss | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 554 insertions(+), 0 deletions(-) create mode 100644 pages/distribution/distribution.js create mode 100644 pages/distribution/distribution.json create mode 100644 pages/distribution/distribution.wxml create mode 100644 pages/distribution/distribution.wxss diff --git a/pages/distribution/distribution.js b/pages/distribution/distribution.js new file mode 100644 index 0000000..d39f078 --- /dev/null +++ b/pages/distribution/distribution.js @@ -0,0 +1,204 @@ +// packageA//pages/distribution/main/main.js +const app = getApp(); +let self = null; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + self = this;//保存全局指针 + + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 + self.setData({ + userInfo: data, + }); + }); + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + console.log('onshow'); + let url = '/api/weshop/users/distribut/getMoney'; + if(app.globalData.userInfo) { + if(!this.data.isLogin) { + this.setData({ + userInfo: app.globalData.userInfo, + imghost: app.globalData.setting.imghost, + isLogin: true, + }); + + // 请求数据 + app.request.get(url + '/' + this.data.userInfo.store_id + '/' + this.data.userInfo.user_id, { + success: function(res) { + console.log('success~~`', self.data.userInfo); + if(res.data.code == 0){ + + self.setData({ + data: res.data.data, + }); + + } else { + // if(!res.data.data.is_distribut) {//如果不是分销商:0不是,1是 + + app.request.promiseGet('/api/weshop/users/distribut/getIsDistribut', { + data: { + storeId: self.data.userInfo.store_id, + userId: self.data.userInfo.user_id, + first_leader: self.data.userInfo.first_leader, + }, + isShowLoading: true, + }).then(function(res) { + console.log('!!!===>', res); + self.setData({ + fenxiao: res.data.data, + }); + }); + + // }; + }; + }, + + }); + + + }; + }; + + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + /** + * 点击跳转 + */ + goto(e) { + let url = ''; + if(e.target.dataset.url) { + url = e.target.dataset.url; + } else { + url = e.currentTarget.dataset.url; + } + console.log(url); + app.goto(url); + }, + + + + /** + * 获取输入框 + */ + getInput(e) { + this.setData({ + inputValue: e.detail.value, + }); + }, + + + /** + * 验证 + */ + verify(e) { + let pass = e.target.dataset.pass; + let mobile = 0; + if(this.data.inputValue) { + mobile = this.data.inputValue; + if(!pass) { + app.request.put('/api/weshop/users/distribut/updateUserRecommender', { + data: { + storeId: self.data.userInfo.store_id, + userId: self.data.userInfo.user_id, + mobile: mobile, + }, + success: function (res) { + if(res.code = -1) { + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }); + }; + console.log('!!!===>', res); + + if(res.data.msg == '绑定上下级关系成功!') { + app.request.promiseGet('/api/weshop/users/distribut/getIsDistribut', { + data: { + storeId: self.data.userInfo.store_id, + userId: self.data.userInfo.user_id, + first_leader: self.data.userInfo.first_leader, + }, + isShowLoading: true, + }).then(function(res) { + console.log('!!!===>', res); + self.setData({ + fenxiao: res.data.data, + }); + }); + }; + + } + }); + + } + } else { + wx.showToast({ + title: '手机号码不能为空', + icon: 'none', + duration: 2000 + }); + }; + + }, +}) \ No newline at end of file diff --git a/pages/distribution/distribution.json b/pages/distribution/distribution.json new file mode 100644 index 0000000..fc0a95e --- /dev/null +++ b/pages/distribution/distribution.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "我的分销", + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/pages/distribution/distribution.wxml b/pages/distribution/distribution.wxml new file mode 100644 index 0000000..14ee80e --- /dev/null +++ b/pages/distribution/distribution.wxml @@ -0,0 +1,119 @@ + + + + + + + + {{filter.show_default(userInfo.nickname)}} + + + + + 可提现金额 + {{filter.show_default(data.liudong_money)}} + + + + + {{filter.show_default(data.today_money)}} + 今日收入 + + + {{filter.show_default(data.sales_volume)}} + 总销售额 + + + {{filter.show_default(data.distribut_money)}} + 累计佣金 + + + + + + 上架商品 + 下架商品 + + + + + + 分销订单 + + + + 分销排行 + + + + 我的团队 + + + + 佣金明细 + + + + 我的名片 + + + + 会员中心 + + + + 我的小店 + + + + 新手必看 + + + + + + 分销规则说明 + + + + + + + 仅限PLUS卡({{item.conditonRemark}})的会员, 立即升级 + + + + + + + + + 验证 + + + + + + + + {{item.conditonRemark}} + + + + + + + + 成功成为分销商,分享商品给好友即可获得相应收益 + + + + + 去购买 + + + + + + + diff --git a/pages/distribution/distribution.wxss b/pages/distribution/distribution.wxss new file mode 100644 index 0000000..fca7a37 --- /dev/null +++ b/pages/distribution/distribution.wxss @@ -0,0 +1,226 @@ +page { + background-color: #f4f4f4; +} + +.main > view { + background-color: white; +} + +.avatar-container { + padding-top: 60rpx; + padding-bottom: 60rpx; + background: url(https://mshopimg.yolipai.net/miniapp/images/user_index_powder.jpg) no-repeat 100% 100%; + /* background-size: 100%; */ +} + +.avatar { + width: 160rpx; + height: 160rpx; + border-radius: 50%; + background-color: #eee; +} + +.nickname { + display: inline-block; + background-color: rgba(0,0,0,.5); + padding: 4rpx 20rpx; + color: white; + border-radius: 24rpx; +} + +.pd2622 { + padding: 20rpx 60rpx 20rpx 20rpx; +} + +.money::before { + content: '¥'; + font-size: 24rpx; +} + +/* .bdb { + border-bottom: 2rpx solid #f8f8f8; +} */ + +.arrow-r { + /* display: relative; */ +} + +.arrow-r::after { + font-family: iconfont; + content: '\e61f'; + position: absolute; + right: 20rpx; + color: #ddd; +} +.line { + position: relative; +} +.line::after { + content: ''; + position: absolute; + right: 0; + background-color: #f8f8f8; + width: 2rpx; + height: 30rpx; + top: 50%; + transform: translateY(-50%); +} + +.circle { + width: 80rpx; + height: 80rpx; + line-height: 80rpx; + border-radius: 50%; + color: white; + margin: 0 auto; + background-color: red; +} + +.fs40 { + font-size: 40rpx; +} + + +.bgBlue { + background-image: linear-gradient(to top, #48c6ef 0%, #6f86d6 100%); +} +.bgPink { + background-image: linear-gradient(to right, #b8cbb8 0%, #b8cbb8 0%, #b465da 0%, #cf6cc9 33%, #ee609c 66%, #ee609c 100%); +} +.bgRed { + background-image: linear-gradient(to right, #f78ca0 0%, #f9748f 19%, #fd868c 60%, #fe9a8b 100%); +} +.bgYellow { + background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%); +} +.bgGreen { + background-image: linear-gradient(120deg, #d4fc79 0%, #96e6a1 100%); +} +.bgPurple { + background-image: linear-gradient(to top, #9795f0 0%, #fbc8d4 100%); +} + +.mask { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0,0,0,.5) !important; +} + +.popup { + position: fixed; + z-index: 1; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 90%; + border-radius: 12rpx; + overflow: hidden; +} + +.icon-container { + border-radius: 50%; + background-color: #FCEA0D; + width: 50rpx; + line-height: 50rpx; + height: 50rpx; + text-align: center; + font-size: 28rpx !important; + margin-right: 10rpx; + flex-shrink: 0; +} + +.item { + padding: 20rpx; + display: flex; + align-items: center; + font-size: 26rpx; + position: relative; +} + +.title { + background-image: linear-gradient( 135deg, #FF6768 10%, #EA5455 100%); + color: white; + font-size: 28rpx; + position: relative; +} + +.icon-close { + position: absolute; + right: 20rpx; + color: white; +} + +.verify { + color: white; + background-color: #FF6768; + padding: 0 20rpx; + border-radius: 6rpx; + display: flex; + align-items: center; + margin-left: 10rpx; +} + +.input { + border-radius: 6rpx; + height: 50rpx; +} + +.item ~ .item .left::before { + content: ''; + position: absolute; + left: 45rpx; + top: -45rpx; + width: 2rpx; + height: 100%; + background: linear-gradient(to bottom, #eee, #eee 8rpx, transparent 8rpx, transparent); + background-size: 100% 16rpx; + z-index: -1; +} + +.left { + display: flex; + align-items: center; + padding-right: 20rpx; +} + + +/*checkbox 整体大小 */ +checkbox { + /* width: 240rpx; + height: 90rpx; */ +} +/*checkbox 选项框大小 */ +checkbox .wx-checkbox-input { + width: 34rpx; + height: 34rpx; + border-radius: 50%; + +} +/*checkbox选中后样式 */ +checkbox .wx-checkbox-input.wx-checkbox-input-checked { + background-color: #FF6768; + border-color: #FF6768; + /* color: white; */ +} +/*checkbox选中后图标样式 */ +checkbox .wx-checkbox-input.wx-checkbox-input-checked::before { + width: 34rpx; + height: 34rpx; + line-height: 34rpx; + text-align: center; + font-size: 24rpx; + color: #fff; + background: transparent; + transform: translate(-50%, -50%) scale(1); + -webkit-transform: translate(-50%, -50%) scale(1); +} + +.item:not(:last-of-type) { + display: flex; + justify-content: space-between; +} + + -- libgit2 0.21.4