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.
 
 
 
 
 
zhishifufei_uniapp/pages/my/order_verify.vue

207 lines
8.1 KiB

<template>
<BaseContainer>
<NavBar title="报名核销" />
<view class="activity-verify">
<view class="one">
<view v-if="order.status==0">待核销</view>
<view v-else-if="order.status==1">已核销</view>
<view>报名成功请在活动时间内到活动地点核销</view>
</view>
<view class="two" @click="activityDetails(activity.id)">
<view>
<image :src="activity.image" />
</view>
<view>
<view v-text="activity.title"></view>
<view><text>{{activity.price}}</text></view>
</view>
</view>
<view class="three">
<view>核销信息</view>
<view>
<view>
<view>活动时间</view>
<view>{{ activity.start_time | timeFormat }}{{ activity.end_time | timeFormat }}</view>
</view>
<view>
<view>活动地址</view>
<view>{{activity.province}}{{activity.city}}{{activity.district}}{{activity.detail}}</view>
</view>
<view>
<view>活动状态</view>
<view v-if="activity.statu == 0 || activity.statu == 1 || activity.statu == 2">活动未开始</view>
<view v-else-if="activity.statu == 3">活动已开始</view>
<view v-else-if="activity.statu == 4">活动已结束</view>
</view>
<view>
<view>核销状态:</view>
<view v-if="order.status == 0">未核销</view>
<view v-else-if="order.status == 1">已核销</view>
</view>
<view class="qrcode">
<view>
<image class="qrcodeimage" :class="order.status == 1 ? 'on' : ''" :src="write_off_code" />
<image v-if="write_off_code && order.status == 1" class="qrcodeno" :src="getImgPath('/wap/first/zsff/images/c3.png')" />
</view>
<view>券码 {{ order.code }}</view>
</view>
</view>
</view>
<view class="four">
<view>订单信息</view>
<view>
<view v-for="item in userInfo">
<view>{{ item.event_name }}</view>
<view>{{ item.event_value }}</view>
</view>
<view>
<view>人数</view>
<view>{{ order.number }}</view>
</view>
<view>
<view>订单编号</view>
<view>{{order_id}}</view>
</view>
<view>
<view>支付时间</view>
<view>{{order.add_time | timeFormat}}</view>
</view>
<view>
<view>支付金额</view>
<view>{{order.pay_price}}</view>
</view>
</view>
</view>
</view>
</BaseContainer>
</template>
<script>
import { orderStatus, getActivitySign, activityDetails } from "@/api/order_verify";
import { getMiniprogramQrcodeByPage } from "@/api/auth";
export default {
data() {
return {
order: {},
activity: {},
order_id: 0,
status: 0,
userInfo: [],
write_off_code:''
};
},
filters: {
timeFormat: function (value) {
if (!value) {
return '--';
}
return dateFormat(value * 1000);
}
},
computed: {
},
onLoad({ order_id }) {
this.order_id = order_id
},
mounted() {
this.getActivitySign();
if (this.status == 0) {
setInterval(this.orderStatus, 60000);
}
},
methods: {
getMiniprogramQrcodeBy(){
let full_path = 'pages/my/sign_order';
let scene = `type=2&oid=${this.order.id}`
getMiniprogramQrcodeByPage(full_path, scene).then(res => {
this.write_off_code = res.data.url
console.log(this.write_off_code)
}).catch(err => {
return this.$util.showMsg(err.msg);
})
},
dateFormat(time) {
let date = new Date(time);
let year = date.getFullYear();
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
// 拼接
// return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
return year + "-" + month + "-" + day + ' ' + hours + ":" + minutes;
},
orderStatus: function () {
var vm = this;
orderStatus(this.order_id).then(res => {
if (res.data == 1) {
//window.location.assign("{:url('wap/my/sign_list')}");
}
})
},
getActivitySign: function () {
var vm = this;
getActivitySign(this.order_id).then(res => {
var data = res.data;
vm.order = data;
// #ifdef MP-WEIXIN
vm.getMiniprogramQrcodeBy();
// #endif
// #ifdef APP-PLUS || H5
vm.write_off_code = data.write_off_code
// #endif
vm.activity = data.activity;
vm.status = data.status;
vm.userInfo = JSON.parse(data.user_info);
})
},
activityDetails: function (id) {
/* activityDetails(id).then(res=>{
})
window.location.assign($h.U({
c: 'special',
a: 'activity_details',
q: {
id: id
}
})); */
}
},
};
function dateFormat(time) {
let date = new Date(time);
let year = date.getFullYear();
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
// 拼接
// return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
return year + "-" + month + "-" + day + ' ' + hours + ":" + minutes;
};
</script>
<style>
page {
background: #F5F5F5;
}
.qrcodeimage.on{
opacity: 0.4;
}
.qrcodeno{
margin-top: -260rpx;
}
</style>