From a5121a3266b4208b81cf84f705a70e8e6271eb53 Mon Sep 17 00:00:00 2001 From: taiyuan Date: Tue, 30 Mar 2021 16:04:48 +0800 Subject: [PATCH] 分销功能 --- packageA/pages/distribution/card/card.js | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/card/card.json | 7 +++++++ packageA/pages/distribution/card/card.wxml | 29 +++++++++++++++++++++++++++++ packageA/pages/distribution/card/card.wxss | 41 +++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/commision/commision.js | 382 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/commision/commision.json | 7 +++++++ packageA/pages/distribution/commision/commision.wxml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/commision/commision.wxss | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/goods/goods.js | 741 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/goods/goods.json | 7 +++++++ packageA/pages/distribution/goods/goods.wxml | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/goods/goods.wxss | 328 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/main/main.js | 247 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/main/main.json | 5 +++++ packageA/pages/distribution/main/main.wxml | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/main/main.wxss | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/myteam/myteam.js | 272 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/myteam/myteam.json | 7 +++++++ packageA/pages/distribution/myteam/myteam.wxml | 23 +++++++++++++++++++++++ packageA/pages/distribution/myteam/myteam.wxss | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/order/order.js | 275 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/order/order.json | 7 +++++++ packageA/pages/distribution/order/order.wxml | 44 ++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/order/order.wxss | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/rank/rank.js | 287 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/rank/rank.json | 7 +++++++ packageA/pages/distribution/rank/rank.wxml | 43 +++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/rank/rank.wxss | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/rookie/rookie.js | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/rookie/rookie.json | 7 +++++++ packageA/pages/distribution/rookie/rookie.wxml | 7 +++++++ packageA/pages/distribution/rookie/rookie.wxss | 1 + packageA/pages/distribution/shop/shop.js | 450 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/shop/shop.json | 7 +++++++ packageA/pages/distribution/shop/shop.wxml | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/distribution/shop/shop.wxss | 399 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 36 files changed, 5020 insertions(+), 0 deletions(-) create mode 100644 packageA/pages/distribution/card/card.js create mode 100644 packageA/pages/distribution/card/card.json create mode 100644 packageA/pages/distribution/card/card.wxml create mode 100644 packageA/pages/distribution/card/card.wxss create mode 100644 packageA/pages/distribution/commision/commision.js create mode 100644 packageA/pages/distribution/commision/commision.json create mode 100644 packageA/pages/distribution/commision/commision.wxml create mode 100644 packageA/pages/distribution/commision/commision.wxss create mode 100644 packageA/pages/distribution/goods/goods.js create mode 100644 packageA/pages/distribution/goods/goods.json create mode 100644 packageA/pages/distribution/goods/goods.wxml create mode 100644 packageA/pages/distribution/goods/goods.wxss create mode 100644 packageA/pages/distribution/main/main.js create mode 100644 packageA/pages/distribution/main/main.json create mode 100644 packageA/pages/distribution/main/main.wxml create mode 100644 packageA/pages/distribution/main/main.wxss create mode 100644 packageA/pages/distribution/myteam/myteam.js create mode 100644 packageA/pages/distribution/myteam/myteam.json create mode 100644 packageA/pages/distribution/myteam/myteam.wxml create mode 100644 packageA/pages/distribution/myteam/myteam.wxss create mode 100644 packageA/pages/distribution/order/order.js create mode 100644 packageA/pages/distribution/order/order.json create mode 100644 packageA/pages/distribution/order/order.wxml create mode 100644 packageA/pages/distribution/order/order.wxss create mode 100644 packageA/pages/distribution/rank/rank.js create mode 100644 packageA/pages/distribution/rank/rank.json create mode 100644 packageA/pages/distribution/rank/rank.wxml create mode 100644 packageA/pages/distribution/rank/rank.wxss create mode 100644 packageA/pages/distribution/rookie/rookie.js create mode 100644 packageA/pages/distribution/rookie/rookie.json create mode 100644 packageA/pages/distribution/rookie/rookie.wxml create mode 100644 packageA/pages/distribution/rookie/rookie.wxss create mode 100644 packageA/pages/distribution/shop/shop.js create mode 100644 packageA/pages/distribution/shop/shop.json create mode 100644 packageA/pages/distribution/shop/shop.wxml create mode 100644 packageA/pages/distribution/shop/shop.wxss diff --git a/packageA/pages/distribution/card/card.js b/packageA/pages/distribution/card/card.js new file mode 100644 index 0000000..85062bc --- /dev/null +++ b/packageA/pages/distribution/card/card.js @@ -0,0 +1,93 @@ +// packageA//pages/distribution/card/card.js +const app = getApp(); +let self = null; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + isLogin: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + self = this;//保存全局指针 + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 + self.setData({ + userInfo: data, + }); + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if(app.globalData.userInfo) { + if(!this.data.isLogin) { + this.setData({ + userInfo: app.globalData.userInfo, + imghost: app.globalData.setting.imghost, + isLogin: true, + }); + // 请求数据 + wx.getImageInfo({ + src: 'https://test-weshop.xinda100.cn/api/wx/open/app/user/getWeAppEwm/1?sceneValue=6519836&pageValue=pages/index/index/index', + success (res) { + self.setData({ + img: res.path, + }); + } + }); + + }; + }; + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + +}) \ No newline at end of file diff --git a/packageA/pages/distribution/card/card.json b/packageA/pages/distribution/card/card.json new file mode 100644 index 0000000..0f67677 --- /dev/null +++ b/packageA/pages/distribution/card/card.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "qrcode": "/components/qr_code/qr_code" + }, + "navigationBarTitleText": "我的名片", + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/packageA/pages/distribution/card/card.wxml b/packageA/pages/distribution/card/card.wxml new file mode 100644 index 0000000..b96e1bd --- /dev/null +++ b/packageA/pages/distribution/card/card.wxml @@ -0,0 +1,29 @@ + + + + + + + {{userInfo.nickname}} + {{userInfo.mobile}} + + + + + + + + 扫码进入我的小店 + 现在就一起欢乐购吧~ + + + + + 长按识别小程序码,即可买买买~ + + + + + + + \ No newline at end of file diff --git a/packageA/pages/distribution/card/card.wxss b/packageA/pages/distribution/card/card.wxss new file mode 100644 index 0000000..53244e3 --- /dev/null +++ b/packageA/pages/distribution/card/card.wxss @@ -0,0 +1,41 @@ +page, +.main { + width: 100%; + height: 100%; +} + +.main { + position: relative; + background-image: linear-gradient(-225deg,#F8C9CF,#F76275); +} + +.panel { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + border-radius: 20rpx; + background-color: #fff; + padding: 60rpx; + width: 60%; +} + +.avatar { + background-color: #eee; + border-radius: 50%; + width: 120rpx; + height: 120rpx; +} + + +.qrCode-container { + /* width: 400rpx; + height: 400rpx; */ + /* margin: 0 auto; */ +} +.qrCode { + display: block; + width: 400rpx; + height: 400rpx; + margin: 0 auto; +} \ No newline at end of file diff --git a/packageA/pages/distribution/commision/commision.js b/packageA/pages/distribution/commision/commision.js new file mode 100644 index 0000000..67603f4 --- /dev/null +++ b/packageA/pages/distribution/commision/commision.js @@ -0,0 +1,382 @@ +// packageA//pages/distribution/commision/commision.js +const app = getApp(); +let self = null; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + isHiddenDropdown: true,//控制下拉菜单显隐 + dropdownArr: ['综合','未付款','已付款','待分成','已分成','已取消'], + statusArr: ['未付款', '已付款', '等待分成', '已分成', '已取消'], + currentSelect: '',//记录当前下拉菜单选中项 + isInputFocus: false,//记录搜索输入框是否聚焦 + inputVal: '',//记录搜索输入框的内容 + isSort: false,//控制排序开关状态,true开启排序 + isDescending: false, //isDescending降序,ascending升序 + currentQuery: null,//保存当前请求参数 + + list: null, + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 + pageNum: 1, // 当前页数 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + currentSelect: this.data.dropdownArr[0], + }); + + self = this;//保存全局指针 + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 + self.setData({ + userInfo: data, + }); + }); + // 判断会员是否授权登录, + // 没有登录则跳转到登录页, + // 已登录则设置已登录状态,请求加载签到数据 + // isLogin记录登录状态 + // app.isLogin().then(function(data) { + // console.log('data', data); + // // 1.登录成功 + // self.setData({ + // isLogin: true, + // userInfo: data, + // currentQuery: { + // store_id: app.globalData.setting.stoid, + // user_id: app.globalData.user_id, + // }, + // }); + // // 2.请求数据 + // self.getData(true, '/api/weshop/rebateLog/commissionlist', self.data.currentQuery); + + // }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + if(app.globalData.userInfo) { + if(!this.data.isLogin) { + this.setData({ + userInfo: app.globalData.userInfo, + imghost: app.globalData.setting.imghost, + currentQuery: { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + }, + isLogin: true, + }); + + // 请求数据 + this.getData(true, '/api/weshop/rebateLog/commissionlist', this.data.currentQuery); + + }; + }; + + + // if(app.globalData.userInfo instanceof Object) { + // this.setData({ + // userInfo: app.globalData.userInfo, + // imghost: app.globalData.setting.imghost, + // currentQuery: { + // store_id: app.globalData.setting.stoid, + // user_id: app.globalData.user_id, + // }, + // }); + // // 检测从登录页返回后的登录状态 + // if(this.data.isLogin) { + // // 初次就授权登录 + // return; + // } else { + // // 初次未授权登录,过后才授权 + // this.setData({ + // isLogin: true + // }); + // // 请求数据 + // this.getData(true, '/api/weshop/rebateLog/commissionlist', this.data.currentQuery); + // }; + // }; + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.scrollToLower('/api/weshop/rebateLog/commissionlist', this.data.currentQuery); + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + /** + * 点击下拉菜单 + */ + clickDropdown() { + this.setData({ + isHiddenDropdown: !this.data.isHiddenDropdown, + }); + }, + + /** + * 点击遮罩层 + */ + clickMask() { + this.setData({ + isHiddenDropdown: true, + }); + }, + + /** + * 选择下拉菜单项 + */ + selectDropdown(e) { + let status = null; + let currentIndex = e.target.dataset.index; + let data = this.data.currentQuery; + + if(data.status) {//清除status + delete data.status; + }; + if(data.page && data.page != 1) {//清除page + delete data.page; + }; + if(data.orderField) {//清除orderField + delete data.orderField; + }; + if(data.orderType) {//清除orderType + delete data.orderType; + }; + if(data.key) {//清除搜索输入框 + delete data.key; + }; + + if(currentIndex != 0) { + status = currentIndex - 1; + data.status = status; + }; + + this.setData({ + list: null, //清空列表 + isSort: false,//关闭排序 + isDescending: false, + noMore: false, + pageNum: 1, + isHiddenDropdown: true, + currentSelect: this.data.dropdownArr[currentIndex], + currentQuery: data,//保存当前请求参数 + inputVal: '', + }); + + this.getData(true, '/api/weshop/rebateLog/commissionlist', data); + }, + + /** + * 搜索输入框聚焦 + */ + inputFocus() { + this.setData({ + isInputFocus: true, + }); + }, + + /** + * 搜索输入框失焦 + */ + inputBlur() { + this.setData({ + isInputFocus: false, + }); + }, + + /** + * 搜索输入框输入内容 + */ + input(e) { + this.data.inputVal = e.detail.value; + }, + + /** + * 搜索输入框清空内容 + */ + inputClear() { + let inputVal = this.data.inputVal; + if(inputVal) { + this.setData({ + inputVal: '', + }); + }; + }, + + /** + * 点击搜索 + */ + search() { + let data = { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + }; + if(this.data.inputVal) { + data.key = this.data.inputVal; + }; + this.setData({ + currentQuery: data, + currentSelect: this.data.dropdownArr[0], + }); + this.getData(true, '/api/weshop/rebateLog/commissionlist', this.data.currentQuery); + }, + + /** + * 点击佣金排序 + */ + clickSort() { + let orderType = ''; + let data = this.data.currentQuery; + + if(!this.data.isHiddenDropdown) { + this.setData({ + isHiddenDropdown: true, + }); + }; + + + if(data.page && data.page != 1) {//清除page + delete data.page; + }; + if(data.orderType) {//清除orderType + delete data.orderType; + }; + if(data.key) {//清除搜索输入框 + delete data.key; + }; + + if(this.data.isDescending) { + orderType = 'desc'; + } else { + orderType = 'asc'; + }; + data.orderField = 'money'; + data.orderType = orderType; + + this.setData({ + list: null, + noMore: false, + pageNum: 1, + isSort: true, + isDescending: !this.data.isDescending, + currentQuery: data, + }); + this.getData(true, '/api/weshop/rebateLog/commissionlist', this.data.currentQuery); + }, + + /** + * 请求数据 + */ + getData: function(isInit, url, data) { + app.request.promiseGet(url, { + data: data, + isShowLoading: true, + }) + .then(function(res) { + // console.log('1121', res.data.code); + if(res.data.code == 0) { + + self.setData({ + isLoading: false + }); + + if(isInit) {// 第一次加载 + self.setData({ + list: res.data.data + }); + } else { + self.setData({ + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) + }); + }; + + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { + self.setData({ + noMore: true + }); + }; + + } else { + self.setData({ + 'list.pageData': [] + }); + }; + + }) + .catch(function(err) { + console.log('出错拉!!!!',err); + self.setData({ + 'list.pageData': [] + }); + }); + }, + + + // 上拉加载 + scrollToLower(url, requestData) { + // 数据总量 + let total = this.data.list.total; + // 单页最大数据量 + let pageSize = this.data.list.pageSize; + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ + if((total != 0)&&(total <= pageSize)) { + this.setData({ + noMore: true + }); + }; + + if(!this.data.isLoading && !this.data.noMore) { + this.setData({ + isLoading: true, + pageNum: this.data.pageNum + 1 + }); + requestData.page = this.data.pageNum; + this.getData(false, url, requestData); + }; + }, +}) \ No newline at end of file diff --git a/packageA/pages/distribution/commision/commision.json b/packageA/pages/distribution/commision/commision.json new file mode 100644 index 0000000..dcfaf37 --- /dev/null +++ b/packageA/pages/distribution/commision/commision.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "nodata": "/components/nodata/nodata" + }, + "navigationBarTitleText": "佣金明细", + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/packageA/pages/distribution/commision/commision.wxml b/packageA/pages/distribution/commision/commision.wxml new file mode 100644 index 0000000..11d99c3 --- /dev/null +++ b/packageA/pages/distribution/commision/commision.wxml @@ -0,0 +1,56 @@ + + + + + + + + + + + 搜索 + + + + + {{currentSelect}} + 佣金 + + + + + + + + + + + + + + {{filter.format_time(item.create_time, 1)}} + {{filter.status(item.status, statusArr)}} + + 订单号:{{item.order_sn}} + + + 订单金额 + {{item.goods_price}} + + + 分成金额 + {{item.money}} + + + 购买者 + {{item.nickname}} + + + + + + + + \ No newline at end of file diff --git a/packageA/pages/distribution/commision/commision.wxss b/packageA/pages/distribution/commision/commision.wxss new file mode 100644 index 0000000..e04d3ea --- /dev/null +++ b/packageA/pages/distribution/commision/commision.wxss @@ -0,0 +1,159 @@ +page { + background-color: #f4f4f4; +} + +.input-container { + position: relative; + background-color: #f0f0f0; + border-radius: 6rpx; +} +.input-container::before { + content: '\e618'; + font-family: iconfont; + position: absolute; + top: 50%; + left: 16rpx; + transform: translateY(-40%); + color: #aaa; +} +.input-container .icon-guanbi { + position: absolute; + top: 50%; + right: 16rpx; + transform: translateY(-40%); + font-size: 28rpx; + color: #aaa; + padding: 10rpx; + z-index: 2; +} +.input { + padding: 10rpx 50rpx; +} + +.time::before { + content: '\e64c'; + font-family: iconfont; + padding-right: 10rpx; + color: #FF6768; +} + +.icon-xia, +.icon-shang { + font-size: 16rpx; +} +.icon-sort2 { + font-size: 24rpx; +} + +.line { + position: relative; +} +.line::after { + content: ''; + position: absolute; + right: 0; + background-color: #f4f4f4; + width: 2rpx; + height: 30rpx; + top: 50%; + transform: translateY(-50%); +} + +.item { + border-radius: 12rpx; + background-color: white; +} + +.item ~ .item { + margin-top: 20rpx; +} + +.money { + /* word-break: break-all; + word-wrap: break-word; */ +} + +.money::before { + content: '¥'; + font-size: 22rpx; +} + +.md { + position: relative; +} +.md::before, +.md::after { + content: ''; + position: absolute; + top: 50%; + transform: translateY(-50%); + width: 2rpx; + height: 40%; + background-color: #f4f4f4; +} +.md::before { + left: 0; +} +.md::after { + right: 0; +} + +.noMore { + padding: 20rpx; + color: #bbb; + text-align: center; + font-size: 26rpx; + background-color: transparent !important; +} + +.head { + position: sticky; + top: 0; + z-index: 1; +} + +.dropdown { + border-top: 2rpx solid #f8f8f8; + position: absolute; + width: 100%; + top: 54rpx; + left: 0; + background-color: white; + z-index: 1; +} + + +.active { + color: #FF6768; + font-weight: bold; + position: relative; +} + + +.mask { + position: fixed; + width: 100%; + height: 100%; + background-color: rgba(0,0,0,.5); +} + +.hover { + background-color: #eee; +} + +.t-icon-sort-up { + width: 12px; + height: 12px; + position: relative; + top: 2rpx; + right: 0; + background-repeat: no-repeat; + box-sizing: border-box; +} + +.t-icon-sort-up.reverse { + transform: rotateZ(-180deg); +} + + + diff --git a/packageA/pages/distribution/goods/goods.js b/packageA/pages/distribution/goods/goods.js new file mode 100644 index 0000000..853501e --- /dev/null +++ b/packageA/pages/distribution/goods/goods.js @@ -0,0 +1,741 @@ +// packageA//pages/distribution/commision/commision.js +const app = getApp(); +let self = null; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + isInputFocus: false,//记录搜索输入框是否聚焦 + inputVal: '',//记录搜索输入框的内容 + isSort: false,//控制排序开关状态,true开启排序 + isDescending: false, //isDescending降序,ascending升序 + + + tabArr: [], + currentTabIndex: 0, + isShowRow: false,//控制视图切换状态 + isHiddenDropdown: true,//控制筛选下拉菜单显隐 + + list: null, + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 + pageNum: 1, // 当前页数 + + isCheckAll: false, //记录是否全选 + currentQuery: { + store_id: app.globalData.setting.stoid, + }, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + self = this;//保存全局指针 + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 + self.setData({ + userInfo: data, + }); + }); + + + //动态设置标题:0选择商品,1上架商品 + let title = ''; + let tabArr = []; + if(options.index == 0) { + title = '选择上架商品'; + tabArr = ['最新','销量','评论','价格']; + } else { + title = '选择下架商品'; + tabArr = ['已选','必营','销量','价格']; + }; + wx.setNavigationBarTitle({ + title, + }); + this.setData({ + options, + tabArr, + }); + + + + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let url = '/api/weshop/goods/page'; + let currentQuery = this.data.currentQuery; + if(app.globalData.userInfo) { + if(!this.data.isLogin) { + this.setData({ + userInfo: app.globalData.userInfo, + imghost: app.globalData.setting.imghost, + isLogin: true, + 'currentQuery.user_id': app.globalData.user_id, + }); + + if(this.data.options.index == 0) {//上架商品 + // 请求数据 + currentQuery.is_mainshow = 1; + currentQuery.isonsale = 1; + // url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; + // this.getData(true, '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1', this.data.currentQuery); + } else {//下架商品 + currentQuery.searchtype = 1; + // url = '/api/weshop/goods/page?dis_type=1'; + // this.getData(true, '/api/weshop/goods/page?dis_type=1', this.data.currentQuery); + }; + currentQuery.dis_type = 1; + this.getData(true, url, currentQuery); + + // 加载筛选条件:国别 + app.request.promiseGet('/api/weshop/goods/listGroupnation', { + data: currentQuery, + // isShowLoading: true, + }).then(function(res) { + console.log('nation=====>', res.data.data); + self.setData({ + nationList: res.data.data, + }); + }); + // 加载筛选条件:品牌 + app.request.promiseGet('/api/weshop/goods/listGroupbrand', { + data: currentQuery, + // isShowLoading: true, + }).then(function(res) { + console.log('brand=====>', res.data.data); + self.setData({ + brandList: res.data.data, + }); + }); + }; + }; + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + let data = this.data.currentQuery; + let options = this.data.options; + let url = ''; + + if(options.index == 0) { + url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; + } else { + url = '/api/weshop/goods/page'; + }; + + + this.scrollToLower(url, data, function() { + let items = self.data.list.pageData; + let values = self.data.checkedArr; + let isCheckAll = self.data.isCheckAll; + + if(items.length == values.length) { + if(!isCheckAll) { + isCheckAll = !isCheckAll; + }; + } else { + if(isCheckAll) { + isCheckAll = !isCheckAll; + }; + }; + + self.setData({ + isCheckAll, + }); + }); + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + /** + * 点击下拉菜单 + */ + clickDropdown() { + this.setData({ + isHiddenDropdown: !this.data.isHiddenDropdown, + }); + }, + + /** + * 点击遮罩层 + */ + clickMask() { + this.setData({ + isHiddenDropdown: true, + }); + }, + + /** + * 选择下拉菜单项 + */ + selectDropdown(e) { + let currentIndex = e.target.dataset.index; + this.setData({ + isHiddenDropdown: true, + currentSelect: this.data.dropdownArr[currentIndex], + }); + }, + + /** + * 搜索输入框聚焦 + */ + inputFocus() { + this.setData({ + isInputFocus: true, + }); + }, + + /** + * 搜索输入框失焦 + */ + inputBlur() { + this.setData({ + isInputFocus: false, + }); + }, + + /** + * 搜索输入框输入内容 + */ + input(e) { + this.data.inputVal = e.detail.value; + }, + + /** + * 搜索输入框清空内容 + */ + inputClear() { + let inputVal = this.data.inputVal; + console.log('input', inputVal); + if(inputVal) { + this.setData({ + inputVal: '', + }); + }; + }, + + /** + * 点击搜索 + */ + search(callback) { + let url = ''; + let data = this.data.currentQuery; + if(data.orderField) delete data.orderField; + if(data.orderType) delete data.orderType; + if(this.data.inputVal) { + data.key = this.data.inputVal; + }; + if(this.data.isHiddenDropdown) { + if(data.nation_id) delete data.nation_id; + if(data.brand_id) delete data.brand_id; + if(data.startprice) delete data.startprice; + if(data.endprice) delete data.endprice; + }; + this.setData({ + list: null, + currentTabIndex: 5 + }); + // console.log('data', data); + + + if(this.data.options.index == 0) {//上架商品 + url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; + } else {//下架商品 + data.dis_type = 1; + url = '/api/weshop/goods/page?searchtype=1'; + }; + this.getData(true, url, data) + .then(function() { + callback(); + }); + }, + + /** + * 点击排序 + */ + clickSort() { + let data = this.data.currentQuery; + if(!this.data.isSort) { + this.setData({ + isSort: true, + }); + } else { + this.setData({ + isDescending: !this.data.isDescending, + }); + }; + if(this.data.isDescending) { + data.orderType = 'desc'; + } else { + data.orderType = 'asc'; + }; + }, + + /** + * 点击视图切换按钮 + */ + change() { + this.setData({ + isShowRow: !this.data.isShowRow + }); + }, + + /** + * 点击Tab + */ + clickTab(e) { + let url = ''; + let isSort = this.data.isSort; + let data = this.data.currentQuery; + let isDescending = this.data.isDescending; + let currentIndex = e.target.dataset.index; + let options = this.data.options; + + if(currentIndex != 3) { + if(isSort) { + isSort = false; + }; + if(isDescending) { + isDescending = false; + }; + }; + if(data.page) delete data.page; + if(data.key) delete data.key; + + this.setData({ + currentTabIndex: currentIndex, + isSort, + isDescending, + list: null, + noMore: false, + pageNum: 1, + isCheckAll: false, //清除全选状态 + }); + + switch(currentIndex) { + case 0: { + if(data.orderField) delete data.orderField; + if(data.orderType) delete data.orderType; + if(options.index == 1) {//下架:已选 + data.searchtype = 1; + data.dis_type = 1; + }; + break; + }; + case 1: { + if(options.index == 0) {//上架:销量排序 + if(data.orderType) delete data.orderType; + data.orderField = 'sales_sum'; + } else {//下架:必营 + if(data.searchtype) delete data.searchtype; + if(data.orderField) delete data.orderField; + if(data.orderType) delete data.orderType; + data.dis_type = 0; + }; + break; + }; + case 2: { + if(options.index == 0) {//上架:评论排序 + if(data.orderType) delete data.orderType; + data.orderField = 'comment_count'; + } else {//下架:销量排序 + if(data.orderType) delete data.orderType; + data.orderField = 'sales_sum'; + data.dis_type = 1; + data.searchtype = 1; + }; + break; + }; + case 3: { + data.orderField = 'shop_price'; + data.dis_type = 1; + break; + }; + }; + + if(options.index == 0) { + url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; + } else { + url = '/api/weshop/goods/page'; + }; + this.getData(true, url, data); + }, + + /** + * 点击筛选 + */ + clickFilter() { + this.setData({ + isHiddenDropdown: !this.data.isHiddenDropdown, + }); + }, + + /** + * 点击遮罩层,关闭筛选下拉菜单 + */ + clickMask() { + if(!this.data.isHiddenDropdown) { + this.setData({ + isHiddenDropdown: true, + }); + } + }, + + /** + * promiseGet请求数据 + */ + getData: function(isInit, url, data) { + return new Promise(function(resolve, reject) { + + app.request.promiseGet(url, { + data: data, + isShowLoading: true, + }) + .then(function(res) { + // console.log('1121', res.data.code); + if(res.data.code == 0) { + + self.setData({ + isLoading: false + }); + + if(isInit) {// 第一次加载 + self.setData({ + list: res.data.data + }); + } else { + self.setData({ + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) + }); + }; + + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { + self.setData({ + noMore: true + }); + }; + + } else { + self.setData({ + 'list.pageData': [] + }); + }; + resolve(); + }) + .catch(function(err) { + console.log('出错拉!!!!',err); + self.setData({ + 'list.pageData': [] + }); + }); + + }); + + }, + + + /** + * 上拉加载数据 + */ + scrollToLower(url, requestData, callback) { + // 数据总量 + let total = this.data.list.total; + // 单页最大数据量 + let pageSize = this.data.list.pageSize; + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ + if((total != 0)&&(total <= pageSize)) { + this.setData({ + noMore: true + }); + }; + + if(!this.data.isLoading && !this.data.noMore) { + this.setData({ + isLoading: true, + pageNum: this.data.pageNum + 1 + }); + requestData.page = this.data.pageNum; + + this.getData(false, url, requestData) + .then(function() { + callback(); + }); + }; + }, + + /** + * 点击多选框 + */ + checkboxChange(e) { + // 全选的情况下,取消选择某个单项,全选状态取消 + // 手动选择所有单项,全选状态点亮 + let items = this.data.list.pageData; + let values = e.detail.value; + let isCheckAll = this.data.isCheckAll; + + if(items.length == values.length) { + if(!isCheckAll) { + isCheckAll = !isCheckAll; + }; + } else { + if(isCheckAll) { + isCheckAll = !isCheckAll; + }; + }; + + this.setData({ + isCheckAll, + checkedArr: values, + }); + // console.log('选择的数组1',values); + }, + + /** + * 全选 + */ + clickCheckAll(e) { + let checkedArr = []; + let items = this.data.list.pageData; + for(let i = 0, length = items.length; i < length; i++) { + items[i].checked = !this.data.isCheckAll; + if(items[i].checked) { + checkedArr.push(items[i].goods_id); + }; + }; + this.setData({ + 'list.pageData': items, + isCheckAll: !this.data.isCheckAll, + checkedArr, + }); + // console.log('选择的数组',checkedArr); + }, + + /** + * 处理多选的e.detail.value + */ + handleValues(arr) { + if(arr) { + let newArr = []; + arr.forEach(function(item, index) { + newArr.push({'goods_id': item}); + }); + // console.log('newArr', newArr); + return newArr; + }; + }, + + /** + * 一键上架 + */ + putOn() { + let checkedArr = this.data.checkedArr; + let checkedList = this.handleValues(checkedArr); + + app.request.promisePost('/api/weshop/users/distribut/UpGoods', { + is_json: true, + data: { + storeId: app.globalData.setting.stoid, + userId: app.globalData.user_id, + goods: checkedList, + }, + }).then(function() { + self.setData({ + isCheckAll: false, + }); + self.getData(true, '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1', self.data.currentQuery); + }); + }, + + /** + * 一键下架 + */ + pullOff() { + let data = { + storeId: app.globalData.setting.stoid, + userId: app.globalData.user_id, + }; + let isCheckAll = this.data.isCheckAll; + + if(isCheckAll) { + // console.log('全选啦~'); + data.type = 1; + } else { + let checkedArr = this.data.checkedArr; + let checkedList = this.handleValues(checkedArr); + data.goods = checkedList; + }; + + app.request.promisePost('/api/weshop/users/distribut/DownGoods', { + is_json: true, + data: data, + }).then(function() { + // console.log('data', self.data.currentQuery); + self.setData({ + isCheckAll: false, + }); + self.getData(true, '/api/weshop/goods/page?dis_type=1&searchtype=1', self.data.currentQuery); + }); + }, + + /** + * 点击跳转 + */ + goto(e) { + let url = ''; + if(e.target.dataset.name == 'checkbox') { + return; + } else { + if(e.target.dataset.url) { + url = e.target.dataset.url; + } else { + url = e.currentTarget.dataset.url; + } + app.goto(url); + }; + }, + + + /** + * 筛选:选择 + */ + select(e) { + let currentIndex = e.target.dataset.index; + let name = e.target.dataset.name; + let id = e.target.dataset.id; + let currentQuery = this.data.currentQuery; + + switch(name) { + case 'nation': { + this.setData({ + nationIndex: currentIndex, + }); + currentQuery.nation_id = id; + break; + }; + case 'brand': { + this.setData({ + brandIndex: currentIndex, + }); + currentQuery.brand_id = id; + break; + }; + }; + + }, + + + /** + * 筛选:获取价格区间 + */ + getPrice(e) { + let isMax = e.target.dataset.ismax; + let price = e.detail.value; + let currentQuery = this.data.currentQuery; + + if(isMax == 0) { + currentQuery.startprice = price; + } else { + currentQuery.endprice = price; + }; + }, + + /** + * 筛选:点击确定 + */ + startFilter() { + let data = this.data.currentQuery; + let startprice = parseFloat(data.startprice); + let endprice = parseFloat(data.endprice); + + // 如果筛选条件为空,按确定按钮不发送请求 + if(!data.nation_id && !data.brand_id && !startprice && !endprice && !this.data.inputVal) { + this.setData({ + isHiddenDropdown: true, + }); + return; + }; + + if(startprice && endprice) { + if(startprice > endprice) { + wx.showToast({ + title: '最低价不能高于最高价', + icon: 'none', + duration: 2000 + }); + return; + }; + }; + if(!this.data.inputVal) { + if(data.key) delete data.key; + }; + + this.search(function() { + self.setData({ + isHiddenDropdown: true, + }); + }); + }, + + /** + * 筛选:重置 + */ + reset() { + let data = this.data.currentQuery; + + if(data.nation_id) delete data.nation_id; + if(data.brand_id) delete data.brand_id; + if(data.startprice) delete data.startprice; + if(data.endprice) delete data.endprice; + if(data.key) delete data.key; + + this.setData({ + nationIndex: null, + brandIndex: null, + price: null, + inputVal: null, + }); + } +}) \ No newline at end of file diff --git a/packageA/pages/distribution/goods/goods.json b/packageA/pages/distribution/goods/goods.json new file mode 100644 index 0000000..8ed1185 --- /dev/null +++ b/packageA/pages/distribution/goods/goods.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "nodata": "/components/nodata/nodata" + }, + "navigationBarTitleText": "我的名片", + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/packageA/pages/distribution/goods/goods.wxml b/packageA/pages/distribution/goods/goods.wxml new file mode 100644 index 0000000..584ef5c --- /dev/null +++ b/packageA/pages/distribution/goods/goods.wxml @@ -0,0 +1,125 @@ + + + + + + + + + + 筛选 + + + + + + + + + {{item}} + + {{item}} + + + + + + + + + + + + + + + + + + + + {{item.goods_name}} + + 1.00 + 分成金额:{{item.commission}} + + + + + + + + + + + {{item.goods_name}} + + + + 1.00 + 分成金额:{{item.commission}} + + + + + + + + + + + + + + + + + + + 一键上架 + 一键下架 + + + + + diff --git a/packageA/pages/distribution/goods/goods.wxss b/packageA/pages/distribution/goods/goods.wxss new file mode 100644 index 0000000..8a17232 --- /dev/null +++ b/packageA/pages/distribution/goods/goods.wxss @@ -0,0 +1,328 @@ +page { + background-color: #f4f4f4; +} + +.input-container { + position: relative; + background-color: #f0f0f0; + border-radius: 6rpx; +} +.input-container::before { + content: '\e618'; + font-family: iconfont; + position: absolute; + top: 50%; + left: 16rpx; + transform: translateY(-40%); + color: #aaa; +} +.input-container .icon-guanbi { + position: absolute; + top: 50%; + right: 16rpx; + transform: translateY(-40%); + font-size: 28rpx; + color: #aaa; + padding: 10rpx; + z-index: 2; +} +.input { + padding: 10rpx 50rpx; +} + +.time::before { + content: '\e64c'; + font-family: iconfont; + padding-right: 10rpx; + color: #FF6768; +} + +.icon-xia, +.icon-shang { + font-size: 16rpx; +} +.icon-sort2 { + font-size: 24rpx; +} + +/* .line { + position: relative; +} +.line::after { + content: ''; + position: absolute; + right: 0; + background-color: #f4f4f4; + width: 2rpx; + height: 30rpx; + top: 50%; + transform: translateY(-50%); +} */ + +/* .item { + border-radius: 12rpx; + background-color: white; +} */ + +/* .item ~ .item { + margin-top: 20rpx; +} */ + +.money { + /* word-break: break-all; + word-wrap: break-word; */ +} + +.money::before { + content: '¥'; + font-size: 22rpx; +} + +.md { + position: relative; +} +.md::before, +.md::after { + content: ''; + position: absolute; + top: 50%; + transform: translateY(-50%); + width: 2rpx; + height: 40%; + background-color: #f4f4f4; +} +.md::before { + left: 0; +} +.md::after { + right: 0; +} + +.noMore { + padding: 20rpx; + color: #bbb; + text-align: center; + font-size: 26rpx; + background-color: transparent !important; +} + +.head { + position: sticky; + top: 0; + z-index: 1; +} + +.dropdown { + border-top: 2rpx solid #f8f8f8; + position: absolute; + width: 100%; + top: 54rpx; + left: 0; + background-color: white; + z-index: 1; +} + + +.active { + color: #FF6768; + font-weight: bold; + position: relative; +} + +.active::after { + content: ''; + width: 30%; + height: 2rpx; + background-color: #FF6768; + position: absolute; + left: 0; + right: 0; + bottom: 0; + margin: 0 auto; +} + + +.mask { + position: fixed; + width: 100%; + height: 100%; + background-color: rgba(0,0,0,.5); +} + +.hover { + background-color: #eee; +} + +.t-icon-sort-up { + width: 12px; + height: 12px; + position: relative; + top: 2rpx; + right: 0; + background-repeat: no-repeat; + box-sizing: border-box; +} + +.t-icon-sort-up.reverse { + transform: rotateZ(-180deg); +} + + + + +.img { + width: 240rpx; + height: 240rpx; + background-color: #eee; +} + +.img2 { + display: block; + width: 100%; + height: 340rpx; + /* height: auto; */ + /* width: 200rpx; + height: 200rpx; */ + background-color: white; +} + + +/*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); +} + +.bottomBar { + box-sizing: border-box; + position: fixed; + bottom: 0; + width: 100%; + background-color: white; + border-radius: 20rpx 20rpx 0 0; +} + +.btn { + color: white; + background-color: #FF6768; + border-radius: 6rpx; +} + +/* .item { + border-radius: 10rpx; +} */ + +.item2 { + width: calc((100% - 20rpx)/2); + box-sizing: border-box; + border-radius: 12rpx; + overflow: hidden; + margin-bottom: 20rpx; + display: flex; + flex-direction: column; +} + +.item2:nth-child(even) { + margin-left: 20rpx; +} + +.content { + padding-bottom: 110rpx; +} + +.dropdown { + position: absolute; + left: 0; + top: 114rpx; + width: 100%; + background-color: white; + box-sizing: border-box; +} + +.label { + display: inline-block; + padding: 5rpx 20rpx; + color: #aaa; + border: 2rpx solid #eee; + background-color: #f8f8f8; + border-radius: 6rpx; + box-sizing: border-box; + text-align: center; +} + + +.mask { + display: none; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background-color: rgba(0,0,0,.5); + z-index: -1; +} + +.bsbb { + box-sizing: border-box; +} + +.l-red { + background-image: linear-gradient(-225deg, #FF6060, #FF6768); +} + +.bgf0 { + background-color: #f0f0f0; +} + +.filter::after { + content: '\e68a'; + font-family: iconfont; +} + +.dropdown.show ~ .mask { + display: block; +} + +.input-price { + background-color: #f0f0f0; + border-radius: 30rpx; + height: 60rpx; +} + +.dropdown-wrapper { + max-height: 1000rpx; + overflow-y: auto; +} + +.label.selected { + color: #FF6768; + border: 2rpx solid #FF6768; +} + + + diff --git a/packageA/pages/distribution/main/main.js b/packageA/pages/distribution/main/main.js new file mode 100644 index 0000000..95beb46 --- /dev/null +++ b/packageA/pages/distribution/main/main.js @@ -0,0 +1,247 @@ +// 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 () { + 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, + }); + console.log('userinfo', this.data.userInfo); + // 请求数据 + app.request.get(url + '/' + this.data.userInfo.store_id + '/' + this.data.userInfo.user_id, { + success: function(res) { + 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, + // first_leader: '', + }, + isShowLoading: true, + }).then(function(res) { + console.log('!!!===>', res); + self.setData({ + fenxiao: res.data.data, + }); + }); + + // }; + }; + }, + fail: function() { + + }, + }); + + // this.getData('/api/weshop/users/distribut/getMoney', { + // store_id: app.globalData.setting.stoid, + // user_id: app.globalData.user_id, + // }); + + }; + }; + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + 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); + }, + + /** + * 请求数据 + */ + // getData(url, data) { + + // app.request.get(url + '/' + data.store_id + '/' + data.user_id, { + // success: function(res) { + // if(res.data.code == 0){ + // // console.log('success',res.data.data.is_distribut); + // if(res.data.data.is_distribut) {//如果是分销商 + // self.setData({ + // data: res.data.data, + // }); + // } else {//如果不是分销商 + + // }; + // }else{ + // wx.showToast({ + // title: "网络繁忙,请重试", + // icon: 'none', + // duration: 2000 + // }) + // } + // }, + // fail: function() {}, + // }); + + // }, + + /** + * 获取输入框 + */ + 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, + }); + }); + }; + + } + }); + + // app.request.promisePost('/api/weshop/users/distribut/updateUserRecommender', { + // data: { + // storeId: self.data.userInfo.store_id, + // userId: self.data.userInfo.user_id, + // mobile: mobile, + // }, + // 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/packageA/pages/distribution/main/main.json b/packageA/pages/distribution/main/main.json new file mode 100644 index 0000000..fc0a95e --- /dev/null +++ b/packageA/pages/distribution/main/main.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "我的分销", + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/packageA/pages/distribution/main/main.wxml b/packageA/pages/distribution/main/main.wxml new file mode 100644 index 0000000..fb2c5cd --- /dev/null +++ b/packageA/pages/distribution/main/main.wxml @@ -0,0 +1,119 @@ + + + + + + + + {{filter.show_default(userInfo.nickname)}} + + + + + 可提现金额 + {{filter.show_default(data.user_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/packageA/pages/distribution/main/main.wxss b/packageA/pages/distribution/main/main.wxss new file mode 100644 index 0000000..fca7a37 --- /dev/null +++ b/packageA/pages/distribution/main/main.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; +} + + diff --git a/packageA/pages/distribution/myteam/myteam.js b/packageA/pages/distribution/myteam/myteam.js new file mode 100644 index 0000000..f5b280c --- /dev/null +++ b/packageA/pages/distribution/myteam/myteam.js @@ -0,0 +1,272 @@ +// packageA//pages/distribution/myteam/myteam.js +const app = getApp(); +let self = null; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + tabArr: ['A级分销','B级分销','C级分销'], + currentTabIndex: 0, //记录当前点击的Tab索引 + + list: null, + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 + pageNum: 1, // 当前页数 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + self = this;//保存全局指针 + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 + self.setData({ + userInfo: data, + }); + }); + // 判断会员是否授权登录, + // 没有登录则跳转到登录页, + // 已登录则设置已登录状态,请求加载签到数据 + // isLogin记录登录状态 + // app.isLogin().then(function(data) { + // console.log('data', data); + // // 1.登录成功 + // self.setData({ + // isLogin: true, + // userInfo: data, + // }); + // // 2.请求数据 + // // 默认请求A级分销 + // self.getData(true, '/api/weshop/users/distribut/teamlist', { + // store_id: app.globalData.setting.stoid, + // user_id: app.globalData.user_id, + // level: 1, + // }); + // // 默认请求佣金用户排行 + // // this.get('/api/weshop/users/distribut/rankingUser', { + // // store_id: app.globalData.setting.stoid, + // // user_id: app.globalData.user_id, + // // }); + + // }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if(app.globalData.userInfo) { + if(!this.data.isLogin) { + this.setData({ + userInfo: app.globalData.userInfo, + imghost: app.globalData.setting.imghost, + isLogin: true, + }); + + // 请求数据 + // 默认请求A级分销 + this.getData(true, '/api/weshop/users/distribut/teamlist', { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + level: 1, + }); + + }; + }; + + + // if(app.globalData.userInfo instanceof Object) { + // this.setData({ + // userInfo: app.globalData.userInfo, + // imghost: app.globalData.setting.imghost, + // }); + // // 检测从登录页返回后的登录状态 + // if(this.data.isLogin) { + // // 初次就授权登录 + // return; + // } else { + // // 初次未授权登录,过后才授权 + // this.setData({ + // isLogin: true + // }); + // // 请求数据 + // // 默认请求A级分销 + // this.getData(true, '/api/weshop/users/distribut/teamlist', { + // store_id: app.globalData.setting.stoid, + // user_id: app.globalData.user_id, + // level: 1, + // }); + // // 默认请求佣金用户排行 + // // this.get('/api/weshop/users/distribut/rankingUser', { + // // store_id: app.globalData.setting.stoid, + // // user_id: app.globalData.user_id, + // // }); + // }; + // }; + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.scrollToLower('/api/weshop/users/distribut/teamlist', { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + level: currentIndex + 1, + }); + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + /** + * 点击Tab项 + */ + clickTab(e) { + let currentIndex = e.target.dataset.index; + + this.setData({ + currentTabIndex: currentIndex, + list: null, //清空列表 + noMore: false, + pageNum: 1, + }); + + this.getData(true, '/api/weshop/users/distribut/teamlist', { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + level: currentIndex + 1, + }); + }, + + /** + * get请求数据 + */ + // get(url, data) { + // app.request.get(url + '/' + data.store_id + '/' + data.user_id, { + // success: function(res) { + // if(res.data.code == 0){ + // console.log('success',res.data.data); + // self.setData({ + // userRanking: res.data.data, + // }); + // }else{ + // wx.showToast({ + // title: "网络繁忙,请重试", + // icon: 'none', + // duration: 2000 + // }) + // } + // }, + // fail: function() {}, + // }); + // }, + + + /** + * promiseGet请求数据 + */ + getData: function(isInit, url, data) { + app.request.promiseGet(url, { + data: data, + isShowLoading: true, + }) + .then(function(res) { + // console.log('1121', res.data.code); + if(res.data.code == 0) { + + self.setData({ + isLoading: false + }); + + if(isInit) {// 第一次加载 + self.setData({ + list: res.data.data + }); + } else { + self.setData({ + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) + }); + }; + + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { + self.setData({ + noMore: true + }); + }; + + } else { + self.setData({ + 'list.pageData': [] + }); + }; + + }) + .catch(function(err) { + console.log('出错拉!!!!',err); + self.setData({ + 'list.pageData': [] + }); + }); + }, + + + // 上拉加载 + scrollToLower(url, requestData) { + // 数据总量 + let total = this.data.list.total; + // 单页最大数据量 + let pageSize = this.data.list.pageSize; + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ + if((total != 0)&&(total <= pageSize)) { + this.setData({ + noMore: true + }); + }; + + if(!this.data.isLoading && !this.data.noMore) { + this.setData({ + isLoading: true, + pageNum: this.data.pageNum + 1 + }); + requestData.page = this.data.pageNum; + this.getData(false, url, requestData); + }; + }, + +}) \ No newline at end of file diff --git a/packageA/pages/distribution/myteam/myteam.json b/packageA/pages/distribution/myteam/myteam.json new file mode 100644 index 0000000..85f1c17 --- /dev/null +++ b/packageA/pages/distribution/myteam/myteam.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "nodata": "/components/nodata/nodata" + }, + "navigationBarTitleText": "我的团队", + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/packageA/pages/distribution/myteam/myteam.wxml b/packageA/pages/distribution/myteam/myteam.wxml new file mode 100644 index 0000000..1493a50 --- /dev/null +++ b/packageA/pages/distribution/myteam/myteam.wxml @@ -0,0 +1,23 @@ + + + + {{item}} + + + + + + + + {{item.nickname}} + {{filter.format_time(item.reg_time)}} + + + {{item.distribut_money}} + + + + + + + diff --git a/packageA/pages/distribution/myteam/myteam.wxss b/packageA/pages/distribution/myteam/myteam.wxss new file mode 100644 index 0000000..af9c0bf --- /dev/null +++ b/packageA/pages/distribution/myteam/myteam.wxss @@ -0,0 +1,59 @@ +page { + background-color: #f4f4f4; +} + +.main > view { + background-color: white; +} + +.active { + color: #FF6768; + font-weight: bold; + position: relative; +} + +.active::after { + content: ''; + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + width: 50%; + height: 4rpx; + background-color: #FF6768; +} + +.avatar { + width: 120rpx; + height: 120rpx; + border-radius: 50%; + background-color: #eee; +} + +.c-a { + color: #aaa; +} + +.noMore { + padding: 20rpx; + color: #bbb; + text-align: center; + font-size: 26rpx; + background-color: transparent !important; +} + +.tab-head { + position: fixed; + width: 100%; + top: 0; +} + +.tab-content { + box-sizing: border-box; + padding-top: 76rpx; +} + +.money::before { + content: '¥'; + font-size: 22rpx; +} \ No newline at end of file diff --git a/packageA/pages/distribution/order/order.js b/packageA/pages/distribution/order/order.js new file mode 100644 index 0000000..9a7acf5 --- /dev/null +++ b/packageA/pages/distribution/order/order.js @@ -0,0 +1,275 @@ +// packageA//pages/distribution/myteam/myteam.js +const app = getApp(); +let self = null; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + tabArr: ['未付款','已付款','已完成'], + statusArr: ['未付款','已付款','等待分成(已收货)','已完成'], + commisionArr: ['一级分成','二级分成','三级分成'], + currentTabIndex: 0, //记录当前点击的Tab索引 + imghost: '', + status: 0, + + list: null, + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 + pageNum: 1, // 当前页数 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + self = this;//保存全局指针 + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 + self.setData({ + userInfo: data, + }); + }); + + // 判断会员是否授权登录, + // 没有登录则跳转到登录页, + // 已登录则设置已登录状态,请求加载签到数据 + // isLogin记录登录状态 + // app.isLogin().then(function(data) { + // console.log('data', data); + // // 1.登录成功 + // self.setData({ + // isLogin: true, + // userInfo: data, + // }); + // // 2.请求数据 + // // status: 0=未付款 1=已付款 3=已完成, 默认加载0 + // app.request.promiseGet('/api/weshop/rebateLog/pageOrder', { + // data: { + // store_id: app.globalData.setting.stoid, + // user_id: app.globalData.user_id, + // status: 0, + // }, + // isShowLoading: true, + // }).then(function(res) { + // self.setData({ + // list: res.data.data, + // }); + // }); + // }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if(app.globalData.userInfo) { + if(!this.data.isLogin) { + this.setData({ + userInfo: app.globalData.userInfo, + imghost: app.globalData.setting.imghost, + isLogin: true, + }); + + // 请求数据 + app.request.promiseGet('/api/weshop/rebateLog/pageOrder', { + data: { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + status: 0, + }, + isShowLoading: true, + }).then(function(res) { + self.setData({ + list: res.data.data, + }); + }); + + }; + }; + + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.scrollToLower('/api/weshop/rebateLog/pageOrder', { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + status: this.data.status, + }); + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + /** + * 点击跳转 + */ + goto(e) { + let url = ''; + if(e.target.dataset.url) { + url = e.target.dataset.url; + } else { + url = e.currentTarget.dataset.url; + } + app.goto(url); + }, + + /** + * 点击Tab项 + */ + clickTab(e) { + if(this.data.isLogin) { + + let status = 0; + let currentIndex = e.target.dataset.index; + + switch(currentIndex) { + case 0: { + status = 0; + break; + }; + case 1: { + status = 1; + break; + }; + case 2: { + status = 3; + break; + }; + }; + + this.setData({ + list: null, //清空列表 + noMore: false, + pageNum: 1, + currentTabIndex: currentIndex, + status, + }); + + app.request.promiseGet('/api/weshop/rebateLog/pageOrder', { + data: { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + status, + }, + isShowLoading: true, + }).then(function(res) { + self.setData({ + list: res.data.data, + }); + }); + + } + + }, + + /** + * 请求数据 + */ + getData: function(isInit, url, data) { + app.request.promiseGet(url, { + data: data, + isShowLoading: true, + }) + .then(function(res) { + // console.log('1121', res.data.code); + if(res.data.code == 0) { + + self.setData({ + isLoading: false + }); + + if(isInit) {// 第一次加载 + self.setData({ + list: res.data.data + }); + } else { + self.setData({ + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) + }); + }; + + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { + self.setData({ + noMore: true + }); + }; + + } else { + self.setData({ + 'list.pageData': [] + }); + }; + + }) + .catch(function(err) { + console.log('出错拉!!!!',err); + self.setData({ + 'list.pageData': [] + }); + }); + }, + + + // 上拉加载 + scrollToLower(url, requestData) { + // 数据总量 + let total = this.data.list.total; + // 单页最大数据量 + let pageSize = this.data.list.pageSize; + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ + if((total != 0)&&(total <= pageSize)) { + this.setData({ + noMore: true + }); + }; + + if(!this.data.isLoading && !this.data.noMore) { + this.setData({ + isLoading: true, + pageNum: this.data.pageNum + 1 + }); + requestData.page = this.data.pageNum; + this.getData(false, url, requestData); + }; + }, + + +}) \ No newline at end of file diff --git a/packageA/pages/distribution/order/order.json b/packageA/pages/distribution/order/order.json new file mode 100644 index 0000000..3cb1e39 --- /dev/null +++ b/packageA/pages/distribution/order/order.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "nodata": "/components/nodata/nodata" + }, + "navigationBarTitleText": "分销订单", + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/packageA/pages/distribution/order/order.wxml b/packageA/pages/distribution/order/order.wxml new file mode 100644 index 0000000..64ed6d2 --- /dev/null +++ b/packageA/pages/distribution/order/order.wxml @@ -0,0 +1,44 @@ + + + + {{item}} + + + + + + + + + {{item.nickname}} + + {{filter.status(item.status, statusArr)}} + + + + + + {{it.goods_name}} + 规格:{{it.goods_price}} + + 最新佣金比例:{{filter.toFix(it.commission/it.goods_price*100, 1)}}% + 佣金:{{it.commission}} + + {{filter.status((item.level-1), commisionArr)}}:{{it.commission}} + + + {{it.goods_price}} + + + + 订单号:{{item.order_sn}} + {{filter.format_time(item.create_time, 1)}} + + 获得分成:{{item.money}} + + + + + + + diff --git a/packageA/pages/distribution/order/order.wxss b/packageA/pages/distribution/order/order.wxss new file mode 100644 index 0000000..7dc9850 --- /dev/null +++ b/packageA/pages/distribution/order/order.wxss @@ -0,0 +1,86 @@ +page { + background-color: #f4f4f4; +} + +.main > view { + /* background-color: white; */ +} + +.active { + color: #FF6768; + font-weight: bold; + position: relative; +} + +.active::after { + content: ''; + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + width: 50%; + height: 4rpx; + background-color: #FF6768; +} + +.avatar { + display: block; + width: 60rpx; + height: 60rpx; + background-color: #eee; + border-radius: 50%; +} + +.img { + display: block; + width: 200rpx; + height: 200rpx; + background-color: #eee; +} + + + + + +.money::before { + content: '¥'; + font-size: 22rpx; +} + +.noMore { + padding: 20rpx; + color: #bbb; + text-align: center; + font-size: 26rpx; + background-color: transparent !important; +} + +.tab-head { + position: fixed; + width: 100%; + top: 0; +} + +.tab-content { + box-sizing: border-box; + padding: 96rpx 20rpx 20rpx 20rpx; +} + +.tab-head, +.item { + background-color: white; +} + +.item { + border-radius: 12rpx; +} + +.item ~ .item { + margin-top: 20rpx; +} + +.icon-ren { + font-size: 60rpx; + line-height: 60rpx; + color: #ccc; +} \ No newline at end of file diff --git a/packageA/pages/distribution/rank/rank.js b/packageA/pages/distribution/rank/rank.js new file mode 100644 index 0000000..aaca578 --- /dev/null +++ b/packageA/pages/distribution/rank/rank.js @@ -0,0 +1,287 @@ +// packageA//pages/distribution/rank/rank.js +const app = getApp(); +let self = null; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + currentTabIndex:0, + tabArr:['佣金排行','下线排行'], + + list: null, + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 + pageNum: 1, // 当前页数 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + self = this;//保存全局指针 + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 + self.setData({ + userInfo: data, + }); + }); + // 判断会员是否授权登录, + // 没有登录则跳转到登录页, + // 已登录则设置已登录状态,请求加载签到数据 + // isLogin记录登录状态 + // app.isLogin().then(function(data) { + // console.log('data', data); + // // 1.登录成功 + // self.setData({ + // isLogin: true, + // userInfo: data, + // }); + // // 2.请求数据 + // // 默认请求佣金排行列表 + // self.getData(true, '/api/weshop/users/distribut/rankinglist', { + // store_id: app.globalData.setting.stoid, + // }); + // // 默认请求佣金用户排行 + // self.get('/api/weshop/users/distribut/rankingUser', { + // store_id: app.globalData.setting.stoid, + // user_id: app.globalData.user_id, + // }); + + // }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if(app.globalData.userInfo) { + if(!this.data.isLogin) { + this.setData({ + userInfo: app.globalData.userInfo, + imghost: app.globalData.setting.imghost, + isLogin: true, + }); + + // 请求数据 + // 默认请求佣金排行列表 + this.getData(true, '/api/weshop/users/distribut/rankinglist', { + store_id: app.globalData.setting.stoid, + }); + // 默认请求佣金用户排行 + this.get('/api/weshop/users/distribut/rankingUser', { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + }); + + }; + }; + + + // if(app.globalData.userInfo instanceof Object) { + // this.setData({ + // userInfo: app.globalData.userInfo, + // imghost: app.globalData.setting.imghost, + // }); + // // 检测从登录页返回后的登录状态 + // if(this.data.isLogin) { + // // 初次就授权登录 + // return; + // } else { + // // 初次未授权登录,过后才授权 + // this.setData({ + // isLogin: true + // }); + // // 请求数据 + // // 默认请求佣金排行列表 + // this.getData(true, '/api/weshop/users/distribut/rankinglist', { + // store_id: app.globalData.setting.stoid, + // }); + // // 默认请求佣金用户排行 + // this.get('/api/weshop/users/distribut/rankingUser', { + // store_id: app.globalData.setting.stoid, + // user_id: app.globalData.user_id, + // }); + // }; + // }; + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.scrollToLower(this.data.listUrl, { + store_id: app.globalData.setting.stoid, + }); + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + /** + * 点击Tab + */ + clickTab(e) { + let currentIndex = e.target.dataset.index; + let listUrl = '';//排行列表 + let userUrl = '';//用户当前排名 + + + if(currentIndex == 0) { + listUrl = '/api/weshop/users/distribut/rankinglist'; + userUrl = '/api/weshop/users/distribut/rankingUser'; + } else { + listUrl = '/api/weshop/users/distribut/underlinglist'; + userUrl = '/api/weshop/users/distribut/underlingUser'; + }; + + this.setData({ + list: null, //清空列表 + noMore: false, + pageNum: 1, + currentTabIndex: currentIndex, + listUrl, + userUrl, + }); + + // 请求排行列表 + this.getData(true, listUrl, { + store_id: app.globalData.setting.stoid, + }); + + // 请求用户排行 + this.get(userUrl, { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + }); + }, + + + /** + * get请求数据 + */ + get(url, data) { + app.request.get(url + '/' + data.store_id + '/' + data.user_id, { + success: function(res) { + if(res.data.code == 0){ + console.log('success',res.data.data); + self.setData({ + userRanking: res.data.data, + }); + }else{ + wx.showToast({ + title: "网络繁忙,请重试", + icon: 'none', + duration: 2000 + }) + } + }, + fail: function() {}, + }); + }, + + + /** + * promiseGet请求数据 + */ + getData: function(isInit, url, data) { + app.request.promiseGet(url, { + data: data, + isShowLoading: true, + }) + .then(function(res) { + // console.log('1121', res.data.code); + if(res.data.code == 0) { + + self.setData({ + isLoading: false + }); + + if(isInit) {// 第一次加载 + self.setData({ + list: res.data.data + }); + } else { + self.setData({ + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) + }); + }; + + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { + self.setData({ + noMore: true + }); + }; + + } else { + self.setData({ + 'list.pageData': [] + }); + }; + + }) + .catch(function(err) { + console.log('出错拉!!!!',err); + self.setData({ + 'list.pageData': [] + }); + }); + }, + + + // 上拉加载 + scrollToLower(url, requestData) { + // 数据总量 + let total = this.data.list.total; + // 单页最大数据量 + let pageSize = this.data.list.pageSize; + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ + if((total != 0)&&(total <= pageSize)) { + this.setData({ + noMore: true + }); + }; + + if(!this.data.isLoading && !this.data.noMore) { + this.setData({ + isLoading: true, + pageNum: this.data.pageNum + 1 + }); + requestData.page = this.data.pageNum; + this.getData(false, url, requestData); + }; + }, +}) \ No newline at end of file diff --git a/packageA/pages/distribution/rank/rank.json b/packageA/pages/distribution/rank/rank.json new file mode 100644 index 0000000..30d2103 --- /dev/null +++ b/packageA/pages/distribution/rank/rank.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "nodata": "/components/nodata/nodata" + }, + "navigationBarTitleText": "分销排行榜", + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/packageA/pages/distribution/rank/rank.wxml b/packageA/pages/distribution/rank/rank.wxml new file mode 100644 index 0000000..e7d6c4d --- /dev/null +++ b/packageA/pages/distribution/rank/rank.wxml @@ -0,0 +1,43 @@ + + + + + 排行榜 + 恭喜您当前排名第一! + 您距离前一名还差{{userRanking.mindistribut_money - userRanking.distribut_money}} + 好好努力,天天向上! + + + + + + {{item}} + + + + + + {{userInfo.nickname}} + 当前排名:{{userRanking.rownum}},获得佣金:{{userRanking.distribut_money}} + 当前排名:{{userRanking.rownum}},下线人数:{{userRanking.underling_number}} + + + + + + + + + {{index + 1}} + + + + {{item.nickname}} + 获得佣金:{{item.distribut_money}} + 下线人数:{{item.underling_number}} + + + + + + \ No newline at end of file diff --git a/packageA/pages/distribution/rank/rank.wxss b/packageA/pages/distribution/rank/rank.wxss new file mode 100644 index 0000000..ea74a14 --- /dev/null +++ b/packageA/pages/distribution/rank/rank.wxss @@ -0,0 +1,123 @@ +.badge { + width: 260rpx; + height: 180rpx; +} + +.pd { + padding: 100rpx 40rpx 70rpx 40rpx; +} + +.bg-red { + background-color: #FF6666; +} + +.bg-red2 { + background-color: #FF5758; +} + +.t1 { + font-family: '微软雅黑'; + font-size: 60rpx; + font-weight: bold; + color: white; +} + +.t2 { + font-size: 28rpx; + font-weight: bold; + color: rgba(255,255,255,.6); +} + +.money::before { + content: '¥'; + font-size: 22rpx; +} + +.active { + color: white; + font-weight: bold; +} + +.tab-head { + color: rgba(255,255,255,.5); +} + +.tab-head-item { + position: relative; +} +.tab-head-item.active::after { + content: ''; + position: absolute; + bottom: 0; + left: 0; + right: 0; + margin: 0 auto; + width: 0; + height: 0; + border: 12rpx solid; + border-color: transparent transparent #ffffff transparent; +} + +.avatar, +.avatar2 { + + border-radius: 50%; + background-color: #eee; +} + +.avatar { + width: 140rpx; + height: 140rpx; +} + +.avatar2 { + width: 120rpx; + height: 120rpx; +} + + +.arrow-r::after { + font-family: iconfont; + content: '\e61f'; + position: absolute; + right: 20rpx; + color: #ccc; +} + +.bdb { + border-bottom: 20rpx solid #f0f0f0; +} + +.badge2-container { + /* margin: auto; */ + width: 56rpx; + text-align: center; + font-size: 32rpx; + /* box-sizing: border-box; */ +} + +.badge2 { + width: 56rpx; + height: 76rpx; + position: relative; +} + +.badge2::after { + content: attr(data-num); + color: white; + font-weight: bold; + text-align: center; + position: absolute; + left: 0; + top: 26rpx; + right: 0; + bottom: 0; +} + +.noMore { + padding: 20rpx; + color: #bbb; + text-align: center; + font-size: 26rpx; + /* background-color: #f4f4f4; */ +} \ No newline at end of file diff --git a/packageA/pages/distribution/rookie/rookie.js b/packageA/pages/distribution/rookie/rookie.js new file mode 100644 index 0000000..b2c775c --- /dev/null +++ b/packageA/pages/distribution/rookie/rookie.js @@ -0,0 +1,221 @@ +var WxParse = require('../../../../utils/wxParse/wxParse.js'); +const app = getApp(); +let self = null; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + list: null, + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 + pageNum: 1, // 当前页数 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + self = this; + + // 判断会员是否授权登录, + // 没有登录则跳转到登录页, + // 已登录则设置已登录状态,请求加载数据 + // isLogin记录登录状态 + app.isLogin().then(function(data) { + // console.log('data', data); + // 1.登录成功 + self.setData({ + isLogin: true, + userInfo: data, + // currentQuery: { + // store_id: app.globalData.setting.stoid, + // user_id: app.globalData.user_id, + // }, + }); + // 2.请求数据 + self.get('/api/weshop/storeDistribut/get', { + store_id: app.globalData.setting.stoid, + }); + + }); + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if(app.globalData.userInfo instanceof Object) { + this.setData({ + userInfo: app.globalData.userInfo, + imghost: app.globalData.setting.imghost, + }); + // 检测从登录页返回后的登录状态 + if(this.data.isLogin) { + // 初次就授权登录 + return; + } else { + // 初次未授权登录,过后才授权 + this.setData({ + isLogin: true + }); + // 请求数据 + this.get('/api/weshop/storeDistribut/get', { + store_id: app.globalData.setting.stoid, + }); + + }; + }; + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + /** + * get请求数据 + */ + get(url, data) { + app.request.get(url + '/' + data.store_id, { + success: function(res) { + if(res.data.code == 0){ + console.log('success~~~~~~~~~~~',res); + self.setData({ + content: res.data.data.distriRule, + }); + /** + * WxParse.wxParse(bindName , type, data, target,imagePadding) + * 1.bindName绑定的数据名(必填) + * 2.type可以为html或者md(必填) + * 3.data为传入的具体数据(必填) + * 4.target为Page对象,一般为this(必填) + * 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选) + */ + WxParse.wxParse('content', 'html', self.data.content, self); + }else{ + wx.showToast({ + title: "网络繁忙,请重试", + icon: 'none', + duration: 2000 + }) + } + }, + fail: function() {}, + }); + }, + + /** + * 请求数据 + */ + // getData: function(isInit, url, data) { + // app.request.promiseGet(url, { + // data: data, + // isShowLoading: true, + // }) + // .then(function(res) { + // // console.log('1121', res.data.code); + // if(res.data.code == 0) { + + // self.setData({ + // isLoading: false + // }); + + // if(isInit) {// 第一次加载 + // self.setData({ + // list: res.data.data + // }); + // } else { + // self.setData({ + // 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) + // }); + // }; + + // if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { + // self.setData({ + // noMore: true + // }); + // }; + + // } else { + // self.setData({ + // 'list.pageData': [] + // }); + // }; + + // }) + // .catch(function(err) { + // console.log('出错拉!!!!',err); + // self.setData({ + // 'list.pageData': [] + // }); + // }); + // }, + + + /** + * 上拉加载 + */ + // scrollToLower(url, requestData) { + // // 数据总量 + // let total = this.data.list.total; + // // 单页最大数据量 + // let pageSize = this.data.list.pageSize; + // // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ + // if((total != 0)&&(total <= pageSize)) { + // this.setData({ + // noMore: true + // }); + // }; + + // if(!this.data.isLoading && !this.data.noMore) { + // this.setData({ + // isLoading: true, + // pageNum: this.data.pageNum + 1 + // }); + // requestData.page = this.data.pageNum; + // this.getData(false, url, requestData); + // }; + // }, + +}) \ No newline at end of file diff --git a/packageA/pages/distribution/rookie/rookie.json b/packageA/pages/distribution/rookie/rookie.json new file mode 100644 index 0000000..ec81b39 --- /dev/null +++ b/packageA/pages/distribution/rookie/rookie.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "nodata": "/components/nodata/nodata" + }, + "navigationBarTitleText": "新手必看", + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/packageA/pages/distribution/rookie/rookie.wxml b/packageA/pages/distribution/rookie/rookie.wxml new file mode 100644 index 0000000..0fe0b58 --- /dev/null +++ b/packageA/pages/distribution/rookie/rookie.wxml @@ -0,0 +1,7 @@ + + + + +