Commit 65b0bf30 authored by qipeng's avatar qipeng

详情退单地址修改

parent 38280e93
......@@ -318,203 +318,203 @@
</template>
<script>
import uQRCode from '@/common/js/uqrcode.js'
export default {
filters:{
orderStatus1(i){//景区订单状态
switch(i){
case 0:
return '待支付'
break
case 1:
return '出票中'
break
case 2:
return '出票成功'
break
case 3:
return '出票失败'
break
case 4:
return '核销中'
break
case 5:
return '核销完成'
break
case 6:
return '退款中'
break
case 7:
return '部分退退货退款'
break
case 8:
return '全部退退货退款'
break
case 9:
return '取消'
break
case 10:
return '已完成 '
break
case 11:
return '已过期 '
break
case 12:
return '退票审核中 '
break
}
},
orderStatus2(i){//酒店订单状态
switch(i){
case 0:
return '待支付'
break
case 1:
return '确认中'
break
case 2:
return '预定成功'
break
case 3:
return '预定失败'
break
case 4:
return '核销中'
break
case 5:
return '核销完成'
break
case 6:
return '退款中'
break
case 7:
return '部分退退货退款'
break
case 8:
return '全部退退货退款'
break
case 9:
return '取消 '
break
case 10:
return '已完成 '
break
}
},
orderStatus3(i){//餐饮订单状态
switch(i){
case 0:
return '待支付'
break
case 1:
return '确认中'
break
case 2:
return '预定成功'
break
case 3:
return '预定失败'
break
case 4:
return '核销中'
break
case 5:
return '核销完成'
break
case 6:
return '退款中'
break
case 7:
return '部分退货退款'
break
case 8:
return '全部退款退货'
break
case 9:
return '取消 '
break
case 10:
return '已完成 '
break
}
},
orderStatus4(i){//特产订单状态
switch(i){
case 0:
return '待支付'
break
case 1:
return '待发货'
break
case 2:
return '待收货'
break
case 3:
return '预定失败'
break
case 4:
return '核销中'
break
case 5:
return '已收货'
break
case 6:
return '退款中'
break
case 7:
return '部分退货/退款'
break
case 8:
return '全部退款退货 '
break
case 9:
return '取消 '
break
case 10:
return '已完成 '
break
}
}
},
data() {
return {
orderDataType:false,
openId:'',//用户信息
id:'',//订单ID
companyId:'',//公司ID
orderInfo:{},//订单信息
sortsInfo:'',//取号数据
sortData:[],//排队号信息
sortsAll:[],//所有排号信息
overSignedData:{},//过号数据
ticketCode:null,//订单编码
verifyCode:null,//二维码
ticketStatus:null,//票状态 0未使用,1已核销,2退票,3过期
codeStart:'',//开始时间
codes:[],//我二维码数组
percentage:0,//进度条百分比
orderExtendList:[],//订单拓展信息
touristInfo:[],//游客信息
orderTypeNum:1,//订单是否展开
timer1:null,
timer2:null,
timer3:null,
maskType :false,
d:'',//倒计时 天
h: '',//倒计时 时
m: '',//倒计时 分
s: '',//倒计时 秒
sum_h: '',//倒计时
timerType:null,//清除标记
returnTripType:false,//返程取号设置
Brightness:'',//屏幕亮度
qrCodeType:false,//是否是多个二维码
btnRefundType:false,//是否可退款
ifyukuaiCode:'',
visitorIndex:'',//短信特殊字段
}
},
onShow() {
import uQRCode from '@/common/js/uqrcode.js'
export default {
filters:{
orderStatus1(i){//景区订单状态
switch(i){
case 0:
return '待支付'
break
case 1:
return '出票中'
break
case 2:
return '出票成功'
break
case 3:
return '出票失败'
break
case 4:
return '核销中'
break
case 5:
return '核销完成'
break
case 6:
return '退款中'
break
case 7:
return '部分退退货退款'
break
case 8:
return '全部退退货退款'
break
case 9:
return '取消'
break
case 10:
return '已完成 '
break
case 11:
return '已过期 '
break
case 12:
return '退票审核中 '
break
}
},
orderStatus2(i){//酒店订单状态
switch(i){
case 0:
return '待支付'
break
case 1:
return '确认中'
break
case 2:
return '预定成功'
break
case 3:
return '预定失败'
break
case 4:
return '核销中'
break
case 5:
return '核销完成'
break
case 6:
return '退款中'
break
case 7:
return '部分退退货退款'
break
case 8:
return '全部退退货退款'
break
case 9:
return '取消 '
break
case 10:
return '已完成 '
break
}
},
orderStatus3(i){//餐饮订单状态
switch(i){
case 0:
return '待支付'
break
case 1:
return '确认中'
break
case 2:
return '预定成功'
break
case 3:
return '预定失败'
break
case 4:
return '核销中'
break
case 5:
return '核销完成'
break
case 6:
return '退款中'
break
case 7:
return '部分退货退款'
break
case 8:
return '全部退款退货'
break
case 9:
return '取消 '
break
case 10:
return '已完成 '
break
}
},
orderStatus4(i){//特产订单状态
switch(i){
case 0:
return '待支付'
break
case 1:
return '待发货'
break
case 2:
return '待收货'
break
case 3:
return '预定失败'
break
case 4:
return '核销中'
break
case 5:
return '已收货'
break
case 6:
return '退款中'
break
case 7:
return '部分退货/退款'
break
case 8:
return '全部退款退货 '
break
case 9:
return '取消 '
break
case 10:
return '已完成 '
break
}
}
},
data() {
return {
orderDataType:false,
openId:'',//用户信息
id:'',//订单ID
companyId:'',//公司ID
orderInfo:{},//订单信息
sortsInfo:'',//取号数据
sortData:[],//排队号信息
sortsAll:[],//所有排号信息
overSignedData:{},//过号数据
ticketCode:null,//订单编码
verifyCode:null,//二维码
ticketStatus:null,//票状态 0未使用,1已核销,2退票,3过期
codeStart:'',//开始时间
codes:[],//我二维码数组
percentage:0,//进度条百分比
orderExtendList:[],//订单拓展信息
touristInfo:[],//游客信息
orderTypeNum:1,//订单是否展开
timer1:null,
timer2:null,
timer3:null,
maskType :false,
d:'',//倒计时 天
h: '',//倒计时 时
m: '',//倒计时 分
s: '',//倒计时 秒
sum_h: '',//倒计时
timerType:null,//清除标记
returnTripType:false,//返程取号设置
Brightness:'',//屏幕亮度
qrCodeType:false,//是否是多个二维码
btnRefundType:false,//是否可退款
ifyukuaiCode:'',
visitorIndex:'',//短信特殊字段
}
},
onShow() {
let _this=this
uni.getScreenBrightness({
success: function(res){
......@@ -527,432 +527,432 @@
}
}
})
},
onHide: function () {
},
onHide: function () {
uni.setScreenBrightness({// 恢复之前屏幕亮度
value: this.Brightness
})
},
onLoad(option) {
console.log(option.orderId)
console.log("-----------------------")
if(option.orderId!=undefined){
this.id = option.orderId
this.orderDataType = true
}else{
this.id = option.thirdOrderId
this.visitorIndex = option.visitorIndex
this.orderDataType = false
}
},
onLoad(option) {
console.log(option.orderId)
console.log('-----------------------')
if(option.orderId!=undefined){
this.id = option.orderId
this.orderDataType = true
}else{
this.id = option.thirdOrderId
this.visitorIndex = option.visitorIndex
this.orderDataType = false
}
this.ifyukuaiCode = option.ifyukuaiCode||''
//this.id = "z00167956572219584dc15634b62cf75"
this.openId = uni.getStorageSync("openid") //openid oroHZ5FaUQ_SOOC_uQQP92fJpBRE oh2UV1lyYABHMZ1rMlgjhVHyyYDQ
//this.openId = "oh2UV1lyYABHMZ1rMlgjhVHyyYDQ"
this.getDetail();
this.ifyukuaiCode = option.ifyukuaiCode||''
//this.id = "z00167956572219584dc15634b62cf75"
this.openId = uni.getStorageSync('openid') //openid oroHZ5FaUQ_SOOC_uQQP92fJpBRE oh2UV1lyYABHMZ1rMlgjhVHyyYDQ
//this.openId = "oh2UV1lyYABHMZ1rMlgjhVHyyYDQ"
this.getDetail()
},
onUnload() {
if(this.timer1) {
clearTimeout(this.timer1)
this.timer1 = null
}
if(this.timer2) {
clearTimeout(this.timer2)
this.timer2 = null
}
if(this.timer3) {
clearTimeout(this.timer3)
this.timer3 = null
}
uni.setScreenBrightness({// 恢复之前屏幕亮度
value: this.Brightness
})
},
methods: {
orderTypeNumFun(){
if(this.orderTypeNum==0){
this.orderTypeNum=1
}else{
this.orderTypeNum=0
}
},
getDetail(){//*-----------------加载订单
var postHttpUrl = '';
let data = {}
if(this.orderDataType == true){//为小程序
data={
orderId:this.id,//订单ID
userId:this.openId,//用户Id
}
postHttpUrl = 'order/userOrder/findOrderDetail'
}else{//为短信
data={
thirdOrderId:this.id,//订单ID
}
postHttpUrl = 'order/userOrder/findOrderDetailByThirdOrderId'
}
},
onUnload() {
if(this.timer1) {
clearTimeout(this.timer1)
this.timer1 = null
}
if(this.timer2) {
clearTimeout(this.timer2)
this.timer2 = null
}
if(this.timer3) {
clearTimeout(this.timer3)
this.timer3 = null
}
uni.setScreenBrightness({// 恢复之前屏幕亮度
value: this.Brightness
})
},
methods: {
orderTypeNumFun(){
if(this.orderTypeNum==0){
this.orderTypeNum=1
}else{
this.orderTypeNum=0
}
},
getDetail(){//*-----------------加载订单
var postHttpUrl = ''
let data = {}
if(this.orderDataType == true){//为小程序
data={
orderId:this.id,//订单ID
userId:this.openId,//用户Id
}
postHttpUrl = 'order/userOrder/findOrderDetail'
}else{//为短信
data={
thirdOrderId:this.id,//订单ID
}
postHttpUrl = 'order/userOrder/findOrderDetailByThirdOrderId'
}
this.$request(postHttpUrl,data).then((res)=>{
if(res.code=="00"){
this.orderInfo = res.data
this.orderExtendList = res.data.orderExtendList
if(this.orderInfo.orderType==1){
this.orderTypeNum =1
}
if(this.orderInfo.orderTicketDetailList&&this.orderInfo.orderTicketDetailList.length>0){
this.verifyCode = this.orderInfo.orderTicketDetailList[0].verifyCode
this.ticketStatus = this.orderInfo.orderTicketDetailList[0].ticketStatus
this.ticketCode = this.orderInfo.orderTicketDetailList[0].ticketCode
}
this.touristInfo = res.data.orderTouristList
if(this.ifyukuaiCode==''||typeof this.ifyukuaiCode=='undefined'){
if(this.orderInfo.orderType==1||this.orderInfo.orderType==3){
if(this.orderInfo.subOrderType!=4&&this.orderInfo.subOrderType!=5){
this.$nextTick(() => {
if(this.orderInfo.playDate.substr(0,10)==this.$commonjs.today()&&this.orderInfo.exchangeMode==4||this.orderInfo.playDate.substr(0,10)==this.$commonjs.today()&&this.orderInfo.exchangeMode==5){
this.dynamicCode()
this.qrCodeType=true
}else if(this.orderInfo.exchangeMode==1){
this.qecode()
this.qrCodeType=false
}
})
}
}
}
if(this.orderInfo.isFetch==1){//isFetch==1需要排队
this.getSortInfo()
this.timer2=setInterval(()=>{
this.getSortInfo()
},1000*120)
// this.$once('hook:beforeDestroy',()=>{
// clearInterval(timer)
// })
}
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
.catch((err) => {
this.timer3 = setTimeout(() => {
this.getDetail();
}, 2000);
});
},
getSortInfo(){//-------------------------排号信息加载
var areaCode = this.orderInfo.areaCode
var orderNum = this.orderInfo.orderNum
var userId = this.openId
var orderId = this.orderInfo.id
var verifyCode = this.ticketCode
let data={areaCode,orderNum,userId,orderId,verifyCode,'againNumber':0}
this.$request('distribution/distribution/getNewFetchInfo',data).then((res)=>{
if(res.code=="00"){
if(res.data.length>0){
this.sortsInfo = res.data[0]
this.companyId = this.sortsInfo.pays[0].companyId
var sortArr = [];
sortArr.push(this.sortsInfo.sorts[0])
this.sortsAll = this.sortsInfo.sorts
var northArr = null
var southArr = null
sortArr.forEach((item)=>{
if(item.projectId=='cjsd_project_0002'){//北站
if(northArr){
if(item.sortNo>northArr.sortNo){
northArr = item
}
}else{
northArr = item
}
}else{//南站
if(southArr){
if(item.sortNo>southArr.sortNo){
southArr = item
}
}else{
southArr = item
}
}
})
var arr = []
if(northArr){
arr.push(northArr)
}
if(southArr){
arr.push(southArr)
}
this.sortData = arr
//时间判断,当前时间是否大于可领号时间
var presentTimer = this.dateFormat()
var takeNumberTimer = this.getAfterDate(this.sortsInfo.sorts[0].createDate,this.sortsInfo.sorts[0].config.paReturnTripTime);
if(this.sortsInfo.sorts[0].sortFair==4||this.sortsInfo.sorts[0].sortFair==5){
clearTimeout(this.timerType)
if(presentTimer<takeNumberTimer){
this.countTime(takeNumberTimer)
}else{
this.returnTripType =true;
}
}
}
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
}).catch((err)=>{
this.timer1=setTimeout(()=>{
this.$request(postHttpUrl,data).then((res)=>{
if(res.code=='00'){
this.orderInfo = res.data
this.orderExtendList = res.data.orderExtendList
if(this.orderInfo.orderType==1){
this.orderTypeNum =1
}
if(this.orderInfo.orderTicketDetailList&&this.orderInfo.orderTicketDetailList.length>0){
this.verifyCode = this.orderInfo.orderTicketDetailList[0].verifyCode
this.ticketStatus = this.orderInfo.orderTicketDetailList[0].ticketStatus
this.ticketCode = this.orderInfo.orderTicketDetailList[0].ticketCode
}
this.touristInfo = res.data.orderTouristList
if(this.ifyukuaiCode==''||typeof this.ifyukuaiCode=='undefined'){
if(this.orderInfo.orderType==1||this.orderInfo.orderType==3){
if(this.orderInfo.subOrderType!=4&&this.orderInfo.subOrderType!=5){
this.$nextTick(() => {
if(this.orderInfo.playDate.substr(0,10)==this.$commonjs.today()&&this.orderInfo.exchangeMode==4||this.orderInfo.playDate.substr(0,10)==this.$commonjs.today()&&this.orderInfo.exchangeMode==5){
this.dynamicCode()
this.qrCodeType=true
}else if(this.orderInfo.exchangeMode==1){
this.qecode()
this.qrCodeType=false
}
})
}
}
}
if(this.orderInfo.isFetch==1){//isFetch==1需要排队
this.getSortInfo()
},10000)
// this.$once('hook:beforeDestroy',()=>{
// clearTimeout(timer)
// })
this.timer2=setInterval(()=>{
this.getSortInfo()
},1000*120)
// this.$once('hook:beforeDestroy',()=>{
// clearInterval(timer)
// })
}
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
.catch((err) => {
this.timer3 = setTimeout(() => {
this.getDetail()
}, 2000)
})
},
getSortInfo(){//-------------------------排号信息加载
var areaCode = this.orderInfo.areaCode
var orderNum = this.orderInfo.orderNum
var userId = this.openId
var orderId = this.orderInfo.id
var verifyCode = this.ticketCode
let data={areaCode,orderNum,userId,orderId,verifyCode,'againNumber':0}
this.$request('distribution/distribution/getNewFetchInfo',data).then((res)=>{
if(res.code=='00'){
if(res.data.length>0){
this.sortsInfo = res.data[0]
this.companyId = this.sortsInfo.pays[0].companyId
var sortArr = []
sortArr.push(this.sortsInfo.sorts[0])
this.sortsAll = this.sortsInfo.sorts
var northArr = null
var southArr = null
sortArr.forEach((item)=>{
if(item.projectId=='cjsd_project_0002'){//北站
if(northArr){
if(item.sortNo>northArr.sortNo){
northArr = item
}
}else{
northArr = item
}
}else{//南站
if(southArr){
if(item.sortNo>southArr.sortNo){
southArr = item
}
}else{
southArr = item
}
}
})
var arr = []
if(northArr){
arr.push(northArr)
}
if(southArr){
arr.push(southArr)
}
this.sortData = arr
//时间判断,当前时间是否大于可领号时间
var presentTimer = this.dateFormat()
var takeNumberTimer = this.getAfterDate(this.sortsInfo.sorts[0].createDate,this.sortsInfo.sorts[0].config.paReturnTripTime)
if(this.sortsInfo.sorts[0].sortFair==4||this.sortsInfo.sorts[0].sortFair==5){
clearTimeout(this.timerType)
if(presentTimer<takeNumberTimer){
this.countTime(takeNumberTimer)
}else{
this.returnTripType =true
}
}
}
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
}).catch((err)=>{
this.timer1=setTimeout(()=>{
this.getSortInfo()
},10000)
// this.$once('hook:beforeDestroy',()=>{
// clearTimeout(timer)
// })
})
},
sortAgain(item){//--------------------------------------重新排队
let data={
againNumber:1,
thirdId:this.sortsInfo.order.orderId,
areaCode:item.projectId,
userId:this.openId,
merchantCode:this.companyId,
}
this.$request('distribution/distribution/newFetchNumber',data).then((res)=>{
if(res.code=='00'){
this.getSortInfo()
this.maskType = false
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
qecode(){//生成二维码
if(this.verifyCode){
// let qrcode = new QRCode('qrcode',{
// width: 180,
// height: 180,
// text:this.verifyCode
// })
let verifyCode=''
if(this.visitorIndex!=''&&typeof this.visitorIndex!=undefined){
verifyCode=this.verifyCode+':'+this.visitorIndex
}else{
verifyCode=this.verifyCode
}
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: verifyCode,
size: 180,
margin: 10,
backgroundColor: '#ffffff',
foregroundColor: '#000000',
fileType: 'jpg',
errorCorrectLevel: uQRCode.errorCorrectLevel.H
})
},
sortAgain(item){//--------------------------------------重新排队
let data={
againNumber:1,
thirdId:this.sortsInfo.order.orderId,
areaCode:item.projectId,
userId:this.openId,
merchantCode:this.companyId,
}
this.$request('distribution/distribution/newFetchNumber',data).then((res)=>{
if(res.code=="00"){
this.getSortInfo()
this.maskType = false
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
qecode(){//生成二维码
if(this.verifyCode){
// let qrcode = new QRCode('qrcode',{
// width: 180,
// height: 180,
// text:this.verifyCode
// })
let verifyCode=""
if(this.visitorIndex!=""&&typeof this.visitorIndex!=undefined){
verifyCode=this.verifyCode+":"+this.visitorIndex
}else{
verifyCode=this.verifyCode
}
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: verifyCode,
size: 180,
margin: 10,
backgroundColor: '#ffffff',
foregroundColor: '#000000',
fileType: 'jpg',
errorCorrectLevel: uQRCode.errorCorrectLevel.H
})
}
},
signOverFun(item){//过号遮罩显示
this.overSignedData = {};
this.overSignedData = item
if(item.config.paPassedNumTakeType==1){
this.maskType = true;
}else{
this.sortAgain(item);
}
},
dynamicCodeRefresh(){
// 获取当前显示第几个二维码
let codes=this.codes
let now = new Date().getTime()
let nowTime = (now - this.codeStart)/1000
let code = null
// 寻找到当前时间的二维码
for(let i = 0 ; i < codes.length ; i++ ){
let item = codes[i]
nowTime -= item.timeout
if(nowTime <= 0 ){
code = item
break
}
}
// 全部遍历完成后,需要重新获取新的二维码
if(code == null){
this.dynamicCode()
} else if( code.code!=this.codeNo ){
this.codeNo = code.code
// if(document.querySelector('#qrcode img')){//移除子元素
// document.querySelector('#qrcode img').remove()
// document.querySelector('#qrcode canvas').remove()
// }
// let qrcode = new QRCode('qrcode',{//进入先获取二维码
// width: 180,
// height: 180,
// text:this.codeNo
// })
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: this.codeNo,
size: 180,
margin: 10,
backgroundColor: '#ffffff',
foregroundColor: '#000000',
fileType: 'jpg',
errorCorrectLevel: uQRCode.errorCorrectLevel.H
})
}
this.percentage+=1
if(this.percentage>=100){
this.percentage=0
}
},
dynamicCode(){//动态码
let data={
codeNo:this.ticketCode,//二维码编号
orderId:this.id,//订单号
userId:this.openId//openid
}
let verifyCode=""
if(this.visitorIndex!=""&&this.visitorIndex!=undefined){
data.codeNo=this.ticketCode+":"+this.visitorIndex
}else{
data.codeNo=this.ticketCode
}
clearInterval(this.codeFlag)
this.$request('distribution/distribution/getAutoCode',data).then((res)=>{
if(res.code == '00'){
this.codes = res.data.codes
this.codeStart = new Date().getTime()
this.codeFlag = setInterval(()=>{
this.dynamicCodeRefresh()
},300)
this.$once('hook:beforeDestroy', () => {
clearInterval(this.codeFlag)
})
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
}).catch((err)=>{
let timer=setTimeout(()=>{
this.dynamicCode()
},2000)
this.$once('hook:beforeDestroy', () => {
clearTimeout(timer)
})
})
},
copyText(value){//-------------------------复制内容
uni.setClipboardData({
data:value,
success:function(){
uni.showToast({
title: "复制成功",
icon: 'none'
})
}
})
},
dateFormat() {//时间格式化函数,此处仅针对yyyy-MM-dd hh:mm:ss 的格式进行格式化
var date=new Date();
var year=date.getFullYear();
/* 在日期格式中,月份是从0开始的,因此要加0
}
},
signOverFun(item){//过号遮罩显示
this.overSignedData = {}
this.overSignedData = item
if(item.config.paPassedNumTakeType==1){
this.maskType = true
}else{
this.sortAgain(item)
}
},
dynamicCodeRefresh(){
// 获取当前显示第几个二维码
let codes=this.codes
let now = new Date().getTime()
let nowTime = (now - this.codeStart)/1000
let code = null
// 寻找到当前时间的二维码
for(let i = 0 ; i < codes.length ; i++ ){
let item = codes[i]
nowTime -= item.timeout
if(nowTime <= 0 ){
code = item
break
}
}
// 全部遍历完成后,需要重新获取新的二维码
if(code == null){
this.dynamicCode()
} else if( code.code!=this.codeNo ){
this.codeNo = code.code
// if(document.querySelector('#qrcode img')){//移除子元素
// document.querySelector('#qrcode img').remove()
// document.querySelector('#qrcode canvas').remove()
// }
// let qrcode = new QRCode('qrcode',{//进入先获取二维码
// width: 180,
// height: 180,
// text:this.codeNo
// })
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: this.codeNo,
size: 180,
margin: 10,
backgroundColor: '#ffffff',
foregroundColor: '#000000',
fileType: 'jpg',
errorCorrectLevel: uQRCode.errorCorrectLevel.H
})
}
this.percentage+=1
if(this.percentage>=100){
this.percentage=0
}
},
dynamicCode(){//动态码
let data={
codeNo:this.ticketCode,//二维码编号
orderId:this.id,//订单号
userId:this.openId//openid
}
let verifyCode=''
if(this.visitorIndex!=''&&this.visitorIndex!=undefined){
data.codeNo=this.ticketCode+':'+this.visitorIndex
}else{
data.codeNo=this.ticketCode
}
clearInterval(this.codeFlag)
this.$request('distribution/distribution/getAutoCode',data).then((res)=>{
if(res.code == '00'){
this.codes = res.data.codes
this.codeStart = new Date().getTime()
this.codeFlag = setInterval(()=>{
this.dynamicCodeRefresh()
},300)
this.$once('hook:beforeDestroy', () => {
clearInterval(this.codeFlag)
})
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
}).catch((err)=>{
let timer=setTimeout(()=>{
this.dynamicCode()
},2000)
this.$once('hook:beforeDestroy', () => {
clearTimeout(timer)
})
})
},
copyText(value){//-------------------------复制内容
uni.setClipboardData({
data:value,
success:function(){
uni.showToast({
title: '复制成功',
icon: 'none'
})
}
})
},
dateFormat() {//时间格式化函数,此处仅针对yyyy-MM-dd hh:mm:ss 的格式进行格式化
var date=new Date()
var year=date.getFullYear()
/* 在日期格式中,月份是从0开始的,因此要加0
* 使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
* */
var month= date.getMonth()+1<10 ? "0"+(date.getMonth()+1) : date.getMonth()+1;
var day=date.getDate()<10 ? "0"+date.getDate() : date.getDate();
var hours=date.getHours()<10 ? "0"+date.getHours() : date.getHours();
var minutes=date.getMinutes()<10 ? "0"+date.getMinutes() : date.getMinutes();
var seconds=date.getSeconds()<10 ? "0"+date.getSeconds() : date.getSeconds();
// 拼接
return year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds;
},
getAfterDate(timer,n) {//当前时间后几分钟
var curTime = new Date(timer);
var d = new Date(curTime.setMinutes(curTime.getMinutes() + n)); //n是分钟,根据自己需求定义
var year = d.getFullYear();
var mon = d.getMonth() + 1;
var day = d.getDate();
var hour = d.getHours();
var minute = d.getMinutes();
var second = d.getSeconds();
var s = year + "-" + (mon < 10 ? ('0' + mon) : mon) + "-" + (day < 10 ? ('0' + day) : day) + ' ' + (hour < 10 ? ('0' + hour) : hour) + ':' + (minute < 10 ? ('0' + minute) : minute) + ':' + (second < 10 ? ('0' + second) : second);
return s;
},
countTime (timer) {//倒计时
// 获取当前时间
var date = new Date();
var now = date.getTime();
//设置截止时间
var endDate = new Date(timer);
var end = endDate.getTime();
//时间差
var leftTime = end - now;
//定义变量 d,h,m,s保存倒计时的时间
if (leftTime >= 0) {
this.d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
this.h = Math.floor(leftTime / 1000 / 60 / 60 % 24);
this.m = Math.floor(leftTime / 1000 / 60 % 60);
this.s = Math.floor(leftTime / 1000 % 60);
this.sum_h = this.d * 24 + this.h
}
if(this.d==0&&this.h==0&&this.m==0&&this.s==0){
this.returnTripType = true
}
//递归每秒调用countTime方法,显示动态时间效果
this.timerType = setTimeout(()=>{
var month= date.getMonth()+1<10 ? '0'+(date.getMonth()+1) : date.getMonth()+1
var day=date.getDate()<10 ? '0'+date.getDate() : date.getDate()
var hours=date.getHours()<10 ? '0'+date.getHours() : date.getHours()
var minutes=date.getMinutes()<10 ? '0'+date.getMinutes() : date.getMinutes()
var seconds=date.getSeconds()<10 ? '0'+date.getSeconds() : date.getSeconds()
// 拼接
return year+'-'+month+'-'+day+' '+hours+':'+minutes+':'+seconds
},
getAfterDate(timer,n) {//当前时间后几分钟
var curTime = new Date(timer)
var d = new Date(curTime.setMinutes(curTime.getMinutes() + n)) //n是分钟,根据自己需求定义
var year = d.getFullYear()
var mon = d.getMonth() + 1
var day = d.getDate()
var hour = d.getHours()
var minute = d.getMinutes()
var second = d.getSeconds()
var s = year + '-' + (mon < 10 ? ('0' + mon) : mon) + '-' + (day < 10 ? ('0' + day) : day) + ' ' + (hour < 10 ? ('0' + hour) : hour) + ':' + (minute < 10 ? ('0' + minute) : minute) + ':' + (second < 10 ? ('0' + second) : second)
return s
},
countTime (timer) {//倒计时
// 获取当前时间
var date = new Date()
var now = date.getTime()
//设置截止时间
var endDate = new Date(timer)
var end = endDate.getTime()
//时间差
var leftTime = end - now
//定义变量 d,h,m,s保存倒计时的时间
if (leftTime >= 0) {
this.d = Math.floor(leftTime / 1000 / 60 / 60 / 24)
this.h = Math.floor(leftTime / 1000 / 60 / 60 % 24)
this.m = Math.floor(leftTime / 1000 / 60 % 60)
this.s = Math.floor(leftTime / 1000 % 60)
this.sum_h = this.d * 24 + this.h
}
if(this.d==0&&this.h==0&&this.m==0&&this.s==0){
this.returnTripType = true
}
//递归每秒调用countTime方法,显示动态时间效果
this.timerType = setTimeout(()=>{
this.countTime(timer)
},1000)
},
refundJump(id){//-------------------景区跳转
uni.reLaunch({
url: '/pages/my/order/applyAfterSales/applyAfterSales?orderId='+id+'&ifyukuaiCode='+this.ifyukuaiCode
})
},
returnMini(){
//#ifdef MP-WEIXIN
wx.navigateBackMiniProgram({
},1000)
},
refundJump(id){//-------------------景区跳转
uni.reLaunch({
url: '/pages/my/order/afterSale/applyAfterSale/applyAfterSale?orderId='+id+'&ifyukuaiCode='+this.ifyukuaiCode
})
},
returnMini(){
//#ifdef MP-WEIXIN
wx.navigateBackMiniProgram({
extraData: {
cqQRCode:1
},
fail(res){
uni.showToast({
title:"获取失败,请退出后重新进入渝快码小程序获取验证码",
icon:"none",
duration:3000
title:'获取失败,请退出后重新进入渝快码小程序获取验证码',
icon:'none',
duration:3000
})
}
})
//#endif
})
//#endif
//#ifdef MP-ALIPAY
my.navigateBackMiniProgram({
extraData:{
cqQRCode:1
},
//#ifdef MP-ALIPAY
my.navigateBackMiniProgram({
extraData:{
cqQRCode:1
},
fail: (res) => {
uni.showToast({
title:"获取失败,请退出后重新进入渝快码小程序获取验证码",
icon:"none",
duration:3000
title:'获取失败,请退出后重新进入渝快码小程序获取验证码',
icon:'none',
duration:3000
})
}
})
//#endif
},
}
}
})
//#endif
},
}
}
</script>
<style scoped="scoped">
......
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