bayi hace 1 año
padre
commit
73d13e1c70

+ 8 - 0
api/sale.js

@@ -3,5 +3,13 @@ import {
 } from "../utils/request";
 
 module.exports = {
+    // 注册分销员
     registerSale: data => request('/v3/sale/user', 'post', data),
+    // 获取分销金额统计数据
+    getSaleData: data => request('/v3/sale/user/info', 'get', data),
+    // 获取分销规则
+    getSaleRule: data => request('/v3/sale/level', 'get', data),
+    // 获取分销邀请用户列表
+    getSaleInvite: data => request('/v3/sale/user/inviteList', 'get', data),
+
 }

+ 6 - 59
salesperson/pages/commission/index.js

@@ -1,66 +1,13 @@
-// salesperson/pages/commission/index.js
+import {
+    getSaleRule
+} from '~/api/sale'
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
 
     },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
+    async onLoad(options) {
+        let res = await getSaleRule()
+        console.log(res);
     },
 
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
 })

+ 1 - 1
salesperson/pages/fill/index.js

@@ -45,7 +45,7 @@ Page({
                 name: username
             })
             console.log(res);
-            wx.navigateTo({
+            wx.redirectTo({
               url: '/salesperson/pages/saleOffice/index',
             })
         }

+ 8 - 7
salesperson/pages/history/index.js

@@ -1,16 +1,17 @@
 import reachBottom from '~/mixins/reachBottom';
-
+import {
+    getSaleInvite
+} from '~/api/sale'
 Page({
     behaviors: [reachBottom],
     data: {
-        date: '2023-09',
+        dateTime: '2023-09',
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-
+        this.resetData();
     },
     bindDateChange: function (e) {
         console.log('picker发送选择改变,携带值为', e.detail.value)
@@ -22,8 +23,8 @@ Page({
         this.selectComponent("#InvitePop").openInvite()
     },
     loadMore() {
-        /*  this.getData(getCategoryWorks, {
-             columnId
-         }); */
+        this.getData(getSaleInvite, {
+            dateTime: this.data.dateTime
+        });
     },
 })

+ 1 - 1
salesperson/pages/history/index.wxml

@@ -3,7 +3,7 @@
     <view class="total">
         <view class="box">
             <view class="label">统计日期</view>
-            <picker mode="date" value="{{date}}" fields="month" start="2023-09" end="2100-09"
+            <picker mode="date" value="{{dateTime}}" fields="month" start="2023-09" end="2100-09"
                 bindchange="bindDateChange">
                 <view class="picker">
                     {{date}} >

+ 11 - 0
salesperson/pages/saleOffice/index.js

@@ -2,6 +2,9 @@ import {
     getMyInfo,
 } from '~/api/user'
 import {
+    getSaleData
+} from '~/api/sale'
+import {
     createStoreBindings
 } from 'mobx-miniprogram-bindings'
 import {
@@ -10,6 +13,7 @@ import {
 Page({
     data: {
         userInfo: {},
+        allIncome: {}
     },
     async onLoad() {
         // 手工绑定 
@@ -20,6 +24,13 @@ Page({
             }
         })
     },
+    async onShow() {
+        let allIncome = await getSaleData()
+        console.log(allIncome);
+        this.setData({
+            allIncome
+        })
+    },
     jump({
         currentTarget
     }) {

+ 5 - 3
salesperson/pages/saleOffice/index.wxml

@@ -1,3 +1,5 @@
+<wxs src="../../../utils/filter.wxs" module="filters" />
+
 <view class="container">
     <view class="userBox">
         <view class="left">
@@ -13,7 +15,7 @@
         <view class="above">
             <view class="left">
                 <view class="label">可提现金额(元)</view>
-                <view class="money">1200.00</view>
+                <view class="money">{{filters.twoDecimal(allIncome.withdraw)}}</view>
             </view>
             <view class="withdrawal" bindtap="jump" data-url="withdrawal">
                 去提现
@@ -23,11 +25,11 @@
         <view class="below">
             <view class="box">
                 <view class="label">今日收益(元)</view>
-                <view class="money">33.33</view>
+                <view class="money">{{filters.twoDecimal(allIncome.todayIncome)}}</view>
             </view>
             <view class="box">
                 <view class="label rtext">累计收益(元)</view>
-                <view class="money rtext" style="padding-right:20rpx;">33.33</view>
+                <view class="money rtext" style="padding-right:20rpx;">{{filters.twoDecimal(allIncome.income)}}</view>
             </view>
         </view>
     </view>