|
|
@@ -28,6 +28,10 @@
|
|
|
-->
|
|
|
</view>
|
|
|
|
|
|
+ <!-- #ifdef H5 -->
|
|
|
+ <canvas :canvas-id="canvasId" style="width: 800px; height: 800px; position: fixed; top: -9999px; left: -9999px;"></canvas>
|
|
|
+ <!-- #endif -->
|
|
|
+
|
|
|
<!-- 提现表单区域 -->
|
|
|
<view class="form-card">
|
|
|
<!-- 提现金额 -->
|
|
|
@@ -54,11 +58,11 @@
|
|
|
<!-- 注意事项 -->
|
|
|
<view class="notes">
|
|
|
<view class="note-title">注意事项</view>
|
|
|
- <view class="note-item">01.提现金额请填写整数;</view>
|
|
|
- <view class="note-item">02.本次提现仅支持sLGNS币种;</view>
|
|
|
- <view class="note-item">03.提现将收取5%的滑点费用;</view>
|
|
|
- <view class="note-item">04.请仔细核对提现地址,地址填写错误导致的资产损失,平台不予负责;</view>
|
|
|
- <view class="note-item">05.提现24小时内到账;</view>
|
|
|
+ <view class="note-item">1.提现金额请填写整数;</view>
|
|
|
+ <view class="note-item">2.本次提现仅支持sLGNS币种;</view>
|
|
|
+ <view class="note-item">3.提现将收取5%的手续费;</view>
|
|
|
+ <view class="note-item">4.请仔细核对提现地址,地址填写错误导致的资产损失,平台不予负责;</view>
|
|
|
+ <view class="note-item">5.考虑到资金安全,提现需要人工审核,提现申请后会在24h内到账,请耐心等待,需要咨询可以联系客服:{{this.$Cache.getItem('platChatConfig').servicePhone}};</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -90,9 +94,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+
|
|
|
import { mapGetters } from "vuex";
|
|
|
- import { sLgnsWithdrawApi } from "@/api/user.js";
|
|
|
+ import { sLgnsWithdrawApi,getRechargeApi } from "@/api/user.js";
|
|
|
import { rmbToLgns, getRmbToLgnsRate } from "@/utils";
|
|
|
+ // #ifdef H5
|
|
|
+ import jsQR from "jsqr";
|
|
|
+ // #endif
|
|
|
let app = getApp();
|
|
|
|
|
|
export default {
|
|
|
@@ -104,7 +112,10 @@
|
|
|
rate: '',
|
|
|
sLGNS: 0, // 余额
|
|
|
showHistory: false,
|
|
|
- historyList: []
|
|
|
+ historyList: [],
|
|
|
+ // #ifdef H5
|
|
|
+ canvasId: 'qr-canvas',
|
|
|
+ // #endif
|
|
|
};
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
@@ -133,12 +144,92 @@
|
|
|
},
|
|
|
scanCode() {
|
|
|
// 扫码逻辑
|
|
|
+ // #ifdef MP || APP-PLUS
|
|
|
uni.scanCode({
|
|
|
+ scanType: ['qrCode', 'barCode'],
|
|
|
success: (res) => {
|
|
|
this.address = res.result;
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ // console.log(err);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+
|
|
|
+ // #ifdef H5
|
|
|
+ // 使用图片选择+jsQR解析
|
|
|
+ uni.chooseImage({
|
|
|
+ count: 1,
|
|
|
+ sizeType: ['compressed'],
|
|
|
+ sourceType: ['camera', 'album'],
|
|
|
+ success: (res) => {
|
|
|
+ this.scanImageH5(res.tempFilePaths[0]);
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ // console.log('选择图片失败', err);
|
|
|
}
|
|
|
});
|
|
|
+ // #endif
|
|
|
},
|
|
|
+ // #ifdef H5
|
|
|
+ scanImageH5(tempFilePath) {
|
|
|
+ uni.showLoading({ title: '识别中...' });
|
|
|
+
|
|
|
+ uni.getImageInfo({
|
|
|
+ src: tempFilePath,
|
|
|
+ success: (image) => {
|
|
|
+ const ctx = uni.createCanvasContext(this.canvasId, this);
|
|
|
+ const width = image.width;
|
|
|
+ const height = image.height;
|
|
|
+
|
|
|
+ // 限制尺寸以提高性能和避免内存问题,同时包含在canvas尺寸内(800x800)
|
|
|
+ const maxDim = 800;
|
|
|
+ // 计算缩放比例,保证宽高都不超过800
|
|
|
+ const scale = Math.min(maxDim / width, maxDim / height, 1);
|
|
|
+
|
|
|
+ const drawWidth = Math.floor(width * scale);
|
|
|
+ const drawHeight = Math.floor(height * scale);
|
|
|
+
|
|
|
+ // 清空画布
|
|
|
+ ctx.clearRect(0, 0, maxDim, maxDim);
|
|
|
+ ctx.drawImage(tempFilePath, 0, 0, drawWidth, drawHeight);
|
|
|
+ ctx.draw(false, () => {
|
|
|
+ // 增加延时确保H5端绘制完成
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.canvasGetImageData({
|
|
|
+ canvasId: this.canvasId,
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ width: drawWidth,
|
|
|
+ height: drawHeight,
|
|
|
+ success: (res) => {
|
|
|
+ // jsQR 期望的是 Uint8ClampedArray,res.data 就是
|
|
|
+ const code = jsQR(res.data, res.width, res.height);
|
|
|
+ if (code) {
|
|
|
+ this.address = code.data;
|
|
|
+ this.$util.Tips({title: '识别成功'});
|
|
|
+ } else {
|
|
|
+ this.$util.Tips({title: '未识别到二维码,请重试'});
|
|
|
+ }
|
|
|
+ uni.hideLoading();
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.log('获取图片数据失败', err);
|
|
|
+ uni.hideLoading();
|
|
|
+ this.$util.Tips({title: '识别失败,请手动输入'});
|
|
|
+ }
|
|
|
+ }, this);
|
|
|
+ }, 300);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.log('获取图片信息失败', err);
|
|
|
+ uni.hideLoading();
|
|
|
+ this.$util.Tips({title: '加载图片失败'});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // #endif
|
|
|
submitWithdraw() {
|
|
|
// 提交逻辑
|
|
|
if(!this.amount) return this.$util.Tips({title: '请输入提现金额'});
|
|
|
@@ -491,4 +582,40 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /* H5 扫码覆盖层样式 */
|
|
|
+ /* #ifdef H5 */
|
|
|
+ .scan-overlay {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ background: rgba(0,0,0,0.8);
|
|
|
+ z-index: 999;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+
|
|
|
+ .scan-box {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .close-scan {
|
|
|
+ margin-top: 40rpx;
|
|
|
+ padding: 15rpx 60rpx;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 40rpx;
|
|
|
+ font-size: 28rpx;
|
|
|
+ color: #333;
|
|
|
+ z-index: 1000;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /* #endif */
|
|
|
</style>
|