This commit is contained in:
@@ -21,17 +21,21 @@ page {
|
|||||||
|
|
||||||
.box {
|
.box {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
background-image: url("../../static/ewm.png");
|
background-image: url('../../static/ewm.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
width: 608px;
|
width: 608px;
|
||||||
height: 457px;
|
height: 457px;
|
||||||
position: relative;
|
position: relative;
|
||||||
.qrcode {
|
.qrcode {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 280px;
|
width: 280px;
|
||||||
height: 280px;
|
height: 280px;
|
||||||
top: 14%;
|
top: 66px;
|
||||||
right: 9%;
|
right: 55px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,24 +5,25 @@
|
|||||||
<view class="desc">请在这里扫码</view>
|
<view class="desc">请在这里扫码</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="box">
|
<view class="box">
|
||||||
<!-- <image :src="`https://api.pwmqr.com/qrcode/create?url=${code}`"></image> -->
|
|
||||||
<!-- <view ref="qrcode" id="qrcode"></view> -->
|
|
||||||
<canvas class="qrcode" canvas-id="qrcode" id="qrcode"></canvas>
|
<canvas class="qrcode" canvas-id="qrcode" id="qrcode"></canvas>
|
||||||
|
<image class="img" :src="dataUrl" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onUnmounted, ref } from "vue";
|
import {onUnmounted, ref} from 'vue';
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro';
|
||||||
import { getAfterOrder } from "@/api/admin";
|
import {getAfterOrder} from '@/api/admin';
|
||||||
import UQRCode from "uqrcodejs";
|
import UQRCode from 'uqrcodejs';
|
||||||
|
|
||||||
const time_id = ref();
|
const time_id = ref();
|
||||||
|
|
||||||
|
const dataUrl = ref('');
|
||||||
|
|
||||||
const info = ref<any>({});
|
const info = ref<any>({});
|
||||||
|
|
||||||
Taro.useLoad((e) => {
|
Taro.useLoad(e => {
|
||||||
info.value = e;
|
info.value = e;
|
||||||
getCode();
|
getCode();
|
||||||
time_id.value = setInterval(async () => {
|
time_id.value = setInterval(async () => {
|
||||||
@@ -33,11 +34,11 @@ Taro.useLoad((e) => {
|
|||||||
if (data.data.status !== 0 && data.data.status !== 2) {
|
if (data.data.status !== 0 && data.data.status !== 2) {
|
||||||
clearInterval(time_id.value);
|
clearInterval(time_id.value);
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "支付成功",
|
title: '支付成功',
|
||||||
icon: "success",
|
icon: 'success',
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Taro.removeStorageSync("pay_code");
|
Taro.removeStorageSync('pay_code');
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/pages/admin/add_order/pending_order/pending_order_detail/index?oid=${info.value.oid}&bid=${info.value.bid}`,
|
url: `/pages/admin/add_order/pending_order/pending_order_detail/index?oid=${info.value.oid}&bid=${info.value.bid}`,
|
||||||
});
|
});
|
||||||
@@ -46,15 +47,28 @@ Taro.useLoad((e) => {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
const getCode = () => {
|
const getCode = async () => {
|
||||||
var qr = new UQRCode();
|
const qr = new UQRCode();
|
||||||
qr.data = Taro.getStorageSync("pay_code");
|
qr.data = Taro.getStorageSync('pay_code');
|
||||||
qr.size = 160;
|
qr.size = 150;
|
||||||
qr.margin = 5;
|
qr.margin = 5;
|
||||||
qr.make();
|
qr.make();
|
||||||
const canvasContext = Taro.createCanvasContext("qrcode");
|
const canvasContext = Taro.createCanvasContext('qrcode');
|
||||||
qr.canvasContext = canvasContext;
|
qr.canvasContext = canvasContext;
|
||||||
qr.drawCanvas();
|
qr.drawCanvas().then(() => {
|
||||||
|
Taro.canvasToTempFilePath({
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width: 150,
|
||||||
|
height: 150,
|
||||||
|
destWidth: 150,
|
||||||
|
destHeight: 150,
|
||||||
|
canvasId: 'qrcode',
|
||||||
|
success: function (res) {
|
||||||
|
dataUrl.value = res.tempFilePath;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Taro.useDidHide(() => {
|
Taro.useDidHide(() => {
|
||||||
@@ -67,5 +81,5 @@ onUnmounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "./index.scss";
|
@import './index.scss';
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user