guojy 1 yıl önce
ebeveyn
işleme
1a71185f51

+ 26 - 1
package-lock.json

@@ -7853,7 +7853,7 @@
     },
     "jsencrypt": {
       "version": "3.3.2",
-      "resolved": "https://registry.npmjs.org/jsencrypt/-/jsencrypt-3.3.2.tgz",
+      "resolved": "https://registry.npmmirror.com/jsencrypt/-/jsencrypt-3.3.2.tgz",
       "integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A=="
     },
     "jsesc": {
@@ -8510,6 +8510,11 @@
         "through2": "^2.0.0"
       }
     },
+    "mitt": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmmirror.com/mitt/-/mitt-2.1.0.tgz",
+      "integrity": "sha512-ILj2TpLiysu2wkBbWjAmww7TkZb65aiQO+DkVdUTBpBXq+MHYiETENkKFMtsJZX1Lf4pe4QOrTSjIfUwN5lRdg=="
+    },
     "mixin-deep": {
       "version": "1.3.2",
       "resolved": "https://registry.npmmirror.com/mixin-deep/-/mixin-deep-1.3.2.tgz",
@@ -14636,6 +14641,16 @@
         }
       }
     },
+    "vue-observe-visibility": {
+      "version": "2.0.0-alpha.1",
+      "resolved": "https://registry.npmmirror.com/vue-observe-visibility/-/vue-observe-visibility-2.0.0-alpha.1.tgz",
+      "integrity": "sha512-flFbp/gs9pZniXR6fans8smv1kDScJ8RS7rEpMjhVabiKeq7Qz3D9+eGsypncjfIyyU84saU88XZ0zjbD6Gq/g=="
+    },
+    "vue-resize": {
+      "version": "2.0.0-alpha.1",
+      "resolved": "https://registry.npmmirror.com/vue-resize/-/vue-resize-2.0.0-alpha.1.tgz",
+      "integrity": "sha512-7+iqOueLU7uc9NrMfrzbG8hwMqchfVfSzpVlCMeJQe4pyibqyoifDNbKTZvwxZKDvGkB+PdFeKvnGZMoEb8esg=="
+    },
     "vue-router": {
       "version": "3.6.5",
       "resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-3.6.5.tgz",
@@ -14683,6 +14698,16 @@
       "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
       "dev": true
     },
+    "vue-virtual-scroller": {
+      "version": "2.0.0-beta.8",
+      "resolved": "https://registry.npmmirror.com/vue-virtual-scroller/-/vue-virtual-scroller-2.0.0-beta.8.tgz",
+      "integrity": "sha512-b8/f5NQ5nIEBRTNi6GcPItE4s7kxNHw2AIHLtDp+2QvqdTjVN0FgONwX9cr53jWRgnu+HRLPaWDOR2JPI5MTfQ==",
+      "requires": {
+        "mitt": "^2.1.0",
+        "vue-observe-visibility": "^2.0.0-alpha.1",
+        "vue-resize": "^2.0.0-alpha.1"
+      }
+    },
     "vue2-svg-icon": {
       "version": "1.3.2",
       "resolved": "https://registry.npmmirror.com/vue2-svg-icon/-/vue2-svg-icon-1.3.2.tgz",

+ 2 - 1
package.json

@@ -20,7 +20,7 @@
     "exif-js": "^2.3.0",
     "fastclick": "^1.0.6",
     "html2canvas": "^1.0.0-rc.3",
-    "jsencrypt": "^3.2.1",
+    "jsencrypt": "^3.3.2",
     "lrz": "^4.9.40",
     "moment": "^2.24.0",
     "px2rem-loader": "^0.1.9",
@@ -42,6 +42,7 @@
     "vue-router": "^3.1.6",
     "vue-scroller": "^2.2.4",
     "vue-shepherd": "^3.0.0",
+    "vue-virtual-scroller": "^2.0.0-beta.8",
     "vue2-svg-icon": "^1.3.2",
     "vuex": "^3.3.0",
     "vuex-persistedstate": "^3.1.0",

+ 3 - 2
src/App.vue

@@ -1,6 +1,6 @@
 <template>
   <div style="width:100%; height: 100%; position: relative;">
-     <vc-keep-alive :ignorePaths="['/help_detail']" :ignoreParams="[]">
+     <vc-keep-alive :ignorePaths="ignorePaths" :ignoreParams="ignoreParams">
         <router-view style="width:100%;height:100%"></router-view>
      </vc-keep-alive>
   </div>
@@ -15,7 +15,8 @@
     name: 'App',
     data() {
       return {
-
+        ignorePaths:['/help_detail'],
+        ignoreParams:[]
       };
     },
     methods: {

BIN
src/assets/course.jpg


+ 35 - 36
src/main.js

@@ -23,15 +23,15 @@ import axiosUser from '@/utils/axiosUser'
 import axiosKc from '@/utils/axiosKc'
 import 'shepherd.js/dist/css/shepherd.css';
 
-import {Tabbar,Empty,TabbarItem,ShareSheet ,Divider,Grid,GridItem,Form,Field,NavBar,Row,Col,List ,Picker , Cell,CellGroup,Toast,Popup,Dialog,RadioGroup,Radio,Notify,Button,Icon,Tab, Tabs} from 'vant'
-import {getWxToken,setWxToken,getIsIdentity,supremeAuthority, getIsWx,getTypes, getTypesName,getUserData, getEmployeeMap,getCache,setCache,removeCache,returnDeptName,getEmployeeMapItem,returnFh } from '@/utils/auth'
+import { Tabbar, Empty, TabbarItem, ShareSheet, Loading, Divider, Grid, GridItem, Form, Field, NavBar, Row, Col, List, Picker, Cell, CellGroup, Toast, Popup, Dialog, RadioGroup, Radio, Notify, Button, Icon, Tab, Tabs } from 'vant'
+import { getWxToken, setWxToken, getIsIdentity, supremeAuthority, getIsWx, getTypes, getTypesName, getUserData, getEmployeeMap, getCache, setCache, removeCache, returnDeptName, getEmployeeMapItem, returnFh } from '@/utils/auth'
 Vue.prototype.$echarts = echarts
 Vue.prototype.$moment = moment
 Vue.prototype.$getTypesName = getTypesName
 Vue.prototype.$getTypes = getTypes()
 Vue.prototype.$userInfo = getUserData;
 Vue.prototype.$getEmployeeMap = getEmployeeMap
-Vue.prototype.$getEmployeeMapItem= getEmployeeMapItem
+Vue.prototype.$getEmployeeMapItem = getEmployeeMapItem
 Vue.prototype.$getCache = getCache
 Vue.prototype.$setCache = setCache
 Vue.prototype.$getIsIdentity = getIsIdentity
@@ -45,7 +45,7 @@ Vue.prototype.$returnDeptName = returnDeptName
 Vue.prototype.$socketApi = socketApi   //长连接
 Vue.prototype.$socketApiTow = socketApiTow   //长连接
 Vue.prototype.$returnFh = returnFh
-Vue.prototype.$isWx=getIsWx()
+Vue.prototype.$isWx = getIsWx()
 
 // true为APP打包,false为M端打包
 Vue.prototype.$isApp = true
@@ -53,15 +53,14 @@ Vue.prototype.$isApp = true
 // setWxToken('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOm51bGwsImlhdCI6MTcwMzU3MzQyMywiZXhwIjotMSwibmJmIjoxNzAzNTczNDIzLCJqdGkiOiJNS0wwQ1d2QW9IZjhGTnhjIiwic3ViIjoyOCwicHJ2IjoiY2E2NDg5ZDUwZjI0MDdhNjc4MzBlODA5MGQwMTQ4ODM1Njg1OTYyYiIsInJvbGUiOiJlbXBsb3llZSJ9.3tu6W0NaobTYKF_p0GxIDcSNbwFOqPr1vwXS0bO9lb0')
 // localStorage.setItem("wx_user_info",JSON.stringify({"account_id":31608,"nickname":"沐阳人","account":{"id":31608,"img_url":"","name":"雷阳","site_count_max":1,"tel":"15270803986","try_user":0,"account":""},"account_site":[{"id":24451,"account_id":31608,"site_id":14,"employee_id":35131,"create_time":"1709805792","update_time":"1709805792","delete_time":null,"site":{"id":14,"name":"广东功道云数字科技有限公司","status":1,"account_id":18,"expire_time":2067350399}}],"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOm51bGwsImlhdCI6MTcxMTA5MjAyNSwiZXhwIjotMSwibmJmIjoxNzExMDkyMDI1LCJqdGkiOiJIOExwaTdmTXpXRGVVTmNIIiwic3ViIjozMTYwOCwicHJ2IjoiOTNhMjEyMzNhMWE5ZDMxZmNkNjlmNzZhMjZhZTVkNzczMzU4NzgxNSIsInJvbGUiOiJwbGF0Zm9ybSJ9.q4z339k_Lb1YyLRNQFzSBXV3rvInExqTh6lM0CiguPQ","invitation_wait_count":0,"join_wait_count":0,"wo_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOm51bGwsImlhdCI6MTcxMTA5MjAyNSwiZXhwIjotMSwibmJmIjoxNzExMDkyMDI1LCJqdGkiOiI3cFRYclZhR0NwQW11eGNFIiwic3ViIjoxMTc3MCwicHJ2IjoiMDMwMGE1NDlhYjhmNzAyY2RhODMyMzFhNDEzMzJlY2NiZGU5ZGY4ZiIsInJvbGUiOiJ3ZWNoYXRfb3Blbl91c2VyIn0.iK5JQ5e2t8aGSK9CdIelDvOm47zUI4FtDM0oMr0FAtE"}))
 
-
 Vue.use(VueScroller)
 Vue.component('icon', icon)
 Vue.component('noData', noData)
 Vue.component('userImage', userImage)
-Vue.use(Button).use(Tabbar).use(TabbarItem).use(ShareSheet).use(Grid).use(Divider).use(GridItem).use(Picker).use(Form).use(Field).use(List).use(Tabs).use(Tab).use(NavBar).use(Row).use(Col).use(Cell).use(CellGroup).use(Toast).use(Popup).use(Dialog).use(RadioGroup).use(Radio).use(Icon).use(Notify).use(Empty)
+Vue.use(Button).use(Tabbar).use(TabbarItem).use(ShareSheet).use(Grid).use(Loading).use(Divider).use(GridItem).use(Picker).use(Form).use(Field).use(List).use(Tabs).use(Tab).use(NavBar).use(Row).use(Col).use(Cell).use(CellGroup).use(Toast).use(Popup).use(Dialog).use(RadioGroup).use(Radio).use(Icon).use(Notify).use(Empty)
 
-Vue.prototype.$route_back = function(setp) {
-  if (typeof(setp) == 'undefined') {
+Vue.prototype.$route_back = function (setp) {
+  if (typeof (setp) == 'undefined') {
     setp = -1
   }
   if (window.history.length <= 1 && window.plus) {
@@ -76,36 +75,36 @@ Vue.prototype.$route_back = function(setp) {
 }
 
 Vue.directive('isKeyboard', function (el) {
-    let isAndroid=true;
-    if (navigator.userAgent.indexOf('Android') > 0) {
-      isAndroid=true;
-    } else {
-      isAndroid=false;
-    }
-    if (isAndroid) {
-      //获取原窗口的高度
-      var originalHeight = document.documentElement.clientHeight || document.body.clientHeight;
-      window.onresize = function() {
-        //键盘弹起与隐藏都会引起窗口的高度发生变化
-        var resizeHeight =document.documentElement.clientHeight || document.body.clientHeight;
-        if (resizeHeight - 0 < originalHeight - 0) {
-          // console.log("键盘收起")
-          el.style['display'] = 'none'
-        } else {
-           // console.log("键盘放下")
-          el.style['display'] = 'block'
-        }
-      };
-    }else {  // ios:focusin和focusout支持冒泡,对应focus和blur, 使用focusin和focusout的原因是focusin和focusout可以冒泡,focus和blur不会冒泡,这样就可以使用事件代理,处理多个输入框存在的情况。
-      document.body.addEventListener("focusin", () => {
-        //软键盘弹出的事件处理
+  let isAndroid = true;
+  if (navigator.userAgent.indexOf('Android') > 0) {
+    isAndroid = true;
+  } else {
+    isAndroid = false;
+  }
+  if (isAndroid) {
+    //获取原窗口的高度
+    var originalHeight = document.documentElement.clientHeight || document.body.clientHeight;
+    window.onresize = function () {
+      //键盘弹起与隐藏都会引起窗口的高度发生变化
+      var resizeHeight = document.documentElement.clientHeight || document.body.clientHeight;
+      if (resizeHeight - 0 < originalHeight - 0) {
+        // console.log("键盘收起")
         el.style['display'] = 'none'
-      });
-      document.body.addEventListener("focusout", () => {
-        //软键盘收起的事件处理
+      } else {
+        // console.log("键盘放下")
         el.style['display'] = 'block'
-      });
-    }
+      }
+    };
+  } else {  // ios:focusin和focusout支持冒泡,对应focus和blur, 使用focusin和focusout的原因是focusin和focusout可以冒泡,focus和blur不会冒泡,这样就可以使用事件代理,处理多个输入框存在的情况。
+    document.body.addEventListener("focusin", () => {
+      //软键盘弹出的事件处理
+      el.style['display'] = 'none'
+    });
+    document.body.addEventListener("focusout", () => {
+      //软键盘收起的事件处理
+      el.style['display'] = 'block'
+    });
+  }
 })
 
 Vue.config.productionTip = false

+ 1 - 1
src/router/course.js

@@ -73,7 +73,7 @@
     {
       path: '/course/video/:id',
       name: 'courseVideo',
-      component: () => import('@/view/course/deal/transfer'),
+      component: () => import('@/view/course/video/video'),
       label: '课程播放',
       need_login: true,
     },

+ 24 - 0
src/utils/auth.js

@@ -83,6 +83,30 @@ export function returnJSEncrypt(data,is=true){
   }
   return arr
 }
+export function returnJSEncrypt1(data,is=true){
+  let jsencrypt = new JSEncrypt()
+  jsencrypt.setPublicKey(publicKey)
+  if(is){
+      data.st=Date.parse(new Date()).toString();
+  }
+  console.log(data)
+  let s=JSON.stringify(data);
+  let arr=[];
+  if(s.length>100){
+    let reg=/.{100}/g;
+    let rs=s.match(reg);
+    rs.push(s.substring(rs.join('').length));
+    rs.forEach(item=>{
+      arr.push(jsencrypt.encrypt(item));
+    })
+    // if(arr[0]){
+    //   decrypt(arr[0])
+    // }
+  }else{
+    arr[0]=jsencrypt.encrypt(s)
+  }
+  return arr
+}
 // 解密
 export function decrypt (msg) {
   let privateKey=`MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDR+Yyjk8lMPNyy

+ 115 - 10
src/view/course/api/index.js

@@ -1,6 +1,20 @@
 import axiosKc from "../../../utils/axiosKc";
-import {Dialog,Notify} from 'vant'
-import {getWxToken,setWxToken,openError,getWxUserId} from '@/utils/auth'
+import { Dialog, Notify } from 'vant'
+import { getWxToken, setWxToken, openError, getWxUserId } from '@/utils/auth'
+
+//手机号获取验证码
+export function getMobileYzm(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc('post', `/mkt/client/sms/${getWxUserId()}`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
 //wxid获取用户wxtoken
 export function getWxApiToken(wxId) {
     return new Promise((resolve, reject) => {
@@ -17,10 +31,10 @@ export function getWxApiToken(wxId) {
 //通过wxtoken获取用户wxApiToken
 export function getUSerInfo(token) {
     return new Promise((resolve, reject) => {
-        axiosKc('post', `/mkt/client/login`,{},'',token).then((res) => {
+        axiosKc('post', `/mkt/client/login`, {}, '', token).then((res) => {
             if (res.data.code == 1) {
                 setWxToken(res.data.data.utoken)
-                localStorage.setItem('wx_user_info',JSON.stringify(res.data.data))
+                localStorage.setItem('wx_user_info', JSON.stringify(res.data.data))
                 resolve(res.data.data)
             } else {
                 Notify({ type: 'danger', message: data.message });
@@ -32,10 +46,10 @@ export function getUSerInfo(token) {
 //添加经销商
 export function addDealer(data) {
     return new Promise((resolve, reject) => {
-        axiosKc('post', `/mkt/client/${getWxUserId()}/join`,data).then((res) => {
+        axiosKc('post', `/mkt/client/${getWxUserId()}/join`, data).then((res) => {
             if (res.data.code == 1) {
                 setWxToken(res.data.data.utoken)
-                localStorage.setItem('wx_user_info',JSON.stringify(res.data.data))
+                localStorage.setItem('wx_user_info', JSON.stringify(res.data.data))
                 resolve(res.data.data)
             } else {
                 Notify({ type: 'danger', message: data.message });
@@ -74,7 +88,7 @@ export function getUserCourseList() {
 //获取经销商推广的所有/指定课程的交易记录
 export function getCourseRecordList(data) {
     return new Promise((resolve, reject) => {
-        axiosKc('get', `/mkt/client/${getWxUserId()}/capital/log`,data).then((res) => {
+        axiosKc('get', `/mkt/client/${getWxUserId()}/capital/log`, data).then((res) => {
             if (res.data.code == 1) {
                 resolve(res.data.data)
             } else {
@@ -87,7 +101,7 @@ export function getCourseRecordList(data) {
 //获取经销商的团队人员
 export function getDealerTeam(data) {
     return new Promise((resolve, reject) => {
-        axiosKc('get', `/mkt/client/${getWxUserId()}/team/list`,data).then((res) => {
+        axiosKc('get', `/mkt/client/${getWxUserId()}/team/list`, data).then((res) => {
             if (res.data.code == 1) {
                 resolve(res.data.data)
             } else {
@@ -98,9 +112,100 @@ export function getDealerTeam(data) {
     })
 }
 //获取经销商的30天内交易的人员
-export function getDealerPerson(data,days=30) {
+export function getDealerPerson(data, days = 30) {
+    return new Promise((resolve, reject) => {
+        axiosKc('get', `/mkt/client/${getWxUserId()}/team/list/transfer/${days}`, data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//获取交易经销商的交易记录列表( 1-待接收 2-已接收 3-发起方主动取消 4-接收方退回 -1-待接收以外的记录 0-不区分状态 默认为0)
+export function getDealerRecord(targetUserId, data) {
+    return new Promise((resolve, reject) => {
+        axiosKc('get', `/mkt/client/${getWxUserId()}/transfer/list/${targetUserId}`, data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//交易经销商的课程
+export function dealCourse(targetUserId, data) {
+    return new Promise((resolve, reject) => {
+        axiosKc('post', `/mkt/client/${getWxUserId()}/transfer/${targetUserId}`, data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//交易课程确认接收
+export function dealAccept(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc('post', `/mkt/client/${getWxUserId()}/transfer/confirm`, data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//交易课程确认退回
+export function dealRefund(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc('post', `/mkt/client/${getWxUserId()}/transfer/refund`, data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//交易课程确认撤回
+export function dealRecall(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc('post', `/mkt/client/${getWxUserId()}/transfer/cancel`, data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//学员课程详情
+export function learnerCourseDetail(id) {
+    return new Promise((resolve, reject) => {
+        axiosKc('get', `/mkt/client/${getWxUserId()}/subject/${id}`).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//生成课程分享码
+export function createCourseCode(id,data) {
     return new Promise((resolve, reject) => {
-        axiosKc('get', `/mkt/client/${getWxUserId()}/team/list/transfer/${days}`,data).then((res) => {
+        axiosKc('get', `/mkt/client/${getWxUserId()}/sales/code/${id}`).then((res) => {
             if (res.data.code == 1) {
                 resolve(res.data.data)
             } else {

+ 4 - 3
src/view/course/components/CourseTeam.vue

@@ -25,7 +25,7 @@
             <p>{{ item.name }}</p>
             <span>手机:{{ item.mobile }}</span>
           </div>
-          <div class="flex-deal" @click="otDealPage(item.id)">交易</div>
+          <div class="flex-deal" @click="otDealPage(item)">交易</div>
         </div>
       </div>
     </div>
@@ -69,9 +69,10 @@ export default {
   },
   methods: {
     //跳转人员交易记录
-    otDealPage(id) {
+    otDealPage(item) {
       this.$router.push({
-        path: `/courseDeal/${id}`,
+        path: `/courseDeal/${item.id}`,
+        query:item
       });
     },
     //初始化

+ 40 - 37
src/view/course/components/courseList.vue

@@ -15,10 +15,10 @@
           :class="{ marginGap: listType == 2 }"
           :style="{ background: outBg }"
         >
-          <div class="listLiTit" v-if="item.direction">
+          <div class="listLiTit" v-if="item.toUserId&&listType==2">
             <p>
-              {{ item.direction == "to" ? "卖出" : "收到"
-              }}<span>【{{ item.dealNumber }}】套</span>课程
+              {{ item.toUserId == user_info.id ? "收到" : "卖出"
+              }}<span>【{{ item.dealAmount }}】套</span>课程
             </p>
           </div>
           <div
@@ -52,17 +52,17 @@
             </div>
           </div>
           <div
-            v-if="showNum == 0 && !(item.dealStatus && item.dealStatus !== 4)"
+            v-if="showNum == 0 && !(item.status && item.status !== 4)"
             style="height: .2rem;"
           ></div>
           <div
             class="dealComfirm"
             @click="comfirm(item)"
-            v-if="item.dealStatus && item.dealStatus !== 4"
-            :class="item.direction == 'to' ? 'dealTo' : ''"
+            v-if="item.status && item.status == 1&&listType==2"
+            :class="payClass(item)? '' : 'dealTo'"
           >
             <span>{{
-              item.direction == "to" ? "待对方确认" : "确认接收"
+              item.toUserId == user_info.id ? "确认接收" : "待对方确认"
             }}</span>
           </div>
         </div>
@@ -118,10 +118,21 @@ export default {
     }
   },
   data() {
-    return {};
+    return {
+      user_info:JSON.parse(localStorage.getItem('wx_user_info'))
+    };
+  },
+  computed:{
+    payClass(item){
+      return function (item) { 
+        if(item.toUserId == this.user_info.id && item.status == 1){
+          return true
+        }
+        return false
+       }
+    }
   },
   created() {},
-  mounted() {},
   methods: {
     //查看名额变动明细
     toMoreUrl() {
@@ -131,35 +142,27 @@ export default {
     // 查看课程详情
     toUrl(item) {
       // console.log(item)
-      if (!this.isNoAd&&this.$route.path != `/courseAdDetail/${item.subjectId}`) {
-        this.$router.push({
-          path:`/courseAdDetail/${item.subjectId}`,
-          query:item
-        });
-      } else if(this.isNoAd&&this.$route.path != `/courseDetail/${item.subjectId}`) {
-        this.$router.push(`/courseDetail/${item.subjectId}`);
-      }else{
-        console.log(123)
+      if(!item.status){
+        if (!this.isNoAd&&this.$route.path != `/courseAdDetail/${item.subjectId}`) {
+          this.$router.push({
+            path:`/courseAdDetail/${item.subjectId}`,
+            query:item
+          });
+        } else if(this.isNoAd&&this.$route.path != `/courseDetail/${item.subjectId}`) {
+          this.$router.push(`/courseDetail/${item.subjectId}`);
+        }else{
+          console.log(123)
+        }
       }
     },
     // 接受名额转入
     comfirm(item) {
-      console.log(item);
-      this.$router.push(`/course/transfer/${item.older_id}`);
-      // if (item.dealStatus == 3) {
-      //   this.$dialog
-      //     .confirm({
-      //       title: "提示",
-      //       message: "确定要接受名额转入吗?"
-      //     })
-      //     .then(() => {
-      //       this.$emit("dealComfirm", item);
-      //     })
-      //     .catch(() => {});
-      // }
+      this.$router.push({
+        path:`/course/transfer/${item.id}`,
+        query:item
+      });
     }
   },
-  computed: {}
 };
 </script>
 <style scoped lang="scss">
@@ -201,7 +204,7 @@ export default {
       padding: 0.2rem 0.15rem 0;
       &:not(:nth-last-child(1)) {
         // padding-bottom: 0.2rem;
-        border-bottom: 1px solid #999;
+        border-bottom: 1px solid #efefef;
       }
       &.marginGap {
         margin-bottom: 0.2rem;
@@ -243,14 +246,14 @@ export default {
           border-radius: 0.1rem;
         }
         & > img {
-          width: 3rem;
-          height: 2.25rem;
+          width: 2.5rem;
+          height: 1.5rem;
           display: block;
           border-radius: 0.1rem;
         }
         .liInfo {
           flex: 1;
-          margin-left: 0.15rem;
+          margin-left: 0.35rem;
           display: flex;
           flex-direction: column;
           justify-content: space-between;
@@ -272,7 +275,7 @@ export default {
             justify-content: space-between;
             span {
               font-size: 0.28rem;
-              color: #333;
+              color: #888;
               line-height: 1.3;
               &:nth-child(1) {
                 margin-right: 0.3rem;

+ 25 - 1
src/view/course/deal/courseLimitRecord.vue

@@ -1,6 +1,30 @@
 <template>
 <div>
-    {{ $route.params.id }}
+  <scroller ref="scroller" :on-refresh="refresh" :on-infinite="infinite" noDataText="没有了噢" :list="targetList">
+    <div class="list-box" v-for="(item,index) in targetList" :key="index">
+        <div class="flex-box border-m" style="padding: 0.2rem;" @click.stop="activeId(item,1)">
+            <div class="radio" style="top: 0.06rem;" :class="{'radio-active':selectId==item.id&&type==item.type}" v-if="showType!=2"></div>
+            <div class="flex-1">
+              <div class="flex-box">
+                <div class="clamp2 flex-1" style="margin-bottom: 5px;">{{item.name}}</div>
+                <van-icon :name="item.isShow? 'arrow-up':'arrow-down'" style="padding-left: 0.2rem;" @click.stop="item.isShow=!item.isShow"/>
+              </div>
+              <div class="flex-box-ce fontColorC" style="font-size: 0.26rem;">
+                  <span>{{item.year}}年</span>
+                  <span class="border-l-r">{{item.dateStr}}</span>
+                  <span>{{$getEmployeeMapItem(item.owner_id).name}}</span>
+              </div>
+            </div>
+        </div>
+        <template v-if="item.isShow">
+          <div class="flex-box-ce border-m" style="padding: 0.2rem;padding-left: 0.6rem;" v-for="(item2,index2) in item.krs" :key="index2" @click.stop="activeId(item2,2)">
+              <div class="radio" :class="{'radio-active':selectId==item2.id&&type==item2.type}"></div>
+              <div class="flex-1 font-flex-word" style="padding-right: 0.2rem;font-size: 0.28rem;">{{item2.name}}</div>
+          </div>
+        </template>
+    </div>
+    <noData :list="targetList" />
+  </scroller>
 </div>
 </template>
 

+ 46 - 48
src/view/course/deal/dealOrder.vue

@@ -27,7 +27,7 @@
           @touchstart.native.stop="numberShow = true"
         />
         <van-field
-          v-model="form.beizhu"
+          v-model="form.content"
           rows="3"
           autosize
           label="备注"
@@ -37,8 +37,15 @@
           show-word-limit
         />
         <div class="submit">
-          <van-button color="#999" style="padding: 0 .8rem;" @click="$router.go(-1)">取消</van-button>
-          <van-button type='primary'  style="padding: 0 .8rem;" @click="comfirm">确认</van-button>
+          <van-button
+            color="#999"
+            style="padding: 0 .8rem;"
+            @click="$router.go(-1)"
+            >取消</van-button
+          >
+          <van-button type="primary" style="padding: 0 .8rem;" @click="comfirm"
+            >确认</van-button
+          >
         </div>
       </div>
     </div>
@@ -54,12 +61,13 @@
       :show="numberShow"
       @blur="numberShow = false"
       @input="onInput"
-      @delete="onDelete"  
+      @delete="onDelete"
     />
   </div>
 </template>
 
 <script>
+import {getDealerCourseList,dealCourse} from '../api'
 import Vue from "vue";
 import { NumberKeyboard } from "vant";
 
@@ -75,56 +83,46 @@ export default {
         name: "",
         id: 0,
         number: 0,
-        beizhu: ""
+        content: ""
       },
       coursesUsable: 0,
-      courseList: [
-        {
-          value: 1,
-          label: "课程精讲1",
-          courseUsable: 18
-        },
-        {
-          value: 2,
-          label: "课程精讲2",
-          courseUsable: 22
-        },
-        {
-          value: 3,
-          label: "课程精讲3",
-          courseUsable: 28
-        },
-        {
-          value: 4,
-          label: "课程精讲4",
-          courseUsable: 118
-        },
-        {
-          value: 5,
-          label: "课程精讲5",
-          courseUsable: 13
-        }
-      ]
+      courseList:[],
+      columnsOptions:[]
     };
   },
-  computed: {
-    columnsOptions() {
-      let list = [];
-      this.courseList.forEach(i => {
-        list.push(i.label);
-      });
-      return list;
-    }
+  created() {
+    this.getCourseList();
   },
-  created() {},
   methods: {
+    getCourseList(){
+      getDealerCourseList().then(res=>{
+        this.courseList = res.list;
+        let list = [];
+        res.list.forEach(item=>{
+          list.push(item.subjectName)
+        })
+        this.columnsOptions = list
+      })
+    },
+    postDeal(){
+      let data = {
+        subjectId:this.form.id,
+        amount:this.form.number,
+        content:this.form.content
+      }
+      dealCourse(this.$route.params.id,data).then(res=>{
+        this.$toast.success('交易成功')
+        setTimeout(()=>{
+          this.$router.go(-1)
+        },1500)
+      })
+    },
     comfirm(){
       this.$dialog.confirm({
          title: '提示',
          message: '确认要提交当前名额交易吗?',
         }).then(() => {
-          console.log(this.form)
-          this.$toast('名额交易成功!')
+          this.postDeal();
         })
     },
     onInput(key) {
@@ -142,9 +140,9 @@ export default {
     },
     onConfirm(e, index) {
       console.log(index);
-      this.form.name = this.courseList[index].label;
-      this.form.id = this.courseList[index].value;
-      this.coursesUsable = this.courseList[index].courseUsable;
+      this.form.name = this.courseList[index].subjectName;
+      this.form.id = this.courseList[index].subjectId;
+      this.coursesUsable = this.courseList[index].amount;
       this.popupShow = false;
     }
   }
@@ -160,8 +158,8 @@ export default {
         color: #888;
         line-height: 2;
       }
-      .submit{
-        margin-top: .5rem;
+      .submit {
+        margin-top: 0.5rem;
         display: flex;
         justify-content: space-around;
         align-items: center;

+ 77 - 36
src/view/course/deal/transfer.vue

@@ -7,36 +7,37 @@
       @click-left="onClickLeft"
     ></van-nav-bar>
     <div class="transferTop">
-      <p>{{ transferInfo.number }}套</p>
+      <p>{{ transferInfo.dealAmount }}套</p>
       <span>课程名额</span>
     </div>
     <div class="transferConetent">
       <span>{{ transferInfo.name }}</span>
       <courseList :dataList="courseInfo" :showNum="3"></courseList>
-      <p>备注信息:{{ transferInfo.beizhu }}</p>
+      <p>备注信息:{{ transferInfo.content }}</p>
     </div>
     <div class="transferBtm">
       <van-button
         style="padding:0 .5rem;"
         type="primary"
-        v-if="transferInfo.status == 3"
+        v-if="transferInfo.toUserId == user_info.id"
         @click="confirm"
         >确认接收</van-button
       >
       <van-button
         style="padding:0 .5rem;background-color: #999;color:#FFF;"
         size="large"
-        v-if="transferInfo.status == 2"
-        >等待接收</van-button
+        v-else
+        >等待对方接收</van-button
       >
       <div class="transferTH">
-        <p>如一天内未确认,将自动退还对方。 <span @click="returnLimit()">立即退还</span></p>
+        <p>如一天内未确认,将自动退还对方。 <span @click="returnLimit()">{{user_info.id == transferInfo.toUserId?'立即退还':'立即撤回'}}</span></p>
       </div>
     </div>
   </div>
 </template>
 
 <script>
+import {dealAccept,dealRefund,dealRecall} from '../api'
 import courseList from "../components/courseList.vue";
 export default {
   name: "courseTransfer",
@@ -45,55 +46,96 @@ export default {
   data() {
     return {
       title: "课程交易",
-      transferInfo: {
-        older_id: 1233,
-        name: "课程精讲",
-        number: 15,
-        status: 3,
-        beizhu: "大萨达撒多阿诗丹顿撒阿斯达啊",
-        course_info: {
-          id: 154,
-          name: "课程精讲",
-          thumb: "/static/img/course.f1777cf.jpg",
-          price: 598,
-          sections: ["", "", ""],
-          courseNum: 14
-        }
-      }
+      transferInfo: {},
+      user_info:JSON.parse(localStorage.getItem('wx_user_info'))
     };
   },
   computed: {
     courseInfo() {
       let list = [];
-      let data = {
-        id: this.transferInfo.course_info.id,
-        title: this.transferInfo.course_info.name,
-        price: this.transferInfo.course_info.price,
-        courseNum: this.transferInfo.course_info.courseNum,
-        url: this.transferInfo.course_info.thumb
-      };
-      list.push(data);
+      list.push(this.transferInfo);
       console.log(list);
       return list;
     }
   },
-  created() {},
+  created() {
+    this.init()
+  },
   methods: {
+    init(){
+      this.transferInfo = this.$route.query
+      console.log(this.transferInfo)
+    },
     onClickLeft() {
       this.$router.go(-1);
     },
     returnLimit(){
-      this.$dialog.confirm({
+      if(this.transferInfo.toUserId == this.user_info.id){
+        this.$dialog.confirm({
         title: "提示",
         message: "确认退还当前转让的名额?"
       })
         .then(() => {
-          // on confirm
-          this.$toast('退还名额成功!')
+          this.sendback();
+        })
+        .catch(() => {
+        });
+      }else{
+        this.$dialog.confirm({
+        title: "提示",
+        message: "确认撤回当前转让的名额?"
+      })
+        .then(() => {
+          this.sendRecall()
         })
         .catch(() => {
-          // on cancel
         });
+      }
+    },
+    // 退还名额
+    sendback(){
+      let data = {
+        transferId:this.transferInfo.id,
+        subjectId:this.transferInfo.subjectId,
+        toUserId:this.transferInfo.toUserId,
+        fromUserId:this.transferInfo.fromUserId,
+      }
+      dealRefund(data).then(res=>{
+        this.$toast.success('退回成功')
+        setTimeout(()=>{
+          this.$router.go(-1)
+        })
+      })
+    },
+    // 撤回名额
+    sendRecall(){
+      let data = {
+        transferId:this.transferInfo.id,
+        subjectId:this.transferInfo.subjectId,
+        toUserId:this.transferInfo.toUserId,
+        fromUserId:this.transferInfo.fromUserId,
+      }
+      dealRecall(data).then(res=>{
+        this.$toast.success('退回成功')
+        setTimeout(()=>{
+          this.$router.go(-1)
+        })
+      })
+    },
+    // 接收名额
+    acceptAccount(){
+      let data = {
+        transferId:this.transferInfo.id,
+        subjectId:this.transferInfo.subjectId,
+        toUserId:this.transferInfo.toUserId,
+        fromUserId:this.transferInfo.fromUserId,
+      }
+      dealAccept(data).then(res=>{
+        this.$toast.success('接收成功')
+        setTimeout(()=>{
+          this.$router.go(-1)
+        })
+      })
     },
     confirm() {
       this.$dialog.confirm({
@@ -101,8 +143,7 @@ export default {
         message: "确认接收当前转让的名额?"
       })
         .then(() => {
-          // on confirm
-          this.$toast('接收名额成功!')
+          this.acceptAccount()
         })
         .catch(() => {
           // on cancel

+ 9 - 43
src/view/course/home.vue

@@ -123,46 +123,12 @@ export default {
         proCourse: {
           title: "我推广的课程",
           total:0,
-          courseList: [
-            {
-              id: 123,//资产id
-              userId:133333,//用户id
-              subjectId:123333333,//课程id
-              subjectName:"大撒大声",
-              subjectThumb:"/static/img/course.f1777cf.jpg",//缩略图
-              subjectPrice:550,//课程价格
-              sectionsNum:13,//章节数
-              subjectEnable:1,//是否上架
-              amount:12,//剩余名额
-              statistics:{
-                saleAmount:133,//已卖出
-                transferOutAmount:1222,//已转入
-                transferInAmount:233,//已转出
-              },
-            }
-          ]
+          courseList: []
         },
         learnCourse: {
           title: "我学习的课程",
           total:0,
-          courseList: [
-          {
-              id: 123,//资产id
-              userId:133333,//用户id
-              subjectId:123333333,//课程id
-              subjectName:"大撒大声",
-              subjectThumb:"/static/img/course.f1777cf.jpg",//缩略图
-              subjectPrice:598,//课程价格
-              sectionsNum:13,//章节数
-              subjectEnable:1,//是否上架
-              amount:12,//剩余名额
-              statistics:{
-                saleAmount:133,//已卖出
-                transferOutAmount:1222,//已转入
-                transferInAmount:233,//已转出
-              },
-            }
-          ]
+          courseList: []
         }
       }
     };
@@ -207,7 +173,7 @@ export default {
               }
               this.getUserCourseList();
             } else {
-              getWxApiToken(7).then(token => {
+              getWxApiToken(11770).then(token => {
                 getUSerInfo(token).then(res => {
                   this.user_info = JSON.parse(
                     localStorage.getItem("wx_user_info")
@@ -223,14 +189,15 @@ export default {
       }
     },
     //获取经销推广课程列表
-    getDealerCourseList() {
+    getDealerCourseList(done) {
       getDealerCourseList().then(res => {
         this.courseClass.proCourse.total = res.total
         this.courseClass.proCourse.courseList = res.list
+        if(done) done();
       });
     },
     //获取用户消费的课程列表
-    getUserCourseList() {
+    getUserCourseList(done) {
       getUserCourseList().then(res => {
         this.courseClass.learnCourse.total = res.total
         let list = []
@@ -246,6 +213,7 @@ export default {
           list.push(data)
         })
         this.courseClass.learnCourse.courseList = list
+        if(done) done();
       });
     },
     // 打开二维码
@@ -297,10 +265,8 @@ export default {
     },
     // 下拉刷新
     refresh(done) {
-      setTimeout(() => {
-        done();
-      }, 1000);
-      // this.getInitData(done);
+      this.getDealerCourseList(done);
+      this.getUserCourseList(done);
     },
     //请求微信授权
     doWeixinLogin() {

+ 46 - 15
src/view/course/user/courseAdDeal.vue

@@ -6,6 +6,7 @@
       left-arrow
       @click-left="onClickLeft"
     ></van-nav-bar>
+    <div id="link" style="display: none;" :aria-label="giveLink"></div>
     <div class="courseContent">
       <scroller 
         ref="scroller"
@@ -31,7 +32,7 @@
         <van-divider  :style="{ color: '#333', borderColor: '#333', padding: '10px 16px' }" v-if='recordList.length == page.total'>没有更多了</van-divider>
       </scroller>
     </div>
-    <div class="courseShare" @click="showShare = true">
+    <div class="courseShare" @click="comfirmCode">
       <span>赠送课程给好友(当前剩余:{{ courseDetail.amount }}套)</span>
     </div>
     <van-share-sheet
@@ -44,7 +45,8 @@
 </template>
 
 <script>
-import {getCourseRecordList} from '../api'
+import {getCourseRecordList,createCourseCode} from '../api'
+import Clipboard from "clipboard";
 import courseList from "../components/courseList.vue";
 export default {
   name: "",
@@ -58,10 +60,11 @@ export default {
       finished: false,
       activeTab: 0,
       title: "课程详情",
+      giveLink:"",
       options:[
-        { name: '微信', icon: 'wechat' },
+        // { name: '微信', icon: 'wechat' },
         { name: '复制链接', icon: 'link' },
-        { name: '二维码', icon: 'qrcode' },
+        // { name: '二维码', icon: 'qrcode' },
       ],
       page:{
         cur:1,
@@ -100,6 +103,45 @@ export default {
   methods: {
     onSelect(option){
       console.log(option)
+          if(option.name == '复制链接'){
+            this.$dialog.confirm({
+            title: '提示',
+            message: '确定要生成课程分享码?',
+            }).then(() => {
+              createCourseCode(this.courseDetail.subjectId).then(res=>{
+                this.giveLink = res
+                this.copyLink('#link')
+              })
+            }).catch(err=>{
+              this.showShare = false 
+            })
+            
+          }
+    },
+    //复制剪切板
+    copyLink(event) {
+      console.log(23333)
+      let that = this;
+      //这里是复制目标的类名
+      let clipboard = new Clipboard(event, {
+        text: function(trigger) {
+          return trigger.getAttribute("aria-label");
+        }
+      });
+      console.log(clipboard)
+      clipboard.on("success", function(e) {
+        e.clearSelection(); //清除选中的文字的选择状态
+        that.$toast.success("复制成功~");
+        that.showShare = false;
+      });
+
+      clipboard.on("error", function(e) {
+        console.log(5544332)
+        console.error(e);
+      });
+    },
+    comfirmCode(){
+      this.showShare = true 
     },
     getMoreList(){
       console.log("到底了")
@@ -129,17 +171,6 @@ export default {
         }
       })
     },
-    // 下拉刷新
-    onScroll(done) {
-      console.log(12333);
-      setTimeout(() => {
-        done();
-      }, 1000);
-      // this.getInitData(done);
-    },
-    toSectionVidio(item) {
-      console.log(item);
-    },
     onClickLeft() {
       this.$router.go(-1);
     },

+ 26 - 80
src/view/course/user/courseDeal.vue

@@ -14,17 +14,17 @@
         <p>{{ courseDetail.name }}</p>
       </div>
       <div class="tabs">
-        <scroller ref="scroller" :isInitRefresh="false" :on-infinite="onScroll">
+        <scroller ref="scroller">
           <van-tabs v-model="activeTab" swipeable>
             <van-tab title="课程目录">
               <div class="catelog">
                 <div class="sup">
-                  <span>{{ courseDetail.section.length }}节课</span>
+                  <span>{{ courseDetail.sections.length }}节课</span>
                 </div>
                 <div class="logConetent">
                   <div
                     class="logLi"
-                    v-for="(item, index) in courseDetail.section"
+                    v-for="(item, index) in courseDetail.sections"
                     :key="index"
                     @click="toSectionVidio(item)"
                   >
@@ -55,76 +55,25 @@
 </template>
 
 <script>
-import {getCourseRecordList} from '../api'
+import JSEncrypt from 'jsencrypt';  
+import {learnerCourseDetail} from '../api'
 export default {
   name: "",
   components: {},
   props: [],
   data() {
     return {
+      encrypt:null,
       loading: false,
       finished: false,
       activeTab: 0,
+      privateKey:"hdisadnihcuxhzcjxhidhsadahdoihasdnxjhuchasjdhandkjnasidhsadsadasklmcxasnsjdoasdjaosijkxoajsidjsaodkasj",
       title: "课程详情",
       courseDetail: {
-        thumb: "/static/img/course.f1777cf.jpg",
-        name: "课程精讲",
-        images: [
-          "/static/img/course.f1777cf.jpg",
-          "/static/img/course.f1777cf.jpg",
-          "/static/img/course.f1777cf.jpg",
-          "/static/img/course.f1777cf.jpg"
-        ],
-        section: [
-          {
-            name: "课程精讲001",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲002",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲003",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲004",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲001",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲002",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲003",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲004",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲001",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲002",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲003",
-            link: "https://baidu.com"
-          },
-          {
-            name: "课程精讲004",
-            link: "https://baidu.com"
-          }
-        ]
+        thumb: "",
+        name: "",
+        images: [],
+        sections: []
       }
     };
   },
@@ -132,15 +81,17 @@ export default {
     this.init();
   },
   methods: {
-    // 下拉刷新
-    onScroll(done) {
-      console.log(12333);
-      setTimeout(() => {
-        done();
-      }, 1000);
-      // this.getInitData(done);
+    encryLink(text){
+      return this.encrypt.encrypt(text)
     },
-    toSectionVidio(item) {
+    toSectionVidio(item,index) {
+      if(this.courseDetail.buy){
+        this.$router.push({
+          path:`/course/video/${item.link}`
+        })
+      }else{
+        this.$toast.fail("请先领取课程后再观看")
+      }
       console.log(item);
     },
     onClickLeft() {
@@ -148,18 +99,13 @@ export default {
     },
     init() {
       this.courseId = this.$route.params.id;
+      this.encrypt = new JSEncrypt();
+      this.encrypt.setPublicKey(this.publicKey);  
+      this.getDetail()
     },
     getDetail(){
-      let data = {
-        
-      }
-      getCourseRecordList(data).then(res=>{
-        this.recordList = this.recordList.concat(res.list)
-        this.page.cur = res.current
-        this.page.total = res.total
-        if(this.recordList.length<this.page.total){
-          this.canReq = true
-        }
+      learnerCourseDetail(this.courseId).then(res=>{
+        this.courseDetail = res
       })
     },
   },

+ 143 - 136
src/view/course/user/deal.vue

@@ -16,7 +16,7 @@
         <div class="userImage">
           <userImage
             class="about-me__avatar"
-            :img_url="user_info.img_url"
+            :img_url="user_info.imgUrl"
             :user_name="user_info.name"
             width="1.12rem"
             height="1.12rem"
@@ -29,7 +29,7 @@
                 color="#E1B98B"
                 style="margin-left: .1rem;"
             /></span>
-            <p>手机:{{ user_info.tel }}</p>
+            <p>手机:{{ user_info.mobile }}</p>
           </div>
         </div>
         <div class="user_leave" @click="dealCourseNum">
@@ -52,14 +52,29 @@
       </van-tabs>
     </div>
     <div class="dealScroll">
-      <scroller :on-refresh="refresh" :isInitRefresh="false">
-        <div class="dealList" v-show="active == 0">
+      <scroller
+      ref='courseScroller'
+        :on-infinite="getMoreList"
+        :list="courseList"
+        noDataText="没有更多..."
+        v-show="active == 0"
+      >
+        <div class="dealList">
           <courseList
             :dataList="courseList"
             :listType="2"
             @dealComfirm="dealComfirm"
           ></courseList>
         </div>
+        <noData :list="courseList" />
+      </scroller>
+      <scroller
+        ref='recordScroller'
+        :on-infinite="getMoreList"
+        noDataText="没有更多..."
+        :list="recordList"
+        v-show="active == 1"
+      >
         <div class="dealRecordList" v-show="active == 1">
           <div
             class="recordLi"
@@ -67,26 +82,27 @@
             :key="index"
           >
             <div class="flex-name-num">
-              <p>{{ item.title }}</p>
+              <p>{{ item.subjectName }}</p>
               <span
-                >{{ item.direction == "to" ? "-" : "+"
-                }}{{ item.dealNumber }}</span
+                >{{ item.toUserId == target_user_info.id ? "收到" : "卖出"
+                }}{{ item.amount }}</span
               >
             </div>
-            <p>{{ item.beizhu }}</p>
-            <span>{{ item.create_time }}</span>
+            <p>{{ item.content }}</p>
+            <span>{{ item.createTime }}</span>
           </div>
         </div>
+        <noData :list="recordList" />
       </scroller>
     </div>
   </div>
 </template>
 
 <script>
-import { isWxEnv } from "../utils";
 import Vue from "vue";
 import { Tab, Tabs } from "vant";
 import courseList from "../components/courseList";
+import { getDealerRecord } from "../api";
 
 Vue.use(Tab);
 Vue.use(Tabs);
@@ -98,135 +114,138 @@ export default {
       title: "交易",
       activeList: ["待确认的交易", "已交易的记录"],
       active: 0,
+      noDate:false,
+      noDate1:false,
+      page: {
+        cur: 1,
+        size: 10,
+        total: 0
+      },
+      page1: {
+        cur: 1,
+        size: 15,
+        total: 0
+      },
       user_info: {
-        img_url: "",
+        imgUrl: "",
         id: "wx15451154555",
         name: "新人",
-        tel: "15270803986",
-        site_count_max: true
+        mobile: "15270803986"
       },
-      courseList: [
-        {
-          id: 1,
-          title:
-            "大撒大声地大萨达大萨达撒大声地的撒旦撒旦撒打算打算大萨达萨达大萨达",
-          price: 598,
-          courseNum: 14,
-          url: "../../../assets/course.jpg",
-          direction: "to",
-          dealStatus: 2,
-          dealNumber: 60,
-          older_id: 154
-        },
-        {
-          id: 2,
-          title:
-            "大撒大声地大萨达大萨达撒大声地的撒旦撒旦撒打算打算大萨达萨达大萨达",
-          price: 598,
-          courseNum: 14,
-          url: "../../../assets/course.jpg",
-          direction: "from",
-          dealStatus: 3,
-          dealNumber: 35,
-          older_id: 153
-        }
-      ],
-      recordList: [
-        {
-          id: 3,
-          title: "出吧v发给别的发光飞碟",
-          beizhu: "但是反反复复毒贩夫妇",
-          direction: "to",
-          dealStatus: 4,
-          dealNumber: 60,
-          create_time: "2012-10-09"
-        },
-        {
-          id: 4,
-          title: "出吧v发给别的发光飞碟",
-          beizhu: "但是反反复复毒贩夫妇",
-          direction: "to",
-          dealStatus: 4,
-          dealNumber: 60,
-          create_time: "2012-10-09"
-        },
-        {
-          id: 5,
-          title: "出吧v发给别的发光飞碟",
-          beizhu: "但是反反复复毒贩夫妇",
-          direction: "to",
-          dealStatus: 4,
-          dealNumber: 60,
-          create_time: "2012-10-09"
-        },
-        {
-          id: 6,
-          title: "出吧v发给别的发光飞碟",
-          beizhu: "但是反反复复毒贩夫妇",
-          direction: "to",
-          dealStatus: 4,
-          dealNumber: 60,
-          create_time: "2012-10-09"
-        },
-        {
-          id: 7,
-          title: "出吧v发给别的发光飞碟",
-          beizhu: "但是反反复复毒贩夫妇",
-          direction: "to",
-          dealStatus: 4,
-          dealNumber: 60,
-          create_time: "2012-10-09"
-        }
-      ]
+      target_user_info: JSON.parse(localStorage.getItem("wx_user_info")),
+      courseList: [],
+      recordList: []
     };
   },
+  watch:{
+    '$route'(to){
+      if(to.path.includes('/courseDeal/')){
+        this.resetList()
+      }
+    }
+  },
   created() {
     this.init();
   },
   methods: {
-    dealCourseNum() {
-      this.$router.push(`/course/dealOrder/${this.$route.params.id}`)
-    },
     init() {
-      console.log(this.$route);
+      this.user_info = this.$route.query;
+      this.getList();
+      this.getRecordList();
+    },
+    resetList(){
+      console.log('reset')
+      this.active = 0;
+      this.page.cur = 1;
+      this.page.total = 0;
+      this.page1.cur = 1;
+      this.page1.total = 0;
+      this.noDate=false,
+      this.noDate1=false,
+      this.courseList=[];
+      this.recordList=[];
+      this.$refs.courseScroller.scrollTo(0,0,false);
+      this.$refs.recordScroller.scrollTo(0,0,false);
+      this.getList();
+      this.getRecordList();
+    },
+    getMoreList(done) {
+      if(this.active == 0){
+        if (!this.noDate) {
+          setTimeout(() => {          
+            this.getList(done);
+          }, 300)
+        } else {
+          this.$refs.courseScroller.finishInfinite(true);
+        }
+      }else{
+        if (!this.noDate1) {
+          setTimeout(() => {          
+            this.getRecordList(done);
+          }, 300)
+        } else {
+          this.$refs.recordScroller.finishInfinite(true);
+        }
+      }
+    },
+    getList(done) {
+      let data = {
+        page: this.page.cur,
+        pageSize: this.page.size,
+        status: 1
+      };
+      getDealerRecord(this.$route.params.id, data).then(res => {
+        res.list.forEach(item => {
+          item.dealAmount = item.amount;
+          item.subjectThumb = item.thumb;
+          item.subjectPrice = item.price;
+          delete item.amount;
+          delete item.thumb;
+          delete item.price;
+        });
+        this.courseList = this.courseList.concat(res.list);
+        this.page.cur = res.current;
+        this.page.total = res.total;
+        if (this.courseList.length >= this.page.total) {
+          if(done) done(true);      
+          this.noDate = true
+        }else{
+          if(done) done();
+          this.page.cur++;//下拉一次页数+1
+          this.noDate = false
+        }
+      });
+    },
+    getRecordList(done) {
+      let data = {
+        page: this.page1.cur,
+        pageSize: this.page1.size,
+        status: -1
+      };
+      getDealerRecord(this.$route.params.id, data).then(res => {
+        this.page.cur = res.current;
+        this.page.total = res.total;
+        this.recordList = this.recordList.concat(res.list);
+        if (this.recordList.length >= this.page1.total) {
+          if(done) done(true);      
+          this.noDate1 = true
+        }else{
+          if(done) done();
+          this.page1.cur++;//下拉一次页数+1
+          this.noDate1 = false
+        }
+      });
+    },
+    dealCourseNum() {
+      this.$router.push(`/course/dealOrder/${this.$route.params.id}`);
     },
     dealComfirm(res) {
       console.log(res);
     },
-    refresh(done) {
-      setTimeout(() => {
-        done();
-      }, 1000);
-    },
     activeChange(e) {
-      console.log(e);
-      let data = [
-        {
-          id: 9,
-          title:
-            "大撒大声地大萨达大萨达撒大声地的撒旦撒旦撒打算打算大萨达萨达大萨达",
-          price: 598,
-          courseNum: 14,
-          url: "../../../assets/course.jpg",
-          direction: "from",
-          dealStatus: 3,
-          dealNumber: 60,
-          older_id: 151
-        },
-        {
-          id: 10,
-          title:
-            "大撒大声地大萨达大萨达撒大声地的撒旦撒旦撒打算打算大萨达萨达大萨达",
-          price: 598,
-          courseNum: 14,
-          url: "../../../assets/course.jpg",
-          direction: "to",
-          dealStatus: 2,
-          dealNumber: 35,
-          older_id: 1522
-        }
-      ];
-      this.courseList = data;
+      this.active = e;
+      // this.page.cur = 1;
+      // this.page1.cur = 1;
     },
     toUrl(url, id) {
       this.$router.push({
@@ -237,18 +256,6 @@ export default {
     //导航左侧返回
     onClickLeft() {
       this.$router.go(-1);
-    },
-    //获取用户数据
-    init() {
-      isWxEnv()
-        .then(() => {
-          this.user_info = JSON.parse(
-            localStorage.getItem("wx_user_info")
-          ).account;
-        })
-        .catch(err => {
-          console.log(err);
-        });
     }
   }
 };
@@ -311,7 +318,7 @@ export default {
     }
   }
   .dealScroll {
-    height: calc(100vh - 4rem) !important;
+    height: calc(100vh - 3.5rem) !important;
     padding: 0 0.2rem;
     position: relative;
     &::after {

+ 78 - 42
src/view/course/user/login.vue

@@ -4,13 +4,13 @@
     <div class="buibOuter">
       <div class="bindContent">
         <div class="tit">
-          <p>请完善用户信息{{ pid }}</p>
+          <p>请完善用户信息</p>
         </div>
         <van-form @submit="onSubmit">
           <van-cell-group>
             <van-field
               v-model="form.name"
-              :rules="[{ required: true, message: '请填写用户名' }]"
+              :rules="[{ required: true}]"
               placeholder="请输入用户名"
             />
           </van-cell-group>
@@ -18,7 +18,7 @@
             <van-field
               v-model="form.mobile"
               name="pattern"
-              :rules="[{ pattern, message: '请填写正确的手机号' }]"
+              :rules="[{ pattern}]"
               placeholder="请输入手机号"
             />
           </van-cell-group>
@@ -27,13 +27,18 @@
               v-model="form.code"
               center
               clearable
-              :rules="[{ required:true, message: '请填写短信验证码' }]"
+              :rules="[{ required: true}]"
               placeholder="请输入短信验证码"
             >
               <template #button>
-                <van-button size="small" style="width: 2rem;" :color="subBtn" @click="getYzm()">{{
-                  outTime == 0 ? "获取验证码" : outTime
-                }}</van-button>
+                <van-button
+                  size="small"
+                  :loading="sendMsgLoading"
+                  style="width: 2rem;"
+                  :disabled="sended"
+                  @click="getYzm()"
+                  >{{ sendMsgText }}</van-button
+                >
               </template>
             </van-field>
           </van-cell-group>
@@ -47,67 +52,96 @@
 </template>
 
 <script>
-import {addDealer} from '../api'
+import { returnJSEncrypt1 } from "@/utils/auth";
+import { getMobileYzm } from "../api";
+import { addDealer } from "../api";
 export default {
   name: "courseLogin",
   components: {},
   props: [],
   data() {
     return {
-      outTime: 0,
-      pid: 0,
+      pid: null,
+      sendMsgText: "获取验证码",
+      sended: false,
+      countdown: 60,
       form: {
         name: "",
         mobile: "",
         code: ""
       },
-      pattern:/^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
-      partternY:/\d{6}/,
+      sendMsgLoading: false,
+      pattern: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
+      partternY: /\d{6}/
     };
   },
   created() {
     this.init();
   },
-  computed: {
-    subBtn() {
-      if (this.outTime > 0) {
-        return "#999";
-      } else {
-        return "#26A2FF";
-      }
-    }
-  },
-  watch: {
-    outTime(val) {
-      if (val > 0) {
-        setTimeout(() => {
-          this.outTime = this.outTime - 1;
-        }, 1000);
-      }
-    }
-  },
   methods: {
     init() {
       if (this.$route.query && this.$route.query.pid) {
         this.pid = this.$route.query.pid;
       }
     },
+    checkMobile(sMobile) {
+      if (!/^1\d{10}$/.test(sMobile)) {
+        return false;
+      } else {
+        return true;
+      }
+    },
     getYzm() {
-      this.outTime = 10;
+      if (!this.checkMobile(this.form.mobile)) {
+        this.$toast("请输入正确的手机号");
+        return false;
+      }
+      let data = { mobile: this.form.mobile.toString(), type: 1 };
+      this.sendMsgLoading = true;
+      getMobileYzm({ data: returnJSEncrypt1(data) })
+        .then(res => {
+          this.sended = true;
+          this.countDownInit();
+          this.$toast("已经发送,请注意查收!");
+        })
+        .finally(() => {
+          this.sendMsgLoading = false;
+        });
+    },
+    countDownInit() {
+      let self = this;
+      self.sendMsgText = "已发送(" + self.countdown + ")";
+      if (self.countdown == 0) {
+        self.countdown = 60;
+        self.sendMsgText = "重新发送";
+        self.sended = false;
+        return false;
+      } else {
+        setTimeout(function() {
+          self.countdown--;
+          self.countDownInit();
+        }, 1000);
+      }
     },
     onSubmit() {
-      let data = {
-        pid:this.pid,
-        name:this.form.name,
-        mobile:this.form.mobile,
-        code:this.form.code
+      if (this.form.name && this.checkMobile(this.form.mobile) && this.form.code) {
+        let data = {
+          name: this.form.name,
+          mobile: this.form.mobile,
+          code: this.form.code
+        };
+        if (this.pid != null) {
+          data.pid = this.pid;
+        }
+        addDealer(data).then(res => {
+          this.$toast.success("注册经销商成功");
+          setTimeout(() => {
+            this.$router.push("/courseHome");
+          }, 1000);
+        });
+      } else {
+        this.$toast.fail("请先将信息填写完整在提交");
       }
-      addDealer(data).then(res=>{
-        this.$toast.success("注册经销商成功")
-        setTimeout(()=>{
-          this.$router.push('/courseHome')
-        },1500)
-      })
     }
   }
 };
@@ -121,6 +155,8 @@ img {
   display: block;
 }
 .page {
+  background: url(../../../../static/images/courseLogin.png) no-repeat;
+  background-size: 100% 100%;
   .buibOuter {
     width: 100%;
     height: calc(100vh - 0.92rem);

+ 18 - 3
src/view/course/video/video.vue

@@ -5,17 +5,32 @@
 </template>
 
 <script>
+import JSEncrypt from 'jsencrypt';  
 export default {
   name: '',
   components: {},
     props: [],
   data () {
     return {
+      decrypt:null,
+      link:"",
+      privateKey:"hdisadnihcuxhzcjxhidhsadahdoihasdnxjhuchasjdhandkjnasidhsadsadasklmcxasnsjdoasdjaosijkxoajsidjsaodkasj"
     }
   },
-  created () { },
-  mounted () { },
-  methods: { },
+  created () {
+    this.init();
+   },
+  methods: { 
+    init(){
+      this.decrypt = new JSEncrypt(); 
+      this.decrypt.setPrivateKey(this.privateKey); // 设置私钥  
+      this.link = this.decryptMessage(this.$route.params.id)
+      console.log(this.init)
+    },
+    decryptMessage(text) {  
+      return this.decrypt.decrypt(text); // 解密消息  
+    }, 
+  },
   computed: {}
 }
 </script>

BIN
static/images/courseLogin.png