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