优惠券
This commit is contained in:
255
components/orderCoupon.vue
Normal file
255
components/orderCoupon.vue
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<!-- 优惠券弹出 -->
|
||||||
|
<u-popup :show="youhuiShow" :round="10" @close="closePup">
|
||||||
|
<view class="tanchu">
|
||||||
|
<view class="dp_title">请选择优惠券</view>
|
||||||
|
<view v-if="list.length > 0">
|
||||||
|
<view style="max-height: 40vh;overflow-y: scroll;" :class="youhuiIndex === index ? 'youhuiItem youItem_style' : 'youhuiItem'"
|
||||||
|
v-for="(item,index) in list" :key="index" @click="choseYouhui(index)">
|
||||||
|
<view style="width: 25%;color:#fd6004;text-align: center;">
|
||||||
|
<text>¥</text>
|
||||||
|
<b style="font-size: 45rpx;">{{item.couponEntity.couponAmount}}</b>
|
||||||
|
<text
|
||||||
|
style="display: block;color: #666;font-size: 25rpx;margin-top: 10rpx;">满{{item.couponEntity.useLevel}}元可用</text>
|
||||||
|
</view>
|
||||||
|
<view style="width: 68%;padding-left: 5%;">
|
||||||
|
<view>
|
||||||
|
<text style="display: inline-block; margin-right: 6rpx;">{{item.couponEntity.couponName}}</text>
|
||||||
|
<text class="border_radius_10" style="font-size: 24rpx; background-color: #fad4bd; color: #666;">{{item.couponEntity.couponRange | couponType}}</text>
|
||||||
|
</view>
|
||||||
|
<text
|
||||||
|
style="display: block;font-size: 20rpx;color: #999;margin-top: 10rpx;">到期时间:{{item.effectType == 0 ? '永久有效' : item.endTime}}</text>
|
||||||
|
<text
|
||||||
|
style="display: block;font-size: 20rpx;color: #999;margin-top: 4rpx;">说明:{{item.couponEntity.remark}}</text>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view style="width: 7%;">
|
||||||
|
<view class="" style="background-color: #d9d9d9; border-radius: 10rpx; 0 0 10rpx; text-align: center;" v-if="sumMeony < item.couponEntity.useLevel">
|
||||||
|
<text
|
||||||
|
style="color: #999; "
|
||||||
|
>不可用</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<text
|
||||||
|
style="border: 1px solid #d9d9d9;width: 35rpx;height:35rpx;display:inline-block;border-radius: 30rpx;"
|
||||||
|
v-if="youhuiIndex !== index"></text>
|
||||||
|
|
||||||
|
<u-icon name="checkmark-circle-fill" color="#fd6004" size="20" v-if="youhuiIndex === index">
|
||||||
|
</u-icon>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<br clear="both">
|
||||||
|
</view>
|
||||||
|
<view class="btnBox flex_box flex_between">
|
||||||
|
<view class="" style="width: 48%;">
|
||||||
|
<button type="default" @click="confirmCoupon('none')">不使用优惠券</button>
|
||||||
|
</view>
|
||||||
|
<view class="" style="width: 48%;">
|
||||||
|
<button type="primary" @click="confirmCoupon()">选好了</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> -->
|
||||||
|
</view>
|
||||||
|
<view class="" v-else>
|
||||||
|
<u-divider text="暂无可用优惠券哦"></u-divider>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "orderCoupon",
|
||||||
|
props: ['list', 'curCouponId','sumMeony'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
youhuiShow: true,
|
||||||
|
youhuiIndex: undefined
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
console.log('进入了', this.curCouponId, this.sumMeony);
|
||||||
|
if (this.curCouponId) {
|
||||||
|
this.youhuiIndex = this.list.findIndex(item => item.couponEntity.id === this.curCouponId);
|
||||||
|
console.log('查找后的结果', this.youhuiIndex);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
filters:{
|
||||||
|
couponType(type){
|
||||||
|
// 0无限制 1课程卷 2课程品类卷
|
||||||
|
var str = ''
|
||||||
|
switch (type){
|
||||||
|
case 0:
|
||||||
|
str = '全场通用'
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
str = '指定课程可用'
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
str = '指定课程品类可用'
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
closePup() {
|
||||||
|
this.youhuiIndex = undefined
|
||||||
|
this.$emit('close')
|
||||||
|
},
|
||||||
|
// 确定选中优惠券
|
||||||
|
confirmCoupon(str) {
|
||||||
|
console.log(str, '6666');
|
||||||
|
if (str && str == 'none') {
|
||||||
|
// 清空优惠券操作
|
||||||
|
this.$emit('confirmCoupon')
|
||||||
|
setTimeout(() => {
|
||||||
|
this.closePup()
|
||||||
|
}, 300)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.youhuiIndex == 0 || this.youhuiIndex) {
|
||||||
|
this.$emit('confirmCoupon', this.list[this.youhuiIndex])
|
||||||
|
setTimeout(() => {
|
||||||
|
this.closePup()
|
||||||
|
}, 300)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请选择您要使用的优惠券',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 选择优惠券
|
||||||
|
choseYouhui(e) {
|
||||||
|
if(this.list[e].couponEntity.useLevel > this.sumMeony ){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('选中优惠券e', e);
|
||||||
|
this.youhuiIndex = e
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.btnBox {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tanchu {
|
||||||
|
padding: 40rpx 30rpx 40rpx 30rpx;
|
||||||
|
position: relative;
|
||||||
|
// max-height: 60vh;
|
||||||
|
// overflow-y: scroll;
|
||||||
|
|
||||||
|
.dp_title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
margin-bottom: 50rpx;
|
||||||
|
color: #555;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dp_add {
|
||||||
|
position: absolute;
|
||||||
|
top: 40rpx;
|
||||||
|
right: 30rpx;
|
||||||
|
font-size: 22rpx;
|
||||||
|
background-color: #fd6004;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
padding: 5rpx 10rpx;
|
||||||
|
|
||||||
|
.u-icon {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 5rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.addressItem {
|
||||||
|
border: 2px dashed #d9d9d9;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
padding: 20rpx 10rpx;
|
||||||
|
margin: 25rpx 0 0 0;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.addrContent {
|
||||||
|
margin-left: 40rpx;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.addrContentTop {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
margin: 0 0 15rpx 0;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.userName {
|
||||||
|
font-size: 35rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userTel {
|
||||||
|
font-size: 25rpx;
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userMoren {
|
||||||
|
border: 1px solid #fd6004;
|
||||||
|
color: #fd6004;
|
||||||
|
padding: 3rpx 10rpx;
|
||||||
|
font-size: 22rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
margin: 0 0 0 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.chooseCheck {
|
||||||
|
position: absolute;
|
||||||
|
top: 3rpx;
|
||||||
|
right: 6rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.addrContentBottom {
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.addressItem.addItem_style {
|
||||||
|
border-color: #fd6004;
|
||||||
|
}
|
||||||
|
|
||||||
|
.youhuiItem {
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
padding: 20rpx 10rpx;
|
||||||
|
margin: 25rpx 0 0 0;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #fff;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.youhuiItem>view {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.youhuiItem.youItem_style {
|
||||||
|
border-color: #fd6004;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -741,6 +741,13 @@
|
|||||||
{
|
{
|
||||||
"navigationBarTitleText" : "我的证书"
|
"navigationBarTitleText" : "我的证书"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/mine/wallet/couponList",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "用户优惠券列表"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
@@ -215,8 +215,14 @@
|
|||||||
<span style="color: #666; margin-right: 10rpx; float: left"
|
<span style="color: #666; margin-right: 10rpx; float: left"
|
||||||
>运费 :
|
>运费 :
|
||||||
</span>
|
</span>
|
||||||
<span>¥</span>{{ orderContet.shippingMoney }}
|
<span>¥</span>{{ orderContet.shippingMoney }}
|
||||||
</view>
|
</view>
|
||||||
|
<view class="orderReal" v-if="orderContet.couponId && orderContet.couponId != null">
|
||||||
|
<span style="color: #666; margin-right: 10rpx; float: left"
|
||||||
|
>优惠券 :
|
||||||
|
</span>
|
||||||
|
<span>- ¥</span>{{ orderContet.couponAmount }}
|
||||||
|
</view>
|
||||||
<view class="orderReal" v-if="orderContet.orderType == 'order'">
|
<view class="orderReal" v-if="orderContet.orderType == 'order'">
|
||||||
<span style="color: #666; margin-right: 10rpx; float: left"
|
<span style="color: #666; margin-right: 10rpx; float: left"
|
||||||
>积分 :
|
>积分 :
|
||||||
@@ -888,11 +894,33 @@ export default {
|
|||||||
orderTabCLi(e) {
|
orderTabCLi(e) {
|
||||||
this.orderListTab = e;
|
this.orderListTab = e;
|
||||||
},
|
},
|
||||||
|
async getCouponDetail(id){
|
||||||
|
await this.$http
|
||||||
|
.request({
|
||||||
|
url: "common/coupon/getCouponHistoryInfo",
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data: {
|
||||||
|
id
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
//默认 无 说明:请求头
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(async (res) => {
|
||||||
|
if(res.code != 0) return this.$commonJS.showToast(res.errMsg);
|
||||||
|
this.orderContet.couponAmount = res.couponHistory.couponEntity.couponAmount
|
||||||
|
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e);
|
||||||
|
this.$commonJS.showToast(e.errMsg);
|
||||||
|
})
|
||||||
|
},
|
||||||
// 获取订单详情
|
// 获取订单详情
|
||||||
getOrderList() {
|
async getOrderList() {
|
||||||
console.log("this.orderType", this.orderType);
|
console.log("this.orderType", this.orderType);
|
||||||
|
|
||||||
this.$http
|
await this.$http
|
||||||
.request({
|
.request({
|
||||||
url: "common/buyOrder/commonOrderDetail",
|
url: "common/buyOrder/commonOrderDetail",
|
||||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
@@ -904,12 +932,16 @@ export default {
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
this.customButton = [];
|
this.customButton = [];
|
||||||
console.log("订单详情", res);
|
console.log("订单详情", res);
|
||||||
this.orderContet = res.data.buyOrder;
|
this.orderContet = res.data.buyOrder;
|
||||||
this.goodsList = res.data.productInfo;
|
this.goodsList = res.data.productInfo;
|
||||||
this.consigneeShow = true;
|
this.consigneeShow = true;
|
||||||
|
// 存在优惠券信息,就查询优惠券集体金额
|
||||||
|
if(this.orderContet.couponId && this.orderContet.couponId != null){
|
||||||
|
await this.getCouponDetail(this.orderContet.couponId)
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
this.orderContet.orderStatus == 2 &&
|
this.orderContet.orderStatus == 2 &&
|
||||||
this.sheetList.length > 0 &&
|
this.sheetList.length > 0 &&
|
||||||
|
|||||||
@@ -133,7 +133,7 @@
|
|||||||
<u-icon v-if="v.icon" name="map-fill" color="#018F89" size="23"
|
<u-icon v-if="v.icon" name="map-fill" color="#018F89" size="23"
|
||||||
style="display: inline-block"></u-icon>
|
style="display: inline-block"></u-icon>
|
||||||
|
|
||||||
<text> {{ v.text }}</text><template v-if="v.type == 3">
|
<text> {{ v.text }}</text><template v-if="v.type == 4">
|
||||||
<text style="color: #aaa; margin-left: 10rpx">
|
<text style="color: #aaa; margin-left: 10rpx">
|
||||||
(全部积分:{{ initData.user.jf }})</text>
|
(全部积分:{{ initData.user.jf }})</text>
|
||||||
</template>
|
</template>
|
||||||
@@ -147,12 +147,29 @@
|
|||||||
}}</text>
|
}}</text>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="v.type == 3">
|
<template v-if="v.type == 3">
|
||||||
|
<template v-if="!curCoupon.id">
|
||||||
|
<template v-if="couponHistoryList.length > 0">
|
||||||
|
<text style="color: #999" @click="showCouponPup = true">可用({{couponHistoryList.length}})张</text>
|
||||||
|
<text @click="showCouponPup = true" style="display: inline-block; margin-left: 20rpx; background-color: #fe6035; color: #fff; border-radius: 30rpx;font-size: 26rpx; border: 4rpx #fe6035 solid; ">选择优惠券</text>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<text style="color: #999">暂无可用优惠券</text>
|
||||||
|
</template>
|
||||||
|
<!-- <text style="color: #fe6035"> -¥{{ jfNumberShow }}</text> -->
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<text style="color: #fe6035" >- ¥ {{curCoupon.couponEntity.couponAmount}}</text>
|
||||||
|
<text @click="showCouponPup = true" style="display: inline-block; margin-left: 20rpx; background-color: #fe6035; color: #fff; border-radius: 30rpx;font-size: 26rpx; border: 4rpx #fe6035 solid; ">重新选择</text>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="v.type == 4">
|
||||||
<text style="color: #fe6035"> -¥{{ jfNumberShow }}</text>
|
<text style="color: #fe6035"> -¥{{ jfNumberShow }}</text>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="bottom jf_box" v-if="v.type == 3">
|
<view class="bottom jf_box" v-if="v.type == 4">
|
||||||
<view class="jf_box">
|
<view class="jf_box">
|
||||||
<text style="color: #258feb; font-weight: 600">可用积分({{ jfNumberMax }}分)</text>
|
<text style="color: #258feb; font-weight: 600">可用积分({{ jfNumberMax }}分)</text>
|
||||||
<view class="jf_input">
|
<view class="jf_input">
|
||||||
@@ -360,12 +377,14 @@
|
|||||||
@click="onHandleClickBuy" @buttonClick="onHandleClickBuy" />
|
@click="onHandleClickBuy" @buttonClick="onHandleClickBuy" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
<order-coupon v-if="showCouponPup" :sumMeony="totalPrice" :curCouponId="curCouponId" :list="couponHistoryList" ref="orderCoupon" @confirmCoupon="confirmCoupon" @close="closeCoupon"></order-coupon>
|
||||||
<!-- <z-navigation></z-navigation> -->
|
<!-- <z-navigation></z-navigation> -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import orderCoupon from "@/components/orderCoupon.vue";
|
||||||
import courseDescription from "@/pages/component/commonComponents/list";
|
import courseDescription from "@/pages/component/commonComponents/list";
|
||||||
import {
|
import {
|
||||||
setPay,
|
setPay,
|
||||||
@@ -382,6 +401,7 @@
|
|||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
courseDescription, //课程说明
|
courseDescription, //课程说明
|
||||||
|
orderCoupon, // 优惠券弹出
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
isDefaultCurrency: {
|
isDefaultCurrency: {
|
||||||
@@ -567,6 +587,10 @@
|
|||||||
haveCourse: false, // 结算队列是否有课程类型的商品
|
haveCourse: false, // 结算队列是否有课程类型的商品
|
||||||
isAndorid: null, //操作系统
|
isAndorid: null, //操作系统
|
||||||
beizhuShow: false, // 是否显示天医币说明?
|
beizhuShow: false, // 是否显示天医币说明?
|
||||||
|
couponHistoryList:[], // 可用优惠券
|
||||||
|
showCouponPup:false, // 是否显示优惠券弹窗
|
||||||
|
curCoupon:{}, // 选中的优惠券信息
|
||||||
|
curCouponId:undefined
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async onLoad(options) {
|
async onLoad(options) {
|
||||||
@@ -607,6 +631,7 @@
|
|||||||
// this.searchList = []
|
// this.searchList = []
|
||||||
},
|
},
|
||||||
async onShow() {
|
async onShow() {
|
||||||
|
this.curCouponId = undefined
|
||||||
console.log("调用了onShow方法");
|
console.log("调用了onShow方法");
|
||||||
var that = this;
|
var that = this;
|
||||||
await uni.$on("returnData", function(data) {
|
await uni.$on("returnData", function(data) {
|
||||||
@@ -625,6 +650,7 @@
|
|||||||
console.log("没有接受到数据");
|
console.log("没有接受到数据");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
await this.getActiveCouponList()
|
||||||
// this.selectPayIndex = 0;
|
// this.selectPayIndex = 0;
|
||||||
console.log("this.addressData at line 416:", this.addressData);
|
console.log("this.addressData at line 416:", this.addressData);
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
@@ -635,6 +661,72 @@
|
|||||||
...mapState(["userInfo"]),
|
...mapState(["userInfo"]),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
closeCoupon(){
|
||||||
|
this.showCouponPup = false
|
||||||
|
},
|
||||||
|
confirmCoupon(data){
|
||||||
|
console.log('选中的优惠券是',data);
|
||||||
|
if(data){
|
||||||
|
this.curCoupon = data
|
||||||
|
this.curCouponId = data.couponEntity.id
|
||||||
|
// this.getTotalPrice()
|
||||||
|
}else{
|
||||||
|
this.curCoupon = {}
|
||||||
|
this.curCouponId = undefined
|
||||||
|
}
|
||||||
|
this.getTotalPrice()
|
||||||
|
},
|
||||||
|
// 查询商品可用优惠券
|
||||||
|
async getActiveCouponList(){
|
||||||
|
console.log('this.goodsDataList',this.goodsDataList);
|
||||||
|
if(this.goodsDataList.length <= 0){
|
||||||
|
uni.showToast({
|
||||||
|
title:'商品参数错误,无法获取优惠券',
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var idsString = (this.goodsDataList.map( item => item.productId)).join(',')
|
||||||
|
console.log('idsString',idsString);
|
||||||
|
// var idsString = ''
|
||||||
|
this.$http
|
||||||
|
.request({
|
||||||
|
// url: "book/buyOrder/buySave",
|
||||||
|
url: 'common/coupon/getCouponListPayment',
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data:{
|
||||||
|
shopProductIds:idsString
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
//默认 无 说明:请求头
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(async (res) => {
|
||||||
|
|
||||||
|
if(res.code != 0){
|
||||||
|
uni.showToast({
|
||||||
|
title:res.errMsg,
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (res.code == 0) {
|
||||||
|
console.log("可用优惠券列表", res);
|
||||||
|
this.couponHistoryList = res.couponHistoryList
|
||||||
|
}
|
||||||
|
this.$forceUpdate();
|
||||||
|
|
||||||
|
// await that.getDetailInfo();
|
||||||
|
}).catch(e=>{
|
||||||
|
console.log("可用优惠券列表报错", e);
|
||||||
|
uni.showToast({
|
||||||
|
title:e.errMsg,
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
// 获得操作系统
|
// 获得操作系统
|
||||||
getOS() {
|
getOS() {
|
||||||
let oprateOs = ''
|
let oprateOs = ''
|
||||||
@@ -668,9 +760,13 @@
|
|||||||
// value = value.replace(/[^\d]/g, "");
|
// value = value.replace(/[^\d]/g, "");
|
||||||
this.jfNumber = Number(value);
|
this.jfNumber = Number(value);
|
||||||
this.jfNumberShow = this.jfNumber.toFixed(2);
|
this.jfNumberShow = this.jfNumber.toFixed(2);
|
||||||
}
|
}
|
||||||
|
var couponAmount = 0
|
||||||
this.actualPayment = this.totalPrice - this.jfNumber + this.freightNum;
|
if(this.curCouponId && this.curCoupon.couponEntity.id){
|
||||||
|
couponAmount = this.curCoupon.couponEntity.couponAmount
|
||||||
|
}
|
||||||
|
// that.actualPayment = that.actualPayment - that.couponAmount; // 减去优惠券的金额
|
||||||
|
this.actualPayment = this.totalPrice - couponAmount - this.jfNumber + this.freightNum;
|
||||||
|
|
||||||
if (this.actualPayment == 0) {
|
if (this.actualPayment == 0) {
|
||||||
this.isDefaultCurrency = true;
|
this.isDefaultCurrency = true;
|
||||||
@@ -712,6 +808,11 @@
|
|||||||
imgUrl: "",
|
imgUrl: "",
|
||||||
type: 2,
|
type: 2,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: "优惠券",
|
||||||
|
imgUrl: "",
|
||||||
|
type: 3,
|
||||||
|
}
|
||||||
];
|
];
|
||||||
// this.goodsDataList
|
// this.goodsDataList
|
||||||
console.log("this.goodsDataList at line 595:", this.goodsDataList);
|
console.log("this.goodsDataList at line 595:", this.goodsDataList);
|
||||||
@@ -744,13 +845,12 @@
|
|||||||
console.log("res at line 374:", res);
|
console.log("res at line 374:", res);
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.initData = res.data;
|
this.initData = res.data;
|
||||||
|
|
||||||
this.isShowAddress = res.data.is_course ? false : true;
|
this.isShowAddress = res.data.is_course ? false : true;
|
||||||
if (!this.isShowAddress) {
|
if (!this.isShowAddress) {
|
||||||
this.priceBreakdownList.push({
|
this.priceBreakdownList.push({
|
||||||
text: "积分",
|
text: "积分",
|
||||||
imgUrl: require("@/static/icon/jifen.png"),
|
imgUrl: require("@/static/icon/jifen.png"),
|
||||||
type: 3,
|
type: 4,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -897,12 +997,18 @@
|
|||||||
} else {
|
} else {
|
||||||
that.jfNumberShow = that.jfNumber.toFixed(2);
|
that.jfNumberShow = that.jfNumber.toFixed(2);
|
||||||
that.actualPayment = that.totalPrice - that.jfNumber;
|
that.actualPayment = that.totalPrice - that.jfNumber;
|
||||||
}
|
}
|
||||||
that.actualPayment = that.actualPayment + that.freightNum;
|
that.actualPayment = that.actualPayment + that.freightNum;
|
||||||
} else {
|
} else {
|
||||||
that.actualPayment = that.totalPrice + that.freightNum;
|
that.actualPayment = that.totalPrice + that.freightNum;
|
||||||
}
|
}
|
||||||
|
var couponAmount = 0
|
||||||
|
if(that.curCouponId && that.curCoupon.couponEntity.id){
|
||||||
|
couponAmount = that.curCoupon.couponEntity.couponAmount
|
||||||
|
}
|
||||||
|
console.log('couponAmount优惠券金额',couponAmount);
|
||||||
|
that.actualPayment = that.actualPayment - couponAmount; // 减去优惠券的金额
|
||||||
|
|
||||||
if (this.actualPayment == 0 && !this.isShowAddress) {
|
if (this.actualPayment == 0 && !this.isShowAddress) {
|
||||||
this.isDefaultCurrency = true;
|
this.isDefaultCurrency = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -997,9 +1103,9 @@
|
|||||||
realMoney: this.actualPayment, //实收金额
|
realMoney: this.actualPayment, //实收金额
|
||||||
shippingMoney: this.freightNum, //运费
|
shippingMoney: this.freightNum, //运费
|
||||||
remark: this.remark, //备注
|
remark: this.remark, //备注
|
||||||
couponId: null, //优惠券Id
|
couponId: this.curCouponId ? this.curCoupon.id : null, //优惠券Id
|
||||||
// isSend: this.isSend,
|
// isSend: this.isSend,
|
||||||
couponName: "", //优惠券名称
|
couponName: this.curCouponId && this.curCoupon.id ? this.curCoupon.couponEntity.couponName : '', //优惠券名称
|
||||||
districtMoney: 0, //优惠金额
|
districtMoney: 0, //优惠金额
|
||||||
|
|
||||||
productList: this.goodsDataList.map((e) => {
|
productList: this.goodsDataList.map((e) => {
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
<!-- 公共组件-每个页面必须引入 -->
|
<!-- 公共组件-每个页面必须引入 -->
|
||||||
<public-module></public-module>
|
<public-module></public-module>
|
||||||
<view class="setIcon" @click="goSetting">
|
<view class="setIcon" @click="goSetting">
|
||||||
<u-icon class="" labelColor="#258feb" labelPos="bottom" label="设置" name="setting"
|
<u-icon class="" labelColor="#258feb" labelPos="bottom" label="设置" name="setting"
|
||||||
:style="`top:${(10 + statusBarHeight) * 2}rpx`" color="#258feb" size="28"></u-icon>
|
:style="`top:${(10 + statusBarHeight) * 2}rpx`" color="#258feb" size="28"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="bg_top flex_box flex_between">
|
<view class="bg_top flex_box flex_between">
|
||||||
<view class="per_mes">
|
<view class="per_mes">
|
||||||
<view class="per_mes_user">
|
<view class="per_mes_user">
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
class="per_mes_img color_shandow"></image>
|
class="per_mes_img color_shandow"></image>
|
||||||
<image src="@/static/icon/home_icon_logo.png" v-if="userMes.avatar == null"
|
<image src="@/static/icon/home_icon_logo.png" v-if="userMes.avatar == null"
|
||||||
class="per_mes_img color_shandow"></image>
|
class="per_mes_img color_shandow"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="user_vip_box ">
|
<view class="user_vip_box ">
|
||||||
<view v-if="userMes.vip == 1" class="user_vip super">超级VIP</view>
|
<view v-if="userMes.vip == 1" class="user_vip super">超级VIP</view>
|
||||||
<view v-if="userMes.vip == 3" class="user_vip">众妙之门VIP</view>
|
<view v-if="userMes.vip == 3" class="user_vip">众妙之门VIP</view>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<br clear="both" />
|
<br clear="both" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mine_box" :style="`top:${(45 + statusBarHeight) * 2}rpx`">
|
<view class="mine_box" :style="`top:${(45 + statusBarHeight) * 2}rpx`">
|
||||||
@@ -145,6 +145,20 @@
|
|||||||
userMes.jf ? userMes.jf : 0
|
userMes.jf ? userMes.jf : 0
|
||||||
}}</view>
|
}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="chong_list_item" style="
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
" @click="onPageJump('/pages/mine/wallet/couponList')">
|
||||||
|
<view class="pay_item_img">
|
||||||
|
优惠券
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="text" style="line-height: 40rpx">{{
|
||||||
|
userCouponNum
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- v-if="iosHide" -->
|
<!-- v-if="iosHide" -->
|
||||||
|
|
||||||
@@ -268,6 +282,7 @@
|
|||||||
signShow: false,
|
signShow: false,
|
||||||
signContent: "是否要退出登录?",
|
signContent: "是否要退出登录?",
|
||||||
playData: {},
|
playData: {},
|
||||||
|
userCouponNum:0, // 优惠券数量
|
||||||
directorShow: false, // 主任是否显示班级入口
|
directorShow: false, // 主任是否显示班级入口
|
||||||
monitorShow: false, // 其他管理是否显示班级入口
|
monitorShow: false, // 其他管理是否显示班级入口
|
||||||
isAndorid: true,
|
isAndorid: true,
|
||||||
@@ -335,10 +350,11 @@
|
|||||||
...mapState(["userInfo"]),
|
...mapState(["userInfo"]),
|
||||||
},
|
},
|
||||||
//页面显示
|
//页面显示
|
||||||
onShow() {
|
async onShow() {
|
||||||
// console.log(this.userInfo, "11111111111111");
|
// console.log(this.userInfo, "11111111111111");
|
||||||
this.getData();
|
this.getData();
|
||||||
this.getUserRole()
|
this.getUserRole()
|
||||||
|
await this.getUserCouponList()
|
||||||
// 隐藏原生的tabbar
|
// 隐藏原生的tabbar
|
||||||
// uni.hideTabBar();
|
// uni.hideTabBar();
|
||||||
},
|
},
|
||||||
@@ -348,6 +364,34 @@
|
|||||||
//方法
|
//方法
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(["setUserInfo"]),
|
...mapMutations(["setUserInfo"]),
|
||||||
|
// 获取用户优惠券列表
|
||||||
|
async getUserCouponList(){
|
||||||
|
await this.$http
|
||||||
|
.request({
|
||||||
|
url: "common/coupon/getCouponHistoryList",
|
||||||
|
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||||
|
data: {
|
||||||
|
"page":1,
|
||||||
|
"limit":10,
|
||||||
|
"getType":"",//获取类型 0 后台赠送 1 主动获取
|
||||||
|
"status":"0",//使用状态 0 未使用 1 已使用 2 已过期
|
||||||
|
"userInfo":"",//用户信息
|
||||||
|
"userId":this.userInfo.id
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
//默认 无 说明:请求头
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(async (res) => {
|
||||||
|
if(res.code != 0) return this.$commonJS.showToast(res.errMsg);
|
||||||
|
this.userCouponNum = res.couponList.total
|
||||||
|
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e);
|
||||||
|
this.$commonJS.showToast(e.errMsg);
|
||||||
|
})
|
||||||
|
},
|
||||||
openInfo() {
|
openInfo() {
|
||||||
this.infoShow = true;
|
this.infoShow = true;
|
||||||
},
|
},
|
||||||
@@ -588,8 +632,11 @@
|
|||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "@/style/mixin.scss";
|
@import "@/style/mixin.scss";
|
||||||
|
|
||||||
.per_mes_user{display: block !important;}
|
.per_mes_user {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
.per_mes {
|
.per_mes {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -898,14 +945,16 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
// position: relative;
|
// position: relative;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.setIcon {
|
|
||||||
position: absolute;
|
.setIcon {
|
||||||
right: 30rpx;
|
position: absolute;
|
||||||
top: 70rpx;
|
right: 30rpx;
|
||||||
z-index: 2;
|
top: 70rpx;
|
||||||
}
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
.mine_box {
|
.mine_box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|||||||
22
pages/mine/wallet/couponList.vue
Normal file
22
pages/mine/wallet/couponList.vue
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
优惠券列表
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user