完善小程序

This commit is contained in:
wwz
2025-03-18 18:29:34 +08:00
parent fc957feb72
commit 9da31e2faa
19 changed files with 594 additions and 352 deletions

View File

@@ -39,7 +39,7 @@
const formInfo = reactive({
shopInfo: '',
shopInfo:uni.cache.get('orderVIP'),
url: '',
shopId: ''
})
@@ -51,47 +51,46 @@
const currentPage = pages[pages.length - 1];
// 获取页面参数
const pageParams = currentPage.options;
formInfo.shopInfo = JSON.parse(decodeURIComponent(pageParams.shopInfo))
// formInfo.shopInfo = JSON.parse(decodeURIComponent(pageParams.shopInfo))
formInfo.shopId = pageParams.shopId
let res = await APIshopUsercode({
shopId: pageParams.shopId
})
console.log(formInfo.shopInfo)
if (res) {
formInfo.url = res;
try {
nextTick(() => {
const query = uni.createSelectorQuery();
query.select('#barcodeCanvas')
.fields({
node: true,
size: true
})
.exec((res) => {
if (res[0]) {
const canvas = res[0].node;
const ctx = canvas.getContext('2d');
const dpr = uni.getSystemInfoSync().pixelRatio;
canvas.width = res[0].width * dpr;
canvas.height = res[0].height * dpr;
ctx.scale(dpr, dpr);
// nextTick(() => {
// const query = uni.createSelectorQuery();
// query.select('#barcodeCanvas')
// .fields({
// node: true,
// size: true
// })
// .exec((res) => {
// if (res[0]) {
// const canvas = res[0].node;
// const ctx = canvas.getContext('2d');
// const dpr = uni.getSystemInfoSync().pixelRatio;
// canvas.width = res[0].width * dpr;
// canvas.height = res[0].height * dpr;
// ctx.scale(dpr, dpr);
JsBarcode(canvas, formInfo.url, {
width: 2,
height: 100,
displayValue: true,
fontOptions: 'bold',
font: 'monospace',
textAlign: 'center',
textPosition: 'bottom',
textMargin: 2,
fontSize: 20,
background: '#ffffff',
lineColor: '#000000'
});
}
});
});
// JsBarcode(canvas, formInfo.url, {
// width: 2,
// height: 100,
// displayValue: true,
// fontOptions: 'bold',
// font: 'monospace',
// textAlign: 'center',
// textPosition: 'bottom',
// textMargin: 2,
// fontSize: 20,
// background: '#ffffff',
// lineColor: '#000000'
// });
// }
// });
// });
} catch (error) {
//TODO handle the exception
}