Commit f1248476 authored by Mac's avatar Mac

修改

parent 12b84410
<template>
<u-popup
mode="bottom"
border-radius="20"
:popup="false"
v-model="show"
:maskCloseAble="true"
length="auto"
:safeAreaInsetBottom="true"
@close="popupClose"
:z-index="9999"
close-icon="cross"
:closeable="true"
>
<view class="course">
<view class="title">课程卡</view>
<view class="chosentips">请选择要使用的课程卡</view>
<view class="details">
<view class="item" v-for="(x, i) in ts" :key="i">
<view class="ticket">
<image mode="aspectFill" :src="x.coupon_data.couponIco" style="width: 100%; height: 100%;" ></image>
</view>
<view class="detail">
<view class="coupond">
<view class="name">{{x.coupon_data.name}}</view>
<view class="rule">{{x.coupon_data.rule}}</view>
<view class="date">{{x.start_time+"-"+x.end_time}}</view>
</view>
<view class="chosen">
<u-radio-group v-model="currentChosen" >
<u-radio
shape="circle"
:name="x.id"
:icon-size="36"
:active-color="mc"
></u-radio>
</u-radio-group>
</view>
</view>
</view>
</view>
<view class="btton-box">
<u-button
size="80"
:ripple="true"
shape="circle"
:custom-style="{
backgroundColor: mc,
height: '80rpx',
color: '#FFF',
fontSize: '14px',
margin: '0 3vw',
width: '90vw',
}"
@click="popupClose"
>确定</u-button
>
</view>
</view>
</u-popup>
</template>
<script>
export default {
props: ["list", "current"],
data() {
return {
mc: "",
show: true,
currentChosen: "",
ts:[]
};
},
mounted() {
this.mc = this.$uiConfig.mainColor;
this.currentChosen = this.current;
this.ts=this.list
this.ts.forEach(x=>{
x.start_time=x.start_time.split(' ')[0].replace(/-/g,'.')
x.end_time=x.end_time.split(' ')[0].replace(/-/g,'.')
})
},
methods: {
popupClose(){
if(this.currentChosen!=this.current){
this.$emit('close',this.currentChosen)
}else{
this.$emit('close',-1)
}
},
},
};
</script>
<style>
.course {
max-height: 70vh;
background: #f5f5f5;
padding-bottom: 50px;
text-align: left !important;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
overflow: scroll;
}
.course .title {
font-size: 22px;
color: #000;
padding: 20px;
background: #fff;
}
.course .chosentips {
padding: 12px 20px;
border-bottom: 1px solid #f5f5f5;
border-top: 1px solid #f5f5f5;
color: #777;
background: #fff;
font-size: 12px;
}
.course .details {
padding: 10px;
display: flex;
flex-direction: column;
}
.course .details .item {
display: flex;
margin-bottom: 10px;
align-items: flex-start;
background: #fff;
border-radius: 5px;
box-shadow:0 4px 6px 1px rgba(76, 76, 76, 0.1);
}
.course .details .item .ticket {
width: 104px;
height: 78px;
}
.course .details .item .detail {
width: 1px;
flex: 1;
background: #fff;
padding: 10px;
display: flex;
align-items: center;
}
.course .details .item .detail .coupond {
flex: 1;
}
.course .details .item .detail .coupond .name {
font-size: 13px;
font-weight: 600;
color: #000;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.course .details .item .detail .coupond .date {
margin-top: 5px;
font-size: 11px;
color: #777;
}
.course .details .item .detail .coupond .rule{
font-size: 11px;
color:#777;
margin-top: 5px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.course .details .item .detail .chosen {
width: 20px;
}
</style>
......@@ -56,43 +56,164 @@
<view class="discountbox">
<view class="filed">
<view class="left">优惠券</view>
<view class="right">
<view class="right" v-if='reduceType!=2'>
<text class="content" v-if="mchs[0].coupon.user_coupon_id == 0 && couponList.length>0" @click="showCouponHandler">选择优惠券</text>
<text class="content" v-else-if="couponList.length==0">暂无优惠券</text>
<text class="content" v-else :style="{ color: pricecolor }" @click="showCouponHandler">已优惠{{ mchs[0].coupon.coupon_discount }}</text>
<u-icon name="ellipsis" size="36" v-if="couponList.length > 0" @click="showCouponHandler"></u-icon>
</view>
<view v-else style="font-size: 11px;color: #999999;">不可使用</view>
</view>
<view class="filed" style="margin-top: 20px;" v-if="integral.can_use">
<view class="left">积分抵扣</view>
<view class="right">
<view class="right" v-if='reduceType!=2'>
<text class="content" :style="{ color: secondary }">{{ `使用${integral.use_num}积分抵扣${integral.deduction_price}元` }}</text>
<u-checkbox-group><u-checkbox v-model="userInt" :active-color="pricecolor" @change="changeUseInt" :icon-size="28" shape="circle"></u-checkbox></u-checkbox-group>
</view>
<view v-else style="font-size: 11px;color: #999999;">不可使用</view>
</view>
<view class="filed" style="margin-top: 20px;">
<view class="left">学习卡</view>
<view class="right">
<text class="content" v-if="mchs[0].coupon.user_coupon_id == 0 && couponList.length>0" @click="showCouponHandler">选择学习卡
<view class="right" v-if='reduceType!=1'>
<text class="content" v-if="mchs[0].education.use_education_id == 0 && courseList.length>0" @click="showCourseHandler">选择学习卡
</text>
<text class="content" v-else-if="couponList.length==0">暂无学习卡</text>
<text class="content" v-else :style="{ color: pricecolor }" @click="showCouponHandler">已优惠{{ mchs[0].coupon.coupon_discount }}</text>
<u-icon name="ellipsis" size="36" v-if="couponList.length > 0" @click="showCouponHandler"></u-icon>
<text class="content" v-else-if="courseList.length==0">暂无学习卡</text>
<text class="content" v-else :style="{ color: pricecolor }" @click="showCourseHandler">已优惠{{ mchs[0].education.education_money }}</text>
<u-icon name="ellipsis" size="36" v-if="courseList.length > 0" @click="showCourseHandler"></u-icon>
</view>
<view v-else style="font-size: 11px;color: #999999;">不可使用</view>
</view>
<view class="filed" style="margin-top: 20px;font-size: 12px;color: #999999;">
:优惠券(包括积分)和学习卡只能二选一
</view>
</view>
<view class="discountbox">
<view class="discountbox" style="margin-bottom: 20px;">
<view class="filed">
<view class="left">商品金额</view>
<view class="right">
<text class="price">{{ goodPrice.toFixed(2) }}</text>
</view>
</view>
<view class="filed" style="margin-top: 20px;" >
<view class="left">优惠</view>
<view class="right">
<text class="price" :style="{ color: pricecolor }">-{{ couponPrice.toFixed(2) }}</text>
</view>
</view>
<view class="filed" style="margin-top: 20px;" >
<view class="left">课程卡优惠</view>
<view class="right">
<text class="price" :style="{ color: pricecolor }">-{{ EducationMoney.toFixed(2) }}</text>
</view>
</view>
<view class="filed" v-if="integral.can_use " style="margin-top: 20px;">
<view class="left">积分抵扣</view>
<view class="right">
<text class="price" :style="{ color: pricecolor }">-{{ userInt ? integral.deduction_price.toFixed(2) : '0.00' }}</text>
</view>
</view>
</view>
<view class="btton-box">
<view class="left" :style="{ color: pricecolor }">
<text></text>
<text class="bold">{{ ds.total_price }}</text>
</view>
<view class="right">
<u-button
size="80"
:ripple="true"
shape="circle"
@click="ds.promptNoSuperiorFY== true ? submitModel():submitOrderHandler()"
:custom-style="{
backgroundColor: mc,
height: '80rpx',
color: '#FFF',
fontSize: '14px'
}"
>
<u-loading mode="circle" style="margin-right: 5px;" v-if="submitOrder"></u-loading>
{{btntext}}
</u-button>
</view>
</view>
<coupon v-if="couponList.length > 0 && showCoupon" :list="couponList" :current="formdata.User_Coupon_Id" @close="closeCouponHandler"></coupon>
<!-- 课程卡选择 -->
<course v-if="courseList.length > 0 && showCourse" :list="courseList" :current="formdata.Use_Education_Id" @close="closeCourseHandler"></course>
<view class="notOption" v-if="submitOrder"></view>
<payCom v-if="payBtn" :payInfo="payInfo" @closePay="closePay"></payCom>
<u-toast ref="uToast" />
<u-popup v-model="payExit" mode="center" :mask-close-able="false">
<view style="background:#fff;width:500rpx">
<view style="padding:10px 0 0 10px">提交失败</view>
<view style="text-align:center;padding-bottom:40rpx">
<view style="margin:80rpx 0">支付取消</view>
<span @click="exitPay" style="padding:10rpx 50rpx;color:#fff;background:#19be6b;border-radius: 12px;">确定</span>
</view>
</view>
</u-popup>
<u-popup v-model="zhaoren" mode="center" :mask-close-able="false">
<view style="background:#fff;width:500rpx;font-family: aa;border-radius: 10px;">
<view style="width: 88%;height: 35px;display: flex;flex-direction: row;align-items: flex-end;justify-content: flex-end;margin-left: 6%;" @click="exitPay">
<u-icon name="close" size="40"></u-icon>
</view>
<view style="padding:10px 0 0 10px;text-align:center;">代付金额</view>
<view style="text-align:center;padding-bottom:40rpx;">
<view class="daif" :style="{'color': mc}">
<text style="margin-bottom: 2px;">
</text>
<span :style="{'font-size': '30px','color': mc}">{{ds.total_price}}</span>
</view>
<u-button
size="30"
:ripple="true"
shape="circle"
open-type="share"
:custom-style="{
backgroundColor: mc,
width:'350rpx',
height: '80rpx',
color: '#FFF',
fontSize: '14px'
}"
>
发送给微信好友
</u-button>
</view>
</view>
</u-popup>
<u-modal
v-model="showReviceModal"
content="您的上级不存在,当前订单不会返佣,是否继续?"
:show-cancel-button="true"
:show-title="false"
@confirm="submitOrderHandler"
:border-radius="20"
></u-modal>
</view>
</template>
<script>
import payCom from '@/components/pay/pay';
import coupon from '@/components/coupon/index';
import course from '@/components/coupon/course';
export default {
components: {
coupon,
course,
payCom,
},
data() {
return{
DetailList:[],
pageTitle: '填写订单',
zhaoren:false,
zrName:'是好友就帮忙代付',
zrimg:'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/zhaoren.png',
formdata:{
DetailList:[],
Use_Integral:0,
......@@ -103,19 +224,40 @@
secondary:'',
pricecolor:'',
isLeave: false,
goodPrice: 0.0,
couponPrice: 0.0,
EducationMoney:0.0,
reduceType:0,//0为都没选1为选择优惠券和积分2为课程卡
integral: {
can_use: false,
use: false,
use_num: 0,
deduction_price: 0
},
payInfo: {
OpenId: 'ow_7I5XC1-RGwwk8QANBmWKYKmOc',
OrderId: '',
OrderPayType: 1,
GoodsName: ''
},
userInt:false,
mchs:{},
ds:{},
ds:{
total_price: '0.00'
},
checked:false,
payExit: false,
payBtn: false,
couponList:[],//优惠券的列表
schoolCPList:[],//学习卡列表
courseList:[],//学习卡列表
windowWidth:0,
btntext:'提交订单',
showCoupon: false,
showCourse:false,
submitOrder: false,
showReviceModal:false,
IsFormShoppingCart: 2,//是否来自购物车 1是2否
ShoppingCartIdList: [],
}
},
onLoad(option) {
......@@ -129,6 +271,7 @@
uni.setNavigationBarTitle({
title: this.pageTitle
});
this.payInfo.OpenId=uni.getStorageSync('mall_UserInfo').OpenId;
},
onShow() {
this.init();
......@@ -139,6 +282,90 @@
}
},
methods:{
onShareAppMessage() {
return {
title: this.zrName,
path: this.path,
imageUrl: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/zhaoren.png'
};
},
exitPay() {
this.payExit = false;
uni.redirectTo({
url: "/pages/order/index/index?status=0",
});
},
closePay() {
this.payBtn = false;
this.payExit = true;
},
submitModel(){
this.showReviceModal = true;
},
// 提交订单
submitOrderHandler(){
let that = this;
console.log('进入')
if (!this.submitOrder) {
this.submitOrder = true;
uni.requestSubscribeMessage({
tmplIds: this.ds.template_message_list,
complete(res) {
console.log(res)
that.submitOrder = false;
let form = {};
form.BuyerMessage = '';//留言
form.DetailList = that.formdata.DetailList;//课程列表
form.User_Coupon_Id = that.formdata.User_Coupon_Id;//使用优惠券id
form.CouponMoney = that.couponPrice;//优惠金额
form.Use_Education_Id = that.formdata.Use_Education_Id;//使用课程卡id
form.EducationMoney = that.EducationMoney;//课程卡抵扣金额
form.Income = that.ds.total_price;//实际付款金额
form.IsFormShoppingCart = that.IsFormShoppingCart;//来自购物车
form.Use_Integral = that.formdata.Use_Integral;//使用积分
form.ShoppingCartIdList = that.ShoppingCartIdList;//购物车id
form.AnchorName = uni.getStorageSync("AnchorName")?uni.getStorageSync("AnchorName").AnchorName:''; //直播名称
that.request2(
{
url: '/api/AppletOrder/SetAppletCourseOrderInfo',
data: form
},
res => {
if (res.resultCode == 1) {
if(that.checked==true){
that.zhaoren = true;
let u = uni.getStorageSync("mall_UserInfo");
let uid = u.UserId ? u.UserId : 0;
let Up = u.UserPageType ? u.UserPageType:0;
let SmallShopId = u.SmallShopId ? u.SmallShopId : 0;
if (SmallShopId == 0) {
//如果微店id为0 去找所属微店id
SmallShopId = u.UserSmallShopId ? u.UserSmallShopId : 0;
}
//TODO 需要看跳转哪里
that.path = '/pages/index/index?OrderId=' + res.data.OrderId + "&user_id=" + uid+ "&Up=" + Up+ "&SmallShopId=" + SmallShopId+'&JumpType=5' ;
}else{
that.payBtn = true;
that.payInfo.OrderId = res.data.OrderId;
that.payInfo.total_price = that.ds.total_price;
}
}
else{
that.$refs.uToast.show({
title: res.data.message,
type: 'warning'
});
}
uni.hideNavigationBarLoading();
}
);
}
});
}
},
init(){
this.request2(
{
......@@ -149,13 +376,25 @@
this.loading = false;
if (res.resultCode == 1) {
this.mchs = res.data.mch_list;
this.payInfo.GoodsName = this.mchs[0].goods_list[0].name.slice(0,10);
this.ds = res.data;
this.goodPrice = 0.0;
this.couponPrice = 0.0;
this.EducationMoney=0.0;
this.mchs.forEach(x=>{
x.goods_list.forEach(j=>{
j.marketingLogo = JSON.parse(j.marketingLogo)
})
})
this.integral = {
can_use: false,
use: false,
use_num: 0,
deduction_price: 0
};
if(res.data.total_price<0){
this.ds.total_price =0
}
this.formatPrice()
......@@ -169,6 +408,9 @@
},
formatPrice(){
this.mchs.forEach(x => {
this.goodPrice += parseFloat(x.total_goods_price);
this.couponPrice += parseFloat(x.coupon.coupon_discount || 0.0);
this.EducationMoney += parseFloat(x.education.education_money || 0.0);
if (x.integral.can_use) {
this.integral.can_use = true;
this.integral.use = false;
......@@ -232,22 +474,51 @@
},
res => {
if (res.resultCode == 1) {
this.schoolCPList = res.data;
this.courseList = res.data;
}
}
);
},
closeCouponHandler(e) {
if (e != -1) {
this.formdata.User_Coupon_Id = e;
this.init();
}
this.showCoupon = false;
this.reduceType=1;
},
closeCourseHandler(e){//选择课程卡的返回
if (e != -1) {
this.formdata.Use_Education_Id = e;
this.init();
}
this.showCourse = false;
this.reduceType=2;
},
showCouponHandler() {
this.showCoupon = true;
},
showCourseHandler(){
this.showCourse = true;
},
changeUseInt(e) {
this.userInt = e.value;
this.formdata.Use_Integral = this.userInt ? 1 : 0;
this.init();
if(this.userInt==true){
this.reduceType=1;
}else{
this.reduceType=0;
}
},
checkboxChange(val){
// if(val.value==true){
// this.btntext = '找人代付'
// }else{
// this.btntext = '提交订单'
// }
if(val.value==true){
this.btntext = '找人代付'
}else{
this.btntext = '提交订单'
}
},
}
}
......@@ -366,4 +637,38 @@
margin-top: 3px;
margin-left: 2px;
}
.coursesubmit .btton-box {
height: 50px;
display: flex;
padding: 5px 10px;
border-top: 1px solid #f5f5f5;
position: fixed;
bottom: 0;
left: 0;
right: 0;
align-items: center;
background: #fff;
z-index: 3;
}
.coursesubmit .btton-box .left {
font-size: 16px;
flex: 1;
font-family: 'oswald';
}
.coursesubmit .btton-box .left .bold {
font-size: 24px;
}
.coursesubmit .btton-box .right {
width: 120px;
}
.coursesubmit .notOption {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: transparent;
z-index: 2;
}
</style>
......@@ -82,7 +82,7 @@
coupon_id: 0,
msg: {
pageIndex: 1,
pageSize: 14,
pageSize: 10,
Name: '',
GoodsType: 0,
CategoryIds: '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment