zhb 2 veckor sedan
förälder
incheckning
3b441cc06f

+ 68 - 0
components/cwg-pay-webview-popup.vue

@@ -0,0 +1,68 @@
+<template>
+  <cwg-popup
+    :visible="visible"
+    :title="displayTitle"
+    width="min(920px, 94vw)"
+    :show-footers="false"
+    footer-type="none"
+    :mask-click="true"
+    @update:visible="onVisibleChange"
+    @close="handleClose"
+  >
+    <view class="pay-webview-body">
+      <!-- #ifdef H5 -->
+      <iframe v-if="payUrl" :src="payUrl" class="pay-webview-frame" frameborder="0" />
+      <!-- #endif -->
+    </view>
+  </cwg-popup>
+</template>
+
+<script setup>
+import { computed } from 'vue'
+import { useI18n } from 'vue-i18n'
+import { payWebviewState, closePayWebview } from '@/hooks/usePayWebview'
+
+const { t } = useI18n()
+
+const visible = computed({
+  get: () => payWebviewState.value.visible,
+  set: (val) => {
+    if (!val) closePayWebview()
+  },
+})
+
+const payUrl = computed(() => payWebviewState.value.url)
+
+const displayTitle = computed(() => {
+  return t('Shop.Order.OrderDetails')
+})
+
+function onVisibleChange(val) {
+  if (!val) closePayWebview()
+}
+
+function handleClose() {
+  closePayWebview()
+}
+</script>
+
+<style scoped lang="scss">
+@import "@/uni.scss";
+
+.pay-webview-body {
+  width: 100%;
+  height: 70vh;
+  min-height: px2rpx(360);
+  max-height: 80vh;
+  overflow: hidden;
+  border-radius: px2rpx(8);
+  background: var(--bs-body-bg, #fff);
+}
+
+.pay-webview-frame {
+  width: 100%;
+  height: 100%;
+  border: none;
+  display: block;
+}
+</style>

+ 21 - 0
hooks/usePayWebview.js

@@ -0,0 +1,21 @@
+import { ref } from 'vue'
+
+export const payWebviewState = ref({
+  visible: false,
+  url: '',
+  title: '',
+})
+
+export function openPayWebview(url, title = '') {
+  if (!url) return
+  payWebviewState.value = {
+    visible: true,
+    url,
+    title,
+  }
+}
+
+export function closePayWebview() {
+  payWebviewState.value.visible = false
+  payWebviewState.value.url = ''
+}

+ 3 - 3
manifest.json

@@ -104,9 +104,9 @@
             "splashscreen" : {
                 "androidStyle" : "default",
                 "android" : {
-                    "hdpi" : "static/res 4/drawable-hdpi/splash.9.png",
-                    "xxhdpi" : "static/res 4/drawable-xxhdpi/splash.9.png",
-                    "xhdpi" : "static/res 4/drawable-xhdpi/splash.9.png"
+                    "hdpi" : "static/res 4/480x762.png",
+                    "xxhdpi" : "static/res 4/1080x1882.png",
+                    "xhdpi" : "static/res 4/720x1242.png"
                 },
                 "iosStyle" : "storyboard",
                 "ios" : {

+ 5 - 1
pages/customer/components/CheckPopup.vue

@@ -60,7 +60,11 @@ const toHistory = () => {
 }
 // 去支付
 const GoPayBtn = () => {
-  openExternalUrl(props.goPayLink)
+  if (props.goPayLink?.includes('onchainpay.html')) {
+    openExternalUrl(props.goPayLink, 'pay')
+  } else {
+    openExternalUrl(props.goPayLink)
+  }
 }
 // 复制分享链接
 const CopyShareLink = (link) => {

+ 2 - 1
pages/customer/deposit.vue

@@ -378,6 +378,7 @@
         <!-- 数字支付确认弹窗 -->
         <DigitalPayConfirmPopup v-model:visible="dialogDigitalPayConfirm" :WireTransferAccount="WireTransferAccount"
             @close="closeDigitalPayConfirm" @confirm="confirmDigitalPayModal" />
+        <cwg-pay-webview-popup />
     </cwg-page-wrapper>
 </template>
 
@@ -1349,7 +1350,7 @@ const submit = async () => {
                         goPayLink.value = setCardUrl(res.data.result)
                         openExternalUrl(goPayLink.value)
                     } else if (res.data.type == 10) {
-                        goPayLink.value = Host80 + '/pay/onchainpay.html?params=' + res.data.result
+                        goPayLink.value = Host80 + '/pay/onchainpay.html?params=' + res.data.result + '&language=' + locale.value
                         openExternalUrl(goPayLink.value)
                     }
                     if (res.data.type != 5) {

+ 32 - 8
utils/openExternalUrl.js

@@ -1,13 +1,37 @@
-export function openExternalUrl(url) {
+import { openPayWebview } from '@/hooks/usePayWebview'
+
+/**
+ * 打开外部链接
+ * @param {string} url
+ * @param {string} [type] 'pay' 支付页:App 内 webview 页,H5 弹窗 iframe
+ * @param {{ title?: string }} [options]
+ */
+export function openExternalUrl(url, type, options = {}) {
+  if (!url) return
+
+  const title = options.title || 'Shop.Order.OrderDetails'
+
+  if (type === 'pay') {
     // #ifdef APP-PLUS
-    plus.runtime.openURL(url, (error) => {
-        if (error) {
-            uni.showToast({ title: '打开失败', icon: 'none' });
-        }
-    });
+    const webviewUrl = `/pages/common/webview?url=${encodeURIComponent(url)}&title=${encodeURIComponent(title)}`
+    uni.navigateTo({ url: webviewUrl })
     // #endif
 
     // #ifdef H5
-    window.open(url, '_blank');
+    openPayWebview(url, title)
     // #endif
-}
+    return
+  }
+
+  // #ifdef APP-PLUS
+  plus.runtime.openURL(url, (error) => {
+    if (error) {
+      uni.showToast({ title: '打开失败', icon: 'none' })
+    }
+  })
+  // #endif
+
+  // #ifdef H5
+  window.open(url, '_blank')
+  // #endif
+}