123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441 |
- <template>
- <view style="padding-top: 50rpx;">
- <view v-if="!showSignup">
- <view class="top">
- <image src="https://qnys.chuliu.cc/daweiboshi_szy/1_1615541900_nrG1vctYn8.jpg"
- mode="widthFix" style="width: 750rpx;margin-bottom: 60rpx;"></image>
- <view class="title">
- 第{{ data.season }}届大卫博士创业实战营(线上)
- </view>
- <view class="time">
- 举办时间:{{ data.start + '-' + data.end }}
- </view>
- <view v-if="data.status == 1" class="btnSig gray">已获取名额</view>
- <view v-else class="btnSig" :class="status ? 'red' : 'gray'" v-throttle="2000" @click="singup">点击获取名额</view>
- </view>
- </view>
- <view class="voucher" v-else>
- <image src="../../static/new_my/bg.png" class="bgImg" mode="widthFix" style="width: 750rpx;"></image>
- <view class="bgImg">
- <text style="margin-top: 30rpx;">第{{ data.season }}届大卫博士创业实战营(线上)</text>
- </view>
- <view class="voucher_con">
- <view class="voucher_icon">
- <image src="../../static/icon/success.png" mode="widthFix" style="width: 300rpx;margin-top: 78rpx;">
- <!-- <image :src="`../../static/icon/${data.pay_status ? 'success' : 'show'}.png`" mode="widthFix" style="width: 300rpx;margin-top: 78rpx;"> -->
- </image>
- <view class="success">{{ data.pay_status ? '报名成功' : '报名成功,请把钱转给老大' }}</view>
- <view class="timed">
- 举办时间:{{ data.start+ '-' +data.end }}
- </view>
- </view>
- <view class="info" v-show="data.pay_status">
- <view>
- <text>收货人:</text>
- <text>{{ info.username }}</text>
- </view>
- <view>
- <text>手机号:</text>
- <text>{{ info.mobile }}</text>
- </view>
- <view>
- <text>收货地址:</text>
- <text>{{ info.local }}</text>
- </view>
- <navigator url="./information" class="info_btn">编辑地址</navigator>
- </view>
- </view>
- </view>
- <!-- <view class="bottom" v-if="showSignup">
- <view class="bottom-btn" @click="goBack">返回首页</view>
- <view v-else class="bottom-btn" v-throttle="2000" @click="singup">立即支付</view>
- </view> -->
- </view>
- </template>
- <script>
- import {
- _API_payment,
- _API_SearchStatus,
- GetEnrollInfo,
- GetEnrollUserAddress,
- GetSzyGiftInfo
- } from '@/apis/szy.js';
- export default {
- data() {
- return {
- showTip: false,
- status: false,
- info: {},
- data: {
- season: '',
- start: '',
- end: '',
- username: '',
- mobile: '',
- cost: '',
- local: ''
- },
- noClick: true,
- showSignup: false,
- }
- },
- onShow() {
- this.getInfo()
- },
- computed: {
- userinfo() {
- return this.$store.state.userinfo
- }
- },
- onPullDownRefresh() {
- this.getInfo()
- },
- methods: {
- // 查看物流信息
- toLogistics() {
- uni.navigateTo({
- url: "/pages/szy-logistics/szy-logistics?info=" + JSON.stringify(this.logInfo)
- })
- },
- // 返回首页
- goBack() {
- uni.switchTab({
- url: '/pages/index/index'
- })
- },
- // 获取赛季信息
- getInfo() {
- GetEnrollInfo().then(res => {
- if (res.code == 200) {
- // console.log(res.data)
- // res.data.status = 1
- // res.data.pay_status = 1
- this.data = res.data
- this.data.start = this.getTimes(res.data.start_time)
- this.data.end = this.getTimes(res.data.end_time)
- // res.data.enroll_start_time = '2023-10-15 10:30:00'
- const a = new Date(res.data.enroll_start_time.replace(/-/g,'/')).getTime()
- const b = new Date(res.data.enroll_end_time.replace(/-/g,'/')).getTime()
- const now = Date.parse(new Date())
- if (now > a && now < b && res.data.limit_num > res.data.num) {
- this.status = true
- }
- if (res.data.status == 1) {
- this.showSignup = true
- } else {
- this.showSignup = false
- }
- if (res.data.pay_status) {
- this.getAddress()
- }
- } else {
- uni.showModal({
- content: res.message || '获取失败',
- showCancel: false
- })
- }
- })
- },
- getAddress() {
- GetEnrollUserAddress().then(res => {
- if (res.code === 200) {
- this.info = res.data
- const data = res.data
- this.info.local = data.province + data.city + data.area + data.address
- } else {
- uni.showModal({
- content: res.message || '获取失败',
- showCancel: false
- })
- }
- })
- },
- getTimes(data) {
- var time = new Date(data.replace(/-/g,'/'))
- var year = time.getFullYear()
- var month = time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1;
- var day = time.getDate() < 10 ? '0' + time.getDate() : time.getDate();
- var today = year + '.' + month + '.' + day;
- return today;
- },
- // 支付状态
- SearchStatus() {
- uni.showLoading({
- mask: true
- })
- _API_SearchStatus().then(res => {
- uni.hideLoading()
- if (res.code == 200) {
- this.getInfo()
- } else {
- uni.showModal({
- content: res.message || '获取失败',
- showCancel: false
- })
- }
- })
- },
- //WeixinJSBridge判断
- wxJsPay(data, callback_succ_func, callback_error_func) {
- if (typeof WeixinJSBridge == 'undefined') {
- if (document.addEventListener) {
- document.addEventListener('WeixinJSBridgeReady', this.jsApiCall, false);
- } else if (document.attachEvent) {
- document.attachEvent('WeixinJSBridgeReady', this.jsApiCall);
- document.attachEvent('onWeixinJSBridgeReady', this.jsApiCall);
- }
- } else {
- this.jsApiCall(data, callback_succ_func, callback_error_func);
- }
- },
- //调起支付
- jsApiCall(data, callback_succ_func, callback_error_func) {
- let that = this
- //使用原生的,避免初始化appid问题
- WeixinJSBridge.invoke(
- 'getBrandWCPayRequest', {
- appId: data.appId,
- timeStamp: data.timestamp,
- nonceStr: data.nonceStr,
- package: data.package,
- signType: data.signType,
- paySign: data.paySign
- },
- function(res) {
- var msg = res.err_msg ? res.err_msg : res.errMsg;
- switch (msg) {
- //支付成功时
- case 'get_brand_wcpay_request:ok':
- if (callback_succ_func) {
- uni.showModal({
- title: '支付成功',
- showCancel: false
- })
- callback_succ_func(res);
- }
- break;
- default:
- //支付失败时
- WeixinJSBridge.log('支付失败!' + msg + ',请返回重试.');
- if (callback_error_func) {
- callback_error_func({
- msg: msg
- });
- }
- break;
- }
- }
- );
- },
- singup() {
- if (!this.status && !this.data.status) {
- return
- }
- let that = this
- uni.showModal({
- title: '提示',
- content: '确定要获取名额吗?',
- success: (res) => {
- if (res.confirm) {
- _API_payment().then(res => {
- if (res.code == 200) {
- that.SearchStatus()
- } else {
- uni.showModal({
- title: '失败',
- content: res.message || '获取失败',
- showCancel: false
- })
- return false;
- }
- })
- .catch(err => {})
- .finally(() => {
- setTimeout(() => {}, 3000)
- })
- }
- }
- })
- }
- },
- }
- </script>
- <style>
- </style>
- <style lang="scss" scoped>
- .top {
- margin: 0 30rpx 0 30rpx;
- border-radius: 16rpx;
- background-color: #fff;
- padding: 40rpx 20rpx 40rpx 20rpx;
-
- }
-
- .tip {
- font-size: 36rpx;
- text-align: center;
- font-weight: bold;
- margin-top: 30rpx;
- color: #FB231F;
- }
- .title {
- font-size: 34rpx;
- font-weight: bold;
- }
- .time {
- margin-top: 20rpx;
- font-size: 32rpx;
- }
- .btnSig {
- margin: 50rpx auto 0;
- width: 600rpx;
- line-height: 88rpx;
- border-radius: 44rpx;
- text-align: center;
- color: #fff;
- font-size: 32rpx;
- }
- .red {
- background: linear-gradient(93deg, #FF232C 0%, #FF571B 100%);
- }
- .gray {
- background-color: #E1E1E1;
- }
- .voucher {
- hieght: 100vh;
- min-height: 100vh;
- width: 100vw;
- position: relative;
- .bgImg {
- height: 100vh;
- width: 100vw;
- position: fixed;
- top: 0;
- left: 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- font-size: 46rpx;
- font-weight: bold;
- text {
- color: #FFFFFF;
- margin-top: 10rpx;
- }
- }
- .voucher_con {
- position: fixed;
- height: 85%;
- width: 100%;
- bottom: 0;
- left: 0;
- background: #fff;
- border-top-left-radius: 60rpx;
- border-top-right-radius: 60rpx;
- .line {
- width: 128rpx;
- height: 8rpx;
- background: #f1f3f5;
- margin: 36rpx auto 0;
- }
- .title {
- color: #333;
- font-size: 38rpx;
- // margin: 48rpx auto 60rpx;
- text-align: center;
- font-weight: bold;
- }
- .voucher_icon {
- text-align: center;
- // image {
- // height: 192rpx;
- // width: 192rpx;
- // margin-bottom: 30rpx;
- // }
- .success {
- margin-top: 18rpx;
- font-size: 48rpx;
- color: #333;
- font-weight: bold;
- }
- .timed {
- margin-top: 36rpx;
- font-size: 40rpx;
- font-weight: bold;
- color: #FF0000;
- }
- }
- .logistics {
- width: 250rpx;
- height: 68rpx;
- margin: 0 auto;
- background: rgba(255, 244, 243, 0.39);
- border: 2rpx solid #FB231F;
- opacity: 1;
- border-radius: 44rpx;
- color: #FB231F;
- }
- .info {
- margin: 68rpx 50rpx 40rpx 50rpx;
- color: #333333;
- text {
- font-size: 32rpx;
- }
- >view {
- margin-top: 20rpx;
- }
- &_btn {
- margin: 30rpx auto 0 !important;
- width: 388rpx;
- line-height: 80rpx;
- text-align: center;
- background: #FFF4F3;
- border: 2rpx solid #FB231F;
- opacity: 1;
- border-radius: 44rpx;
- font-size: 30rpx;
- font-weight: bold;
- color: #FB231F;
- }
- }
- }
- }
- .bottom {
- position: fixed;
- bottom: 0;
- width: 100%;
- height: 100rpx;
- padding: 6rpx 30rpx;
- background-color: #fff;
- border-top: 1px solid #eeeeee;
- &-btn {
- color: #fff;
- text-align: center;
- font-size: 32rpx;
- font-weight: bold;
- line-height: 88rpx;
- height: 88rpx;
- background: linear-gradient(90deg, #F30000 0%, #FE4815 100%);
- opacity: 1;
- border-radius: 44px;
- }
- }
- </style>
|