Bläddra i källkod

完成代理商接口对接,未完成代理商页面确认

yerong 4 år sedan
förälder
incheckning
dac07c949e

+ 1 - 1
dist/wx

@@ -1 +1 @@
-Subproject commit 07b7ca0931124e92a30fdfb8387a5573ea2c1685
+Subproject commit 7a56addf40ff37aaa66055e394adb6d6280a6a8f

+ 4 - 16
src/components/index/scan.vue

@@ -10,13 +10,7 @@
     </div>
 
     <div class="text-center padding">
-      <van-field
-        :value="username"
-        placeholder="请输入用户名"
-        @change="inputChange"
-      >
-      </van-field>
-      <button class="cu-btn lg cu-btn-primary text-white text-center" @click="toLogin">关于水母星球</button>
+      <button class="cu-btn lg cu-btn-primary text-white text-center">关于水母星球</button>
     </div>
     <view class="text-center text-xs">
       <text class="text-gray">如果您在我们的实体店,请在店员的指导下链接脑环</text>
@@ -43,17 +37,11 @@ export default {
       $this.username = e.mp.detail
     },
     toLogin() {
-      console.log(1)
-      console.log($this.username)
-      let $params = {
-        access_token: 11,
-        user_name: $this.username
-      }
-      $this.$fly.post('user/user-name', $params).then((res) => {
-        console.log(res)
-      })
     }
   },
+  mounted() {
+    console.log()
+  },
   created() {
     $this = this
   }

+ 20 - 4
src/pages/agent/customer/index.vue

@@ -42,13 +42,13 @@
       </div>
     </div>
     <!--  列表-->
-    <view class="solid-bottom padding-lr-sm" v-for="item in customer_count" :key="item">
+    <view class="solid-bottom padding-lr-sm" v-for="(user,index) in user_list" :key="index">
       <van-card>
         <view slot="thumb" class="cu-avatar lg round margin-left"
               style="background-image:url(https://img.shuimuai.com/web/icon_dingdan.png);"></view>
         <view slot="title" class="flex justify-between">
           <view>
-            <text class="text-sm">摄影大师陈冠希</text>
+            <text class="text-sm">{{ user.user_name }}</text>
           </view>
           <view>
             <text class="text-normal">最后下单时间&emsp;</text>
@@ -59,12 +59,12 @@
         <view slot="num" class="flex justify-end">
           <view>
             <text class="text-normal text-sm margin-right-lg">成交额</text>
-            <text class="text-xxl">39.00</text>
+            <text class="text-xxl">{{ user.price_total }}</text>
           </view>
         </view>
         <view slot="price">
           <view>
-            <text class="text-normal text-sm">订单数 1</text>
+            <text class="text-normal text-sm">订单数 {{ user.count }}</text>
           </view>
         </view>
       </van-card>
@@ -83,6 +83,8 @@
 
 <script>
 
+import {agentUserList} from "../../../requests/agent";
+
 var $this
 export default {
   name: "agent_customer_container",
@@ -139,6 +141,7 @@ export default {
           name: "二级客户"
         },
       ],
+      user_list: [],
       customer_type_action: 1
     }
   },
@@ -172,6 +175,19 @@ export default {
     //  切换客户类型筛选
     toggle_type($id) {
       $this.customer_type_action = $id
+      //根据类型获取用户列表
+      $this.get_user_list($id - 1)
+    },
+    get_user_list($type) {
+      let $params = {}
+      if ($type) {
+        $params['type'] = $type
+      }
+      agentUserList($params).then((res) => {
+        let $data = res.data;
+        $this.user_list = $data.data
+        $this.customer_count = $this.user_list.length
+      })
     }
   },
   mounted() {

+ 37 - 10
src/pages/agent/extend/detail/index.vue

@@ -1,19 +1,23 @@
 <template>
   <div id="agent_order_detail_container">
-    <van-cell title="订单编号" value="E20200928143900200001" :border="false"></van-cell>
-    <van-cell title="消费产品" value="次卡" :border="false"></van-cell>
-    <van-cell title="下单时间" value="2020.9.27  10:31:35" :border='false'></van-cell>
-    <van-cell title="买家" value="摄影大师陈冠希" :border="false"></van-cell>
+    <van-cell title="订单编号" :value="order.sn" :border="false"></van-cell>
+    <van-cell title="消费产品" :value="order.goods_name" :border="false"></van-cell>
+    <van-cell title="下单时间" :value="order.create_time" :border='false'></van-cell>
+    <van-cell title="买家" :value="order.user_name" :border="false"></van-cell>
     <van-cell title="卖家等级" value="一级消费" :border="false"></van-cell>
 
     <van-row class="">
       <van-col span="10">
-        <van-cell title="佣金收益" value="¥15.00" :border="false" custom-class="not_show"></van-cell>
-        <van-cell title="结算状态" value="未结算" :border="false"></van-cell>
+        <van-cell title="佣金收益" :value="order.invite_rebater" :border="false" custom-class="not_show"></van-cell>
+        <van-cell title="结算状态"  :border="false">
+          <text v-if="order.provide_status == 1">收益到余额</text>
+          <text v-if="order.provide_status == 2">未收益</text>
+          <text v-if="order.provide_status == 3">收益到冻结余额</text>
+        </van-cell>
       </van-col>
       <van-col span="10" offset="4">
-        <van-cell title="佣金收益" value="¥15.00" :border="false"></van-cell>
-        <van-cell title="订单总价" value="¥39.00" :border="false"></van-cell>
+        <van-cell title="佣金收益" :value="order.rebater" :border="false"></van-cell>
+        <van-cell title="订单总价" :value="order.price" :border="false"></van-cell>
       </van-col>
     </van-row>
 
@@ -24,14 +28,37 @@
 <script>
 
 
+import {agentOrderDetail} from "../../../../requests/agent";
+import util from '@/utils/index'
+
+var $this
 export default {
   name: "agent_order_detail_container",
   components: {},
   data() {
-    return {}
+    return {
+      order: {}
+    }
+  },
+  methods: {
+    get_order($sn) {
+      let $params = {
+        sn: $sn
+      }
+      agentOrderDetail($params).then((res) => {
+        let $data = res.data;
+        $this.order = $data.data
+        $this.order['create_time'] = util.formatTime($this.order['create_time'])
+      })
+    }
   },
-  methods: {},
   mounted() {
+  },
+  created() {
+    $this = this
+  },
+  onLoad($options) {
+    let $order_sn = $options.sn
   }
 }
 </script>

+ 46 - 17
src/pages/agent/extend/orders/index.vue

@@ -37,17 +37,17 @@
       </div>
     </div>
     <!--  列表-->
-    <view class="solid-bottom padding-lr-sm" v-for="item in 3" :key="item">
+    <view class="solid-bottom padding-lr-sm" v-for="(item,index) in order_list" :key="index">
       <van-card>
         <view slot="thumb" class="cu-avatar lg round margin-left"
               style="background-image:url(https://img.shuimuai.com/web/icon_dingdan.png);"></view>
         <view slot="title" class="flex justify-between">
           <view>
             <text class="text-normal">消费产品 &emsp;</text>
-            <text>黄金会员卡</text>
+            <text>{{ item.goods_name }}</text>
           </view>
           <view>
-            <text class="text-normal text-sm under_line" @click="to_detail(item)">订单详情</text>
+            <text class="text-normal text-sm under_line" @click="to_detail(item.sn)">订单详情</text>
           </view>
         </view>
 
@@ -55,13 +55,13 @@
           <view>
             <view>
               <text class="text-sm text-normal">买家&emsp;</text>
-              <text class="text-sm text-normal">Only is lonly</text>
+              <text class="text-sm text-normal">{{ item.user_name }}</text>
             </view>
-            <text class="text-gray text-sm">2018/09/24 10:44</text>
+            <text class="text-gray text-sm">{{ item.create_time }}</text>
           </view>
           <view>
             <text class="text-normal text-sm margin-right">订单总价</text>
-            <text class="text-xxl">39.00</text>
+            <text class="text-xxl">{{ item.price }}</text>
           </view>
 
 
@@ -82,6 +82,9 @@
 
 <script>
 
+import {agentOrderList} from "../../../../requests/agent";
+import util from '@/utils/index'
+
 var $this
 export default {
   name: "agent_income_container",
@@ -95,24 +98,26 @@ export default {
         },
         {
           id: 2,
-          name: "今日"
+          name: "今日",
+          start_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime()).getTime() / 1000),
+          end_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1).getTime() / 1000)
         },
         {
           id: 3,
-          name: "昨日"
+          name: "昨日",
+          start_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() - 24 * 60 * 60 * 1000).getTime() / 1000),
+          end_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() - 1000).getTime() / 1000)
         },
         {
           id: 4,
-          name: "近七日"
+          name: "近七日",
+          start_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() - 7 * 24 * 60 * 60 * 1000).getTime() / 1000),
+          end_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1).getTime() / 1000)
         }
       ],
       filter_action: 1,
-      userinfo: {
-        //累计收益
-        order_counts: 14,
-        //含待结算
-        unsettle_account: 65.00,
-      },
+      order_counts: 0,
+      order_list: [],
       calendar_show: false,
       start_time: "",
       end_time: "",
@@ -126,6 +131,11 @@ export default {
     change_filter($id) {
       $this.filter_date = ""
       $this.filter_action = $id
+      $this.filter_date.forEach(($val, $index) => {
+        if ($val['id'] == $id) {
+          $this.get_order_list($val['start_time'], $val['end_time'])
+        }
+      })
     },
     //  自定义筛选时间
     show_datetime_picker() {
@@ -146,12 +156,31 @@ export default {
       $this.filter_date = $this.formatDate(start) + '-' + $this.formatDate(end)
       $this.start_time = Math.round(new Date(start).getTime() / 1000)
       $this.end_time = Math.round(new Date(end).getTime() / 1000)
+      $this.get_order_list($this.start_time, $this.end_time)
       $this.calendar_show = false
     },
     //  跳转订单详情
-    to_detail($index) {
+    to_detail($id) {
       mpvue.navigateTo({
-        url:"/pages/agent/extend/detail/main"
+        url: "/pages/agent/extend/detail/main?sn=" + $id
+      })
+    },
+    //获取订单列表
+    get_order_list($start_time, $end_time) {
+      let $params = {}
+      if ($start_time && $end_time) {
+        $params['start_time'] = $start_time
+        $params['end_time'] = $end_time
+      }
+      agentOrderList($params).then((res) => {
+        let $data = res.data
+        let $result = $data.data;
+        $this.order_counts = $result.count;
+        let $list = $result.list;
+        $list.forEach(($val, $index) => {
+          $list[$index]['create_time'] = util.formatTime($val['create_time'])
+        })
+        $this.order_list = $list
       })
     }
   },

+ 55 - 15
src/pages/agent/income_cal/index.vue

@@ -18,14 +18,18 @@
     <!--      收益模块-->
     <div class="profit_container text-center">
       <view>
-        <text class="text-normal margin-xl"><template v-if="filter_date">{{filter_date}}</template><template v-else>{{ filter_list[filter_action - 1].name }}</template>累计收益</text>
+        <text class="text-normal margin-xl">
+          <template v-if="filter_date">{{ filter_date }}</template>
+          <template v-else>{{ filter_list[filter_action - 1].name }}</template>
+          累计收益
+        </text>
       </view>
       <view>
-        <text class="text-bold text-sl text-price">{{ userinfo.profit }}</text>
+        <text class="text-bold text-sl text-price">{{ total.balance_freeze }}</text>
       </view>
       <view>
         <text class="text-normal ">含待结算
-          <text class="text-price">{{ userinfo.unsettle_account }}</text>
+          <text class="text-price">{{ total.balance }}</text>
         </text>
       </view>
@@ -39,24 +43,24 @@
       </div>
     </div>
     <!--  列表-->
-    <view class="solid-bottom padding-lr-sm" v-for="item in 3" :key="item">
+    <view class="solid-bottom padding-lr-sm" v-for="(item,index) in balance_list" :key="index">
       <van-card>
         <view slot="thumb" class="cu-avatar lg round margin-left"
               style="background-image:url(https://img.shuimuai.com/web/icon_dingdan.png);"></view>
         <view slot="title" class="flex justify-between">
           <view>
             <text class="text-normal">产品&emsp;</text>
-            <text>次卡</text>
+            <text>{{ item.goods_name }}</text>
           </view>
           <view>
-            <text class="text-gray text-sm">2018/09/24 10:44</text>
+            <text class="text-gray text-sm">{{ item.create_time }}</text>
           </view>
         </view>
 
         <view slot="num" class="flex justify-end">
           <view>
             <text class="text-normal text-sm margin-right-lg">收益</text>
-            <text class="text-xxl">+39.00</text>
+            <text class="text-xxl">+{{ item.rebater }}</text>
           </view>
         </view>
       </van-card>
@@ -75,6 +79,9 @@
 
 <script>
 
+import {agentIncomeDetail, agentIncomeList} from "../../../requests/agent";
+import util from '@/utils/index'
+
 var $this
 export default {
   name: "agent_income_container",
@@ -88,30 +95,37 @@ export default {
         },
         {
           id: 2,
-          name: "今日"
+          name: "今日",
+          start_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime()).getTime() / 1000),
+          end_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1).getTime() / 1000)
         },
         {
           id: 3,
-          name: "昨日"
+          name: "昨日",
+          start_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() - 24 * 60 * 60 * 1000).getTime() / 1000),
+          end_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() - 1000).getTime() / 1000)
         },
         {
           id: 4,
-          name: "近七日"
+          name: "近七日",
+          start_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() - 7 * 24 * 60 * 60 * 1000).getTime() / 1000),
+          end_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1).getTime() / 1000)
         }
       ],
       filter_action: 1,
-      userinfo: {
+      total: {
         //累计收益
-        profit: 16824.50,
+        balance_freeze: 16824.50,
         //含待结算
-        unsettle_account: 65.00,
+        balance: 65.00,
       },
+      balance_list: [],
       calendar_show: false,
       start_time: "",
       end_time: "",
       filter_date: "",
       //最小日期应该为用户使用的第一个月开始
-      min_date:false,
+      min_date: false,
     }
   },
   methods: {
@@ -119,6 +133,11 @@ export default {
     change_filter($id) {
       $this.filter_date = ""
       $this.filter_action = $id
+      $this.filter_date.forEach(($val, $index) => {
+        if ($val['id'] == $id) {
+          $this.get_income_list($val['start_time'], $val['end_time'])
+        }
+      })
     },
     //  自定义筛选时间
     show_datetime_picker() {
@@ -139,11 +158,32 @@ export default {
       $this.filter_date = $this.formatDate(start) + '-' + $this.formatDate(end)
       $this.start_time = Math.round(new Date(start).getTime() / 1000)
       $this.end_time = Math.round(new Date(end).getTime() / 1000)
+      $this.get_income_list($this.start_time, $this.end_time)
       $this.calendar_show = false
+    },
+    // 收益列表
+    get_income_list($start_time, $end_time) {
+      let $params = {}
+      if ($start_time && $end_time) {
+        $params['start_time'] = $start_time
+        $params['end_time'] = $end_time
+      }
+      agentIncomeList($params).then((res) => {
+        let $data = res.data
+        let $result = $data.data;
+        $this.total = $result.total;
+        let $incomes = $result.list;
+        $incomes.forEach(($val, $index) => {
+          $incomes[$index]['create_time'] = util.formatTime($val['create_time'])
+        })
+        $this.balance_list = $incomes
+      })
     }
   },
   mounted() {
-    $this.min_date = new Date(2020,1,1).getTime()
+    $this.min_date = new Date(2020, 1, 1).getTime()
+    //一开始查询全部
+    $this.get_income_list(false, false)
   },
   created() {
     $this = this

+ 44 - 43
src/pages/agent/index/index.vue

@@ -32,11 +32,11 @@
           <text class="text-normal padding">累计收益(元)</text>
         </view>
         <view>
-          <text class="text-white text-bold text-sl text-price">{{ userinfo.profit }}</text>
+          <text class="text-white text-bold text-sl text-price">{{ agent_info.rebater }}</text>
         </view>
         <view>
           <text class="text-normal ">含待结算
-            <text class="text-price">{{ userinfo.unsettle_account }}</text>
+            <text class="text-price">{{ agent_info.rebater_freeze }}</text>
           </text>
         </view>
@@ -48,7 +48,7 @@
         <van-row gutter="40">
           <van-col span="6" offset="3" @click="to_extend_order">
             <view>
-              <text class="text-xxl text-white">{{ userinfo.orders_count }}</text>
+              <text class="text-xxl text-white">{{ agent_info.order_count }}</text>
             </view>
             <view>
               <text class="text-normal text-sm">累计订单</text>
@@ -56,7 +56,7 @@
           </van-col>
           <van-col span="6" @click="to_customer">
             <view>
-              <text class="text-xxl text-white">{{ userinfo.customer_count }}</text>
+              <text class="text-xxl text-white">{{ agent_info.user_count }}</text>
             </view>
             <view>
               <text class="text-normal text-sm">累计客户</text>
@@ -64,7 +64,7 @@
           </van-col>
           <van-col span="6" @click="to_agent_invite_card">
             <view>
-              <text class="text-xxl text-white">{{ userinfo.invite_card_count }}</text>
+              <text class="text-xxl text-white">0</text>
             </view>
             <view>
               <text class="text-normal text-sm">邀请卡库存</text>
@@ -73,62 +73,50 @@
           </van-col>
         </van-row>
       </div>
-          </div>
+    </div>
 
 
-      <!--      提现金额-->
-      <div class="withdraw_container flex justify-between align-center padding-lr" @click="to_agent_cal_center">
-        <text class="text-white">可提现金额(元)</text>
-        <text class="text-white withdraw_money">{{ userinfo.withdraw_money }}.00</text>
-      </div>
+    <!--      提现金额-->
+    <div class="withdraw_container flex justify-between align-center padding-lr" @click="to_agent_cal_center">
+      <text class="text-white">可提现金额(元)</text>
+      <text class="text-white withdraw_money">{{ agent_info.user_balance }}.00</text>
+    </div>
 
-      <!--      菜单列表-->
-      <div class="menu">
-        <van-cell title="今日收益(元)" value="0.98" is-link url="/pages/agent/income_cal/main">
-          <van-icon name="balance-o" slot="icon" color="#4B3AB0" class="margin-lr-sm" size="20px"></van-icon>
-        </van-cell>
+    <!--      菜单列表-->
+    <div class="menu">
+      <van-cell title="今日收益(元)" :value="income_info.rebater" is-link url="/pages/agent/income_cal/main">
+        <van-icon name="balance-o" slot="icon" color="#4B3AB0" class="margin-lr-sm" size="20px"></van-icon>
+      </van-cell>
 
-        <van-cell title="今日订单" value="1" is-link>
-          <van-icon name="notes-o" slot="icon" color="#4B3AB0" class="margin-lr-sm" size="20px"></van-icon>
-        </van-cell>
+      <van-cell title="今日订单" :value="income_info.today_order" is-link url="/pages/agent/extend/orders/main">
+        <van-icon name="notes-o" slot="icon" color="#4B3AB0" class="margin-lr-sm" size="20px"></van-icon>
+      </van-cell>
 
-        <van-cell title="今日新增客户" value="0.5" is-link>
-          <van-icon name="contact" slot="icon" color="#4B3AB0" class="margin-lr-sm" size="20px"></van-icon>
-        </van-cell>
+      <van-cell title="今日新增客户" :value="income_info.today_user" is-link url="/pages/agent/customer/main">
+        <van-icon name="contact" slot="icon" color="#4B3AB0" class="margin-lr-sm" size="20px"></van-icon>
+      </van-cell>
 
-      </div>
+    </div>
   </div>
 </template>
 
 <script>
 
 
+import {agentDetail, agentIncomeDetail} from "../../../requests/agent";
+
 export default {
   name: "agent_index_container",
   filter: {},
   components: {},
   data() {
     return {
-      userinfo: {
-        //头像
-        avatar: "https://img.shuimuai.com/weixintouxiang.png",
-        //昵称
-        nickname: "小疯兔屁屁",
-        //代理商名称
-        agent_name: "区域代理商",
-        //累计收益
-        profit: 16824.50,
-        //含待结算
-        unsettle_account: 65.00,
-        //  累计订单数量
-        orders_count: 720,
-        //  累计客户数量
-        customer_count: 6,
-        //  邀请卡库存
-        invite_card_count: 2,
-        //  提现金额
-        withdraw_money: 328215.00
-      },
+      //用户信息
+      userinfo: {},
+      //代理商详情
+      agent_info: {},
+      //代理商收益详情
+      income_info:{}
     }
   },
   methods: {
@@ -155,9 +143,22 @@ export default {
       mpvue.navigateTo({
         url: "/pages/agent/invite_card_inventory/main"
       })
+    },
+    //获取代理商详情
+    get_agent_detail() {
+      agentDetail().then((res) => {
+        let $data = res.data;
+        $this.agent_info = $data.data;
+      })
+      agentIncomeDetail().then((res)=>{
+        let $data =res.data;
+        $this.income_info = $data.data;
+      })
     }
   },
   mounted() {
+    $this.get_agent_detail()
+    $this.userinfo = wx.getStorageSync('userinfo')
   }
 }
 </script>

+ 35 - 19
src/pages/agent/invite_card_inventory/index.vue

@@ -4,7 +4,7 @@
     <div class="header flex justify-around text-center align-end margin-tb-xl">
       <view>
         <view>
-          <text class="text-xxl text-bold">269</text>
+          <text class="text-xxl text-bold">{{ total_count }}</text>
         </view>
         <view>
           <text class="text-sm text-gray slot_text">总卡数</text>
@@ -21,7 +21,7 @@
         :size="150"
       >
         <view>
-          <text class="process_text">{{ total_count }}</text>
+          <text class="process_text">{{ stock_count }}</text>
         </view>
         <view class="flex justify-center">
           <text class="cuIcon-title color-primary"></text>
@@ -32,7 +32,7 @@
 
       <view>
         <view>
-          <text class="text-xxl text-bold">269</text>
+          <text class="text-xxl text-bold">{{ use_count }}</text>
         </view>
         <view class="flex">
           <text class="cuIcon-title text-gray"></text>
@@ -50,23 +50,23 @@
       </div>
     </div>
     <!--  列表-->
-    <view class="solid-bottom padding-lr-sm list-item" v-for="item in customer_count" :key="item">
+    <view class="solid-bottom padding-lr-sm list-item" v-for="(cu,index) in invite_list" :key="index">
       <van-card>
         <view slot="thumb" class="cu-avatar lg round margin-left"
               style="background-image:url(https://img.shuimuai.com/web/icon_dingdan.png);"></view>
         <view slot="title" class="flex justify-between">
           <view>
-            <text class="text-sm">摄影大师陈冠希</text>
+            <text class="text-sm">{{ cu.user_name }}</text>
           </view>
           <view>
-            <text class="text-gray text-sm">2018/09/24 10:44</text>
+            <text class="text-gray text-sm">{{ cu.bind_time }}</text>
           </view>
         </view>
 
         <view slot="num">
           <view>
             <text class="text-gray text-sm margin-right-lg">卡号</text>
-            <text class="text-sm text-gray">ED12344829519982</text>
+            <text class="text-sm text-gray">{{ cu.code }}</text>
           </view>
         </view>
       </van-card>
@@ -85,27 +85,43 @@
 
 <script>
 
+import {agentInviteStock} from "../../../requests/agent";
+import util from '@/utils/index'
+
 var $this
 export default {
   name: "agent_invite_card_inventory_container",
   components: {},
   data() {
     return {
-      userinfo: {
-        //累计收益
-        profit: 16824.50,
-        //含待结算
-        unsettle_account: 65.00,
-      },
-      total_count:269,
-      percent:0,
-      //客户数量
-      customer_count: 3,
+      total_count: 269,
+      stock_count: 0,
+      use_count: 0,
+      invite_list: [],
+      percent: 0,
+    }
+  },
+  methods: {
+    get_invite_stock($type) {
+      let $params = {}
+      if ($type) {
+        $params['type'] = $type
+      }
+      agentInviteStock($params).then((res) => {
+        let $data = res.data.data;
+        $this.total_count = $data.total
+        $this.stock_count = $data.stock
+        $this.use_count = $data.use
+        $this.invite_list = $data.list
+        $this.invite_list.forEach(($val,$index)=>{
+          $this.invite_list[$index]['bind_time'] = util.formatTime($val['bind_time'])
+        })
+        $this.percent = ($data.stock / $data.total).toFixed(2) * 100
+      })
     }
   },
-  methods: {},
   mounted() {
-    $this.percent = ($this.total_count / 500 ).toFixed(2) * 100
+    $this.get_invite_stock(false)
   },
   created() {
     $this = this

+ 47 - 0
src/requests/agent.js

@@ -0,0 +1,47 @@
+import fly from "./main";
+import store from "@/store/index"
+
+
+// 代理商详情
+export function agentDetail($param = {}) {
+  $param['access_token'] = wx.getStorageSync('token')
+  return fly.post('agent/agent-detail', $param);
+}
+
+
+// 代理商收益详情
+export function agentIncomeDetail($param = {}) {
+  $param['access_token'] = wx.getStorageSync('token')
+  return fly.post('agent/income-detail', $param);
+}
+
+// 代理商收益列表
+export function agentIncomeList($param = {}) {
+  $param['access_token'] = wx.getStorageSync('token')
+  return fly.post('agent/income-list', $param);
+}
+
+// 代理商订单列表
+export function agentOrderList($param = {}) {
+  $param['access_token'] = wx.getStorageSync('token')
+  return fly.post('agent/order-list', $param);
+}
+
+// 代理商订单详情
+export function agentOrderDetail($param = {}) {
+  $param['access_token'] = wx.getStorageSync('token')
+  return fly.post('agent/order-detail', $param);
+}
+
+
+// 代理商订单详情
+export function agentUserList($param = {}) {
+  $param['access_token'] = wx.getStorageSync('token')
+  return fly.post('agent/user-list', $param);
+}
+
+// 邀请卡列表
+export function agentInviteStock($param = {}) {
+  $param['access_token'] = wx.getStorageSync('token')
+  return fly.post('agent/invite-stock', $param);
+}