更新记录

1.0.0(2024-12-10)

模组需要切换到HID POS状态


平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 4.36,Android:6.0,iOS:不支持,HarmonyNext:不确定 × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×
<template>
    <view class="">
        <view class="mask" :style="'width: '+screenWidth+'px;height: '+screenHeight+'px;'">
            <view class="page-pay">
                <image class="home_bg" style="width: 600px;height: 450px;" src="./../static/images/bg.jpg"></image>
                <view class="countdown-pay">
                    <!-- <text class="countdown-pay-text">{{time}}</text> -->
                    <laowu-countdown @close="payClose" class="laowu-countdown" style="" />
                </view>
                <view class="pay_type">
                    <view class="pay_item">
                        <view class="pay_button">
                            <image class="icon" src="../../static/images/weixin.png" mode=""></image>
                            <image style="width: 80px;height: 25px" class="image_text"
                                src="../../static/images/weixinzhifu.png" mode=""></image>
                        </view>
                    </view>
                    <view class="pay_item">
                        <view class="pay_button">
                            <image class="icon" src="../../static/images/aliy.png" mode=""></image>
                            <image style="width: 76px;height: 25px" class="image_text"
                                src="../../static/images/zhifubao.png" mode=""></image>
                        </view>
                    </view>
                </view>
                <view class="pay-content">
                    <image class="price_text" src="../../static/images/zhifujine.png" mode=""></image>
                    <text class="price_num">
                        ¥ {{ order['price'] }}
                    </text>

                    <image class="price_tips" src="../../static/images/qingshushinidefukuanma.png" mode=""></image>

                    <view class="cancel" @click="cancelNo">
                        <image class="border" src="../../static/images/quxiaok.png" mode=""></image>
                        <image class="text" src="../../static/images/quxiaotext.png" style="width: 50px;height: 30px"
                            mode="">
                        </image>
                    </view>
                </view>
                <image class="tips" src="../../static/images/zhifuguochengzhong.png" mode="">
                </image>
            </view>
            <laowu-scan-hid ref="laowu-scan-hid" @scanSuccess="scanSuccess"></laowu-scan-hid>
        </view>
    </view>
</template>

<script lang='uts'>
    import BroadcastReceiver from 'android.content.BroadcastReceiver'
    import Context from 'android.content.Context'
    import Intent from 'android.content.Intent'
    import IntentFilter from 'android.content.IntentFilter'
    import Build from 'android.os.Build'
    import View from 'android.view.View';

    class MyReciver extends BroadcastReceiver {

        private comp: PayComponentPublicInstance;

        constructor(comp: PayComponentPublicInstance) {
            this.comp = comp;
        }

        override onReceive(context: Context, intent: Intent) {
            var action = intent.getAction()
            console.log('廣播來了')
            if (action.equals("ACTION_FROM_NATIVE")) {
                var value = intent.getStringExtra("key");
                console.log(value);
                this.comp.scanSuccessGb(value as string)
            }
        }
    }

    export default {
        name: "pay",
        data() {
            return {
                receiver: null as BroadcastReceiver | null,
                // 是否开始支付,避免重复扫码支付
                isPayStatus: true
            };
        },
        created() {
            this.isPayStatus = true
            // 注册广播
            this.receiver = new MyReciver(this)
            if (Build.VERSION.SDK_INT >= 33) {
                UTSAndroid.getUniActivity()?.registerReceiver(this.receiver, IntentFilter("ACTION_FROM_NATIVE"), Context
                    .RECEIVER_EXPORTED)
            } else {
                UTSAndroid.getUniActivity()?.registerReceiver(this.receiver, IntentFilter("ACTION_FROM_NATIVE"))
            }

        },
        methods: {
            // 广播
            scanSuccessGb(code: string) {
                if (code != "" && this.isPayStatus) {
                    this.startPay(code)
                }
            }
        }
    }
</script>

<style lang="scss">

</style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问