公司演示版e鹿悦游
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
CjyTravel/subPageC/order/orderDetail.vue

727 lines
21 KiB

<template>
<view class="m-content" v-if="!loading">
<view class="m-ticket-status">
<view class="m-ticket-status-item" v-if="formData.orderStatus == 1">
<image style="width: 40px; height: 40px;" src="../static/img/order_pending-payment1.svg" />待支付
</view>
<view class="m-ticket-status-item" v-if="formData.orderStatus == 2">
<image style="width: 40px; height: 40px;" src="../static/img/order_paid1.svg" />已支付
</view>
<view class="m-ticket-status-item" v-if="formData.orderStatus == 3">
<image style="width: 40px; height: 40px;" src="../static/img/order_completed1.svg" />已完成
</view>
<view class="m-ticket-status-item" v-if="formData.orderStatus == 4">
<image style="width: 40px; height: 40px;" src="../static/img/order_cancel1.svg" />已取消
</view>
</view>
<view class="m-box">
<view class="m-row right" v-if="formData.orderStatus == 1">
<view class="m-label big-font">应付金额</view>
<view class="m-value">¥{{ formData.settlementAmount }}</view>
</view>
<view class="m-row right">
<view class="m-label big-font">{{ formData.ticketList[0].ticketname }}</view>
<view class="m-value">{{ formData.ticketNums }} 张
{{ formData.settlementAmount }}元
</view>
</view>
<view class="m-row">
<view class="m-label">使用有效期</view>
<view class="m-value orange">
{{ parseTime(formData.ticketList[0].startdate, '{y}-{m}-{d}') || '' }}至{{
parseTime(formData.ticketList[0].enddate, '{y}-{m}-{d}') ||
'' }}
</view>
</view>
</view>
<view class="m-box" v-if="formData.orderStatus == 2 || formData.orderStatus == 3">
<view class="m-row right">
<view class="m-label big-font">凭【检票码】直接检票使用</view>
<view class="m-value"></view>
</view>
<!-- <view class="m-box"> -->
<view class="qrinfo">
<view class="qr" v-for="(item, index) in formData.ticketList"
:class="formData.ticketList.length == 1 ? 'alone' : ''">
<view class="user-info" v-if="item.tickeTourtList.length > 0 && item.tickeTourtList">
<view>姓 名:{{ item.tickeTourtList[0].username }}</view>
<view v-if="item.tickeTourtList[0].idcard">证件号:{{ item.tickeTourtList[0].idcard }}</view>
<view v-if="item.tickeTourtList[0].mobile">电话号:{{ item.tickeTourtList[0].mobile }}</view>
</view>
<view class="qr-box">
<view v-if="item.qmxSnUrl == null">
<image style="width: 170px; height: 170px; background-color: #eeeeee;" :src="item.EwmImg"></image>
</view>
<view v-if="item.qmxSnUrl != null" style="width: 170px; height: 170px;">
<image style="width: 170px; height: 170px; background-color: #eeeeee;" :src="item.qmxSnUrl"></image>
</view>
<view class="chect-time" v-if="item.ticketStatus!=null">已检票次数:{{ item.ticketCheckedNums }}/{{ item.ticketChecksNums }}次
</view>
<view class="refond-btn" v-if="item.ticketStatus == 1 && item.refundRules != 1"
hover-class="refond-btn-hover" @click="toRefund(item)">
单票退款</view>
<view class="cover" v-if="item.ticketStatus == 2 && item.ticketCheckedNums == item.ticketChecksNums || item.ticketStatus == 3 || item.ticketStatus == 4 || item.ticketStatus == 5 || item.ticketStatus == 6 || item.ticketStatus == 7||item.ticketStatus == null">{{
item.ticketStatusName||'暂无' }}</view>
</view>
<uqrcode v-show="false" @complete="completeQr($event, index)" ref="uqrcode" canvas-id="qrcode"
:value="item.ticketEwm" :options="options"></uqrcode>
</view>
</view>
<view class="tips">可左右滑动查看检票码</view>
</view>
<view class="m-box">
<view class="m-row right">
<view class="m-label big-font">订单信息</view>
<view class="m-value"></view>
</view>
<view class="m-row">
<view class="m-label">订单编号</view>
<view class="m-value">{{ formData.orderNumber }}</view>
</view>
<view class="m-row">
<view class="m-label">下单时间</view>
<view class="m-value">{{ parseTime(formData.orderTime) }}</view>
</view>
<view class="m-row" v-if="formData.orderStatus == 2 || formData.orderStatus == 3">
<view class="m-label">支付时间</view>
<view class="m-value">{{ parseTime(formData.payTime) }}</view>
</view>
<view class="m-row" v-if="formData.orderStatus == 2 || formData.orderStatus == 3">
<view class="m-label">支付方式</view>
<view class="m-value">微信支付</view>
</view>
<view v-if="formData.ticketList.tickeTourtList > 0">
<view class="m-row">
<view class="m-label">联系人</view>
<view class="m-value">{{ formData.ticketList.tickeTourtList[0].username }}</view>
</view>
<view class="m-row">
<view class="m-label" v-if="formData.ticketList.tickeTourtList[0].idcard">身份证</view>
<view class="m-value">{{ formData.ticketList.tickeTourtList[0].idcard }}</view>
</view>
<view class="m-row">
<view class="m-label" v-if="formData.ticketList.tickeTourtList[0].mobile">手机号</view>
<view class="m-value">{{ formData.ticketList.tickeTourtList[0].mobile }}</view>
</view>
</view>
</view>
<view class="m-box">
<view class="m-row right">
<view class="m-label big-font">购买须知</view>
<view class="m-value"></view>
</view>
<view class="m-row">
<view class="m-label">退票规则</view>
<view class="m-value">{{ formData.ticketList[0].refundRulesLabel }}</view>
</view>
<view class="m-row">
<view class="m-label">使用次数</view>
<view class="m-value">{{ formData.ticketList[0].ticketchecksNum }}</view>
</view>
<view class="m-row">
<view class="m-label">购票限制</view>
<view class="m-value">
{{ formData.ticketList[0].buyticketlimit == 1 ? '不限' :
(formData.ticketList[0].buyticketlimit == 2 ? '每个手机号限购' + formData.ticketList[0].ticketlimitnum + '张' : '') }}
</view>
</view>
</view>
<view class="m-box">
<view class="m-row right">
<view class="m-label big-font">使用说明</view>
<view class="m-value"></view>
</view>
<view class="m-row">
<view class="m-label ">开放时间</view>
<view class="m-value">{{ formData.scenicInfo.openTime }}</view>
</view>
<view class="m-row">
<view class="m-label">购票须知</view>
<view class="m-value">{{ formData.scenicInfo.ticketInfo }}</view>
</view>
<view class="m-row">
<view class="m-label ">景区地址</view>
<view class="m-value">
{{ formData.scenicInfo.provinceCode }}{{ formData.scenicInfo.cityCode }}{{ formData.scenicInfo.blockCode }}{{
formData.scenicInfo.addressInfo }}
</view>
</view>
</view>
<view class="m-box">
<view class="m-row right">
<view class="m-label big-font">联系我们</view>
<view class="m-value"></view>
</view>
<view class="m-row">
<view class="m-label ">客服电话</view>
<view class="m-value blue" @click="callPhone">0311-83886677</view>
</view>
</view>
<u-popup :show="isPayPopup" mode="bottom" @close="isPayPopup = false" round="10">
<f-pay :show-title="false" :show="isPayPopup" :order="orderInf" :payMoney="orderInf.settlementAmount"
:tradeNo="orderInf.orderNumber" @payResult="payResult"></f-pay>
</u-popup>
<view class="btn-group" v-if="formData.orderStatus == 1 || (formData.orderStatus == 2 && canAbove)">
<view class=" m-btn cancel-btn" v-if="formData.orderStatus == 1" @click="cancelOrder()">取消订单</view>
<view class="m-btn go-pay" v-if="formData.orderStatus == 1" @click="goPay()">继续支付</view>
<view class="m-btn above-pay" v-if="formData.orderStatus == 2 && canAbove" @click="toRefund()">申请退款</view>
</view>
</view>
</template>
<script>
import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
import { parseTime } from "@/common/util";
import fPay from "../components/f-pay/f-pay";
import uPopup from "../components/uview-ui/components/u-popup/u-popup.vue";
import uniTransition from "../components/uni-transition/components/uni-transition/uni-transition.vue"
// import UQRCode from 'uqrcodejs'; // npm install uqrcodejs
export default {
mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
components: {
fPay, uPopup, uniTransition
},
data() {
return {
formData: {},
QR: null,
idx: 0,
loading: true,
belongId: null,
isPayPopup: false,
orderInf: null,
zid: null,
canAbove: false,
sss: null,
options: {
margin: 10
}
};
},
onReady() {
// 获取uQRCode实例
// this.QR = new UQRCode();
},
onLoad(option) {
if (option.id) {
this.zid = option.id
//这里通过订单好获取开票详情
this.getOrderDetails(option.id);
}
if (option.belongId) {
this.belongId = option.belongId
}
if (option.orderInf) {
this.orderInf = JSON.parse(decodeURIComponent(option.orderInf))
// const index = this.orderInf.ticketList.findIndex(ele => ele.ticketStatus == '1' && ele.refundRules != 1);
// if (index != -1) {
// this.canAbove = true
// } else {
// this.canAbove = false; // 根据需求设置
// }
}
},
methods: {
//取消订单
cancelOrder(orderNumber) {
let this_ = this
uni.showModal({
icon: 'warning',
content: `确定取消该笔订单吗`,
success: function (res) {
if (res.confirm) {
let httpData = {
orderNumber: this_.formData.orderNumber,
}
this_.$Request
.get(this_.$config.cancelOrder, httpData, null, null, false, false)
.then((res) => {
if (res.code == 0) {
uni.showToast({
title: '取消成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack({ delta: 1 });
}, 1000)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
})
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
//支付结果
payResult(data) {
console.log(data);
if (data.payStatus == 1) {
uni.showToast({ title: '支付成功', icon: 'none' });
this.isPayPopup = false
setTimeout(() => {
this.getOrderDetails(this.zid);
}, 1000)
} else {
uni.showToast({ title: '支付失败', icon: 'none' });
}
//uni.showToast({title: data.detail.errMsg,icon:'none'});
},
//支付
goPay() {
this.isPayPopup = true
},
//单票退款
toRefund(val) {
let that = this
uni.showModal({
title: '提示',
content: '确定退款?',
showCancel: true,
confirmText: '确认',
success: function (res) {
let httpData
if (res.confirm) {
if (val) {
httpData = {
id: that.belongId,
ticketId: val.id,
};
} else {
httpData = {
id: that.belongId,
ticketId: 0,
};
}
if (that.formData.qmxOrderNumber == null) {
that.$Request
.put(that.$config.refund, httpData, null, null, false, true).then(res => {
if (res.data != null) {
uni.showToast({
title: '退款已提交',
icon: 'none',
mask: false
})
} else {
uni.showToast({
title: res.msg,
icon: 'none',
mask: false
})
}
setTimeout(() => {
uni.navigateBack({ delta: 1 });
}, 1000)
}).catch(err => {
console.log(err)
})
} else {
that.$Request
.put(that.$config.refundWeChat, httpData, null, null, false, true).then(res => {
if (res.data != null) {
uni.showToast({
title: '退款已提交',
icon: 'none',
mask: false
})
} else {
uni.showToast({
title: res.msg,
icon: 'none',
mask: false
})
}
setTimeout(() => {
uni.navigateBack({ delta: 1 });
}, 1000)
}).catch(err => {
console.log(err)
})
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
},
callPhone() {
uni.makePhoneCall({
phoneNumber: '0311-83886677' //仅为示例
});
},
completeQr(el, inx) {
console.log(el, inx, 'ggghhhh')
this.$refs.uqrcode[inx].toTempFilePath({
success: (res) => {
this.formData.ticketList[inx].EwmImg = res.tempFilePath
this.$forceUpdate()
},
})
console.log(this.formData.ticketList, 'this.formData.ticketList')
},
createQR(vale) {
let this_ = this;
vale.forEach((item, index) => {
// if (item.ticketStatus == 1){
// 设置二维码内容
this.QR.data = item.ticketEwm;
// 设置二维码大小,必须与canvas设置的宽高一致
this.QR.size = 170;
// 调用制作二维码方法
this.QR.make();
// 获取canvas上下文
var canvasContext = uni.createCanvasContext('qrcode_' + index, this); // 如果是组件,this必须传入
// 设置uQRCode实例的canvas上下文
this.QR.canvasContext = canvasContext;
// 调用绘制方法将二维码图案绘制到canvas上
this.QR.drawCanvas()
setTimeout(() => {
uni.canvasToTempFilePath({
width: 170,
height: 170,
canvasId: 'qrcode_' + index,
success: function (res) {
// 在H5平台下,tempFilePath 为 base64
console.log(res.tempFilePath)
this_.sss = res.tempFilePath
},
fail: function (err) {
console.log(err, 'sdsdsd')
}
})
}, 3500)
// }
})
},
parseTime(val, pre) {
return parseTime(val, pre)
},
getOrderDetails(id) {
let this_ = this;
let httpData = {
id: id,
}
uni.showLoading({
title: "加载中"
})
this.$Request
.get(this.$config.getOrderDetails, httpData, null, null, false, false)
.then((res) => {
if (res.code == 0) {
this.loading = false
uni.hideLoading()
console.log(res)
this.formData = res.data
// if (res.data.qmxSnUrl==null){
// this_.createQR(res.data.ticketList)
// }
const index = res.data.ticketList.findIndex(ele => ele.ticketStatus == '1' && ele.refundRules != 1);
if (index != -1) {
this.canAbove = true
} else {
this.canAbove = false; // 根据需求设置
}
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
})
}
},
}
</script>
<style lang="scss" scoped>
.m-content {
margin: 0 24rpx;
padding: 20rpx 0;
width: unset;
height: fit-content;
padding-bottom: 180rpx;
.m-ticket-status {
.m-ticket-status-item {
display: flex;
align-items: center;
}
font-family: Source Han Sans SC;
font-weight: 500;
font-size: 40rpx;
color: #000000;
margin-bottom: 20rpx;
}
.m-box {
background: #FFFFFF;
border-radius: 20rpx;
padding: 34rpx 26rpx;
margin-bottom: 40rpx;
.qrinfo {
display: flex;
overflow-x: scroll;
overflow-y: hidden;
.qr {
position: relative;
margin: 0 10rpx;
border: 1px dashed #ccc;
background-image: linear-gradient(to bottom, #f7f8fc, #e3eefc);
text-align: center;
}
.qr.alone {
margin: 0 auto;
}
.qr-box {
position: relative;
padding: 40rpx 80rpx;
&::before {
content: "检票码";
position: absolute;
top: 0;
right: 0;
width: 40rpx;
height: 100%;
padding-top: 50rpx;
background-color: #416BA1;
color: #fff;
text-align: center;
font-size: 28rpx;
}
&::after {
content: "检票码";
position: absolute;
display: inline-block;
vertical-align: middle;
top: 0;
left: 0;
width: 40rpx;
height: 100%;
padding-top: 50rpx;
background-color: #416BA1;
color: #fff;
text-align: center;
font-size: 28rpx;
}
.chect-time {
margin-top: 40rpx;
font-size: 28rpx;
}
.cover {
width: 170px;
height: 170px;
position: absolute;
left: 80rpx;
top: 40rpx;
text-align: center;
background-color: rgba(255, 255, 255, 0.8);
z-index: 999;
color: #FF5500;
font-size: 55rpx;
font-weight: bolder;
display: flex;
align-items: center;
justify-content: center;
}
}
.user-info {
position: relative;
padding: 40rpx 80rpx;
border-bottom: 1px dashed #fff;
text-align: left;
font-size: 24rpx;
&::before {
content: "游客";
position: absolute;
top: 0;
right: 0;
width: 40rpx;
height: 100%;
padding-top: 10rpx;
background-color: #416BA1;
color: #fff;
font-size: 28rpx;
text-align: center;
}
&::after {
content: "游客";
position: absolute;
top: 0;
left: 0;
width: 40rpx;
height: 100%;
padding-top: 10rpx;
background-color: #416BA1;
color: #fff;
font-size: 28rpx;
text-align: center;
font-size: 28rpx;
}
.user-info-left-c {
position: absolute;
left: -12rpx;
bottom: -12rpx;
z-index: 99;
width: 24rpx;
height: 24rpx;
border-radius: 24rpx;
background-color: #fff;
}
.user-info-right-c {
position: absolute;
right: -12rpx;
bottom: -12rpx;
z-index: 99;
width: 24rpx;
height: 24rpx;
border-radius: 24rpx;
background-color: #fff;
}
}
}
.tips {
margin-top: 20rpx;
width: 100%;
font-size: 28rpx;
text-align: center;
color: #666;
}
.m-row {
display: flex;
align-items: center;
margin-bottom: 10rpx;
.m-label {
color: rgba(102, 102, 102, 1);
margin-right: 12rpx;
width: 25%;
}
.m-value {
color: 000013354;
flex: 1;
}
.orange {
color: rgba(255, 85, 0, 1);
}
.blue {
color: rgb(0, 123, 255);
}
.big-font {
font-family: Source Han Sans SC;
font-weight: bold;
font-size: 32rpx;
color: #1B1B1B;
margin-right: 0;
}
}
.right {
justify-content: space-between;
margin-bottom: 15rpx;
.m-label {
width: fit-content;
}
.m-value {
flex: unset;
}
}
}
}
.btn-group {
height: 136rpx;
width: 100%;
display: flex;
align-items: center;
position: fixed;
bottom: 0;
left: 0;
background-color: #fff;
justify-content: flex-end;
.m-btn {
margin-right: 20rpx;
width: 180rpx;
height: 80rpx;
border-radius: 16rpx;
text-align: center;
line-height: 80rpx;
border-radius: 16rpx;
border: 1px solid #CCCCCC;
&:last-child {
margin-right: 50rpx;
}
}
.go-pay,
.above-pay {
background: #0983FF;
color: #fff;
border: 1px solid #0983FF;
}
}
.refond-btn {
width: 160rpx;
height: 60rpx;
background: #0983FF;
border-radius: 16rpx;
margin: 0 auto;
margin-top: 20rpx;
color: #fff;
line-height: 60rpx;
}
.refond-btn-hover {
opacity: 0.9;
}
</style>