覆盖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 @@
</view> </view>
</view> </view>
<view style="width: 100%;height: 200rpx;"> </view> <view style="width: 100%;height: 200rpx;"> </view>
<payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent" @close="ispws = false" /> <payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent"
:password='payPasswordPassword' @close="ispws = false" />
</view> </view>
</template> </template>
@@ -130,6 +131,9 @@
// import orderInfoBefore from '../components/orderInfoBefore.vue' // import orderInfoBefore from '../components/orderInfoBefore.vue'
// import rechargeFree from '../components/rechargeFree.vue' // import rechargeFree from '../components/rechargeFree.vue'
import paymentMethodes from '@/components/paymentMethod.vue'; //支付方式 import paymentMethodes from '@/components/paymentMethod.vue'; //支付方式
import {
onBackPress
} from '@dcloudio/uni-app';
// 输入支付密码 // 输入支付密码
const ispws = ref(false) const ispws = ref(false)
@@ -229,7 +233,7 @@
.coupondiscountAmount || 0) - (listinfo.pointsDiscountAmount || 0); .coupondiscountAmount || 0) - (listinfo.pointsDiscountAmount || 0);
listinfo.totalCost = Math.round(sums * 100) / 100; listinfo.totalCost = Math.round(sums * 100) / 100;
// 积分 // 积分
if (listinfo.totalCost) { if (listinfo.totalCost && listinfo.status == 'unpaid') {
await memberPointscalcUsablePoints() await memberPointscalcUsablePoints()
} }
} }
@@ -251,7 +255,7 @@
const paymentmethod = reactive({ const paymentmethod = reactive({
radiovalue: 1, radiovalue: 1,
paymentBtnText: "余额支付", paymentBtnText: "余额支付",
payType: '' payType: 'accountPay'
}) })
const groupChange = async (e) => { const groupChange = async (e) => {
@@ -306,11 +310,32 @@
}; };
const payPasswordPassword = ref('')
// * 去支付 // * 去支付
const goToPay = async () => { const goToPay = async () => {
// 余额支付 // 余额支付
if (paymentmethod.payType == '') { if (paymentmethod.payType == 'accountPay') {
ispws.value = true if (orderVIP.value.isVip == 0) {
uni.showModal({
title: '提示',
content: '您还不是会员,是否去注册会员?',
success: (res) => {
if (res.confirm) {
uni.pro.navigateTo('user/member/index', {
shopId: orderVIP.value.shopId,
type: 'detail'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
} else {
payPasswordPassword.value = ''
ispws.value = true
}
return false return false
} }
let checkOrderPay = { let checkOrderPay = {
@@ -381,7 +406,7 @@
remark: '', //用户备注 remark: '', //用户备注
} }
try { try {
let res = await storeMemberpay.balancePayOrder({ await storeMemberpay.balancePayOrder({
checkOrderPay, checkOrderPay,
payType: paymentmethod.payType, payType: paymentmethod.payType,
pwd: pwd, pwd: pwd,
@@ -393,14 +418,14 @@
} catch (error) { } catch (error) {
//TODO handle the exception //TODO handle the exception
} }
payPasswordref.value.closeModal() payPasswordPassword.value = ''
} }
onUnmounted(() => { onUnmounted(() => {
uni.$off('returnData', handleReturnData); uni.$off('returnData', handleReturnData);
}); });
// 监听页面返回事件
onMounted(async () => { onMounted(async () => {
// 获取当前页面栈 // 获取当前页面栈
const pages = getCurrentPages(); const pages = getCurrentPages();

View File

@@ -561,9 +561,9 @@
uni.$u.debounce(store.scrollTop = res.scrollTop, 500) uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
uni.$u.debounce(navScroll.value = res.scrollTop, 500) uni.$u.debounce(navScroll.value = res.scrollTop, 500)
uni.$u.debounce(mainScroll(res), 500) uni.$u.debounce(mainScroll(res), 500)
if(res.scrollTop >= 44){ if (res.scrollTop >= 44) {
store.showSearch = true store.showSearch = true
}else{ } else {
store.showSearch = false store.showSearch = false
} }
}); });
@@ -583,13 +583,6 @@
goods: [] goods: []
} }
}) })
/* 价格 */
const salePrice = computed(() => {
// return shopInfo.isVip == 1 && memberPrice > 0 ? res.data.memberPrice : res.data.salePrice
return 0
})
// 用于判断接口数据是否加载完成 // 用于判断接口数据是否加载完成
const isDataLoaded = ref(false); const isDataLoaded = ref(false);
@@ -942,10 +935,25 @@
} }
}) })
// 更新购物车数据 // 更新购物车数据shopProductList.hots
const matchedProducts = computed(() => { const matchedProducts = computed(() => {
if (!cartList.value) {
return false;
}
let Specialstop = null
try {
Specialstop = [...[{
id: "",
name: "",
productList: shopProductList.hots
}], ...shopProductList.productInfo]
} catch (error) {
Specialstop = shopProductList.productInfo
//TODO handle the exception
}
return cartList.value.map((cartItem) => { return cartList.value.map((cartItem) => {
for (const group of shopProductList.productInfo) { for (const group of Specialstop) {
for (const product of group.productList) { for (const product of group.productList) {
if (product.id == cartItem.product_id) { if (product.id == cartItem.product_id) {
// 多规格 // 多规格
@@ -986,23 +994,6 @@
}, 0); }, 0);
}); });
// 计算购物车商品费用
// const totalPrices = ref(0);
// watchEffect(() => {
// if (matchedProducts.value.length > 0) {
// totalPrices.value = cartStore.getTotalTotalPrices(matchedProducts.value).value;
// }
// });
// matchedProducts 变化时,更新总打包费用
// watch(() => matchedProducts.value, () => {
// if (matchedProducts.value.length > 0) {
// totalPrices.value = cartStore.getTotalTotalPrices(matchedProducts.value).value;
// }
// });
// 计算购物车商品总价格 // 计算购物车商品总价格
const totalPrices = computed(() => { const totalPrices = computed(() => {
// 购物车总数价格 // 购物车总数价格
@@ -1091,22 +1082,27 @@
// 列表请求 // 列表请求
const productqueryProduct = async () => { const productqueryProduct = async () => {
shopProductList.hots = await productminiApphotsquery() try {
shopProductList.productInfo = await APIgroupquery() shopProductList.hots = await productminiApphotsquery()
//第一步:将所有商品的 cartNumber 初始化为 0 shopProductList.productInfo = await APIgroupquery()
shopProductList.productInfo.forEach((group) => { //第一步:将所有商品的 cartNumber 初始化为 0
group.productList.forEach((product) => { shopProductList.productInfo.forEach((group) => {
product.cartNumber = 0; group.productList.forEach((product) => {
product.cartNumber = 0;
});
}); });
}); shopProductList.hots.forEach((i) => {
shopProductList.hots.forEach((i) => { i.cartNumber = 0
i.cartNumber = 0 })
}) scrollTopSize.value = 0
scrollTopSize.value = 0 topArr.value = []
topArr.value = [] userStore.actionsAPIuser()
userStore.actionsAPIuser() // 数据可以更新
// 数据可以更新 isDataLoaded.value = true;
isDataLoaded.value = true; } catch (error) {
uni.navigateBack()
//TODO handle the exception
}
} }
onLoad(async (e) => { onLoad(async (e) => {

View File

@@ -85,7 +85,8 @@
import { import {
defineProps, defineProps,
reactive, reactive,
ref ref,
defineEmits
} from 'vue'; } from 'vue';
import { import {
@@ -101,6 +102,10 @@
type: Object, type: Object,
default: () => ({}) default: () => ({})
}, },
detailtype: {
type: String,
default: ''
},
memberOpen: { memberOpen: {
type: Boolean, type: Boolean,
default: false default: false
@@ -340,9 +345,21 @@
phone: formInfo.telephone, phone: formInfo.telephone,
birthDay: formInfo.birthDay 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> </script>

View File

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

View File

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

View File

@@ -59,36 +59,42 @@
console.log(formInfo.shopInfo) console.log(formInfo.shopInfo)
if (res) { if (res) {
formInfo.url = res; formInfo.url = res;
nextTick(() => { try {
const barcodeText = '1234567890'; nextTick(() => {
const query = uni.createSelectorQuery(); const query = uni.createSelectorQuery();
query.select('#barcodeCanvas') query.select('#barcodeCanvas')
.fields({ node: true, size: true }) .fields({
.exec((res) => { node: true,
if (res[0]) { size: true
const canvas = res[0].node; })
const ctx = canvas.getContext('2d'); .exec((res) => {
const dpr = uni.getSystemInfoSync().pixelRatio; if (res[0]) {
canvas.width = res[0].width * dpr; const canvas = res[0].node;
canvas.height = res[0].height * dpr; const ctx = canvas.getContext('2d');
ctx.scale(dpr, dpr); const dpr = uni.getSystemInfoSync().pixelRatio;
canvas.width = res[0].width * dpr;
canvas.height = res[0].height * dpr;
ctx.scale(dpr, dpr);
JsBarcode(canvas, barcodeText, { JsBarcode(canvas, formInfo.url, {
width: 2, width: 2,
height: 100, height: 100,
displayValue: true, displayValue: true,
fontOptions: 'bold', fontOptions: 'bold',
font: 'monospace', font: 'monospace',
textAlign: 'center', textAlign: 'center',
textPosition: 'bottom', textPosition: 'bottom',
textMargin: 2, textMargin: 2,
fontSize: 20, fontSize: 20,
background: '#ffffff', background: '#ffffff',
lineColor: '#000000' lineColor: '#000000'
}); });
} }
}); });
}); });
} catch (error) {
//TODO handle the exception
}
} }
}) })
</script> </script>

View File

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