|
@@ -2,6 +2,7 @@ import dayjs from "dayjs";
|
|
|
import { message } from "@/utils/message";
|
|
import { message } from "@/utils/message";
|
|
|
import { addDialog } from "@/components/ReDialog";
|
|
import { addDialog } from "@/components/ReDialog";
|
|
|
import { usePublicHooks } from "@/views/system/hooks";
|
|
import { usePublicHooks } from "@/views/system/hooks";
|
|
|
|
|
+import QRCode from "qrcode";
|
|
|
import { deviceDetection } from "@pureadmin/utils";
|
|
import { deviceDetection } from "@pureadmin/utils";
|
|
|
import type { PaginationProps } from "@pureadmin/table";
|
|
import type { PaginationProps } from "@pureadmin/table";
|
|
|
import { getReplenisherList,
|
|
import { getReplenisherList,
|
|
@@ -330,15 +331,18 @@ export function useReplenisher(tableRef: Ref) {
|
|
|
const bindingCodeData = reactive<{
|
|
const bindingCodeData = reactive<{
|
|
|
replenisherName: string;
|
|
replenisherName: string;
|
|
|
bindingCode: string;
|
|
bindingCode: string;
|
|
|
|
|
+ qrCodeDataUrl: string;
|
|
|
}>({
|
|
}>({
|
|
|
replenisherName: "",
|
|
replenisherName: "",
|
|
|
- bindingCode: ""
|
|
|
|
|
|
|
+ bindingCode: "",
|
|
|
|
|
+ qrCodeDataUrl: ""
|
|
|
});
|
|
});
|
|
|
const generatingCode = ref(false);
|
|
const generatingCode = ref(false);
|
|
|
|
|
|
|
|
function openBindingCodeDialog(row: ReplenisherFormItem) {
|
|
function openBindingCodeDialog(row: ReplenisherFormItem) {
|
|
|
bindingCodeData.replenisherName = row.name;
|
|
bindingCodeData.replenisherName = row.name;
|
|
|
bindingCodeData.bindingCode = "";
|
|
bindingCodeData.bindingCode = "";
|
|
|
|
|
+ bindingCodeData.qrCodeDataUrl = "";
|
|
|
bindingDialogVisible.value = true;
|
|
bindingDialogVisible.value = true;
|
|
|
handleGenerateAndShowBindingCode(row);
|
|
handleGenerateAndShowBindingCode(row);
|
|
|
}
|
|
}
|
|
@@ -361,6 +365,21 @@ export function useReplenisher(tableRef: Ref) {
|
|
|
const code = res.data.bindingCode;
|
|
const code = res.data.bindingCode;
|
|
|
bindingCodeData.bindingCode = code;
|
|
bindingCodeData.bindingCode = code;
|
|
|
|
|
|
|
|
|
|
+ // 生成二维码(将绑定码编码为二维码,补货员可在小程序登录页扫码识别)
|
|
|
|
|
+ try {
|
|
|
|
|
+ bindingCodeData.qrCodeDataUrl = await QRCode.toDataURL(code, {
|
|
|
|
|
+ width: 280,
|
|
|
|
|
+ margin: 2,
|
|
|
|
|
+ color: {
|
|
|
|
|
+ dark: "#1e293b",
|
|
|
|
|
+ light: "#ffffff"
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (qrErr) {
|
|
|
|
|
+ console.error("生成二维码失败:", qrErr);
|
|
|
|
|
+ bindingCodeData.qrCodeDataUrl = "";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 刷新列表更新 wechatOpenid 状态
|
|
// 刷新列表更新 wechatOpenid 状态
|
|
|
onSearch();
|
|
onSearch();
|
|
|
} else {
|
|
} else {
|