|
|
@@ -19,9 +19,9 @@
|
|
|
<div class="text">微信扫描二维码进行支付</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="tips" v-if="isMobile">长按保存图片</div>
|
|
|
- <div class="mt-16" v-else>
|
|
|
- <n-button type="primary" @click="down" round block size="large">保存图片</n-button>
|
|
|
+ <!-- <div class="tips" v-if="isMobile">长按保存图片</div> -->
|
|
|
+ <div class="mt-16 w-3/4">
|
|
|
+ <n-button type="primary" @click="goChat" round block :loading="loading">我已支付</n-button>
|
|
|
</div>
|
|
|
|
|
|
<n-button text class="cancel" @click.stop="updateShow(false)"> 取消 </n-button>
|
|
|
@@ -34,6 +34,7 @@ import { NModal, NButton, NGradientText } from 'naive-ui'
|
|
|
import { ref, Ref, watch } from 'vue'
|
|
|
import QrcodeVue from 'qrcode.vue'
|
|
|
import html2canvas from 'html2canvas'
|
|
|
+import { useUserStore } from '@/store'
|
|
|
import { useBasicLayout } from '@/hooks/useBasicLayout'
|
|
|
import { fetchRedirectUrl } from '@/api'
|
|
|
|
|
|
@@ -41,9 +42,13 @@ const props = defineProps({
|
|
|
show: {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
+ },
|
|
|
+ planId: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
}
|
|
|
})
|
|
|
-const emit = defineEmits(['update:show'])
|
|
|
+const emit = defineEmits(['update:show', 'goChat'])
|
|
|
|
|
|
function updateShow(val: boolean) {
|
|
|
emit('update:show', val)
|
|
|
@@ -54,11 +59,27 @@ const shareUrl = ref('')
|
|
|
const isWechat = /micromessenger/i.test(navigator.userAgent)
|
|
|
|
|
|
const postRef: Ref<HTMLElement | null> = ref(null)
|
|
|
+const userStore = useUserStore()
|
|
|
watch(
|
|
|
() => props.show,
|
|
|
val => {
|
|
|
if (val) {
|
|
|
- //todo 在这里获取二维码链接
|
|
|
+ fetchRedirectUrl(
|
|
|
+ location.origin + '/api/membership/h5pay?userId=' + userStore.userInfo.id + '&planId=' + props.planId
|
|
|
+ ).then((res: any) => {
|
|
|
+ shareUrl.value = res.url
|
|
|
+ })
|
|
|
+ // setTimeout(() => {
|
|
|
+ // html2canvas(postRef.value!, {
|
|
|
+ // useCORS: true,
|
|
|
+ // allowTaint: true,https://chillgpt.raexmeta.com/api/membership/h5pay?userId=&planId=
|
|
|
+ // backgroundColor: null,
|
|
|
+ // scale: 3
|
|
|
+ // }).then(canvas => {
|
|
|
+ // console.log(canvas)
|
|
|
+ // imgUrl.value = canvas.toDataURL('image/png')
|
|
|
+ // })
|
|
|
+ // }, 500)
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
@@ -78,6 +99,14 @@ function down() {
|
|
|
}
|
|
|
|
|
|
const { isMobile } = useBasicLayout()
|
|
|
+
|
|
|
+const loading = ref(false)
|
|
|
+function goChat() {
|
|
|
+ loading.value = true
|
|
|
+ setTimeout(() => {
|
|
|
+ emit('goChat')
|
|
|
+ }, 200)
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
@@ -113,29 +142,29 @@ const { isMobile } = useBasicLayout()
|
|
|
.text {
|
|
|
font-size: 12px;
|
|
|
color: #5b4380;
|
|
|
- // margin-top: 16px;
|
|
|
+ margin-top: 16px;
|
|
|
position: relative;
|
|
|
- // &::before {
|
|
|
- // position: absolute;
|
|
|
- // left: -20px;
|
|
|
- // top: 50%;
|
|
|
- // content: '';
|
|
|
- // width: 12px;
|
|
|
- // height: 1px;
|
|
|
- // background: linear-gradient(270deg, #5b4380 0%, rgba(91, 67, 128, 0) 100%);
|
|
|
- // opacity: 0.8;
|
|
|
- // }
|
|
|
-
|
|
|
- // &::after {
|
|
|
- // position: absolute;
|
|
|
- // right: -20px;
|
|
|
- // top: 50%;
|
|
|
- // content: '';
|
|
|
- // width: 12px;
|
|
|
- // height: 1px;
|
|
|
- // background: linear-gradient(270deg, rgba(91, 67, 128, 0) 0%, #5b4380 100%);
|
|
|
- // opacity: 0.8;
|
|
|
- // }
|
|
|
+ &::before {
|
|
|
+ position: absolute;
|
|
|
+ left: -20px;
|
|
|
+ top: 50%;
|
|
|
+ content: '';
|
|
|
+ width: 12px;
|
|
|
+ height: 1px;
|
|
|
+ background: linear-gradient(270deg, #5b4380 0%, rgba(91, 67, 128, 0) 100%);
|
|
|
+ opacity: 0.8;
|
|
|
+ }
|
|
|
+
|
|
|
+ &::after {
|
|
|
+ position: absolute;
|
|
|
+ right: -20px;
|
|
|
+ top: 50%;
|
|
|
+ content: '';
|
|
|
+ width: 12px;
|
|
|
+ height: 1px;
|
|
|
+ background: linear-gradient(270deg, rgba(91, 67, 128, 0) 0%, #5b4380 100%);
|
|
|
+ opacity: 0.8;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|