This commit is contained in:
@@ -79,7 +79,6 @@
|
||||
"@tarojs/taro": "3.6.28",
|
||||
"dayjs": "^1.11.10",
|
||||
"pinia": "^2.1.7",
|
||||
"uqrcodejs": "^4.0.7",
|
||||
"vue": "^3.3.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@@ -68,9 +68,6 @@ importers:
|
||||
pinia:
|
||||
specifier: ^2.1.7
|
||||
version: 2.1.7(typescript@4.9.5)(vue@3.4.25(typescript@4.9.5))
|
||||
uqrcodejs:
|
||||
specifier: ^4.0.7
|
||||
version: 4.0.7
|
||||
vue:
|
||||
specifier: ^3.3.9
|
||||
version: 3.4.25(typescript@4.9.5)
|
||||
@@ -8747,9 +8744,6 @@ packages:
|
||||
upper-case@2.0.2:
|
||||
resolution: {integrity: sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==}
|
||||
|
||||
uqrcodejs@4.0.7:
|
||||
resolution: {integrity: sha512-84+aZmD2godCVI+93lxE3YUAPNY8zAJvNA7xRS7R7U+q57KzMDepBSfNCwoRUhWOfR6eHFoAOcHRPwsP6ka1cA==}
|
||||
|
||||
uri-js@4.4.1:
|
||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||
|
||||
@@ -19853,8 +19847,6 @@ snapshots:
|
||||
dependencies:
|
||||
tslib: 2.6.2
|
||||
|
||||
uqrcodejs@4.0.7: {}
|
||||
|
||||
uri-js@4.4.1:
|
||||
dependencies:
|
||||
punycode: 2.3.1
|
||||
|
||||
@@ -26,11 +26,6 @@ page {
|
||||
width: 608px;
|
||||
height: 457px;
|
||||
position: relative;
|
||||
.qrcode {
|
||||
position: absolute;
|
||||
left: 1000px;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.img {
|
||||
position: absolute;
|
||||
|
||||
@@ -12,33 +12,31 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {onUnmounted, ref} from 'vue';
|
||||
import Taro from '@tarojs/taro';
|
||||
import {getAfterOrder} from '@/api/admin';
|
||||
import UQRCode from 'uqrcodejs';
|
||||
import { onUnmounted, ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { getAfterOrder } from "@/api/admin";
|
||||
|
||||
const time_id = ref();
|
||||
|
||||
const dataUrl = ref('');
|
||||
const dataUrl = ref("");
|
||||
|
||||
const info = ref<any>({});
|
||||
|
||||
Taro.useLoad(e => {
|
||||
Taro.useLoad((e) => {
|
||||
info.value = e;
|
||||
getCode();
|
||||
dataUrl.value = Taro.getStorageSync("pay_code");
|
||||
time_id.value = setInterval(async () => {
|
||||
const {data} = await getAfterOrder({
|
||||
const { data } = await getAfterOrder({
|
||||
bid: info.value.bid,
|
||||
oid: info.value.oid,
|
||||
});
|
||||
if (data.data.status !== 0 && data.data.status !== 2) {
|
||||
clearInterval(time_id.value);
|
||||
Taro.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'success',
|
||||
title: "支付成功",
|
||||
icon: "success",
|
||||
});
|
||||
setTimeout(() => {
|
||||
Taro.removeStorageSync('pay_code');
|
||||
Taro.removeStorageSync("pay_code");
|
||||
Taro.navigateTo({
|
||||
url: `/pages/admin/add_order/pending_order/pending_order_detail/index?oid=${info.value.oid}&bid=${info.value.bid}`,
|
||||
});
|
||||
@@ -47,39 +45,17 @@ Taro.useLoad(e => {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
const getCode = async () => {
|
||||
const qr = new UQRCode();
|
||||
qr.data = Taro.getStorageSync('pay_code');
|
||||
qr.size = 150;
|
||||
qr.margin = 5;
|
||||
qr.make();
|
||||
const canvasContext = Taro.createCanvasContext('qrcode');
|
||||
qr.canvasContext = canvasContext;
|
||||
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(() => {
|
||||
clearInterval(time_id.value);
|
||||
Taro.removeStorageSync("pay_code");
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
clearInterval(time_id.value);
|
||||
Taro.removeStorageSync("pay_code");
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
@import "./index.scss";
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user