This commit is contained in:
2023-08-18 17:22:11 +08:00
parent 1263c372cb
commit 61f840059b
36 changed files with 2371 additions and 1109 deletions

View File

@@ -10,29 +10,43 @@
<script setup lang="ts">
import Taro from "@tarojs/taro";
import { orderVerify } from "@/api/admin";
// url参数转对象
const urlParse = (url: string) => {
const obj: any = {};
const reg = /[?&][^?&]+=[^?&]+/g;
const arr = url.match(reg);
if (arr) {
arr.forEach((item) => {
const tempArr = item.substring(1).split("=");
const key = decodeURIComponent(tempArr[0]);
const val = decodeURIComponent(tempArr[1]);
obj[key] = val;
});
}
return obj;
};
// const urlParse = (url: string) => {
// const obj: any = {};
// const reg = /[?&][^?&]+=[^?&]+/g;
// const arr = url.match(reg);
// if (arr) {
// arr.forEach((item) => {
// const tempArr = item.substring(1).split("=");
// const key = decodeURIComponent(tempArr[0]);
// const val = decodeURIComponent(tempArr[1]);
// obj[key] = val;
// });
// }
// return obj;
// };
const scanCode = () => {
Taro.scanCode({
onlyFromCamera: true,
scanType: ["qrCode"],
success: (res) => {
console.log(urlParse(res.result));
success: async (res) => {
try {
const data = await orderVerify({
oid: res.result,
});
Taro.showToast({
title: data.msg,
icon: "none",
});
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
},
});
};
@@ -41,7 +55,7 @@ const scanCode = () => {
<style lang="scss">
page {
background-color: #f5f5f5;
background-image: url("../../../static/admin/cancellation-header.png");
background-image: url("~@/static/admin/cancellation-header.png");
background-repeat: no-repeat;
background-size: 100% 30%;
}