覆盖11.20的代码

This commit is contained in:
wwz
2025-03-12 13:43:14 +08:00
parent cab9f836af
commit 50c5b4ca81
7 changed files with 197 additions and 118 deletions

View File

@@ -85,7 +85,8 @@
import {
defineProps,
reactive,
ref
ref,
defineEmits
} from 'vue';
import {
@@ -101,6 +102,10 @@
type: Object,
default: () => ({})
},
detailtype: {
type: String,
default: ''
},
memberOpen: {
type: Boolean,
default: false
@@ -340,9 +345,21 @@
phone: formInfo.telephone,
birthDay: formInfo.birthDay
})
if (res.code == 0) {
}
// 定义自定义事件
let APIshopUserInfores = await APIshopUserInfo({
shopId: uni.cache.get('shopId')
})
uni.cache.set('orderVIP', APIshopUserInfores)
uni.cache.set('ordershopUserInfo', APIshopUserInfores.shopInfo)
uni.showToast({
title: '会员加入成功',
icon: 'none'
})
setTimeout(() => {
if (props.detailtype == 'detail') {
uni.navigateBack()
}
}, 1500)
}
</script>

View File

@@ -94,7 +94,7 @@
</view>
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
</view>
<registermember :memberOpen="infoForn.show" :shopUserInfo="infoForn.shopUserInfo">
<registermember :memberOpen="infoForn.show" :shopUserInfo="infoForn.shopUserInfo" :detailtype='detailtype' >
</registermember>
</view>
@@ -159,6 +159,7 @@
infoForn.listdata = res;
infoForn.couponList = infoForn.listdata[0].couponList;
infoForn.giftAmount = infoForn.listdata[0].giftAmount
infoForn.id = infoForn.listdata[0].id
if (infoForn.type == 'topUpActivity') {
infoForn.amountChange()
} else {
@@ -288,11 +289,11 @@
// 充值金额切换
const clickinput = (a, b) => {
console.log(a, b)
infoForn.inputshow = b;
infoForn.couponList = a.couponList;
infoForn.amount = a.amount;
infoForn.giftAmount = a.giftAmount;
infoForn.id = a.id;
}
// 充值
@@ -319,8 +320,17 @@
});
return false;
}
console.log({
shopId: infoForn.shopId,
activateId: infoForn.id,
shopUserId: infoForn.userInfo.id,
amount: infoForn.amount, //金额
returnUrl: '', //跳转地址
buyerRemark: ''
})
let res = await store.actionspayltPayVip({
shopId: infoForn.shopId,
activateId: infoForn.id,
shopUserId: infoForn.userInfo.id,
amount: infoForn.amount, //金额
returnUrl: '', //跳转地址
@@ -329,6 +339,19 @@
console.log(res)
}
// 会员总信息
const asyncshopUserInfo = async () => {
let res = await APIshopUserInfo({
shopId: uni.cache.get('shopId')
})
uni.cache.set('orderVIP', res)
uni.cache.set('ordershopUserInfo', res.shopInfo)
infoForn.show = res.isVip == 1 ? false : true
}
const detailtype = ref('')
onMounted(async () => {
// 获取当前页面栈
const pages = getCurrentPages();
@@ -349,21 +372,17 @@
// }
// uni.cache.set('shopId', infoForn.shopId)
// // #endif
if (options.shopId) {
uni.cache.set('shopId', options.shopId, 30)
infoForn.shopId = options.shopId ? options.shopId : uni.cache.get('shopId')
let resone = await APIusershopInfodetail({
shopId: options.shopId
})
infoForn.shopUserInfo = resone.shopInfo
// 根据传的shopInfo来返回上面的值
infoForn.userInfo = await APIshopUserInfo({
shopId: options.shopId
})
infoForn.show == infoForn.userInfo.isVip == 1 ? true : false
asyncshopUserInfo()
}
if (options.type == 'detail') {
detailtype.value = 'detail'
}
if (options.type) {
infoForn.type = options.type

View File

@@ -159,6 +159,18 @@
this.init()
}
// 会员总信息
const asyncshopUserInfo = async () => {
let res = await APIshopUserInfo({
shopId: shopUserInfo.shopId
})
uni.cache.set('orderVIP', res)
uni.cache.set('ordershopUserInfo', res.shopInfo)
form.memberOpen = res.isVip == 1 ? false : true
}
onMounted(async () => {
// 获取当前页面栈
const pages = getCurrentPages();
@@ -171,16 +183,17 @@
const currentPage = pages[pages.length - 1];
// 获取页面参数
const pageParams = currentPage.options;
let res = await APIusershopInfodetail({
shopId: pageParams.shopId
})
// 根据传的shopInfo来返回上面的值
shopUserInfo.shopInfo = await APIshopUserInfo({
shopId: pageParams.shopId
})
shopUserInfo.shopExtend = res.shopExtend.member_bg
shopUserInfo.shopId = pageParams.shopId
form.memberOpen = shopUserInfo.shopInfo.isVip == 1 ? false : true
if (pageParams.shopId) {
asyncshopUserInfo()
uni.cache.set('shopId', pageParams.shopId, 30)
let res = await APIusershopInfodetail({
shopId: pageParams.shopId
})
// 根据传的shopInfo来返回上面的值
shopUserInfo.shopExtend = res.shopExtend.member_bg
shopUserInfo.shopId = pageParams.shopId
}
})
</script>

View File

@@ -59,36 +59,42 @@
console.log(formInfo.shopInfo)
if (res) {
formInfo.url = res;
nextTick(() => {
const barcodeText = '1234567890';
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, barcodeText, {
width: 2,
height: 100,
displayValue: true,
fontOptions: 'bold',
font: 'monospace',
textAlign: 'center',
textPosition: 'bottom',
textMargin: 2,
fontSize: 20,
background: '#ffffff',
lineColor: '#000000'
});
}
});
});
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);
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
}
}
})
</script>

View File

@@ -9,10 +9,10 @@
<image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image>
<view class="name">{{userInfo.nickName || '无'}}</view>
</view>
<image class="my_info_right_qr" @click="clickEvent" v-if="userInfo.isVip == 1"
<image class="my_info_right_qr" @click="clickEvent" v-if="userInfo.isVip == 1 && ShopId"
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_qRcode.png'" mode="aspectFill">
</image>
<view class="my_info_right" @click="clickEvent" v-if="userInfo.isVip == 0">
<view class="my_info_right" @click="clickEvent" v-if="userInfo.isVip == 0 && ShopId">
<text>免费入会</text>
</view>
</view>
@@ -92,11 +92,11 @@
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_order.png"
},
// { name: "收货地址", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_address.png"},
{
name: "个人资料",
type: "myself",
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/personal.png"
},
// {
// name: "个人资料",
// type: "myself",
// icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/personal.png"
// },
{
name: "我的会员卡",
type: "my_member",
@@ -107,15 +107,19 @@
const teblist = ref([])
const shopExtend = ref(null)
const userInfo = reactive({})
const ShopId = ref(uni.cache.get('shopId'))
const clickEvent = () => {
if (uni.cache.get('shopId') && uni.cache.get('token')) {
if (ShopId.value) {
if (userInfo.isVip == 0) {
uni.pro.navigateTo('user/member/memberdetails', {
shopId: uni.cache.get('shopId')
})
} else {
uni.navigateTo({
url: '/pages/user/member/qrcode?userInfo=' + JSON.stringify(userInfo)
uni.pro.navigateTo('user/member/paycode', {
shopId: uni.cache.get('shopId'),
shopInfo: JSON.stringify(uni.cache.get('orderVIP').shopInfo)
})
}
} else {
@@ -179,7 +183,7 @@
onShow(async () => {
await store.actionsAPIuser()
let res = uni.cache.get('userInfo')
let res = uni.cache.get('orderVIP')
if (uni.cache.get('shopId')) {
Object.assign(userInfo, res)
} else {
@@ -188,7 +192,6 @@
...res.assetsSummary
})
}
console.log(userInfo, 11)
})
</script>