guojy 1 year ago
parent
commit
fe9a5c6ac7

+ 130 - 0
src/course/api/index.js

@@ -106,4 +106,134 @@ export function getDealerList(data) {
             }
         })
     })
+}
+//获取经销商各课程购买&销售列表
+export function getDealerTransactionList(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc("get",`/mkt/admin/${getCourseId()}/user/capital/list`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Message(res.data.message)
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//加减经销商课程名额
+export function editDealerCourseNum(userId,subjectId,data) {
+    return new Promise((resolve, reject) => {
+        axiosKc("post",`/mkt/admin/${getCourseId()}/user/capital/add/${userId}/${subjectId}`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Message(res.data.message)
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//获取经销商课程交易明细
+export function getCourseTransationList(userId,subjectId,data) {
+    return new Promise((resolve, reject) => {
+        axiosKc("get",`/mkt/admin/${getCourseId()}/user/capital/log/list/${userId}/${subjectId}`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Message(res.data.message)
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//获取经销商订购统计列表
+export function getDealerOrderList(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc("get",`/mkt/admin/${getCourseId()}/statistics/transfer/user`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Message(res.data.message)
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//获取课程订购统计列表
+export function getCourseOrderList(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc("get",`/mkt/admin/${getCourseId()}/statistics/transfer/subject`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Message(res.data.message)
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//获取指定经销商/课程订购统计明细
+export function getDealerOrCourseRecode(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc("get",`/mkt/admin/${getCourseId()}/statistics/transfer/list`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Message(res.data.message)
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//获取管理员列表
+export function getAdminList(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc("get",`/mkt/admin/${getCourseId()}/admin/list`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Message(res.data.message)
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//删除管理员
+export function deleteAdmin(auId) {
+    return new Promise((resolve, reject) => {
+        axiosKc("post",`/mkt/admin/${getCourseId()}/admin/delete/${auId}`).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Message(res.data.message)
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//添加管理员
+export function addAdmin(auId) {
+    return new Promise((resolve, reject) => {
+        axiosKc("post",`/mkt/admin/${getCourseId()}/admin/create/${auId}`).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Message(res.data.message)
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//精确搜索8.0平台已绑定账号的微信号
+export function getAssignAccount(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc("get",`/mkt/admin/${getCourseId()}/account`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Message(res.data.message)
+                reject(res.data.message)
+            }
+        })
+    })
 }

+ 54 - 68
src/course/courseManage/home.vue

@@ -6,7 +6,7 @@
       >
     </el-header>
     <el-container class="course_data">
-      <el-table :data="courseList" border stripe highlight-current-row>
+      <el-table :data="courseList" border stripe highlight-current-row v-loading="loading">
         <el-table-column prop="name" label="课程名称" align="center">
         </el-table-column>
         <el-table-column label="价格" align="center">
@@ -19,14 +19,12 @@
         </el-table-column>
         <el-table-column fixed="right" label="操作" width="250" align="center">
           <template slot-scope="scope">
-            <el-button  type="text" @click="courseEdit(scope.row,scope.$index)"
+            <el-button type="text" @click="courseEdit(scope.row, scope.$index)"
               >编辑</el-button
             >
-            <el-button
-              type="text"
-              @click="courseDel(scope.row,scope.$index)"
+            <!-- <el-button type="text" @click="courseDel(scope.row, scope.$index)"
               >删除</el-button
-            >
+            > -->
           </template>
         </el-table-column>
       </el-table>
@@ -47,96 +45,84 @@
 </template>
 
 <script>
+import { deleteCourse, getCourseList } from "../api";
 export default {
   name: "",
   components: {},
   data() {
     return {
-      page:{
-        total:0,
-        size:10,
-        cur:1
+      loading:true,
+      page: {
+        total: 0,
+        size: 10,
+        cur: 1,
       },
       courseList: [],
     };
   },
-  watch:{
-    '$route':function(){
-      this.getCourseList()
-    }
+  watch: {
+    $route: function () {
+      this.getCourseList();
+    },
   },
   created() {
-    this.getCourseList()
+    this.getCourseList();
   },
   methods: {
     //获取课程列表
-    getCourseList(){
+    getCourseList() {
       let data = {
-        size:this.page.size,
-        page:this.page.cur
-      }
-      this.$axiosKc('get',`/mkt/admin/${this.$getCourseId()}/subject/list`,data).then(res=>{
-        if(res.data.code == 1){
-          this.courseList = res.data.data.list
-          this.page.total = res.data.data.total
-          this.page.size = res.data.data.size
-          this.page.cur = res.data.data.current
-        }else{
-          this.$message({
-            message: res.data.message,
-            type: 'error',
-            showClose: true,
-            duration: 3000,
-          });
-        }
-      })
+        size: this.page.size,
+        page: this.page.cur,
+      };
+      getCourseList(data).then((res) => {
+        this.loading = false
+        this.courseList = res.list;
+        this.page.total = res.total;
+        this.page.size = res.size;
+        this.page.cur = res.current;
+      });
     },
     // 当前页切换
-    curPageChange(){
-      this.getCourseList()
+    curPageChange() {
+      this.loading = true
+      this.getCourseList();
     },
     // 跳转课程修改
     courseEdit(row) {
       this.$router.push({
-        path:`/course/courseEdit/${row.id}`,
-      })
+        path: `/course/courseEdit/${row.id}`,
+      });
     },
     // 跳转创建新课程
-    courseCreate(){
-      this.$router.push('/course/courseCreate')
+    courseCreate() {
+      this.$router.push("/course/courseCreate");
     },
     // 删除
-    deleteCourse(id){
-      this.$axiosKc('post',`/mkt/admin/${this.$getCourseId()}/subject/delete/${id}`).then(res=>{
-        if(res.data.code == 1){
-          this.$message({
-            message: res.data.message,
-            type: 'success',
-            showClose: true,
-            duration: 3000,
-          });
-          this.page.cur = 1
-          this.getCourseList();
-        }else{
-          this.$message({
-            message: res.data.message,
-            type: 'error',
-            showClose: true,
-            duration: 3000,
-          });
-        }
-      })
+    deleteCourse(id) {
+      deleteCourse(id).then((res) => {
+        this.$message({
+          message: res.message,
+          type: "success",
+          showClose: true,
+          duration: 3000,
+        });
+        this.page.cur = 1;
+        this.loading = true
+        this.getCourseList();
+      });
     },
     // 删除课程
     courseDel(row) {
-      this.$confirm('确定删除当前课程吗?', '提示', {
-        confirmButtonText: '确认',
-        cancelButtonText: '取消',
-        type: 'warning',
-      }).then(action => {
-        this.deleteCourse(row.id)
-      }).catch(() => {
-      });
+      this.$confirm("确定删除当前课程吗?", "提示", {
+        confirmButtonText: "确认",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then((action) => {
+          this.deleteCourse(row.id);
+        })
+        .catch(() => {});
     },
   },
 };

+ 201 - 116
src/course/dealerManage/edit.vue

@@ -1,19 +1,36 @@
 <template>
   <div class="page">
-    <el-page-header @back="$router.go(-1)" :content='curName' style="margin-bottom: 20px;"></el-page-header>
+    <el-page-header
+      @back="$router.go(-1)"
+      :content="curName"
+      style="margin-bottom: 20px"
+    ></el-page-header>
     <el-container class="course_data">
-      <el-table :data="courseList" border stripe highlight-current-row>
-        <el-table-column prop="name" label="课程名称" align="center">
+      <el-button
+        type="primary"
+        plain
+        size="default"
+        style="margin-bottom: 15px"
+        @click="showAllcourseSelect"
+        >增加课程名额</el-button
+      >
+      <el-table :data="courseList" border stripe highlight-current-row v-loading="loading">
+        <el-table-column prop="subjectName" label="课程名称" align="center">
         </el-table-column>
         <el-table-column label="卖出" align="center">
-          <template slot-scope="scope"> {{ scope.row.save }} </template>
+          <template slot-scope="scope">
+            {{ scope.row.statistics.saleAmount }}
+          </template>
         </el-table-column>
         <el-table-column label="剩余" align="center">
-          <template slot-scope="scope"> {{ scope.row.surplus }} </template>
+          <template slot-scope="scope"> {{ scope.row.amount }} </template>
         </el-table-column>
         <el-table-column fixed="right" label="操作" width="250" align="center">
           <template slot-scope="scope">
-            <el-button type="text" size="mini" @click="courseAdd(scope.row, scope.$index)"
+            <el-button
+              type="text"
+              size="mini"
+              @click="courseAdd(scope.row, scope.$index)"
               >增加</el-button
             >
             <el-button
@@ -45,31 +62,63 @@
       </div>
     </el-container>
     <el-dialog
-      :title="eldiType?'增加课程名额':'减少课程名额'"
+      :title="eldiType ? '增加课程名额' : '减少课程名额'"
       :visible.sync="changeLimit"
       width="30%"
       :close-on-click-modal="false"
-      :close-on-press-escape='false'
+      :close-on-press-escape="false"
       center
-      @close="cancleDi">
-      <el-form :model="eldiForm" ref="form" label-width="80px" :inline="false" size="normal">
-        <el-form-item label="选择课程" size="normal">
-          <el-select v-model="eldiForm.id" placeholder="请选择课程">
+      @close="cancleDi"
+    >
+      <el-form
+        :model="eldiForm"
+        ref="form"
+        label-width="80px"
+        :inline="false"
+        size="normal"
+      >
+        <el-form-item label="选择课程" size="normal" v-if="addAllcourse">
+          <el-select v-model="eldiForm.id" placeholder="请选择所有课程">
             <el-option
-              v-for="item in courseOptions"
+              v-for="item in courseOptions(addAllcourse)"
               :key="item.value"
               :label="item.label"
-              :value="item.value">
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="选择课程" size="normal" v-else>
+          <el-select v-model="eldiForm.id" placeholder="请选择课程" disabled>
+            <el-option
+              v-for="item in courseOptions(addAllcourse)"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
             </el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="数量">
-          <el-input-number v-model="eldiForm.num" size="normal" :min="1" :step="1" :controls="true">
+          <el-input-number
+            v-model="eldiForm.num"
+            size="normal"
+            :min="1"
+            :step="1"
+            :controls="true"
+          >
           </el-input-number>
         </el-form-item>
         <el-form-item label="备注" size="normal">
-          <el-input type="textarea" :rows="2" v-model="eldiForm.beizhu" placeholder="请输入备注" 
-            :maxlength="-1" :show-word-limit="false" :autosize="{ minRows: 2, maxRows: 5 }">
+          <el-input
+            type="textarea"
+            :rows="2"
+            v-model="eldiForm.content"
+            placeholder="请输入备注"
+            :maxlength="-1"
+            :show-word-limit="false"
+            :autosize="{ minRows: 2, maxRows: 5 }"
+          >
           </el-input>
         </el-form-item>
       </el-form>
@@ -78,144 +127,180 @@
         <el-button type="primary" @click="confirmSave">保存</el-button>
       </span>
     </el-dialog>
-    
   </div>
 </template>
 
 <script>
+import {
+  getCourseList,
+  getDealerTransactionList,
+  editDealerCourseNum,
+} from "../api";
 export default {
   name: "dealerManage",
   data() {
     return {
+      loading:true,
       curName: "",
+      addAllcourse: false,
       page: {
         total: 1000,
         size: 10,
         cur: 1,
       },
       teamValue: "",
-      changeLimit:false,
-      eldiType:0,
-      eldiForm:{
-        id:0,
-        num:0,
-        addOrreduce:false,
-        beizhu:''
+      changeLimit: false,
+      eldiType: 0,
+      eldiForm: {
+        id: 0,
+        num: 1,
+        content: "",
       },
-      courseOptions:[
-        {
-          label:"经济讲堂1",
-          value:1555
-        },
-        {
-          label:"经济讲堂2",
-          value:1552
-        },
-        {
-          label:"经济讲堂3",
-          value:1535
-        },
-        {
-          label:"经济讲堂4",
-          value:1255
-        }
-      ],
-      courseList:[],
-      courseList: [
-        {
-          id: 123455,
-          name: "经济论坛001",
-          save: 64,
-          surplus:136,
-        },
-        {
-          id: 123452,
-          name: "经济论坛002",
-          save: 33,
-          surplus:16,
-        },
-        {
-          id: 123451,
-          name: "经济论坛003",
-          save: 64,
-          surplus:136,
-        },
-        {
-          id: 123422,
-          name: "经济论坛004",
-          save: 62,
-          surplus:116,
-        },
-      ],
+      courseList: [],
+      courseAllList: [],
     };
   },
+  computed: {
+    //添加/减少课程选择列表
+    courseOptions() {
+      return function (type) {
+        if (!type) {
+          let list = [];
+          this.courseList.forEach((item) => {
+            list.push({
+              label: item.subjectName,
+              value: item.subjectId,
+            });
+          });
+          return list;
+        } else {
+          let list = [];
+          this.courseAllList.forEach((item) => {
+            list.push({
+              label: item.name,
+              value: item.id,
+            });
+          });
+          return list;
+        }
+      };
+    },
+  },
   created() {
     this.init();
   },
-  watch:{
-    '$route'(){
-      this.init()
-    }
-  },
   methods: {
+    //添加新的课程名额
+    showAllcourseSelect() {
+      this.eldiForm.id = this.courseAllList[0].id;
+      this.addAllcourse = true;
+      this.changeLimit = true;
+      this.eldiType = 1;
+    },
+    //获取所有课程列表
+    getAllList() {
+      let data = {
+        page: 1,
+        pageSize: 100000,
+      };
+      getCourseList(data).then((res) => {
+        this.loading = false
+        this.courseAllList = res.list;
+      });
+    },
+    //获取经销商推广课程列表
+    getList() {
+      let data = {
+        userId: this.$route.params.id,
+        page: this.page.cur,
+        pageSize: this.page.size,
+      };
+      getDealerTransactionList(data)
+        .then((res) => {
+          this.loading = false
+          this.courseList = res.list;
+          this.page.cur = res.current;
+          this.page.total = res.total;
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
     //增加名额
-    courseAdd(row,index){
-      this.eldiType = 1
-      this.changeLimit = true
+    courseAdd(row, index) {
+      this.eldiForm.id = row.subjectId;
+      this.eldiType = 1;
+      this.changeLimit = true;
     },
     //减少名额
-    courseSurplus(row,index){
-      this.eldiType = 0
-      this.changeLimit = true
+    courseSurplus(row, index) {
+      this.eldiForm.id = row.subjectId;
+      this.eldiType = 0;
+      this.changeLimit = true;
     },
     //查看明细
-    courseRecord(row,index){
+    courseRecord(row, index) {
       this.$router.push({
-        path:`/course/courseRecord/${row.id}`,
-        query:{
-          name:row.name
-        }
-      })
+        path: `/course/courseRecord/${this.$route.params.id}/${row.id}`,
+        query: {
+          name: row.subjectName,
+        },
+      });
     },
     // 提交名额交易
-    confirmSave(){
-      this.$confirm('确定要提交名额交易吗?', '提示', {
-        confirmButtonText: '确认',
-        cancelButtonText: '取消',
-        type: 'info',
-      }).then(action => {
-        this.$message({
-          message: '交易成功!',
-          type: 'success',
-          showClose: true,
-          duration: 1500,
-        });
-        this.cancleDi()
-      }).catch(() => {
-        
-      });
-      
+    confirmSave() {
+      this.$confirm("确定要提交名额交易吗?", "提示", {
+        confirmButtonText: "确认",
+        cancelButtonText: "取消",
+        type: "info",
+      })
+        .then(() => {
+          let amount = Number(
+            `${this.eldiType ? "" : "-"}${this.eldiForm.num}`
+          );
+          let data = {
+            amount: amount,
+            content: this.eldiForm.content,
+          };
+          editDealerCourseNum(
+            this.$route.params.id,
+            this.eldiForm.id,
+            data
+          ).then((res) => {
+            this.$message({
+              message: "交易成功!",
+              type: "success",
+              showClose: true,
+              duration: 1500,
+            });
+            this.cancleDi();
+            this.loading = true
+            this.getList();
+          });
+        })
+        .catch(() => {});
     },
     //取消弹窗
-    cancleDi(){
+    cancleDi() {
       let form = {
-        id:0,
-        num:0,
-        addOrreduce:false,
-        beizhu:''
-      }
-      this.eldiType = 0
-      this.eldiForm = form
-      this.changeLimit = false
+        id: 0,
+        num: 0,
+        content: "",
+      };
+      this.eldiType = 0;
+      this.eldiForm = form;
+      this.changeLimit = false;
     },
     //初始化
     init() {
-      // console.log(this.$route)
-        this.curName = `${this.$route.query.name}推广的课程`;
+      this.curName = `${this.$route.query.name}推广的课程`;
+      this.getList();
+      this.getAllList();
     },
     // 页面切换
     curPageChange() {
-      console.log(this.page);
+      this.loading = true
+      this.getList();
     },
   },
 };

+ 72 - 47
src/course/dealerManage/home.vue

@@ -10,14 +10,14 @@
       <el-button
         type="primary"
         size="normal"
-        @click="createQr"
+        @click="qropen"
         plain
         v-if="isOuter"
         >经销商邀请二维码</el-button
       >
       <div class="search">
         <el-input
-          placeholder="请输入内容"
+          placeholder="请输入用户名"
           v-model.trim="teamValue"
           @keyup.enter.native="teamSearch"
         >
@@ -26,7 +26,13 @@
       </div>
     </el-header>
     <el-container class="course_data">
-      <el-table :data="dealerInfo" border stripe highlight-current-row>
+      <el-table
+        :data="dealerInfo"
+        border
+        stripe
+        highlight-current-row
+        v-loading="loading"
+      >
         <el-table-column prop="name" label="用户名" align="center">
         </el-table-column>
         <el-table-column label="微信ID" align="center" min-width="100px">
@@ -52,12 +58,12 @@
         </el-table-column>
         <el-table-column fixed="right" label="操作" width="250" align="center">
           <template slot-scope="scope">
-            <el-button
+            <!-- <el-button
               type="text"
               size="mini"
               @click="infoEdit(scope.row, scope.$index)"
               >修改信息</el-button
-            >
+            > -->
             <el-button
               size="mini"
               type="text"
@@ -111,10 +117,20 @@
         <el-button type="primary" @click="confirmSave">保存</el-button>
       </span>
     </el-dialog>
+    <el-dialog
+      :visible.sync="qrVisible"
+      width="400px"
+      title="经销商邀请二维码"
+      center
+      @close="cancleQr"
+    >
+      <div id="root" style="display: flex;justify-content: center;" ref="qrCodeUrl"></div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import QRCode from "qrcodejs2";
 import { getDealerList } from "../api";
 export default {
   name: "dealerManage",
@@ -122,6 +138,10 @@ export default {
   props: [],
   data() {
     return {
+      loading: true,
+      qrVisible: false,
+      qrcode: null,
+      qrcodeStatus: false,
       eldiForm: false,
       dealerForm: {
         id: 0,
@@ -152,33 +172,50 @@ export default {
     };
   },
   watch: {
-    // $route: function (to, from) {
-    //   if(to.path == '/course/dealerManage'){
-    //     this.init();
-    //   }
-    // },
+    // '$route':function(to,from){
+    // }
   },
   created() {
     this.init();
   },
   methods: {
+    qropen() {
+      this.qrVisible = true;
+      this.$nextTick(() => {
+        this.creatQrCode();
+      });
+    },
+    cancleQr() {},
+    creatQrCode() {
+      if (!this.qrcodeStatus) {
+        this.qrcode = new QRCode(this.$refs.qrCodeUrl, {
+          text: "https://www.baidu.com/", // 需要转换为二维码的内容
+          width: 300,
+          height: 300,
+          colorDark: "#000000",
+          colorLight: "#ffffff",
+          correctLevel: QRCode.CorrectLevel.H,
+        });
+        this.qrcodeStatus = true;
+      }
+    },
     //获取经销商列表
-    getDealerMap(type, pid) {
-      console.log(123)
+    getDealerMap(type) {
       let data = {
         page: this.page.cur,
         pageSize: this.page.size,
         marketable: type,
       };
-      if (pid != undefined) {
-        data.pid = pid;
+      if (this.$route.params.id) {
+        data.pid = this.$route.params.id;
+      }
+      if (this.teamValue) {
+        data.keyword = this.teamValue;
       }
-      console.log(data);
       getDealerList(data).then((res) => {
-        // console.log(res);
+        this.loading = false;
         this.dealerInfo = res.list;
-        this.page.cur = res.page;
-        this.page.size = res.size;
+        this.page.cur = res.current;
         this.page.total = res.total;
       });
     },
@@ -215,62 +252,50 @@ export default {
     },
     // 初始化
     init() {
-      console.log(this.$route.params.id)
-      // if (this.$route.params.id) {
-      //   console.log(1111)
-      //   this.isOuter = false;
-      //   this.curTeamTel = `${this.$route.query.tel}的团队`;
-      //   this.getDealerMap(1, this.$route.params.id);
-      // } else {
-      //   console.log(2222)
-      //   this.isOuter = true;
-      //   this.getDealerMap(1);
-      // }
-      console.log(2222)
+      if (
+        this.$route.path.includes("/course/dealerTeam") &&
+        this.$route.params.id
+      ) {
+        this.isOuter = false;
+        this.curTeamTel = `${this.$route.query.name}的团队`;
+        this.getDealerMap(1, this.$route.params.id);
+      } else {
         this.isOuter = true;
         this.getDealerMap(1);
+      }
     },
     // 跳转到我的团队
     toDealerTeam(row) {
-      console.log(row);
       if (row.statistics.teamAmount != 0) {
         this.$router.push({
-          path: `/course/dealerTeam/${row.id}?tel=${row.tel}`,
-          params: {
-            tel: row.tel,
-          },
+          path: `/course/dealerTeam/${row.id}?name=${row.name}`,
         });
-      }else{
+      } else {
         this.$message({
-          message: '您还没有团队',
-          type: 'warning',
+          message: "您还没有团队",
+          type: "warning",
           showClose: true,
           duration: 3000,
         });
-        
       }
     },
     // 搜索
     teamSearch() {
-      if (this.teamValue) {
-        console.log(this.teamValue);
-      }
+      this.loading = true;
+      this.getDealerMap();
     },
-    // 创建二维码
-    createQr() {},
     // 切换当前页
     curPageChange() {
-      console.log(this.page);
+      this.loading = true;
+      this.getDealerMap();
     },
     // 打开弹窗修改个人信息
     infoEdit(row) {
       this.dealerForm = JSON.parse(JSON.stringify(row));
       this.eldiForm = true;
-      console.log(row);
     },
     // 跳转查看交易详情
     dealerPay(row) {
-      console.log(row);
       this.$router.push(`/course/dealerEdit/${row.id}?name=${row.name}`);
     },
   },

+ 25 - 52
src/course/dealerManage/record.vue

@@ -3,23 +3,21 @@
       <el-page-header @back="$router.go(-1)" content='课程交易明细' style="margin-bottom: 20px;"></el-page-header>
       <h3>{{ curTeamTel }}</h3>
       <el-container class="course_data">
-        <el-table :data="courseRecord" border stripe highlight-current-row>
+        <el-table :data="courseRecord" border stripe highlight-current-row v-loading="loading">
           <el-table-column label="课程名额变动明细" align="center">
-            <template slot-scope="scope"> {{ scope.row.direction == 'to'?'-':'+' }}{{ scope.row.num }} </template>
+            <template slot-scope="scope"> {{ scope.row.amount }} </template>
           </el-table-column>
           <el-table-column label="备注" align="center">
-            <template slot-scope="scope"> {{ scope.row.beizhu }} </template>
+            <template slot-scope="scope"> {{ scope.row.content }} </template>
           </el-table-column>
           <el-table-column label="记录时间" align="center">
-            <template slot-scope="scope"> {{ scope.row.create_time }} </template>
+            <template slot-scope="scope"> {{ scope.row.createTime }} </template>
           </el-table-column>
         </el-table>
         <div class="proness">
           <el-pagination
             background
             layout="prev, pager, next"
-            @prev-click="prevPage()"
-            @next-click="nextPage()"
             @current-change="curPageChange()"
             :current-page.sync="page.cur"
             :page-size="page.size"
@@ -33,75 +31,50 @@
   </template>
   
   <script>
+  import {getCourseTransationList} from '../api'
   export default {
     name: "dealerRecord",
     components: {},
     props: [],
     data() {
       return {
-        curTeamTel: "经济讲堂1的交易明细",
+        loading:true,
+        userId: this.$route.params.userId,
+        courseId: this.$route.params.courseId,
+        curTeamTel: "交易明细",
         page: {
-          total: 1000,
+          total: 0,
           size: 10,
           cur: 1,
         },
-        courseRecord: [
-          {
-            id: 123455,
-            direction:"to",
-            num:12,
-            beizhu: "撒大大实打实大师大撒大大实打实大师大",
-            create_time: '2021-6-15',
-          },
-          {
-            id: 123453,
-            direction:"to",
-            num:22,
-            beizhu: "撒大大实打实大师大撒大大实打实大师大",
-            create_time: '2021-6-12',
-          },
-          {
-            id: 123452,
-            direction:"from",
-            num:50,
-            beizhu: "撒大大实打实大师大撒大大实打实大师大",
-            create_time: '2021-3-15',
-          },
-          {
-            id: 123451,
-            direction:"to",
-            num:42,
-            beizhu: "撒大大实打实大师大撒大大实打实大师大",
-            create_time: '2022-1-15',
-          },
-        ],
+        courseRecord: [],
       };
     },
-    watch: {
-      $route:function(to,from){
-        this.init()
-      }
-    },
     created() {
       this.init();
     },
     methods: {
       // 初始化
       init() {
-        console.log(this.$route)
           this.curTeamTel = `${this.$route.query.name}的交易明细`;
+          this.getList()
       },
-      // 上一页
-      prevPage() {
-        console.log(this.page);
-      },
-      // 下一页
-      nextPage() {
-        console.log(this.page);
+      getList(){
+        let data = {
+          page:this.page.cur,
+          pageSize:this.page.size
+        }
+        getCourseTransationList(this.userId,this.courseId,data).then(res=>{
+          this.loading = false
+          this.courseRecord = res.list;
+          this.page.cur = res.current;
+          this.page.total = res.total;
+        })
       },
       // 切换当前页
       curPageChange() {
-        console.log(this.page);
+        this.loading = true
+        this.getList()
       },
     },
   };

+ 55 - 25
src/course/home.vue

@@ -2,46 +2,76 @@
   <div>
     <div>
       <div class="flex-box">
-        <div class="flex-1" style="margin-right: 10px;">
-          <div style="background-color: #fff;padding:20px;margin-bottom: 10px;" class="br-5 ">
+        <div class="flex-1">
+          <div
+            style="background-color: #fff; padding: 20px; margin-bottom: 10px"
+            class="br-5"
+          >
             <div class="flex-box-ce">
-                <div style="margin-right: 10px;">
-                  <userImage :id="course_account_info.id" :img_url="course_account_info.img_url" :user_name="course_account_info.name" width="50px" height="50px"></userImage>
-                </div>
-                <div class="flex-1">
-                  <div class="flex-box-ce" style="margin-bottom: 6px;font-size: 14px;color: #666;font-weight: 700;">
-                    <div style="font-size: 16px;font-weight: 700;padding-right:15px;" class="black">你好,{{ course_account_info.name }}</div>
+              <div style="margin-right: 10px">
+                <userImage
+                  :id="course_account_info.id"
+                  :img_url="course_account_info.img_url"
+                  :user_name="course_account_info.name"
+                  width="50px"
+                  height="50px"
+                ></userImage>
+              </div>
+              <div class="flex-1">
+                <div
+                  class="flex-box-ce"
+                  style="
+                    margin-bottom: 6px;
+                    font-size: 14px;
+                    color: #666;
+                    font-weight: 700;
+                  "
+                >
+                  <div
+                    style="
+                      font-size: 16px;
+                      font-weight: 700;
+                      padding-right: 15px;
+                    "
+                    class="black"
+                  >
+                    {{ course_account_info.name }}
                   </div>
                 </div>
+              </div>
             </div>
           </div>
         </div>
       </div>
+      <div class="other" style="background-color: #5FA4E8;overflow: hidden;border-radius: 5px;">
+        <img
+          src="static/images/login2.png"
+          style="margin:  150px auto; display: block;"
+        />
+      </div>
     </div>
-</div>
+  </div>
 </template>
 
 <script>
-import { mapGetters, mapState } from 'vuex';
+import { mapGetters, mapState } from "vuex";
 export default {
-  name: '',
+  name: "",
   components: {},
-    props: [],
-  data () {
-    return {
-    }
+  props: [],
+  data() {
+    return {};
   },
-  created () { },
-  mounted () { },
-  methods: {
-   },
+  created() {},
+  mounted() {},
+  methods: {},
   computed: {
-    ...mapGetters(['course_account_info'])
-  }
-}
+    ...mapGetters(["course_account_info"]),
+  },
+};
 </script>
-<style scoped lang='scss'>
-.page{
-  background-color: #FFF;
+<style scoped lang="scss">
+.page {
+  background-color: #fff;
 }
 </style>

+ 109 - 115
src/course/setting/home.vue

@@ -6,17 +6,23 @@
       >
     </el-header>
     <el-container class="course_data">
-      <el-table :data="manageList" border stripe highlight-current-row>
-        <el-table-column prop="name" label="用户名" align="center">
+      <el-table
+        :data="manageList"
+        border
+        stripe
+        highlight-current-row
+        v-loading="loading"
+      >
+        <el-table-column prop="accountName" label="用户名" align="center">
         </el-table-column>
         <el-table-column label="手机号" align="center">
-          <template slot-scope="scope"> {{ scope.row.tel }} </template>
+          <template slot-scope="scope">
+            {{ scope.row.accountMobile }}
+          </template>
         </el-table-column>
         <el-table-column fixed="right" label="操作" width="250" align="center">
           <template slot-scope="scope">
-            <el-button
-              type="text"
-              @click="courseDel(scope.row, scope.$index)"
+            <el-button type="text" @click="courseDel(scope.row, scope.$index)"
               >删除</el-button
             >
           </template>
@@ -26,8 +32,6 @@
         <el-pagination
           background
           layout="prev, pager, next"
-          @prev-click="prevPage()"
-          @next-click="nextPage()"
           @current-change="curPageChange()"
           :current-page.sync="page.cur"
           :page-size="page.size"
@@ -40,7 +44,7 @@
     <el-dialog
       title="设置管理员"
       :visible.sync="showSetting"
-      :close-on-press-escape='false'
+      :close-on-press-escape="false"
       width="32%"
       @close="cancle()"
     >
@@ -67,20 +71,19 @@
             @click="selectMange(item, index)"
           >
             <userImage
-              class="user_img"
               width="40px"
               height="40px"
               fontSize="14"
-              :user_name="item.name"
+              :user_name="item.accountName"
               :img_url="item.img_url"
             ></userImage>
-            <span>{{ item.name }}</span>
+            <span>{{ item.accountName }}</span>
           </div>
         </div>
       </el-container>
 
       <span slot="footer">
-        <el-button @click="canle()">取消</el-button>
+        <el-button @click="cancle()">取消</el-button>
         <el-button type="primary" @click="manageSetting()">保存</el-button>
       </span>
     </el-dialog>
@@ -88,12 +91,16 @@
 </template>
 
 <script>
+import { Loading } from "element-ui";
+import { getAdminList, deleteAdmin, addAdmin, getAssignAccount } from "../api";
+import { validateTel } from "@/utils/validate";
 export default {
   name: "",
   components: {},
   props: [],
   data() {
     return {
+      loading: true,
       showSetting: false,
       searchTel: "",
       page: {
@@ -101,93 +108,87 @@ export default {
         size: 10,
         cur: 1,
       },
-      manageList: [
-        {
-          id: 1545545,
-          name: "张三",
-          tel: "15156664888",
-          img_ur: "../../assets/404_images/404.png",
-        },
-        {
-          id: 1545543,
-          name: "李四",
-          tel: "15156332211",
-          img_ur: "../../assets/404_images/404.png",
-        },
-        {
-          id: 1545544,
-          name: "王五",
-          tel: "15156954421",
-          img_ur: "../../assets/404_images/404.png",
-        },
-      ],
-      userList: [
-        {
-          id: 1454555,
-          name: "张三",
-          img_url: "../../assets/404_images/404.png",
-          tel: "15266664444",
-          active: false,
-        },
-        {
-          id: 1454553,
-          name: "李四",
-          img_url: "../../assets/404_images/404.png",
-          tel: "15266321144",
-          active: false,
-        },
-        {
-          id: 1454552,
-          name: "王五",
-          img_url: "../../assets/404_images/404.png",
-          tel: "15266611144",
-          active: true,
-        },
-        {
-          id: 1451555,
-          name: "燕小六",
-          img_url: "../../assets/404_images/404.png",
-          tel: "15266663333",
-          active: false,
-        },
-        {
-          id: 1453355,
-          name: "七剑下天山",
-          img_url: "../../assets/404_images/404.png",
-          tel: "15266662214",
-          active: false,
-        }
-      ],
+      manageList: [],
+      userList: [],
     };
   },
-  created() {},
+  created() {
+    this.getList();
+  },
   methods: {
+    // 删除管理员
+    deleteAdmin(id) {
+      deleteAdmin(id).then((res) => {
+        this.$message({
+          message: "删除管理员成功",
+          type: "success",
+          showClose: true,
+          duration: 3000,
+        });
+        this.page.cur = 1;
+        this.page.total = 0;
+        this.loading = true;
+        this.getList();
+      });
+    },
+    // 添加管理员
+    addAdmin(id) {
+      addAdmin(id).then((res) => {
+        this.$message({
+          message: "添加管理员成功",
+          type: "success",
+          showClose: true,
+          duration: 3000,
+        });
+        this.searchTel = "";
+        this.page.cur = 1;
+        this.page.total = 0;
+        this.loading = true;
+        this.getList();
+        this.cancle();
+      });
+    },
+    //获取管理员列表
+    getList() {
+      let data = {
+        page: this.page.cur,
+        pageSize: this.page.size,
+      };
+      getAdminList(data).then((res) => {
+        this.loading = false;
+        this.manageList = res.list;
+        this.page.cur = res.current;
+        this.page.total = res.total;
+      });
+    },
     // 初始化表单并关闭弹窗
-    canle() {
-      // this.userList = []
+    cancle() {
+      this.userList = [];
       this.showSetting = false;
     },
-    // 点击用户为管理员
+    // 选择用户为管理员备选
     selectMange(item, index) {
-      // if(this.sureActiveUser() == 1 && ){
-      //   this.$message({
-      //     message: '只能选择一个用户!',
-      //     type: 'warn',
-      //     showClose: true,
-      //     duration: 2000,
-      //   });
-
-      //   return false
-      // }
       this.userList[index].active = !this.userList[index].active;
     },
     // 用户手机号搜索
     userSearch() {
-      console.log(this.searchTel);
-    },
-    // 关闭设置管理员弹窗
-    cancle() {
-      this.showSetting = false;
+      let rule = new RegExp(/^(?:(?:\+|00)86)?1[3-9]\d{9}$/)
+      if (rule.test(this.searchTel)) {
+        let data = {
+          mobile: this.searchTel,
+        };
+        getAssignAccount(data).then((res) => {
+          res.active = false;
+          this.userList.push(res);
+        });
+      } else {
+        this.$message({
+          message: "请输入正确的手机号格式",
+          type: "warning",
+          showClose: true,
+          duration: 1500,
+        });
+      }
     },
     // 查询已选择管理员人数
     sureActiveUser() {
@@ -197,6 +198,10 @@ export default {
       });
       return leng;
     },
+    pageReset() {
+      this.page.cur = 1;
+      this.page.total = 0;
+    },
     //表单提交为管理员
     manageSetting() {
       if (this.sureActiveUser() == 1) {
@@ -205,19 +210,21 @@ export default {
           cancelButtonText: "取消",
           type: "info",
         })
-          .then((action) => {
-            this.$message({
-              message: "用户设置为管理员成功!",
-              type: "info",
-              showClose: true,
-              duration: 3000,
+          .then(() => {
+            let activeItem;
+            this.userList.forEach((item, index) => {
+              if (item.active) {
+                activeItem = item;
+              }
             });
-            this.showSetting = false;
+            this.addAdmin(activeItem.accountId);
           })
-          .catch(() => {});
+          .catch((err) => {
+            console.log(err);
+          });
       } else {
         this.$message({
-          message: "只能选择一个用户",
+          message: "请搜索并选择用户作为管理员",
           type: "info",
           showClose: true,
           duration: 2000,
@@ -228,17 +235,9 @@ export default {
     setManage() {
       this.showSetting = true;
     },
-    // 上一页
-    prevPage() {
-      console.log(this.page);
-    },
-    // 下一页
-    nextPage() {
-      console.log(this.page);
-    },
     // 切换当前页
     curPageChange() {
-      console.log(this.page);
+      this.getList();
     },
     // 删除管理员
     courseDel(row) {
@@ -247,13 +246,8 @@ export default {
         cancelButtonText: "取消",
         type: "warning",
       })
-        .then((action) => {
-          this.$message({
-            message: "删除成功!",
-            type: "success",
-            showClose: true,
-            duration: 1500,
-          });
+        .then(() => {
+          this.deleteAdmin(row.auId);
         })
         .catch(() => {});
     },
@@ -279,7 +273,7 @@ export default {
     flex-wrap: wrap;
     justify-content: space-between;
     .userLi {
-      padding-top: 5px;
+      padding: 5px 0;
       cursor: pointer;
       width: 70px;
       overflow: hidden;

+ 203 - 159
src/course/statistics/home.vue

@@ -5,35 +5,39 @@
         <el-tab-pane label="经销商订购情况" name="1"> </el-tab-pane>
         <el-tab-pane label="课程订购情况" name="2"></el-tab-pane>
       </el-tabs>
-      <el-header height="40px">
-        <div class="flex-box">
+        <div class="flex-box" style="margin-bottom: 10px;">
           <el-date-picker
             v-model="searchTime"
             type="daterange"
             range-separator="至"
             start-placeholder="开始日期"
             end-placeholder="结束日期"
+            value-format="yyyy-MM-dd"
           >
           </el-date-picker>
           <div class="search" v-if="activeIndex == '1'">
             <el-input
-              placeholder="搜索课程"
-              v-model.trim="searchText"
-              @keyup.enter.native="courseSearch"
+              placeholder="搜索经销商"
+              v-model.trim="searchDealer"
+              @keyup.enter.native="dealerSearch"
             >
               <i slot="prefix" class="el-input__icon el-icon-search"></i>
             </el-input>
           </div>
           <div class="search" v-else>
             <el-input
-              placeholder="搜索经销商"
-              v-model.trim="searchDealer"
-              @keyup.enter.native="dealerSearch"
+              placeholder="搜索课程"
+              v-model.trim="searchText"
+              @keyup.enter.native="courseSearch"
             >
               <i slot="prefix" class="el-input__icon el-icon-search"></i>
             </el-input>
           </div>
-          <el-select v-model="sortValue" placeholder="排序">
+          <el-select
+            v-model="sortValue"
+            placeholder="排序"
+            @change="recordList.sort(sortBy('amount', sortValue))"
+          >
             <el-option
               v-for="item in sortOptions"
               :key="item.value"
@@ -43,25 +47,37 @@
             </el-option>
           </el-select>
         </div>
-      </el-header>
       <el-container direction="vertical">
-        <el-table :data="recordList" border stripe>
-          <el-table-column label="经销商" align="center" v-if='activeIndex == "1"'>
-            <template slot-scope="scope">{{ scope.row.dealer_name }}</template>
+        <el-table :data="recordList" border stripe v-loading="loading">
+          <el-table-column
+            label="经销商"
+            align="center"
+            v-if="activeIndex == '1'"
+          >
+            <template slot-scope="scope">{{ scope.row.userName }}</template>
           </el-table-column>
           <el-table-column
-            prop="course_name"
+            label="手机号"
+            align="center"
+            v-if="activeIndex == '1'"
+          >
+            <template slot-scope="scope">{{
+              scope.row.mobile == "" ? "无" : scope.row.mobile
+            }}</template>
+          </el-table-column>
+          <el-table-column
+            prop="subjectName"
             label="课程标题"
             align="center"
-            v-if='activeIndex == "2"'
+            v-if="activeIndex == '2'"
           ></el-table-column>
           <el-table-column label="时间区间" align="center">
-            <template slot-scope="scope"
-              >{{ scope.row.satet_time }}-{{ scope.row.end_time }}</template
-            >
+            <template slot-scope="scope">{{
+              scope.row.timeScope == "" ? "全部" : scope.row.timeScope
+            }}</template>
           </el-table-column>
           <el-table-column
-            prop="sale"
+            prop="amount"
             label="经销商订购量(套)"
             align="center"
           ></el-table-column>
@@ -74,50 +90,56 @@
           </el-table-column>
         </el-table>
       </el-container>
-      <div class="proness">
+      <!-- <div class="proness">
         <el-pagination
           background
           layout="prev, pager, next"
-          @prev-click="prevPage()"
-          @next-click="nextPage()"
-          @current-change="curPageChange()"
+          @current-change="curPageChange(1)"
           :current-page.sync="page.cur"
           :page-size="page.size"
           :total="page.total"
           :hide-on-single-page="true"
         >
         </el-pagination>
-      </div>
+      </div> -->
     </el-container>
     <el-dialog
       title="记录明细"
       :visible.sync="showDetail"
-      width="50%"
+      width="70%"
       center
       @close="cancle()"
     >
-      <el-table :data="recordDetails" border stripe>
-        <el-table-column label="经销商" align="center" v-if='activeIndex == "2"'>
-          <template slot-scope="scope">{{ scope.row.dealer_name }}</template>
+      <el-table :data="recordDetails" border stripe v-loading="rLoading">
+        <el-table-column
+          label="发起人(名额交易发起人)"
+          align="center"
+        >
+          <template slot-scope="scope">{{ scope.row.fromUserMobile===0?'平台增加':scope.row.fromUserMobile }}</template>
         </el-table-column>
         <el-table-column
-          prop="course_name"
-          label="课程标题"
+          label="接收人(名额交易接收人)"
           align="center"
-          v-if='activeIndex == "1"'
+          v-if="activeIndex == '2'"
+        >
+          <template slot-scope="scope">{{ scope.row.toUserMobile===0?'平台扣除':scope.row.toUserMobile}}</template>
+        </el-table-column>
+        <el-table-column
+          prop="subjectName"
+          label="课程名称"
+          align="center"
+          v-if="activeIndex == '1'"
         ></el-table-column>
         <el-table-column label="名额变动数量" align="center">
-          <template slot-scope="scope"
-            >{{ scope.row.direction == 'to'?'-':'+' }}{{ scope.row.num }}</template
-          >
+          <template slot-scope="scope">{{ scope.row.amount }}</template>
         </el-table-column>
         <el-table-column
-          prop="beizhu"
-          label="备注(套)"
+          prop="content"
+          label="备注"
           align="center"
         ></el-table-column>
         <el-table-column
-          prop="create_time"
+          prop="createTime"
           label="创建时间"
           align="center"
         ></el-table-column>
@@ -126,9 +148,7 @@
         <el-pagination
           background
           layout="prev, pager, next"
-          @prev-click="prevPage(1)"
-          @next-click="nextPage(1)"
-          @current-change="curPageChange(1)"
+          @current-change="curPageChange(2)"
           :current-page.sync="page1.cur"
           :page-size="page1.size"
           :total="page1.total"
@@ -141,168 +161,192 @@
 </template>
 
 <script>
+import {
+  getDealerOrCourseRecode,
+  getDealerOrderList,
+  getCourseOrderList,
+} from "../api";
 export default {
-  name: "",
+  name: "statistics",
   components: {},
   props: [],
   data() {
     return {
-      page:{
-        total:1000,
-        size:10,
-        cur:1
+      loading:true,
+      rLoading:true,
+      page: {
+        total: 0,
+        size: 10,
+        cur: 1,
       },
-      page1:{
-        total:50,
-        size:10,
-        cur:1
+      page1: {
+        total: 0,
+        size: 10,
+        cur: 1,
       },
       showDetail: false,
-      searchTime: "",
+      searchTime: null,
       searchText: "",
       searchDealer: "",
       activeIndex: "1",
       sortValue: 0,
       sortOptions: [
         {
-          label: "默认",
+          label: "由多到少",
           value: 0,
         },
         {
-          label: "时间排序",
+          label: "由少到多",
           value: 1,
         },
-        {
-          label: "卖出数量",
-          value: 2,
-        },
-      ],
-      recordList: [
-        {
-          id: 154465,
-          dealer_name: "张三",
-          satet_time: "2023-2-15",
-          end_time: "2023-5-11",
-          sale: 440,
-          course_name: "经济讲堂1",
-        },
-        {
-          id: 154433,
-          dealer_name: "李四",
-          satet_time: "2023-3-15",
-          end_time: "2023-4-11",
-          sale: 440,
-          course_name: "经济讲堂2",
-        },
-        {
-          id: 154123,
-          dealer_name: "王五",
-          satet_time: "2023-1-15",
-          end_time: "2023-3-11",
-          sale: 440,
-          course_name: "经济讲堂3",
-        },
-      ],
-      recordDetails: [
-        {
-          dealer_name: "张三",
-          course_name: "课程精讲5",
-          direction: "to",
-          num: 10,
-          sale: 100,
-          satet_time: "2022-5-4",
-          end_time: "2022-9-1",
-          beizhu:"哦哦kik尽快",
-          create_time:"2022-1-1"
-        },
-        {
-          dealer_name: "李四",
-          course_name: "课程精讲4",
-          direction: "from",
-          num: 10,
-          sale: 100,
-          satet_time: "2022-5-4",
-          end_time: "2022-9-1",
-          beizhu:"哦哦kik尽快",
-          create_time:"2022-2-1"
-        },
-        {
-          dealer_name: "王五",
-          course_name: "课程精讲3",
-          direction: "from",
-          num: 10,
-          sale: 100,
-          satet_time: "2022-5-4",
-          end_time: "2022-9-1",
-          beizhu:"哦哦kik尽快",
-          create_time:"2022-3-1"
-        },
-        {
-          dealer_name: "小六",
-          course_name: "课程精讲2",
-          direction: "to",
-          num: 10,
-          sale: 100,
-          satet_time: "2022-5-4",
-          end_time: "2022-9-1",
-          beizhu:"哦哦kik尽快",
-          create_time:"2022-6-1"
-        },
       ],
+      recordList: [],
+      recordDetails: [],
     };
   },
-  created() {},
+  watch: {
+    searchTime() {
+      if (this.activeIndex == "1") {
+        this.getList();
+      } else {
+        this.getCourseList();
+      }
+    },
+  },
+  created() {
+    this.getList();
+  },
   methods: {
-    // 上一页
-    prevPage(type){
-      if(type){
-        console.log(this.page1)
-      }else{
-        console.log(this.page)
+    sortBy(attr, type) {
+      let rev = type ? 1 : -1;
+      if (rev == undefined) {
+        rev = 1;
+      } else {
+        rev ? 1 : -1;
       }
+      return function (a, b) {
+        a = a[attr];
+        b = b[attr];
+        if (a < b) {
+          return rev * -1;
+        }
+        if (a > b) {
+          return rev * 1;
+        }
+        return 0;
+      };
     },
-    // 下一页
-    nextPage(type){
-      if(type){
-        console.log(this.page1)
-      }else{
-        console.log(this.page)
+    //获取经销商统计列表
+    getList() {
+      let data = {
+        page: this.page.cur,
+        size: this.page.size,
+      };
+      if (this.searchTime && this.searchTime.length > 0) {
+        data.startDate = this.searchTime[0];
+        data.endDate = this.searchTime[1];
+      }
+      if (this.searchDealer) {
+        data.keyword = this.searchDealer;
+      }
+      getDealerOrderList(data).then((res) => {
+        this.loading = false
+        this.recordList = res.list;
+        this.page.cur = res.current;
+        this.page.total = res.total;
+      });
+    },
+    //获取课程统计列表
+    getCourseList() {
+      let data = {
+        page: this.page.cur,
+        size: this.page.size,
+      };
+      if (this.searchTime && this.searchTime.length > 0) {
+        data.startDate = this.searchTime[0];
+        data.endDate = this.searchTime[1];
+      }
+      if (this.searchText) {
+        data.keyword = this.searchText;
       }
+      getCourseOrderList(data).then((res) => {
+        this.loading = false
+        this.recordList = res.list;
+        this.page.cur = res.current;
+        this.page.total = res.total;
+      });
+    },
+    //获取指定经销商/课程的订购明细
+    getAssignDrtailList(type, id) {
+      let data = {
+        page: this.page1.cur,
+        pageSize: this.page1.size,
+      };
+      if (type == 1) {
+        data.userId = id;
+      } else {
+        data.subjectId = id;
+      }
+      getDealerOrCourseRecode(data).then((res) => {
+        this.rLoading = false
+        this.recordDetails = res.list;
+          this.page1.cur = res.current;
+          this.page1.total = res.total;
+      });
     },
     // 切换当前页
-    curPageChange(type){
-      if(type){
-        console.log(this.page1)
-      }else{
-        console.log(this.page)
+    curPageChange(type) {
+      if (type == 1&&this.activeIndex == '1') {
+        this.loading = true
+        this.getList();
+      } else if (type == 1&&this.activeIndex != '1'){
+        this.loading = true
+        this.getCourseList();
+      }else if(type == 2){
+        this.rLoading = true
+        this.getAssignDrtailList()
       }
     },
     // 初始化明细表单并关闭弹窗
     cancle() {
-      // this.recordDetails=[]
-      this.showDetail = false
+      this.recordDetails=[]
+      this.showDetail = false;
     },
     // 查看明细
     toDetail(row) {
-      console.log(row);
-      this.showDetail = true
+      if (row.userId && !row.subjectId) {
+        this.rLoading = true
+        this.getAssignDrtailList(1, row.userId);
+      } else if (!row.userId && row.subjectId) {
+        this.rLoading = true
+        this.getAssignDrtailList(2, row.subjectId);
+      }
+      this.showDetail = true;
     },
     // 课程搜索
     courseSearch() {
-      if (this.searchText) {
-        console.log(this.searchText);
-      }
+      this.loading = true
+      this.getCourseList();
     },
     // 经销商名称搜索
     dealerSearch() {
-      if (this.searchDealer) {
-        console.log(this.searchDealer);
-      }
+      this.loading = true
+      this.getList();
     },
     // 导航标签切换
     handleClick() {
-      this.searchTime = ''
-      console.log(this.activeIndex);
+      this.sortValue = 0;
+      this.searchTime = null;
+      this.searchText = "";
+      this.searchDealer = "";
+      this.recordList = [];
+      if (this.activeIndex == "1") {
+        this.loading = true
+        this.getList();
+      } else {
+        this.loading = true
+        this.getCourseList();
+      }
     },
   },
 };
@@ -315,7 +359,7 @@ export default {
   .search {
     margin: 0 20px;
   }
-  .proness{
+  .proness {
     display: flex;
     justify-content: center;
     margin-top: 20px;

+ 7 - 5
src/course/user/login.vue

@@ -32,7 +32,9 @@
       <div class="login-right flex-2" style="position: relative;">
         <div class="login_input">
           <div class="third-login-box">
-            <p class="third-account" @click="getToken">微信扫码登录</p>
+            <p class="third-account" @click="getToken">平台ID登录</p>
+            <el-input v-model="testId" placeholder="请输入平台ID,回车登录" size="normal" style="width: 250px;margin:0 0 20px;" clearable @keyup.enter.native="getToken(testId)"></el-input>
+            <p class="third-account">微信扫码登录</p>
              <div class="account-login">
                  <a data-href="/thirdlogin/wechat.do?appId=1006" class="wechat-login" @click="openWx" style="background-image: url(static/images/wechat1.png);"></a>
              </div>
@@ -55,16 +57,16 @@ import {getUserToken,getAdminTokenId} from '../api'
 export default {
   data() {
     return {
+      testId:"",
       isShowWxLogin:false,
       // wxUrl:process.env.BASE_API+'/wechat/auth/web?ct=1',
       wxUrl:'https://oa.g107.com/wechat/auth/web?ct=1',
     };
   },
   methods: {
-    //临时指定id获取用户token
-    getToken(){
-      getUserToken(11770).then(token=>{
-        console.log(token)
+    //临时指定id获取用户token(11770)
+    getToken(id){
+      getUserToken(id).then(token=>{
         this.getAccountIdToken(token)
       }).catch(err=>{
         console.log(err)

+ 5 - 5
src/router/course.js

@@ -42,7 +42,7 @@ const routes = [
         component: () => import('@/course/dealerManage/home'),
         label: '经销商管理',
         meta: {
-            keepAlive:true
+            keepAlive:false
         },
     },
     {
@@ -73,12 +73,12 @@ const routes = [
         },
     },
     {
-        path: 'courseRecord/:id',
+        path: 'courseRecord/:userId/:courseId',
         name: 'courseRecord',
         component: () => import('@/course/dealerManage/record'),
         label: '课程交易明细',
         meta: {
-            keepAlive:true
+            keepAlive:false
         },
     },
     {
@@ -87,7 +87,7 @@ const routes = [
         component: () => import('@/course/statistics/home'),
         label: '统计',
         meta: {
-            keepAlive:true
+            keepAlive:false
         },
     },
     {
@@ -96,7 +96,7 @@ const routes = [
         component: () => import('@/course/setting/home'),
         label: '管理员设置',
         meta: {
-            keepAlive:true
+            keepAlive:false
         },
     }
 ]

+ 9 - 9
src/utils/axiosKc.js

@@ -60,27 +60,27 @@ service.interceptors.response.use(
         return
       }
       Message({
-        message: res.msg
+        message: res.message
       })
       return Promise.reject(response)
-    } else if (res.code === 2001) {
+    } else if (res.code === 999) {
       Message({
-        message: res.msg
+        message: res.message
       })
       return Promise.reject(response)
-    } else if (res.code === 999) {
+    } else if (res.code === 2) {
       Message({
-        message: res.msg
+        message: res.message
       })
       return Promise.reject(response)
-    } else if (res.code === 3000) {
+    } else if (res.code === 0) {
       Message({
-        message: res.msg
+        message: res.message
       })
       return Promise.reject(response)
-    } else if (res.code === 4444) {
+    } else if (res.code === 3) {
       Message({
-        message: res.msg
+        message: res.message
       })
       return Promise.reject(response)
     } else {