对接订单系列接口
parent
bce9d1cf5e
commit
08ce9d2038
|
@ -0,0 +1,152 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="posAll bac5" v-if="ifMask">
|
||||
<view 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="disjbac pad-sx20">
|
||||
<view class="fon28 bold colb">优惠券</view>
|
||||
<view @tap="executeEv(0)" class="icon icon-del-white fon24" style="color: #b2b2b2;"></view>
|
||||
</view>
|
||||
<view class="fon20" style="color: #616161;">已选中推荐优惠,使用优惠券{{couponCount}}张,共抵扣<span class="col-e42417">¥{{$toolAll.tools.addXiaoShu(couponPrice)}}</span></view>
|
||||
</view>
|
||||
<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 class="disac">
|
||||
<view class="flexs bold col-e42417 dis pad-z20" style="min-width: 180rpx;color:#e42417;">
|
||||
<view class="">¥</view>
|
||||
<view class="fon66" style="margin-top: -10rpx;">{{item.amount}}</view>
|
||||
</view>
|
||||
<view class="width100 pad-zy20">
|
||||
<view class="line-h40">
|
||||
<view class="">{{item.name}}</view>
|
||||
<view class="fon20" style="color: #747474;" v-if="item.begin_at">有限期:{{item.begin_at.slice(0,10).split('-').join('.')}}-{{item.end_at.slice(0,10).split('-').join('.')}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="disjcac flexs mar-zy20" :class="item.ifcheck?'coupon-active':'coupon-mo'">
|
||||
<image src="/static/public/icon-choose.png" mode="" style="width: 18rpx;height: 18rpx;"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"custom-coupon",
|
||||
props:{
|
||||
currentPrice:{
|
||||
type:Number | String,
|
||||
default:0 | '0'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataList:[],
|
||||
ifMask:false,//控制蒙层
|
||||
ifAnimated:false,//控制白色弹框内容
|
||||
couponPrice:0,//选中优惠券金额
|
||||
couponId:'',//选中优惠券id
|
||||
couponCount:0,//选中优惠券数量
|
||||
couponIndex:0,//当前选中项
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getCoupon();
|
||||
},
|
||||
methods:{
|
||||
// 执行动画
|
||||
executeEv(index){
|
||||
if(index){
|
||||
if(this.couponId){
|
||||
this.$emit('confrimEv',{coupon_id:this.couponId,coupon_price:this.couponPrice});
|
||||
} else {
|
||||
this.$emit('confrimEv',{coupon_id:0,coupon_price:0});
|
||||
}
|
||||
} else {
|
||||
if(!this.$parent.couponInfo.coupon_id){
|
||||
this.setCoupon(false,this.couponIndex);
|
||||
}
|
||||
}
|
||||
this.ifAnimated=false;
|
||||
setTimeout(()=>{
|
||||
this.ifMask = false;
|
||||
},600)
|
||||
},
|
||||
// 查询是否选中
|
||||
checkChoose(){
|
||||
let exitIndex = this.dataList.findIndex(item=>item.coupon_id==this.couponId);
|
||||
if(exitIndex!=-1){
|
||||
this.dataList[exitIndex].ifcheck = true;
|
||||
this.setCoupon(true,exitIndex);
|
||||
}
|
||||
},
|
||||
// 存储优惠券的值
|
||||
setCoupon(flag,index){
|
||||
this.couponIndex = index;
|
||||
this.dataList[index].ifcheck = flag;
|
||||
this.couponPrice = flag?this.dataList[index].amount:0;//选中优惠券金额
|
||||
this.couponId = flag?this.dataList[index].coupon_id:'';//选中优惠券id
|
||||
this.couponCount = flag?1:0;//选中优惠券数量
|
||||
},
|
||||
// 选择优惠券
|
||||
chooseCoupon(id,index){
|
||||
if(this.currentPrice >= this.dataList[index].condition){
|
||||
if(this.dataList[index].ifcheck){
|
||||
this.setCoupon(false,index);
|
||||
} else {
|
||||
this.dataList.forEach(item=>{
|
||||
item.ifcheck = false;
|
||||
})
|
||||
this.setCoupon(true,index);
|
||||
}
|
||||
} else {
|
||||
this.$toolAll.tools.showToast('不满足使用条件');
|
||||
}
|
||||
},
|
||||
// 获取待使用优惠券列表
|
||||
getCoupon(){
|
||||
this.dataList = [];
|
||||
let params = {
|
||||
status:'normal',
|
||||
page:1,
|
||||
size:100
|
||||
}
|
||||
this.$requst.get('/api/user/coupon-list',params).then(res=>{
|
||||
if(res.code==0){
|
||||
if(res.data.list.length){
|
||||
res.data.list.forEach(item=>{
|
||||
let obj = {
|
||||
...item,
|
||||
ifcheck:false
|
||||
}
|
||||
this.dataList.push(obj);
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.coupon-mo,.coupon-active{
|
||||
border: 2rpx solid #c3c3c3;
|
||||
width: 29rpx;
|
||||
height: 29rpx;
|
||||
border-radius: 100%;
|
||||
}
|
||||
.coupon-active{
|
||||
border-color: #f37617;
|
||||
background-color: #f37617;
|
||||
}
|
||||
</style>
|
|
@ -39,6 +39,7 @@ const checkError = (e) => {
|
|||
flag = false;
|
||||
switch (Number(e.data.code)) {
|
||||
case 500:
|
||||
case 4000:// 参数错误
|
||||
case 4003:// 参数错误
|
||||
case 4004:// 记录不存在
|
||||
case 5000:// xxx错误
|
||||
|
@ -50,7 +51,7 @@ const checkError = (e) => {
|
|||
icon:'none'
|
||||
})
|
||||
if(Number(e.data.code)==5050){
|
||||
// 调用到登录页
|
||||
// 跳转到登录页
|
||||
setTimeout(()=>{
|
||||
goLogin();
|
||||
},1000)
|
||||
|
|
|
@ -79,12 +79,12 @@
|
|||
if(this.dataList.length){
|
||||
// 设置分类id
|
||||
this.classId = this.dataList[0].id;
|
||||
// 调用获取商品产品列表
|
||||
// 调用获取课程列表
|
||||
this.getCourseList();
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取商品产品列表
|
||||
// 获取课程列表
|
||||
getCourseList(){
|
||||
let params = {
|
||||
category_id:this.classId,
|
||||
|
@ -97,7 +97,7 @@
|
|||
// 设置总数
|
||||
this.total = res.data.total;
|
||||
if(this.page==1){this.$refs.refcourse.list=[];}
|
||||
// 设置产品列表
|
||||
// 设置课程列表
|
||||
this.$refs.refcourse.list = [...this.$refs.refcourse.list,...res.data.list];
|
||||
if(this.total==this.$refs.refcourse.list.length && this.page!=1){
|
||||
this.noMore = true;
|
||||
|
@ -108,7 +108,7 @@
|
|||
// 去课程详情
|
||||
goDetail(id){
|
||||
uni.navigateTo({
|
||||
url:`/pagesB/course-detail/course-detail?id=${id}&category_id=${this.classId}`
|
||||
url:`/pagesB/course-detail/course-detail?id=${id}`
|
||||
})
|
||||
},
|
||||
}
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
<view class="pad-zy20 mar-s30">
|
||||
<view class="bacf radius12 pad-sx20 fon24 mar-x20" v-for="(item,index) in dataList" :key="index">
|
||||
<view class="disac">
|
||||
<view class="flexs col-e42417 dis pad-z20" style="min-width: 180rpx;" :style="{color:current!=0?'#c0c0c0':'#e42417'}">
|
||||
<view class="flexs bold col-e42417 dis pad-z20" style="min-width: 180rpx;" :style="{color:current!=0?'#c0c0c0':'#e42417'}">
|
||||
<view class="">¥</view>
|
||||
<view class="fon66 bold">{{item.price}}</view>
|
||||
<view class="fon66" style="margin-top: -10rpx;">{{item.amount}}</view>
|
||||
</view>
|
||||
<view class="width100 pad-zy20 posir">
|
||||
<view class="disjbac" style="border-bottom: 2rpx dashed #e4e4e4;">
|
||||
<view class="line-h40 pad-x10">
|
||||
<view class="">{{item.title}}</view>
|
||||
<view class="fon20" style="color: #747474;">有限期:{{item.time}}</view>
|
||||
<view class="disjbac">
|
||||
<view class="line-h40">
|
||||
<view class="">{{item.name}}</view>
|
||||
<view class="fon20" style="color: #747474;" v-if="item.begin_at">有限期:{{item.begin_at.slice(0,10).split('-').join('.')}}-{{item.end_at.slice(0,10).split('-').join('.')}}</view>
|
||||
</view>
|
||||
<view class="flexs mar-z20 radius26 colf disjcac" style="width: 124rpx;height: 52rpx;" :style="{backgroundColor:current!=0?'#c0c0c0':'#f37717'}">去使用</view>
|
||||
</view>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<view @tap="lookDetail(index)" class="icon icon-return fon20 mar-z10" :class="item.show?'isshow':'noshow'"></view>
|
||||
</view> -->
|
||||
<!-- 图标 -->
|
||||
<view class="posia" v-if="current!=0" style="position: absolute;right: 120rpx;top: 60rpx;">
|
||||
<view class="posia" v-if="current!=0" style="position: absolute;right: 120rpx;top: 0rpx;">
|
||||
<image v-if="current==1" src="/static/tabbar/icon-used.png" style="width: 90rpx;height: 86rpx;" mode="" lazy-load></image>
|
||||
<image v-if="current==2" src="/static/tabbar/icon-overduce.png" style="width: 90rpx;height: 86rpx;" mode="" lazy-load></image>
|
||||
</view>
|
||||
|
@ -67,10 +67,10 @@
|
|||
{title:'已过期'}
|
||||
],
|
||||
dataList:[
|
||||
{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},
|
||||
{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},
|
||||
// {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,
|
||||
|
@ -91,6 +91,7 @@
|
|||
methods: {
|
||||
// tab点击事件
|
||||
clickTab(index){
|
||||
this.dataList = [];
|
||||
this.current = index;
|
||||
this.status = ['normal','used','invalid'][this.current];
|
||||
this.page = 1;
|
||||
|
@ -120,12 +121,12 @@
|
|||
}
|
||||
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;
|
||||
// }
|
||||
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;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -134,9 +135,6 @@
|
|||
</script>
|
||||
|
||||
<style>
|
||||
.used-item{
|
||||
border-top: 2rpx solid ;
|
||||
}
|
||||
.noshow{transform: rotate(-90deg);transition: all .3s linear;}
|
||||
.isshow{transform: rotate(90deg);transition: all .3s linear;}
|
||||
</style>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="pad-sx30 fon24 pad-zy10 disjbac bbot mar-x30" @tap="chooseEv(6)">
|
||||
<!-- <view class="pad-sx30 fon24 pad-zy10 disjbac bbot mar-x30"> -->
|
||||
<view class="col26">联系电话</view>
|
||||
<view class="disac">
|
||||
<view class="">{{phone || '未填写'}}</view>
|
||||
|
@ -74,15 +75,34 @@
|
|||
this.$refs.refFrame.tempText = JSON.parse(JSON.stringify(this.phone || ''));
|
||||
}
|
||||
},
|
||||
|
||||
//确认修改
|
||||
returnEv(obj){
|
||||
if(this.showType==5){
|
||||
if(this.realName!=obj.content){
|
||||
// 如果修改后的跟修改前的不一样
|
||||
this.setData('real_name',obj.content);
|
||||
}
|
||||
this.realName = obj.content;
|
||||
}
|
||||
if(this.showType==6){
|
||||
if(this.phone!=obj.content){
|
||||
// 如果修改后的跟修改前的不一样
|
||||
this.setData('mobile',obj.content);
|
||||
}
|
||||
this.phone = obj.content;
|
||||
}
|
||||
},
|
||||
// 执行修改事件
|
||||
setData(field,value){
|
||||
let params = {
|
||||
field,
|
||||
value
|
||||
}
|
||||
this.$requst.post('/api/user/update-info',params).then(res=>{
|
||||
if(res.code==0){
|
||||
this.$toolAll.tools.showToast('修改成功');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<view slot="content" style="padding-bottom: 0;">
|
||||
<view class="posi-sticky boxshow2" :style="{top:newtop+'px'}" style="margin-top: -20rpx;">
|
||||
<view class="bbot disjbac pad-zy40 pad-sx30">
|
||||
<view class="fon26">积分:6548</view>
|
||||
<view class="fon26">积分:{{allScore}}</view>
|
||||
<view class="disac pad-zy12 pad-sx8 radius6" @tap="$toolAll.tools.goPage('/pagesA/my-sign/my-sign')" style="border: 2rpx solid #adadad;">
|
||||
<image src="/static/tabbar/icon-score-rili.png" mode="" style="width: 24rpx;height: 24rpx;" lazy-load></image>
|
||||
<view class="fon24 mar-z10" style="color: #adadad;">签到</view>
|
||||
|
@ -15,10 +15,10 @@
|
|||
<view class="mar-s30 bacf pad-zy40 pad-sx20 boxshow2" v-if="total">
|
||||
<view class="pad-sx20 col26 bbot" v-for="(item,index) in dataList" :key="index">
|
||||
<view class="fon26 disjbac">
|
||||
<view class="">{{item.title}}</view>
|
||||
<view class="col-e42417">{{item.price}}</view>
|
||||
<view class="">{{item.name}}</view>
|
||||
<view class="col-e42417"><span v-if="item.num>0">+</span>{{item.num}}</view>
|
||||
</view>
|
||||
<view class="fon20" style="color: #8b8b8b;">{{item.time}}</view>
|
||||
<view class="fon20" style="color: #8b8b8b;">{{item.created_at}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pad-zy20" v-if="noMore">
|
||||
|
@ -40,6 +40,7 @@
|
|||
data() {
|
||||
return {
|
||||
newtop:uni.getSystemInfoSync().statusBarHeight + 42,
|
||||
allScore:uni.getStorageSync('userInfo').score,
|
||||
current:0,
|
||||
tabList:[
|
||||
{title:'全部'},
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<view class="posi-sticky" :style="{top:newtop+'px'}">
|
||||
<swiper-tab id="tab" :list="dataList" v-model="current" @changeEv="clickTab" :itemColor="'#e42417'" :lineColor="'#e42417'"></swiper-tab>
|
||||
</view>
|
||||
<view class="bacf mar-s20 pad-x20">
|
||||
<view @tap="$toolAll.tools.goPage(`/pagesB/order-detail/order-detail?id=${0}`)" class="bbot disac pad30 col26" v-for="(item,index) in orderList" :key="index">
|
||||
<view class="bacf mar-s20 pad-x20" v-if="orderList.length">
|
||||
<view @tap="getOrderDetail(item.id)" class="bbot disac pad30 col26" v-for="(item,index) in orderList" :key="index">
|
||||
<image class="flexs mar-y20" :src="item.skus[0].spu_cover" style="width: 192rpx;height: 134rpx;" mode="aspectFill" lazy-load></image>
|
||||
<view class="fon24 width100 disjbac fc" style="height: 134rpx;">
|
||||
<view class="dis width100">
|
||||
|
@ -15,9 +15,12 @@
|
|||
</view>
|
||||
<view class="disjbac width100">
|
||||
<view class="">实付:¥{{item.skus[0].price}}</view>
|
||||
<view v-if="item.status=='paid'" @tap.stop="clickBtn(index)" class="fon22 radius26 disjcac" style="background-color:#f37717;border: 2rpx solid #f37717;color: #FFFFFF;width: 134rpx;height: 50rpx;">去付款</view>
|
||||
<!-- <view @tap.stop="clickBtn(index)" class="fon22 radius26 disjcac" :style="{backgroundColor:['#FFFFF','#f37717','#FFFFF'][index],color:['#f37717','#FFFFFF','#969696'][index],borderColor:['#f37717','#f37717','#c9c9c9'][index]}" style="border: 2rpx solid #f37717;color: #f37717;width: 134rpx;height: 50rpx;">{{['确认收货','去付款','查看物流'][index]}}</view>
|
||||
<view @tap.stop="clickBtn(index)" class="fon22 radius26 disjcac" :style="{backgroundColor:['#FFFFF','#f37717','#FFFFF'][index],color:['#f37717','#FFFFFF','#969696'][index],borderColor:['#f37717','#f37717','#c9c9c9'][index]}" style="border: 2rpx solid #f37717;color: #f37717;width: 134rpx;height: 50rpx;">{{['确认收货','去付款','查看物流'][index]}}</view> -->
|
||||
<view class="disac">
|
||||
<view v-if="item.status=='waiting'" @tap.stop="goPay(index)" class="fon22 radius26 disjcac" style="background-color:#f37717;border: 2rpx solid #f37717;color: #FFFFFF;width: 134rpx;height: 50rpx;">去付款</view>
|
||||
<!-- <view v-if="item.status!='waiting' && item.status!='completed'" @tap.stop="clickBtn(index)" class="fon22 radius26 disjcac" style="border: 2rpx solid #c9c9c9;color: #969696;width: 134rpx;height: 50rpx;">查看物流</view> -->
|
||||
<view v-if="item.status=='shipped'" @tap.stop="clickBtn(index)" class="fon22 radius26 disjcac" style="border: 2rpx solid #c9c9c9;color: #969696;width: 134rpx;height: 50rpx;">查看物流</view>
|
||||
<view v-if="item.status=='paid' || item.status=='shipped'" @tap.stop="confirmReceipt(item.id)" class="fon22 radius26 disjcac mar-z10" style="border: 2rpx solid #f37717;color: #f37717;border-color:#f37717;width: 134rpx;height: 50rpx;">确认收货</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -50,18 +53,21 @@
|
|||
],
|
||||
showType:-1,
|
||||
tipsTitle:'提示信息',
|
||||
dynamicText:{
|
||||
content:''
|
||||
},
|
||||
page:1,
|
||||
size:20,
|
||||
tag:'',
|
||||
total:0,
|
||||
noMore:false,
|
||||
orderList:[]
|
||||
orderList:[],
|
||||
flag:true
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
onShow() {
|
||||
uni.removeStorageSync('orderDetail');
|
||||
this.getOrderList();
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
onReachBottom() {
|
||||
if(this.total!=this.orderList.length){
|
||||
|
@ -73,6 +79,11 @@
|
|||
// tab点击事件
|
||||
clickTab(index){
|
||||
this.current = index;
|
||||
this.page = 1;
|
||||
this.orderList = [];
|
||||
this.noMore = false;
|
||||
this.tag = ['','waiting','accept','completed'][this.current];
|
||||
this.getOrderList();
|
||||
},
|
||||
// 按钮点击
|
||||
clickBtn(index){
|
||||
|
@ -85,7 +96,8 @@
|
|||
getOrderList(){
|
||||
let params = {
|
||||
page:this.page,
|
||||
size:this.size
|
||||
size:this.size,
|
||||
tag:this.tag
|
||||
}
|
||||
if(this.page==1) this.orderList = [];
|
||||
this.$requst.get('/api/user/order',params).then(res=>{
|
||||
|
@ -97,6 +109,62 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取订单详情
|
||||
getOrderDetail(id){
|
||||
this.$toolAll.tools.goPage(`/pagesB/order-detail/order-detail?id=${id}`)
|
||||
},
|
||||
// 确认收货
|
||||
confirmReceipt(id){
|
||||
this.$requst.post('/api/order/accepted',{order_id:id}).then(res=>{
|
||||
if(res.code==0){
|
||||
this.clickBtn(0);
|
||||
this.getOrderList();
|
||||
}
|
||||
})
|
||||
},
|
||||
// 去支付
|
||||
goPay(index){
|
||||
if(this.flag){
|
||||
this.flag = false;
|
||||
this.$requst.post('/api/order/pay',{order_coding:this.orderList[index].coding}).then(res=>{
|
||||
if(res.code==0){
|
||||
let info = res.data;
|
||||
if(info.status!='completed'){
|
||||
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:this.orderList[index].coding}).then(res=>{
|
||||
if(res.code==0){
|
||||
this.clickBtn(1);
|
||||
this.getOrderList();
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
})
|
||||
},
|
||||
fail:()=> {
|
||||
this.$toolAll.tools.showToast('支付已取消o(╥﹏╥)o');
|
||||
},
|
||||
complete:()=> {
|
||||
this.flag = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$toolAll.tools.showToast('支付成功(*^▽^*)');
|
||||
setTimeout(()=>{
|
||||
uni.navigateTo({
|
||||
url:'/pagesA/my-order/my-order'
|
||||
})
|
||||
},1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,27 +45,8 @@
|
|||
return {
|
||||
statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
|
||||
newHeight:uni.getSystemInfoSync().screenHeight,
|
||||
dataList:[
|
||||
{price:10,time:'2022.07.23'},
|
||||
{price:10,time:'2022.07.23'},
|
||||
{price:10,time:'2022.07.23'},
|
||||
{price:10,time:'2022.07.23'},
|
||||
{price:10,time:'2022.07.23'},
|
||||
{price:10,time:'2022.07.23'},
|
||||
{price:10,time:'2022.07.23'},
|
||||
{price:10,time:'2022.07.23'},
|
||||
{price:10,time:'2022.07.23'},
|
||||
],
|
||||
signList:[
|
||||
{score:'+5',day:'7-11'},
|
||||
{score:'+5',day:'7-12'},
|
||||
{score:'+5',day:'7-13'},
|
||||
{score:'+5',day:'7-14'},
|
||||
{score:'+5',day:'7-15'},
|
||||
{score:'+5',day:'7-16'},
|
||||
{score:'+5',day:'7-17'},
|
||||
],
|
||||
sameDay:1,
|
||||
dataList:[],// 记录列表
|
||||
signList:[],// 日期列表
|
||||
signText:'签到',
|
||||
showType:4,
|
||||
page:1,
|
||||
|
|
|
@ -18,11 +18,12 @@
|
|||
<view class="">商品金额</view>
|
||||
<view class="">¥{{$toolAll.tools.addXiaoShu(courseInfo.original_total*1)}}</view>
|
||||
</view>
|
||||
<view class="disjbac mar-s30">
|
||||
<view @tap="chooseCoupon" class="disjbac mar-s30">
|
||||
<view class="">优惠券抵扣</view>
|
||||
<view class="disjbac col-e42417">-¥{{couponInfo.coupon_price}} <i class="icon icon-next fon20" style="color: #7f7f7f;"></i></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fon24 dis fe mar-s20">合计:<span class="col-e42417">{{realityPrice}}</span></view>
|
||||
</view>
|
||||
<view class="bacf mar-s30 disjbac fon24 pad-sx20 pad-zy30 boxshowb">
|
||||
<view class="">支付方式</view>
|
||||
|
@ -35,14 +36,19 @@
|
|||
</view>
|
||||
</view>
|
||||
</status-container>
|
||||
<view class="">
|
||||
|
||||
</view>
|
||||
<customCoupon ref="refCoupon" :currentPrice="courseInfo.original_total" @confrimEv="confrimEv"></customCoupon>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 底部组件
|
||||
import footTab from '@/components/foot-tabs/foot-tab.vue';
|
||||
import customCoupon from '@/components/custom-coupon.vue';
|
||||
export default {
|
||||
components:{'foot-tab' :footTab},
|
||||
components:{'foot-tab' :footTab,customCoupon},
|
||||
data() {
|
||||
return {
|
||||
courseInfo:'',
|
||||
|
@ -72,6 +78,17 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
// 调起优惠券弹框
|
||||
chooseCoupon(){
|
||||
this.$refs.refCoupon.couponId = this.couponInfo.coupon_id;
|
||||
this.$refs.refCoupon.checkChoose();
|
||||
this.$refs.refCoupon.ifMask = true;
|
||||
this.$refs.refCoupon.ifAnimated = true;
|
||||
},
|
||||
// 优惠券弹框确定事件
|
||||
confrimEv(obj){
|
||||
this.couponInfo = obj;
|
||||
},
|
||||
// 去支付
|
||||
goPay(){
|
||||
if(this.flag){
|
||||
|
|
|
@ -28,15 +28,15 @@
|
|||
<view class="bbot pad-sx30">
|
||||
<view class="disjbac">
|
||||
<view class="">商品金额</view>
|
||||
<view class="">¥{{$toolAll.tools.addXiaoShu(orderInfo.original_total*1)}}</view>
|
||||
<view class="pad-y30">¥{{$toolAll.tools.addXiaoShu(orderInfo.original_total*1)}}</view>
|
||||
</view>
|
||||
<view class="disjbac mar-s30">
|
||||
<!-- <view class="disjbac mar-s30">
|
||||
<view class="">优惠券抵扣</view>
|
||||
<view class="disjbac col-e42417">-¥{{couponInfo.coupon_price}} <view class="icon icon-next fon28 mar-z10" style="color: #777777;"></view></view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="disjbac mar-s30">
|
||||
<view class="">积分抵扣</view>
|
||||
<view class="disjbac col-e42417">-¥{{score}} <view class="icon icon-next fon28 mar-z10" style="color: #777777;"></view></view>
|
||||
<view class="disac col-e42417">-¥{{scorePrice}} <view class="icon icon-next fon28 mar-z10" style="color: #777777;"></view></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="disje pad-s30 pad-x10 pad-y30">
|
||||
|
@ -63,11 +63,12 @@
|
|||
addressInfo:'',
|
||||
orderInfo:'',
|
||||
flag:true,
|
||||
couponInfo:{
|
||||
coupon_id:'',//优惠券ID
|
||||
coupon_price:0//优惠券抵扣金额
|
||||
},
|
||||
score:0
|
||||
// couponInfo:{
|
||||
// coupon_id:'',//优惠券ID
|
||||
// coupon_price:0//优惠券抵扣金额
|
||||
// },
|
||||
score:0,
|
||||
scorePrice:0
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
|
@ -75,6 +76,7 @@
|
|||
},
|
||||
onLoad() {
|
||||
this.getAddress();
|
||||
this.scoreToPrice();
|
||||
},
|
||||
computed:{
|
||||
realityPrice(){
|
||||
|
@ -86,13 +88,21 @@
|
|||
})
|
||||
}
|
||||
// 商品金额减优惠券抵扣
|
||||
newPrice = this.$toolAll.tools.operationEv(newPrice,this.couponInfo.coupon_price,'-',2);
|
||||
// newPrice = this.$toolAll.tools.operationEv(newPrice,this.couponInfo.coupon_price,'-',2);
|
||||
// 商品金额减积分抵扣
|
||||
newPrice = this.$toolAll.tools.operationEv(newPrice,this.score,'-',2);
|
||||
return newPrice;
|
||||
newPrice = this.$toolAll.tools.operationEv(newPrice,this.scorePrice,'-',2);
|
||||
return newPrice<0?0:newPrice;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 积分转金额
|
||||
scoreToPrice(){
|
||||
this.$requst.post('/api/index/score2price',{score:this.score}).then(res=>{
|
||||
if(res.code==0){
|
||||
this.scorePrice = res.data.price;
|
||||
}
|
||||
})
|
||||
},
|
||||
// 收货地址查询
|
||||
getAddress(){
|
||||
this.$requst.get('/api/user/address').then(res=>{
|
||||
|
@ -120,42 +130,51 @@
|
|||
total:this.realityPrice,//实际付款金额 即:使用优惠券、积分抵扣等所有优惠后的金额(需加上运费)
|
||||
express_code:'',
|
||||
freight:0,//运费
|
||||
...this.couponInfo,
|
||||
// ...this.couponInfo,
|
||||
address_id:this.addressInfo.id,//地址ID
|
||||
type:'spu',//订单类型 spu=商品 course=课程
|
||||
score:0,//使用积分
|
||||
score_deduct_price:0//积分抵扣的金额
|
||||
score:this.score,//使用积分
|
||||
score_deduct_price:this.scorePrice//积分抵扣的金额
|
||||
}
|
||||
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);
|
||||
if(info.status!='completed'){
|
||||
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;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$toolAll.tools.showToast('支付成功(*^▽^*)');
|
||||
setTimeout(()=>{
|
||||
uni.navigateTo({
|
||||
url:'/pagesA/my-order/my-order'
|
||||
})
|
||||
},
|
||||
fail:()=> {
|
||||
this.$toolAll.tools.showToast('支付已取消o(╥﹏╥)o');
|
||||
},
|
||||
complete:()=> {
|
||||
this.flag = true;
|
||||
}
|
||||
});
|
||||
},1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<rich-text :nodes="couresDetail.content" style="color: #5a5a5a;"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="disjcac pad-sx40">
|
||||
<view class="disjcac pad-sx40" v-if="!couresDetail.is_buy">
|
||||
<view class="disjcac fon28 radius34"
|
||||
style="width: 290rpx;height: 68rpx;border: 2rpx solid #e42417;color: #e42417;"
|
||||
@tap="goBuy">立即购买</view>
|
||||
|
|
|
@ -1,58 +1,133 @@
|
|||
<template>
|
||||
<view>
|
||||
<status-container titlet="订单详情" returnc="#FFFFFF">
|
||||
<view slot="content" style="margin-top: -20rpx;">
|
||||
<view slot="content" style="margin-top: -20rpx;" v-if="orderDetail">
|
||||
<view class="bacf disjcac fc pad-sx40 boxshow2">
|
||||
<view class="fon28 mar-x20">待付款</view>
|
||||
<view class="fon26 radius30 disjcac" :style="{backgroundColor:['#FFFFF','#f37717','#FFFFF'][1],color:['#f37717','#FFFFFF','#969696'][1],borderColor:['#f37717','#f37717','#c9c9c9'][1]}" style="border: 2rpx solid #f37717;color: #f37717;width: 204rpx;height: 62rpx;">{{['确认收货','去付款','查看物流'][1]}}</view>
|
||||
<view v-if="orderDetail.status=='waiting'" class="fon28 mar-x20">待付款</view>
|
||||
<view v-if="orderDetail.status=='shipped' || orderDetail.status=='paid'" class="fon28 mar-x20">待收货</view>
|
||||
<view v-if="orderDetail.status=='completed'" class="fon28 mar-x20">已完成</view>
|
||||
<view @tap="goPay" v-if="orderDetail.status=='waiting'" class="fon26 radius30 disjcac" style="background-color:#f37717;border: 2rpx solid #f37717;color: #FFFFFF;width: 204rpx;height: 62rpx;">去付款</view>
|
||||
<view @tap="confirmReceipt(orderDetail.id)" v-if="orderDetail.status=='shipped' || orderDetail.status=='paid'" class="fon26 radius30 disjcac" style="border: 2rpx solid #f37717;color: #f37717;border-color:#f37717;width: 204rpx;height: 62rpx;">确认收货</view>
|
||||
</view>
|
||||
<view class="bacf mar-s20 pad-x20 boxshow2">
|
||||
<view @tap="$toolAll.tools.goPage(`/pagesB/order-detail/order-detail?id=${0}`)" class="bbot disac pad30 col26" v-for="(item,index) in 3" :key="index">
|
||||
<image class="flexs mar-y20" src="https://s6.jpg.cm/2022/02/14/L4oDhy.jpg" style="width: 192rpx;height: 134rpx;" mode="aspectFill" lazy-load></image>
|
||||
<view @tap="$toolAll.tools.goPage(`/pagesB/order-detail/order-detail?id=${0}`)" class="bbot disac pad30 col26" v-for="(item,index) in orderDetail.skus" :key="index">
|
||||
<image class="flexs mar-y20" :src="item.spu_cover" style="width: 192rpx;height: 134rpx;" mode="aspectFill" lazy-load></image>
|
||||
<view class="fon24 width100 disjbac fc" style="height: 134rpx;">
|
||||
<view class="dis width100">
|
||||
<view class="clips2">武术用品商品名称后用品商品名称后 台上传基础动作教学</view>
|
||||
<view class="mar-z50">x3</view>
|
||||
<view class="clips2 width100">{{item.spu_name}}</view>
|
||||
<view class="mar-z50 flexs">x{{item.num}}</view>
|
||||
</view>
|
||||
<view class="width100 disje">
|
||||
<view class="">实付:¥199.00</view>
|
||||
<view class="">实付:¥{{item.price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="col26 fon24 line-h46 pad-zy30 pad-sx20 bbot">
|
||||
<view class="">订单编号:<span style="color:#707070;">1234578454545</span></view>
|
||||
<view class="">下单时间:<span style="color:#707070;">2022.07.20 11:23:45</span></view>
|
||||
<view class="">支付时间:<span style="color:#707070;">2022.07.08 12:12:12</span></view>
|
||||
<view class="">快递公司:<span style="color:#707070;">京东快递</span></view>
|
||||
<view class="">快递单号:<span style="color:#707070;">JD120231651302</span></view>
|
||||
<view class="">订单编号:<span style="color:#707070;">{{orderDetail.coding}}</span></view>
|
||||
<view class="">下单时间:<span style="color:#707070;">{{orderDetail.created_at}}</span></view>
|
||||
<view class="">支付时间:<span style="color:#707070;">{{orderDetail.paid_at || '-'}}</span></view>
|
||||
<view class="">快递公司:<span style="color:#707070;">{{orderDetail.express_name || '-'}}</span></view>
|
||||
<view class="">快递单号:<span style="color:#707070;">{{orderDetail.express_number || '-'}}</span></view>
|
||||
</view>
|
||||
<view class="col26 fon24 line-h46 pad-zy30 pad-sx20 bbot">
|
||||
<view class="disjbac">订单总额<span class="colb">¥199.00</span></view>
|
||||
<view class="disjbac">运费<span class="colb">+¥0.00</span></view>
|
||||
<view class="disjbac">优惠券抵扣<span class="colb">-¥10.00</span></view>
|
||||
<view class="disjbac">积分抵扣<span class="colb">-¥15.00</span></view>
|
||||
<view class="disjbac">订单总额<span class="colb">¥{{orderDetail.original_price}}</span></view>
|
||||
<view class="disjbac">运费<span class="colb">+¥{{orderDetail.freight}}</span></view>
|
||||
<!-- <view class="disjbac">优惠券抵扣<span class="colb">-¥{{orderDetail.coupon_price}}</span></view> -->
|
||||
<view class="disjbac">积分抵扣<span class="colb" >-¥{{orderDetail.score_deduct_price}}</span></view>
|
||||
</view>
|
||||
<view class="col26 fon24 line-h46 pad-zy30 pad-s30 pad-x20">
|
||||
<view class="disjbac">实付金额<span class="colb">¥174.00</span></view>
|
||||
<view class="disjbac">实付金额<span class="colb">¥{{orderDetail.price}}</span></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</status-container>
|
||||
<dynamic-frame ref="refFrame" :showType="showType" :tipsTitle="tipsTitle"></dynamic-frame>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dynamicFrame from '@/components/dynamic-frame.vue';
|
||||
export default {
|
||||
components:{dynamicFrame},
|
||||
data() {
|
||||
return {
|
||||
|
||||
orderDetail:'',
|
||||
flag:true,
|
||||
showType:-1,
|
||||
tipsTitle:'提示信息',
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
onLoad(op) {
|
||||
this.getOrderDetail(op.id);
|
||||
},
|
||||
methods: {
|
||||
|
||||
// 按钮点击
|
||||
clickBtn(index){
|
||||
this.tipsTitle = index==2?'物流信息':'提示信息';
|
||||
this.showType = [2,3,1][index];
|
||||
this.$refs.refFrame.ifLogistics = true;
|
||||
this.$refs.refFrame.ifAnimated = true;
|
||||
},
|
||||
// 获取订单详情
|
||||
getOrderDetail(id){
|
||||
this.$requst.get('/api/user/order-detail',{id}).then(res=>{
|
||||
if(res.code==0){
|
||||
this.orderDetail = res.data;
|
||||
}
|
||||
})
|
||||
},
|
||||
// 确认收货
|
||||
confirmReceipt(id){
|
||||
this.$requst.post('/api/order/accepted',{order_id:id}).then(res=>{
|
||||
if(res.code==0){
|
||||
this.clickBtn(0);
|
||||
this.getOrderDetail(id);
|
||||
}
|
||||
})
|
||||
},
|
||||
// 去支付
|
||||
goPay(){
|
||||
if(this.flag){
|
||||
this.flag = false;
|
||||
this.$requst.post('/api/order/pay',{order_coding:this.orderDetail.coding}).then(res=>{
|
||||
if(res.code==0){
|
||||
let info = res.data;
|
||||
if(info.status!='completed'){
|
||||
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:this.orderDetail.coding}).then(res=>{
|
||||
if(res.code==0){
|
||||
this.clickBtn(1);
|
||||
this.getOrderDetail(this.orderDetail.id);
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
})
|
||||
},
|
||||
fail:()=> {
|
||||
this.$toolAll.tools.showToast('支付已取消o(╥﹏╥)o');
|
||||
},
|
||||
complete:()=> {
|
||||
this.flag = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$toolAll.tools.showToast('支付成功(*^▽^*)');
|
||||
setTimeout(()=>{
|
||||
uni.navigateTo({
|
||||
url:'/pagesA/my-order/my-order'
|
||||
})
|
||||
},1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -35,12 +35,12 @@
|
|||
<view class="posia-xzy" style="height: 6rpx;background-color: #e42417;bottom: -2rpx;"></view>
|
||||
</span>
|
||||
</view>
|
||||
<view class="rich-text fon24 mar-s30" style="line-height: 1.8;">
|
||||
<view class="rich-text fon24 mar-s30" style="line-height: 1.8;" v-if="ifDetail">
|
||||
<rich-text :nodes="richText" style="color: #5a5a5a;"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部按钮 -->
|
||||
<view class="posixzy bacf pad-zy30 disjbac pad-sx20">
|
||||
<view class="posixzy bacf pad-zy30 disjbac pad-sx20 boxshowt">
|
||||
<view class="fon30 bold col-e42417">¥{{shopInfo.price}}</view>
|
||||
<view class="disac fon24 colf">
|
||||
<view @tap="addCart" class="radius32 disjcac" style="background-color: #FFFFFF;color: #f37617;border: 2rpx solid #f37617; width: 184rpx;height: 64rpx;">加入购物车</view>
|
||||
|
@ -73,7 +73,8 @@
|
|||
moSpecList:[],//默认规格
|
||||
haveSpecList:[],//有这个规格商品
|
||||
isLoading:true,
|
||||
shopList:[]
|
||||
shopList:[],
|
||||
ifDetail:false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
|
@ -128,6 +129,8 @@
|
|||
// 商品规格
|
||||
this.$requst.get('/api/spu/spec',{id:this.shopId}).then(resspec=>{
|
||||
if(resspec.code==0){
|
||||
//
|
||||
this.ifDetail = true;
|
||||
// 所有规格列表
|
||||
this.specList = resspec.data.spec;
|
||||
// 默认规格
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 658 B |
Loading…
Reference in New Issue