master
chen 2022-08-18 14:22:40 +08:00
parent 002e2daf18
commit 188f750313
12 changed files with 81 additions and 20 deletions

View File

@ -1,16 +1,16 @@
<template> <template>
<view> <view>
<view class="posAll bac5" v-if="ifMask"> <view class="posAll bac5" v-if="ifMask" @tap="executeEv(0)">
<view class="animated width100 " :class="ifAnimated?'bounceInUp':'bounceOutDown'" style="position: absolute;bottom: 0;"> <view @tap.stop="ifMask=true,ifAnimated=true" class="animated width100 " :class="ifAnimated?'bounceInUp':'bounceOutDown'" style="position: absolute;bottom: 0;">
<view class="bacf pad-zy20 pad-x20" style="border-radius: 30rpx 30rpx 0 0;"> <view class="bacf pad-zy20 pad-x20" style="border-radius: 30rpx 30rpx 0 0;">
<view class="disjbac pad-sx20"> <view class="disjbac pad-sx20">
<view class="fon28 bold colb">优惠券</view> <view class="fon28 bold colb">优惠券</view>
<view @tap="executeEv(0)" class="icon icon-del-white fon24" style="color: #b2b2b2;"></view> <view @tap.stop="executeEv(0)" class="icon icon-del-white fon24 pad-zy20" style="color: #b2b2b2;"></view>
</view> </view>
<view class="fon20" style="color: #616161;">已选中推荐优惠使用优惠券{{couponCount}}共抵扣<span class="col-e42417">{{$toolAll.tools.addXiaoShu(couponPrice)}}</span></view> <view class="fon20" style="color: #616161;">使用优惠券{{couponCount}}共抵扣<span class="col-e42417">{{$toolAll.tools.addXiaoShu(couponPrice)}}</span></view>
</view> </view>
<view class="pad20 overflow-s" style="background-color: #f2f2f2;max-height: 720rpx;"> <view class="pad20 overflow-s" style="background-color: #f2f2f2;max-height: 720rpx;">
<view @tap="chooseCoupon(item.id,index)" class="radius12 bacf boxshow2 pad-sx20 fon24" :class="index<(dataList.length-1)?'mar-x20':''" v-for="(item,index) in dataList" :key="index"> <view @tap.stop="chooseCoupon(item.id,index)" class="radius12 bacf boxshow2 pad-sx20 fon24" :class="index<(dataList.length-1)?'mar-x20':''" v-for="(item,index) in dataList" :key="index">
<view class="disac"> <view class="disac">
<view class="flexs bold col-e42417 dis pad-z20" style="min-width: 180rpx;color:#e42417;"> <view class="flexs bold col-e42417 dis pad-z20" style="min-width: 180rpx;color:#e42417;">
<view class=""></view> <view class=""></view>
@ -30,7 +30,7 @@
<view class="col9 fon24 disjcac pad-sx50" v-if="!dataList.length"></view> <view class="col9 fon24 disjcac pad-sx50" v-if="!dataList.length"></view>
</view> </view>
<view class="bacf pad-sx20 disjcac boxshowt"> <view class="bacf pad-sx20 disjcac boxshowt">
<view @tap="executeEv(1)" class="disjcac fon24" style="width: 380rpx;height: 70rpx;border-radius: 35rpx;background-color: #f37617;color: #FFFFFF;"> <view @tap.stop="executeEv(1)" class="disjcac fon24" style="width: 380rpx;height: 70rpx;border-radius: 35rpx;background-color: #f37617;color: #FFFFFF;">
确定 确定
</view> </view>
</view> </view>
@ -83,7 +83,6 @@
}, },
// //
checkChoose(){ checkChoose(){
console.log(this.couponId,666666);
let exitIndex = this.dataList.findIndex(item=>item.id==this.couponId); let exitIndex = this.dataList.findIndex(item=>item.id==this.couponId);
if(exitIndex!=-1){ if(exitIndex!=-1){
this.dataList[exitIndex].ifcheck = true; this.dataList[exitIndex].ifcheck = true;
@ -121,7 +120,8 @@
let params = { let params = {
status:'normal', status:'normal',
page:1, page:1,
size:100 size:100,
condition:uni.getStorageSync('courseInfo').original_total*1
} }
this.$requst.get('/api/user/coupon-list',params).then(res=>{ this.$requst.get('/api/user/coupon-list',params).then(res=>{
if(res.code==0){ if(res.code==0){

View File

@ -11,3 +11,7 @@ export function uploadFile(data) {
export function reportRecord(data) { export function reportRecord(data) {
return request.post("/api/user/video-view", data); return request.post("/api/user/video-view", data);
} }
// 查询购物车数量
export function checkCartNum() {
return request.get("/api/order/shopping-cart-count");
}

View File

@ -26,6 +26,8 @@
import swiperTab from '@/components/swiper-tab/swiper-tab.vue'; import swiperTab from '@/components/swiper-tab/swiper-tab.vue';
import list from '@/components/list.vue'; import list from '@/components/list.vue';
import pitera from '@/components/nothing/pitera.vue'; import pitera from '@/components/nothing/pitera.vue';
import { mapState } from 'vuex';
import { checkCartNum } from '@/jsFile/public-api.js';
export default { export default {
components:{ components:{
'foot-tab' :footTab, 'foot-tab' :footTab,
@ -46,9 +48,15 @@
loading:false loading:false
} }
}, },
computed:{
...mapState({
cartNum: state => state.moduleA.cartNum
})
},
onLoad() { onLoad() {
// //
this.getHomeCate(); this.getHomeCate();
this.cartNumEv();
}, },
onReachBottom() { onReachBottom() {
if(this.total!=this.$refs.refproduct.list.length){ if(this.total!=this.$refs.refproduct.list.length){
@ -62,6 +70,14 @@
uni.removeStorageSync('skuList'); uni.removeStorageSync('skuList');
}, },
methods: { methods: {
//
cartNumEv(){
checkCartNum().then(res=>{
if(res.code==0){
this.$store.commit('setCartNum',res.data.count);
}
})
},
// tab // tab
clickTab(index){ clickTab(index){
this.current = index; this.current = index;

View File

@ -7,7 +7,7 @@
<view class="fon24 col26">头像</view> <view class="fon24 col26">头像</view>
<view class="disac"> <view class="disac">
<image class="radius_100" :src="userInfo.headimgurl" mode="aspectFill" style="width: 92rpx;height: 92rpx;"></image> <image class="radius_100" :src="userInfo.headimgurl" mode="aspectFill" style="width: 92rpx;height: 92rpx;"></image>
<view class="icon icon-next fon24 mar-z10" style="color: #7f7f7f;"></view> <!-- <view class="icon icon-next fon24 mar-z10" style="color: #7f7f7f;"></view> -->
</view> </view>
</view> </view>
<view class="pad-sx30 fon24 pad-zy10 disjbac bbot"> <view class="pad-sx30 fon24 pad-zy10 disjbac bbot">

View File

@ -13,7 +13,7 @@
</view> </view>
<view class="disjbac pad-sx20 pad-zy10"> <view class="disjbac pad-sx20 pad-zy10">
<view class="fon22 col26">推广获取积分</view> <view class="fon22 col26">推广获取积分</view>
<view class="fon26 bold col-e42417" v-if="scoreInfo">{{scoreInfo.score}}</view> <view class="fon26 bold col-e42417" v-if="scoreInfo">{{scoreInfo}}</view>
</view> </view>
</view> </view>
<view class="mar-s30 pad-zy20 bacf boxshow2"> <view class="mar-s30 pad-zy20 bacf boxshow2">
@ -85,7 +85,7 @@
} }
this.$requst.get('/api/user/sales',params).then(res=>{ this.$requst.get('/api/user/sales',params).then(res=>{
if(res.code==0){ if(res.code==0){
this.scoreInfo = res.data.account; this.scoreInfo = res.data.promotion_score;
this.total = res.data.list.total; this.total = res.data.list.total;
if(this.page==1){this.dataList=[];} if(this.page==1){this.dataList=[];}
this.dataList = [...this.dataList,...res.data.list.list]; this.dataList = [...this.dataList,...res.data.list.list];

View File

@ -16,7 +16,7 @@
</view> </view>
<view class="pad-zy30"> <view class="pad-zy30">
<view class="disjbac" style="background: linear-gradient(to bottom, #fefcfc 0%, #f8efed 100%);border-radius: 24rpx 24rpx 0 0;"> <view class="disjbac" style="background: linear-gradient(to bottom, #fefcfc 0%, #f8efed 100%);border-radius: 24rpx 24rpx 0 0;">
<view class="disjcac fc fon24 pad-sx30 width100" :class="item.is_today==1?'activeDay':''" v-for="(item,index) in signList" :key="index"> <view class="disjcac fc fon24 pad-sx30 width100" :class="item.is_sign==1?'activeDay':''" v-for="(item,index) in signList" :key="index">
<view class="">+{{item.score}}</view> <view class="">+{{item.score}}</view>
<view class="mar-s10">{{item.key}}</view> <view class="mar-s10">{{item.key}}</view>
</view> </view>

View File

@ -20,7 +20,8 @@
</view> </view>
<view @tap="chooseCoupon" class="disjbac mar-s30"> <view @tap="chooseCoupon" class="disjbac mar-s30">
<view class="">优惠券抵扣</view> <view class="">优惠券抵扣</view>
<view class="disjbac col-e42417">-{{couponInfo.coupon_price}} <i class="icon icon-next fon20" style="color: #7f7f7f;"></i></view> <view class="disjbac col-e42417" v-if="couponInfo.coupon_id">-{{couponInfo.coupon_price}} <i class="icon icon-next fon20" style="color: #7f7f7f;"></i></view>
<view class="disjbac col26" v-else>{{couponNum}}<i class="icon icon-next fon20" style="color: #7f7f7f;"></i></view>
</view> </view>
</view> </view>
<view class="fon24 dis fe mar-s20">合计<span class="col-e42417">{{realityPrice}}</span></view> <view class="fon24 dis fe mar-s20">合计<span class="col-e42417">{{realityPrice}}</span></view>
@ -53,11 +54,13 @@
coupon_id:'',//ID coupon_id:'',//ID
coupon_price:0// coupon_price:0//
}, },
flag:true flag:true,
couponNum:0
} }
}, },
onLoad() { onLoad() {
this.courseInfo = uni.getStorageSync('courseInfo'); this.courseInfo = uni.getStorageSync('courseInfo');
this.getCoupon();
// uni.getStorageSync('skuList'); // uni.getStorageSync('skuList');
}, },
computed:{ computed:{
@ -75,6 +78,20 @@
} }
}, },
methods: { methods: {
// 使
getCoupon(){
let params = {
status:'normal',
page:1,
size:100,
condition:this.courseInfo.original_total*1
}
this.$requst.get('/api/user/coupon-list',params).then(res=>{
if(res.code==0){
this.couponNum = res.data.list.length;
}
})
},
// //
chooseCoupon(){ chooseCoupon(){
this.$refs.refCoupon.couponId = this.couponInfo.coupon_id; this.$refs.refCoupon.couponId = this.couponInfo.coupon_id;

View File

@ -158,6 +158,7 @@
this.datalist = []; this.datalist = [];
this.$requst.get('/api/order/shopping-cart',params).then(res=>{ this.$requst.get('/api/order/shopping-cart',params).then(res=>{
if(res.code==0){ if(res.code==0){
this.$store.commit('setCartNum',res.data.list.length);
if(res.data.list.length){ if(res.data.list.length){
res.data.list.forEach(item=>{ res.data.list.forEach(item=>{
let obj = { let obj = {
@ -329,6 +330,7 @@
this.delCart(this.datalist[index].id); this.delCart(this.datalist[index].id);
setTimeout(()=>{ setTimeout(()=>{
this.datalist.splice(index,1); this.datalist.splice(index,1);
this.$store.commit('setCartNum',this.datalist.length);
this.judgeSelectAllEv(); this.judgeSelectAllEv();
},500) },500)
} }

View File

@ -2,7 +2,7 @@
<view> <view>
<status-container titlet="确认订单" returnc="#FFFFFF"> <status-container titlet="确认订单" returnc="#FFFFFF">
<view slot="content" style="margin-top: -20rpx;" v-if="loading"> <view slot="content" style="margin-top: -20rpx;" v-if="loading">
<view @tap="$toolAll.tools.goPage(`/pagesA/my-address/my-address?ifChoose=1`)" class="bacf disjbac fon24 pad-sx20 pad-zy30 boxshowb"> <view v-if="orderInfo.list[0].spu_type!='coupon'" @tap="$toolAll.tools.goPage(`/pagesA/my-address/my-address?ifChoose=1`)" class="bacf disjbac fon24 pad-sx20 pad-zy30 boxshowb">
<view class="fon20 line-h40" v-if="addressInfo"> <view class="fon20 line-h40" v-if="addressInfo">
<view class="" style="color: #676767;">{{addressInfo.province_str}}{{addressInfo.city_str}}{{addressInfo.county_str}}</view> <view class="" style="color: #676767;">{{addressInfo.province_str}}{{addressInfo.city_str}}{{addressInfo.county_str}}</view>
<view class="fon26">{{addressInfo.address}}</view> <view class="fon26">{{addressInfo.address}}</view>

View File

@ -62,6 +62,8 @@
import list from '@/components/list.vue'; import list from '@/components/list.vue';
import swiperPu from '@/components/swipers/swiper-pu.vue'; import swiperPu from '@/components/swipers/swiper-pu.vue';
import buyPopu from '@/components/buy-popu.vue'; import buyPopu from '@/components/buy-popu.vue';
import { mapState } from 'vuex';
import { checkCartNum } from '@/jsFile/public-api.js';
export default { export default {
components:{'foot-tab' :footTab,list,swiperPu,buyPopu}, components:{'foot-tab' :footTab,list,swiperPu,buyPopu},
data() { data() {
@ -79,6 +81,11 @@
ifDetail:false ifDetail:false
} }
}, },
computed:{
...mapState({
cartNum: state => state.moduleA.cartNum
})
},
onShow() { onShow() {
// banner // banner
this.$store.commit('setAutoplay',true); this.$store.commit('setAutoplay',true);
@ -109,6 +116,7 @@
this.shopId = op.id; this.shopId = op.id;
// //
this.getDetail(); this.getDetail();
this.cartNumEv();
}, },
methods: { methods: {
// //
@ -224,10 +232,19 @@
this.$requst.post('/api/order/shopping-cart-add',params).then(res=>{ this.$requst.post('/api/order/shopping-cart-add',params).then(res=>{
if(res.code==0){ if(res.code==0){
this.$toolAll.tools.showToast('添加购物车成功(*^▽^*)'); this.$toolAll.tools.showToast('添加购物车成功(*^▽^*)');
this.cartNumEv();
} }
}) })
} }
}, },
//
cartNumEv(){
checkCartNum().then(res=>{
if(res.code==0){
this.$store.commit('setCartNum',res.data.count);
}
})
},
// //
objField(field){ objField(field){
let newObj = JSON.parse(JSON.stringify(this.shopList[0].sku_list[0])); let newObj = JSON.parse(JSON.stringify(this.shopList[0].sku_list[0]));

View File

@ -10,9 +10,9 @@
<input @tap="uploadVideo" class="width100 radius4 mar-s20 pad-zy20 tcenter" type="text" placeholder="浏览..." disabled <input @tap="uploadVideo" class="width100 radius4 mar-s20 pad-zy20 tcenter" type="text" placeholder="浏览..." disabled
style="border: 2rpx solid #ececec;background-color: #f5f5f5;height: 70rpx;box-sizing: border-box;"> style="border: 2rpx solid #ececec;background-color: #f5f5f5;height: 70rpx;box-sizing: border-box;">
<view class="pad-s20" v-if="videoInfo.full_src"> <view class="pad-s20" v-if="videoInfo.full_src">
<video :src="videoInfo.full_src" :controls="true" object-fit="contain" :show-center-play-btn="true" style="height: 180rpx;" class="width100"></video> <video :src="videoInfo.full_src" :controls="true" object-fit="contain" :show-center-play-btn="true" style="height: 388rpx;" class="width100"></video>
</view> </view>
<input @tap="submitEv" class="width100 radius4 mar-s60 tcenter" type="text" placeholder="立即上传" placeholder-style="color:#FFFFFF;" disabled <input @tap="submitEv" class="width100 radius4 mar-s60 tcenter" type="text" placeholder="立即保存" placeholder-style="color:#FFFFFF;" disabled
style="border: 2rpx solid #e42417;background-color: #e42417;height: 70rpx;box-sizing: border-box;"> style="border: 2rpx solid #e42417;background-color: #e42417;height: 70rpx;box-sizing: border-box;">
</view> </view>
</view> </view>
@ -68,7 +68,7 @@
this.flag = false; this.flag = false;
let params = { let params = {
title:this.title, title:this.title,
video:this.videoInfo.full_src video:this.videoInfo.src
} }
uni.showToast({ uni.showToast({
title:'正在上传练习视频', title:'正在上传练习视频',
@ -79,7 +79,7 @@
if(res.code==0){ if(res.code==0){
this.title = ''; this.title = '';
this.videoInfo.full_src = ''; this.videoInfo.full_src = '';
this.$toolAll.tools.showToast('上传练习视频成功'); this.$toolAll.tools.showToast('保存成功');
setTimeout(()=>{ setTimeout(()=>{
uni.navigateBack({delta:1}) uni.navigateBack({delta:1})
},1000) },1000)

View File

@ -3,7 +3,8 @@ export default {
token:'token已生成', token:'token已生成',
userInfo:{}, userInfo:{},
ifAutoplay:false ,// 组件轮播是否自动播放 ifAutoplay:false ,// 组件轮播是否自动播放
fristIn:false fristIn:false,//是否第一次进入
cartNum:0//购物车数量
}, },
// Vuex中store数据改变的唯一方法就是mutations 不适合异步方法 // Vuex中store数据改变的唯一方法就是mutations 不适合异步方法
mutations: { mutations: {
@ -14,5 +15,9 @@ export default {
setFristIn(state,str) { setFristIn(state,str) {
state.fristIn = str; state.fristIn = str;
}, },
// 设置购物车数量
setCartNum(state,str) {
state.cartNum = str;
},
} }
} }