uniapp微信公众号内支付微信点金计划商家小票支付成功页代码

<template>
    <view>
         <view id="success">恭喜您,支付成功</view>
         <view @tap="go">联系客服</view>
    </view>
</template>
<script>    
    export default {
        data() {
            return {
            }
        },
        onLoad() {
        },
        onShow() {        
        },
        mounted() {
            
            // #ifdef H5
            let initData = {
                action: 'onIframeReady',
                displayStyle: 'SHOW_CUSTOM_PAGE',
                height: 960
            }
            let initPostData = JSON.stringify(initData)
            parent.postMessage(initPostData, "*")
            document.getElementById("success").onclick = function () {
                var mchData = {
                    action: 'jumpOut',
                    jumpOutUrl: 'https://www.xxx.com' //跳转你想去的页面
                }
                var postData = JSON.stringify(mchData)
                parent.postMessage(postData, "*")
            }
            const link = location.href
            let sub_mch_id = this.getQueryString(link, "sub_mch_id"); //特约商户号
            let out_trade_no = this.getQueryString(link, "out_trade_no"); //商户订单号    
            console.log("以下进入你的骚操作")
            // #endif
            
        },
        
        methods: {
            
            //获取URL参数
            getQueryString(path,name){
                const reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
                if (reg.test(path)) {
                    return unescape(RegExp.$2.replace(/\+/g, " "));
                }
                return "";
            }
            
            //跳转
            go() {
                window.location.assign('https://www.xxx.com')
            },
        },
    }

</script>

相关问题链接https://developers.weixin.qq.com/community/develop/article/doc/0002e816648fe0e42b2b4305a53c13

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐