|
|
@ -3,8 +3,11 @@ import { onLoad } from '@dcloudio/uni-app'; |
|
|
|
import { reactive, ref, onMounted, getCurrentInstance, computed } from "vue"; |
|
|
|
import confirmTemplate from "../../components/confirm_template.vue"; |
|
|
|
import ticketItem from "../../components/ticket_item.vue"; |
|
|
|
import { jsapiPreVerifyCertificates } from "../../api"; |
|
|
|
import { routeTo, showModal } from '@/utils/polish'; |
|
|
|
const stadiumInfo = ref({}); // 场馆信息 |
|
|
|
const ticketInfo = ref({}); // 票券信息 |
|
|
|
const verify_token = ref(''); |
|
|
|
onLoad(() => { |
|
|
|
|
|
|
|
}); |
|
|
@ -16,10 +19,79 @@ onMounted(() =>{ |
|
|
|
const instance = getCurrentInstance().proxy |
|
|
|
const eventChannel = instance.getOpenerEventChannel(); |
|
|
|
eventChannel.on('dataFromGrouponStadiums', function(data) { |
|
|
|
ticketInfo.value = data?.ticket || {}; |
|
|
|
stadiumInfo.value = data?.stadium || {}; |
|
|
|
let { ticket, stadium } = data; |
|
|
|
ticketInfo.value = ticket || {}; |
|
|
|
stadiumInfo.value = stadium || {}; |
|
|
|
pvc_func({ |
|
|
|
encrypted_codes: ticket?.encrypted_codes ?? '', |
|
|
|
stadium_id: stadium?.id ?? '', |
|
|
|
douyin_merchant_pay_amount: ticket?.douyin_merchant_pay_amount ?? '', |
|
|
|
certificate_id: ticket?.certificate_id ?? '', |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
function pvc_func({ |
|
|
|
encrypted_codes, stadium_id, douyin_merchant_pay_amount, certificate_id |
|
|
|
}){ |
|
|
|
jsapiPreVerifyCertificates({ |
|
|
|
data: { |
|
|
|
encrypted_codes, stadium_id, douyin_merchant_pay_amount, certificate_id |
|
|
|
}, |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
// routeTo(`/subpackage/groupon/pages/exchange_success`); |
|
|
|
console.log('jsapiPreVerifyCertificates', res); |
|
|
|
verify_token.value = res?.data?.verify_token ?? ''; |
|
|
|
}) |
|
|
|
} |
|
|
|
function confirmBtn(){ |
|
|
|
let _tVal = ticketInfo.value; |
|
|
|
|
|
|
|
const _query = { |
|
|
|
verifyToken: verify_token.value ?? '', |
|
|
|
poiId: '7174984639059068985', |
|
|
|
orderList: [{ |
|
|
|
orderId: _tVal?.order_id ?? '', |
|
|
|
certificateList: [{ |
|
|
|
code: _tVal?.certificate_id ?? '', |
|
|
|
times: 1 |
|
|
|
}] |
|
|
|
}], |
|
|
|
orderEntrySchema: { |
|
|
|
path: 'subpackage/order/pages/detail' |
|
|
|
}, |
|
|
|
success(res){ |
|
|
|
console.warn('verifyCertificates success', res); |
|
|
|
|
|
|
|
}, |
|
|
|
fail(err){ |
|
|
|
console.warn('verifyCertificates fail', err); |
|
|
|
showModal({ content: err?.errMsg ?? '兑换操作失败!' }) |
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
console.log('tt.verifyCertificates data -->', _query) |
|
|
|
return tt.verifyCertificates(_query); |
|
|
|
jsapiPreVerifyCertificates({ |
|
|
|
data: { |
|
|
|
encrypted_codes: _tVal?.encrypted_codes ?? '', |
|
|
|
verify_token: _tVal?.verify_token ?? '', |
|
|
|
stadium_id: stadiumInfo.value?.id ?? '', |
|
|
|
douyin_merchant_pay_amount: _tVal?.douyin_merchant_pay_amount ?? '', |
|
|
|
certificate_id: _tVal?.certificate_id ?? '', |
|
|
|
}, |
|
|
|
Catch: true, |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
// routeTo(`/subpackage/groupon/pages/exchange_success`); |
|
|
|
console.log('jsapiPreVerifyCertificates', res); |
|
|
|
|
|
|
|
console.log('verifyCertificates data -->', _query) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
@ -27,6 +99,7 @@ onMounted(() =>{ |
|
|
|
:stadiumLogo="stadiumInfo?.logo || ''" |
|
|
|
:stadiumName="stadiumInfo?.name || ''" |
|
|
|
:stadiumAddress="stadiumInfo?.address || ''" |
|
|
|
@click:confirm="confirmBtn" |
|
|
|
> |
|
|
|
<view class="ticket-info"> |
|
|
|
<view class="ti-content"> |
|
|
@ -55,6 +128,14 @@ onMounted(() =>{ |
|
|
|
></ticket-item> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<template #fixed> |
|
|
|
<view class="ti-fixed"> |
|
|
|
<view class="cf-price" v-if="0 >= 0"> |
|
|
|
<text class="cp-txt">应付金额:</text> ¥{{ 0 }} |
|
|
|
</view> |
|
|
|
<button v-if="verify_token" class="cf-btn" :class="{ 'cf-full': 0 < 0 }" @click="confirmBtn" data-eventsync>确认兑换</button> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</confirm-template> |
|
|
|
</template> |
|
|
|
|
|
|
@ -128,5 +209,31 @@ onMounted(() =>{ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
.ti-fixed{ |
|
|
|
@include ctf; |
|
|
|
.cf-btn{ |
|
|
|
@include clearBtn; |
|
|
|
flex-shrink: 0; |
|
|
|
flex-grow: 0; |
|
|
|
margin-left: 12upx; |
|
|
|
width: 240upx; |
|
|
|
text-align: center; |
|
|
|
border-radius: 20upx; |
|
|
|
background-color: $redColor; |
|
|
|
@include flcw(32upx, 88upx, #fff); |
|
|
|
&.cf-full{ |
|
|
|
flex-grow: 1; |
|
|
|
width: auto; |
|
|
|
} |
|
|
|
} |
|
|
|
.cf-price{ |
|
|
|
flex-grow: 1; |
|
|
|
@include flcw(40upx, 56upx, $redColor, 500); |
|
|
|
.cp-txt{ |
|
|
|
@include flcw(28upx, 56upx, #333); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |