From bce9d1cf5e2dbcf1992b4d19847fa302553f1b6a Mon Sep 17 00:00:00 2001
From: chen <2659004835@qq.com>
Date: Wed, 10 Aug 2022 18:18:06 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=BE=88=E5=A4=9A=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
commons/base.css | 4 ++
jsFile/public-api.js | 6 +-
pages/tabbar/my/my.vue | 6 +-
pages/tabbar/pagehome/pagehome.vue | 6 +-
pages/tabbar/video/video.vue | 14 ++++-
pagesA/my-coupon/my-coupon.vue | 47 +++++++++++++--
pagesA/my-course/my-course.vue | 41 +++++++------
pagesA/my-extend/my-extend.vue | 67 +++++++++++++++++++--
pagesA/my-integral/my-integral.vue | 41 ++++++++++++-
pagesA/my-order/my-order.vue | 48 ++++++++++++---
pagesA/my-sign/my-sign.vue | 80 ++++++++++++++++++-------
pagesB/buy-now/buy-now.vue | 83 ++++++++++++++++++++++----
pagesB/cart/cart.vue | 33 +++++++---
pagesB/confirm-order/confirm-order.vue | 78 +++++++++++++++++++++---
pagesB/course-detail/course-detail.vue | 52 +++++++++++++---
pagesB/play-video/play-video.nvue | 3 +-
pagesB/second-level/second-level.vue | 43 +++++++++++--
pagesB/shop-detail/shop-detail.vue | 3 +
18 files changed, 548 insertions(+), 107 deletions(-)
diff --git a/commons/base.css b/commons/base.css
index 9908f69..ceceafe 100644
--- a/commons/base.css
+++ b/commons/base.css
@@ -323,6 +323,10 @@ button:after{content: none!important;}
.mar-x160{margin-bottom: 160rpx;}
.mar-x180{margin-bottom: 180rpx;}
/* 左---外边距 */
+.mar-z2{margin-left: 2rpx;}
+.mar-z4{margin-left: 4rpx;}
+.mar-z6{margin-left: 6rpx;}
+.mar-z8{margin-left: 8rpx;}
.mar-z10{margin-left: 10rpx;}
.mar-z20{margin-left: 20rpx;}
.mar-z25{margin-left: 25rpx;}
diff --git a/jsFile/public-api.js b/jsFile/public-api.js
index 346769a..b312055 100644
--- a/jsFile/public-api.js
+++ b/jsFile/public-api.js
@@ -6,4 +6,8 @@ export function uploadImg(data) {
// 视频上传\音频\文件
export function uploadFile(data) {
return request.upload("/universal/api.upload/upload", data, 'file');
-}
\ No newline at end of file
+}
+// 视频播放记录上报
+export function reportRecord(data) {
+ return request.post("/api/user/video-view", data);
+}
diff --git a/pages/tabbar/my/my.vue b/pages/tabbar/my/my.vue
index 9a5eb46..81d5d74 100644
--- a/pages/tabbar/my/my.vue
+++ b/pages/tabbar/my/my.vue
@@ -57,11 +57,12 @@
statusBarHeight: uni.getSystemInfoSync().statusBarHeight, // 状态栏高度
newHeight:uni.getSystemInfoSync().screenHeight, // 窗口高度
isLoading:false, //加载完成
+ // {src:'/static/tabbar/icon-panh.png',title:'我的练习视频'},
funList:[
{src:'/static/tabbar/icon-set.png',title:'个人资料'},
{src:'/static/tabbar/icon-course.png',title:'我的课程'},
{src:'/static/tabbar/icon-order.png',title:'我的订单'},
- {src:'/static/tabbar/icon-panh.png',title:'我的练习视频'},
+
{src:'/static/tabbar/icon-coupon.png',title:'我的优惠券'},
{src:'/static/tabbar/icon-score.png',title:'我的积分'},
{src:'/static/tabbar/icon-address.png',title:'我的地址'},
@@ -96,11 +97,12 @@
// 导航跳转
chooseFun(index){
+ // '/pagesA/my-video/my-video',
let list = [
'/pagesA/my-data/my-data',
'/pagesA/my-course/my-course',
'/pagesA/my-order/my-order',
- '/pagesA/my-video/my-video',
+
'/pagesA/my-coupon/my-coupon',
'/pagesA/my-integral/my-integral',
'/pagesA/my-address/my-address',
diff --git a/pages/tabbar/pagehome/pagehome.vue b/pages/tabbar/pagehome/pagehome.vue
index 69adfb0..dd86299 100644
--- a/pages/tabbar/pagehome/pagehome.vue
+++ b/pages/tabbar/pagehome/pagehome.vue
@@ -68,6 +68,7 @@
import footTab from '@/components/foot-tabs/foot-tab.vue';
import list from '@/components/list.vue';
import pitera from '@/components/nothing/pitera.vue';
+ import {reportRecord} from '@/jsFile/public-api.js';
export default {
components:{
'foot-tab' :footTab,
@@ -210,7 +211,9 @@
wx.openChannelsActivity({
finderUserName:this.videoList[index].video_number,
feedId:this.videoList[index].subtitle,
- success:(res)=>{},fail:()=>{
+ success:(res)=>{
+ reportRecord({id:this.videoList[index].id}).then(result=>{})
+ },fail:()=>{
this.$toolAll.tools.showToast('视频已丢失或已删除')
}
})
@@ -222,6 +225,7 @@
uni.navigateTo({
url:`/pagesB/play-video/play-video?current=${index}`
})
+ reportRecord({id:this.videoList[index].id}).then(result=>{})
}
},
// 更多
diff --git a/pages/tabbar/video/video.vue b/pages/tabbar/video/video.vue
index a3b187f..2922a86 100644
--- a/pages/tabbar/video/video.vue
+++ b/pages/tabbar/video/video.vue
@@ -43,6 +43,7 @@
// 底部组件
import footTab from '@/components/foot-tabs/foot-tab.vue';
import pitera from '@/components/nothing/pitera.vue';
+ import {reportRecord} from '@/jsFile/public-api.js';
export default {
components:{
'foot-tab' :footTab,
@@ -95,7 +96,13 @@
wx.openChannelsActivity({
finderUserName:this.dataList[index].video_number,
feedId:this.dataList[index].subtitle,
- success:(res)=>{},fail:()=>{
+ success:(res)=>{
+ reportRecord({id:this.dataList[index].id}).then(result=>{
+ if(result.code==0){
+ this.dataList[index].view++;
+ }
+ })
+ },fail:()=>{
this.$toolAll.tools.showToast('视频已丢失或已删除')
}
})
@@ -107,6 +114,11 @@
uni.navigateTo({
url:`/pagesB/play-video/play-video?current=${index}`
})
+ reportRecord({id:this.dataList[index].id}).then(result=>{
+ if(result.code==0){
+ this.dataList[index].view++;
+ }
+ })
}
},
}
diff --git a/pagesA/my-coupon/my-coupon.vue b/pagesA/my-coupon/my-coupon.vue
index 98b5067..c2ea78b 100644
--- a/pagesA/my-coupon/my-coupon.vue
+++ b/pagesA/my-coupon/my-coupon.vue
@@ -20,10 +20,10 @@
去使用
-
+
@@ -31,17 +31,17 @@
-
+
-
+
@@ -71,13 +71,30 @@
{price:10,title:'【满减卷】满100元减10元抵扣卷',time:'2022.07.11-2022.07.30',show:false},
{price:10,title:'【满减卷】满100元减10元抵扣卷',time:'2022.07.11-2022.07.30',show:false},
{price:10,title:'【满减卷】满100元减10元抵扣卷',time:'2022.07.11-2022.07.30',show:false},
- ]
+ ],
+ status:'normal',
+ page:1,
+ size:20,
+ total:0,
+ noMore:false
}
},
+ onReachBottom() {
+ if(this.total!=this.dataList.length){
+ this.page++;
+ this.getCouponList();
+ }
+ },
+ onLoad() {
+ this.getCouponList();
+ },
methods: {
// tab点击事件
clickTab(index){
this.current = index;
+ this.status = ['normal','used','invalid'][this.current];
+ this.page = 1;
+ this.getCouponList();
},
// 去商品详情
goDetail(id){
@@ -93,6 +110,24 @@
this.dataList.forEach(item=>item.show=false);
this.dataList[index].show = true;
}
+ },
+ // 获取优惠券列表
+ getCouponList(){
+ let params = {
+ status:this.status,
+ page:this.page,
+ size:this.size
+ }
+ this.$requst.get('/api/user/coupon-list',params).then(res=>{
+ if(res.code==0){
+ // this.total = res.data.total;
+ // if(this.page==1){this.dataList=[];}
+ // this.dataList = [...this.dataList,...res.data.list];
+ // if(this.total==this.dataList.length && this.page!=1){
+ // this.noMore = true;
+ // }
+ }
+ })
}
}
}
diff --git a/pagesA/my-course/my-course.vue b/pagesA/my-course/my-course.vue
index 8a13089..53af573 100644
--- a/pagesA/my-course/my-course.vue
+++ b/pagesA/my-course/my-course.vue
@@ -2,22 +2,22 @@
-
+
-
+
- {{item.title}}
- {{item.time}}
+ {{item.name}}
+ {{item.created_at}}
¥{{item.price}}
- 点击学习
+ 点击学习
-
+
@@ -40,26 +40,33 @@
{imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'思通造化随通而行为术基础动作教学思通造化随通而行为术基础动作教学',time:'2022.07.20 12:12:12',price:'199.00'},
{imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'思通造化随通而行为术基础动作教学思通造化随通而行为术基础动作教学',time:'2022.07.20 12:12:12',price:'199.00'},
{imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'思通造化随通而行为术基础动作教学思通造化随通而行为术基础动作教学',time:'2022.07.20 12:12:12',price:'199.00'},
- ]
+ ],
+ page:1,
+ size:20,
+ total:0,
+ noMore:false,
}
},
- onShow() {
+ onLoad() {
// 获取课程列表
this.getCouresList();
},
+ onReachBottom() {
+ if(this.total!=this.dataList.lenght){
+ this.page++;
+ this.getCouresList();
+ }
+ },
methods: {
// 获取课程列表
getCouresList(){
- uni.showLoading({
- title:'加载中'
- });
- this.$requst.get('/api/spu/course').then(res=>{
- console.log(res,'课程列表')
- if(res.code==0) {
- this.userInfo = res.data;
+ this.$requst.get('/api/user/course').then(res=>{
+ this.total = res.data.total;
+ if(this.page==1){this.dataList=[];}
+ this.dataList = [...this.dataList,...res.data.list];
+ if(this.total==this.dataList.length && this.page!=1){
+ this.noMore = true;
}
- uni.hideLoading();
- this.isLoading = true;
})
},
diff --git a/pagesA/my-extend/my-extend.vue b/pagesA/my-extend/my-extend.vue
index ad6cceb..a984393 100644
--- a/pagesA/my-extend/my-extend.vue
+++ b/pagesA/my-extend/my-extend.vue
@@ -1,10 +1,10 @@
-
+
-
+
推广获取积分
@@ -12,7 +12,7 @@
-
+
@@ -26,7 +26,9 @@
-
+
+
+
@@ -34,17 +36,70 @@
diff --git a/pagesA/my-integral/my-integral.vue b/pagesA/my-integral/my-integral.vue
index d6754c3..160de18 100644
--- a/pagesA/my-integral/my-integral.vue
+++ b/pagesA/my-integral/my-integral.vue
@@ -12,7 +12,7 @@
-
+
{{item.title}}
@@ -21,7 +21,7 @@
{{item.time}}
-
+
@@ -55,13 +55,48 @@
{price:10,title:'签到',time:'2022.07.11-2022.07.30'},
{price:10,title:'分享',time:'2022.07.11-2022.07.30'},
{price:10,title:'推荐消费',time:'2022.07.11-2022.07.30'},
- ]
+ ],
+ page:1,
+ size:20,
+ type:'',
+ total:0,
+ noMore:false
+ }
+ },
+ onLoad() {
+ this.getIntegral();
+ },
+ onReachBottom() {
+ if(this.total!=this.dataList.length){
+ this.page++;
+ this.getIntegral();
}
},
methods: {
// tab点击事件
clickTab(index){
this.current = index;
+ this.type = ['','in','out'][this.current];
+ this.page = 1;
+ this.getIntegral();
+ },
+ // 获取积分列表
+ getIntegral(){
+ let params = {
+ type:this.type,
+ page:this.page,
+ size:this.size
+ }
+ this.$requst.get('/api/user/score-log',params).then(res=>{
+ if(res.code==0){
+ this.total = res.data.total;
+ if(this.page==1){this.dataList=[];}
+ this.dataList = [...this.dataList,...res.data.list];
+ if(this.total==this.dataList.length && this.page!=1){
+ this.noMore = true;
+ }
+ }
+ })
}
}
}
diff --git a/pagesA/my-order/my-order.vue b/pagesA/my-order/my-order.vue
index b68878a..a7dc508 100644
--- a/pagesA/my-order/my-order.vue
+++ b/pagesA/my-order/my-order.vue
@@ -6,21 +6,23 @@
-
-
+
+
- 武术用品商品名称后用品商品名称后 台上传基础动作教学
- x3
+ {{item.skus[0].spu_name}}
+ x{{item.skus[0].num}}
- 实付:¥199.00
- {{['确认收货','去付款','查看物流'][index]}}
+ 实付:¥{{item.skus[0].price}}
+ 去付款
+
-
+
@@ -50,11 +52,22 @@
tipsTitle:'提示信息',
dynamicText:{
content:''
- }
+ },
+ page:1,
+ size:20,
+ total:0,
+ noMore:false,
+ orderList:[]
}
},
onLoad() {
-
+ this.getOrderList();
+ },
+ onReachBottom() {
+ if(this.total!=this.orderList.length){
+ this.page++;
+ this.getOrderList();
+ }
},
methods: {
// tab点击事件
@@ -67,6 +80,23 @@
this.showType = [2,3,1][index];
this.$refs.refFrame.ifLogistics = true;
this.$refs.refFrame.ifAnimated = true;
+ },
+ // 获取我的订单列表
+ getOrderList(){
+ let params = {
+ page:this.page,
+ size:this.size
+ }
+ if(this.page==1) this.orderList = [];
+ this.$requst.get('/api/user/order',params).then(res=>{
+ if(res.code==0){
+ this.total = res.data.total;
+ this.orderList = [...this.orderList,...res.data.list];
+ if(this.total==this.orderList.length && this.page!=1){
+ this.noMore = true;
+ }
+ }
+ })
}
}
}
diff --git a/pagesA/my-sign/my-sign.vue b/pagesA/my-sign/my-sign.vue
index 476ad63..4fedf15 100644
--- a/pagesA/my-sign/my-sign.vue
+++ b/pagesA/my-sign/my-sign.vue
@@ -4,28 +4,30 @@
每日签到
-
-
-
-
-
- {{signText}}
+
+
+
+
+
+
+ {{signText}}
+
-
-
-
-
- {{item.score}}
- {{item.day}}
+
+
+
+ {{item.score}}
+ {{item.key}}
+
-
-
-
-
- {{item.price}}
- {{item.time}}
+
+
+
+ {{item.num}}
+ {{item.created_at.slice(0,10).split('-').join('.')}}
+
@@ -65,23 +67,55 @@
],
sameDay:1,
signText:'签到',
- showType:4
+ showType:4,
+ page:1,
+ size:20,
+ loading:false
}
},
onLoad() {
-
+ this.getSignInfo();
},
methods: {
+ // 获取签到信息
+ getSignInfo(){
+ this.$requst.get('/api/sign/info').then(res=>{
+ if(res.code==0){
+ this.signList = res.data.week;
+ this.signText = ['签到','已签到'][res.data.today_sign];
+ this.loading = true;
+ this.getSignList();
+ }
+ })
+ },
// 返回
goBack(){
uni.navigateBack({
delta:1
})
},
+ // 执行签到
signEv(){
- this.signText = "已签到";
- this.$refs.refFrame.ifLogistics = true;
- this.$refs.refFrame.ifAnimated = true;
+ this.$requst.post('/api/sign/sign').then(res=>{
+ if(res.code==0){
+ this.signText = "已签到";
+ this.$refs.refFrame.ifLogistics = true;
+ this.$refs.refFrame.ifAnimated = true;
+ this.getSignList();
+ }
+ })
+ },
+ // 获取签到记录
+ getSignList(){
+ let params = {
+ page:this.page,
+ size:this.size
+ }
+ this.$requst.get('/api/user/sign-score',params).then(res=>{
+ if(res.code==0){
+ this.dataList = res.data.list;
+ }
+ })
}
}
}
diff --git a/pagesB/buy-now/buy-now.vue b/pagesB/buy-now/buy-now.vue
index f546d3f..2074abb 100644
--- a/pagesB/buy-now/buy-now.vue
+++ b/pagesB/buy-now/buy-now.vue
@@ -3,24 +3,24 @@
-
-
+
+
- 武,止戈为武;术,思通造化、随通而 行为术基础动作教学
+ {{item.spu_name}}
- ¥199.00
- ¥220.00
+ ¥{{item.price}}
+ ¥{{item.original_price}}
商品金额
- ¥199.00
+ ¥{{$toolAll.tools.addXiaoShu(courseInfo.original_total*1)}}
优惠券抵扣
- -¥10.00
+ -¥{{couponInfo.coupon_price}}
@@ -30,8 +30,8 @@
- ¥189.00
- 去支付
+ ¥{{realityPrice}}
+ 去支付
@@ -45,14 +45,73 @@
components:{'foot-tab' :footTab},
data() {
return {
-
+ courseInfo:'',
+ couponInfo:{
+ coupon_id:'',//优惠券ID
+ coupon_price:0//优惠券抵扣金额
+ },
+ flag:true
}
},
onLoad() {
-
+ this.courseInfo = uni.getStorageSync('courseInfo');
+ // uni.getStorageSync('skuList');
+ },
+ computed:{
+ realityPrice(){
+ let newPrice = 0;
+ if(this.courseInfo){
+ this.courseInfo.list.forEach(item=>{
+ let tempprice = this.$toolAll.tools.operationEv(item.price,item.num,'*',2)
+ newPrice = this.$toolAll.tools.operationEv(tempprice,newPrice,'+',2);
+ })
+ }
+ // 商品金额减优惠券抵扣
+ newPrice = this.$toolAll.tools.operationEv(newPrice,this.couponInfo.coupon_price,'-',2);
+ return newPrice;
+ }
},
methods: {
-
+ // 去支付
+ goPay(){
+ if(this.flag){
+ this.flag = false;
+ this.$toolAll.tools.showToast('正在调起支付...');
+ let params = {
+ sku_list:uni.getStorageSync('skuList'),
+ total:this.realityPrice,//实际付款金额 即:使用优惠券、积分抵扣等所有优惠后的金额(需加上运费)
+ ...this.couponInfo,
+ type:'course',//订单类型 spu=商品 course=课程
+ }
+ this.$requst.post('/api/order/create',params).then(res=>{
+ if(res.code==0){
+ let info = res.data;
+ uni.requestPayment({
+ provider: 'wxpay',
+ appId:info.payment_params.appId,//appId
+ timeStamp: info.payment_params.timeStamp,//时间戳
+ nonceStr: info.payment_params.nonceStr,//随机字符串
+ package: info.payment_params.package,//package
+ signType: info.payment_params.signType,//MD5
+ paySign: info.payment_params.sign,//签名
+ success:(result)=> {
+ this.$requst.post('/api/order/paid',{order_coding:info.coding}).then(res=>{
+ if(res.code==0){
+ this.$toolAll.tools.showToast('支付成功(*^▽^*)');
+ } else this.$toolAll.tools.showToast(res.msg);
+ })
+ },
+ fail:()=> {
+ this.$toolAll.tools.showToast('支付已取消o(╥﹏╥)o');
+ },
+ complete:()=> {
+ this.flag = true;
+ }
+ });
+ }
+ })
+ }
+ }
}
}
diff --git a/pagesB/cart/cart.vue b/pagesB/cart/cart.vue
index 56e7e95..84c792b 100644
--- a/pagesB/cart/cart.vue
+++ b/pagesB/cart/cart.vue
@@ -49,8 +49,7 @@
-
-
+
@@ -103,6 +102,8 @@
this.getCartList();
// 检测是否全选
this.judgeSelectAllEv();
+ uni.removeStorageSync('orderInfo');
+ uni.removeStorageSync('skuList');
},
onHide() {
// 关闭banner图自动轮播
@@ -134,6 +135,20 @@
},
methods: {
+ // 热门商品
+ getShopList(){
+ let params = {
+ page:1,
+ size:1000,
+ is_hot:1
+ }
+ this.$requst.post('/api/spu/list',params).then(res=>{
+ if(res.code==0){
+ // 设置商品列表
+ this.$refs.refproduct.list = res.data.list;
+ }
+ })
+ },
// 获取购物车列表
getCartList(){
let params = {
@@ -155,6 +170,7 @@
})
}
this.loading = true;
+ this.getShopList();
}
})
},
@@ -182,11 +198,13 @@
if(exit!=-1){
let newList = [];
this.datalist.forEach(item=>{
- let obj = {
- sku_coding:item.sku.coding,
- num:item.num,
+ if(item.ifcheck){
+ let obj = {
+ sku_coding:item.sku.coding,
+ num:item.num,
+ }
+ newList.push(obj);
}
- newList.push(obj);
})
let params = {
sku_list:newList
@@ -197,6 +215,7 @@
url:'/pagesB/confirm-order/confirm-order'
})
uni.setStorageSync('orderInfo',res.data);
+ uni.setStorageSync('skuList',params.sku_list);
}
})
} else {
@@ -234,7 +253,7 @@
// 去商品详情事件
goDetail(id){
uni.navigateTo({
- url:'/pagesB/shop-detail/shop-detail'
+ url:`/pagesB/shop-detail/shop-detail?id=${id}`
})
},
// 数量加减事件
diff --git a/pagesB/confirm-order/confirm-order.vue b/pagesB/confirm-order/confirm-order.vue
index afce01e..8f92ed9 100644
--- a/pagesB/confirm-order/confirm-order.vue
+++ b/pagesB/confirm-order/confirm-order.vue
@@ -20,7 +20,7 @@
{{item.sku_name}}
¥{{item.price}}
- X{{item.num}}
+ X {{item.num}}
@@ -28,24 +28,24 @@
商品金额
- ¥{{orderInfo.original_total}}
+ ¥{{$toolAll.tools.addXiaoShu(orderInfo.original_total*1)}}
优惠券抵扣
- -¥10.00
+ -¥{{couponInfo.coupon_price}}
积分抵扣
- -¥10.00
+ -¥{{score}}
- 合计:¥1168.00
+ 合计:¥{{realityPrice}}
- 合计:¥189.00
+ 合计:¥{{realityPrice}}
去支付
@@ -62,7 +62,12 @@
return {
addressInfo:'',
orderInfo:'',
- flag:true
+ flag:true,
+ couponInfo:{
+ coupon_id:'',//优惠券ID
+ coupon_price:0//优惠券抵扣金额
+ },
+ score:0
}
},
onShow() {
@@ -71,6 +76,22 @@
onLoad() {
this.getAddress();
},
+ computed:{
+ realityPrice(){
+ let newPrice = 0;
+ if(this.orderInfo){
+ this.orderInfo.list.forEach(item=>{
+ let tempprice = this.$toolAll.tools.operationEv(item.price,item.num,'*',2)
+ newPrice = this.$toolAll.tools.operationEv(tempprice,newPrice,'+',2);
+ })
+ }
+ // 商品金额减优惠券抵扣
+ newPrice = this.$toolAll.tools.operationEv(newPrice,this.couponInfo.coupon_price,'-',2);
+ // 商品金额减积分抵扣
+ newPrice = this.$toolAll.tools.operationEv(newPrice,this.score,'-',2);
+ return newPrice;
+ }
+ },
methods: {
// 收货地址查询
getAddress(){
@@ -94,6 +115,49 @@
if(this.flag){
this.flag = false;
this.$toolAll.tools.showToast('正在调起支付...');
+ let params = {
+ sku_list:uni.getStorageSync('skuList'),
+ total:this.realityPrice,//实际付款金额 即:使用优惠券、积分抵扣等所有优惠后的金额(需加上运费)
+ express_code:'',
+ freight:0,//运费
+ ...this.couponInfo,
+ address_id:this.addressInfo.id,//地址ID
+ type:'spu',//订单类型 spu=商品 course=课程
+ score:0,//使用积分
+ score_deduct_price:0//积分抵扣的金额
+ }
+ this.$requst.post('/api/order/create',params).then(res=>{
+ if(res.code==0){
+ let info = res.data;
+ uni.requestPayment({
+ provider: 'wxpay',
+ appId:info.payment_params.appId,//appId
+ timeStamp: info.payment_params.timeStamp,//时间戳
+ nonceStr: info.payment_params.nonceStr,//随机字符串
+ package: info.payment_params.package,//package
+ signType: info.payment_params.signType,//MD5
+ paySign: info.payment_params.sign,//签名
+ success:(result)=> {
+ this.$requst.post('/api/order/paid',{order_coding:info.coding}).then(res=>{
+ if(res.code==0){
+ this.$toolAll.tools.showToast('支付成功(*^▽^*)');
+ setTimeout(()=>{
+ uni.navigateTo({
+ url:'/pagesA/my-order/my-order'
+ })
+ },1000)
+ } else this.$toolAll.tools.showToast(res.msg);
+ })
+ },
+ fail:()=> {
+ this.$toolAll.tools.showToast('支付已取消o(╥﹏╥)o');
+ },
+ complete:()=> {
+ this.flag = true;
+ }
+ });
+ }
+ })
}
}
}
diff --git a/pagesB/course-detail/course-detail.vue b/pagesB/course-detail/course-detail.vue
index d6c071b..def450b 100644
--- a/pagesB/course-detail/course-detail.vue
+++ b/pagesB/course-detail/course-detail.vue
@@ -26,7 +26,7 @@
立即购买
+ @tap="goBuy">立即购买
@@ -67,29 +67,53 @@
classId:'', //分类id
id:'', //课程id
page:1, //页数
- size:6, //条数
+ size:1000, //条数
+ courseList:[]
}
},
onLoad(op) {
- if(op.category_id){
- this.classId = op.category_id
- }
if(op.id){
this.id = op.id;
+ this.classId = op.category_id
// 获取课程详情
this.getCouresDetail(op.id);
}
},
+ onShareAppMessage(res) {
+ var shareObj = {
+ title: ``, // 默认是小程序的名称(可以写slogan等)
+ path: `/pagesB/course-detail/course-detail?id=${this.id}&category_id=${this.classId}&is_activity=${this.detailObj.is_activity==0 ? 0 : 1}&invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
+ imageUrl: ``//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
+ };
+ return shareObj;
+ },
+ onShow() {
+ uni.removeStorageSync('courseInfo');
+ uni.removeStorageSync('skuList');
+ },
methods: {
// 获取课程详情
getCouresDetail(id){
uni.showLoading({
title:'加载中'
});
- this.$requst.get('/api/spu/detail',{id:id}).then(res=>{
+ this.$requst.get('/api/spu/detail',{id}).then(res=>{
console.log(res,'课程详情')
if(res.code==0) {
this.couresDetail = res.data.detail;
+ // 课程规格
+ this.$requst.get('/api/spu/spec',{id}).then(resspec=>{
+ if(resspec.code==0){
+ this.courseList.push({
+ sku_list:[
+ {
+ sku_coding:resspec.data.sku.coding,
+ num:1,
+ }
+ ]
+ })
+ }
+ })
// 获取课程推荐
this.getCouresRecommend();
}
@@ -97,7 +121,21 @@
this.isLoading = true;
})
},
-
+ // 立即购买
+ goBuy(){
+ let params = {
+ sku_list:this.courseList[0].sku_list
+ };
+ this.$requst.post('/api/order/prepare-info',params).then(res=>{
+ if(res.code==0){
+ uni.setStorageSync('courseInfo',res.data);
+ uni.setStorageSync('skuList',params.sku_list);
+ uni.navigateTo({
+ url:'/pagesB/buy-now/buy-now'
+ })
+ }
+ })
+ },
// 获取课程推荐
getCouresRecommend(){
let params = {
diff --git a/pagesB/play-video/play-video.nvue b/pagesB/play-video/play-video.nvue
index 3a0c78d..008e94b 100644
--- a/pagesB/play-video/play-video.nvue
+++ b/pagesB/play-video/play-video.nvue
@@ -40,7 +40,8 @@
},
onLoad(op) {
- this.currentIndex = op.current;
+ // this.currentIndex = op.current;
+ this.currentIndex = 0;
uni.getStorageSync('videoList').forEach(item=>{
let obj = {
...item,
diff --git a/pagesB/second-level/second-level.vue b/pagesB/second-level/second-level.vue
index 2d3dfd2..810b292 100644
--- a/pagesB/second-level/second-level.vue
+++ b/pagesB/second-level/second-level.vue
@@ -4,7 +4,7 @@
-
+
代理登记
@@ -30,7 +30,9 @@
-
+
+
+
@@ -44,11 +46,44 @@
},
data() {
return {
-
+ dataList:[],
+ page:1,
+ size:20,
+ total:0,
+ noMore:false,
+ personCode:'',
+ loading:false
+ }
+ },
+ onLoad() {
+ this.personCode = uni.getStorageSync('personCode');
+ this.getExtend();
+ },
+ onReachBottom() {
+ if(this.total!=this.dataList.lenght){
+ this.page++;
+ this.getExtend();
}
},
methods: {
-
+ // 获取二级推广人
+ getExtend(){
+ let params = {
+ grade:'second',
+ page:this.page,
+ size:this.size
+ }
+ this.$requst.get('/api/user/share-users',params).then(res=>{
+ if(res.code==0){
+ this.total = res.data.total;
+ if(this.page==1){this.dataList=[];}
+ this.dataList = [...this.dataList,...res.data.list];
+ if(this.total==this.dataList.length && this.page!=1){
+ this.noMore = true;
+ }
+ }
+ })
+ }
}
}
diff --git a/pagesB/shop-detail/shop-detail.vue b/pagesB/shop-detail/shop-detail.vue
index ac99fae..72e9071 100644
--- a/pagesB/shop-detail/shop-detail.vue
+++ b/pagesB/shop-detail/shop-detail.vue
@@ -80,6 +80,8 @@
// 开启banner图自动轮播
this.$store.commit('setAutoplay',true);
uni.removeStorageSync('addressInfo');
+ uni.removeStorageSync('orderInfo');
+ uni.removeStorageSync('skuList');
},
onHide() {
// 关闭banner图自动轮播
@@ -178,6 +180,7 @@
url:'/pagesB/confirm-order/confirm-order'
})
uni.setStorageSync('orderInfo',res.data);
+ uni.setStorageSync('skuList',params.sku_list);
}
})
},