This commit is contained in:
zmj 2024-06-15 18:41:28 +08:00
commit 8b98d78dce
4 changed files with 49 additions and 8 deletions

View File

@ -90,7 +90,9 @@
//
const onChooseShop = (item) => {
currShop.value = item.id;
uni.setStorageSync('STORE_INFO', JSON.stringify(item))
uni.setStorageSync('STORE_INFO', JSON.stringify(item));
// ,
uni.removeStorageSync('SHARE_INFO');
setTimeout(() => {
uni.reLaunch({
url: '/pages/index/index?id=' + item.id,
@ -108,6 +110,7 @@
//
const handleSearch = () => {
if (!queryParams.latitude || !queryParams.longitude) return;
shopList.value = [];
queryParams.page_no = 1;
status.value = '';
@ -182,7 +185,6 @@
}
</script>
<style lang="scss">
page {
background: #FAFAFA;

View File

@ -23,7 +23,8 @@
<template #left>
<view class="store-info" @click="navgo('/multipleShop/index/index')">
<view style="display: flex;font-size: 30rpx;font-weight: bold;">
{{STORE_INFO.name}}
<text
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{shareInfo.real_name?(shareInfo.real_name + '-' + STORE_INFO.name):STORE_INFO.name}}</text>
<up-icon name="arrow-right"></up-icon>
</view>
<view style="display: flex;font-size: 24rpx;color:#777777 ;">
@ -222,6 +223,7 @@
import useUserStore from "@/store/user";
const userStore = useUserStore();
const STORE_INFO = ref({
name: '',
id: '',
@ -237,9 +239,15 @@
//
onShareAppMessage(() => {
let shareStr = '?id=' + STORE_INFO.value.id;
if (userStore.userInfo.user_ship == 1) {
shareStr = shareStr + '&spread_uid=' + userStore.userInfo.id + '&real_name=' + (userStore.userInfo
.real_name || userStore.userInfo.nickname)
}
let shareInfo = {
title: STORE_INFO.value.name,
path: '/pages/index/index?id=' + STORE_INFO.value.id,
path: '/pages/index/index' + shareStr,
imageUrl: STORE_INFO.value.image,
success() {
uni.$u.toast('分享成功');
@ -273,7 +281,6 @@
const show = ref(0);
const topActive = ref(0);
const changeOne = async (item, index) => {
console.log(item)
topActive.value = item.id;
show.value = 0;
goodClassTow.value = item?.children || [];
@ -358,7 +365,6 @@
}).then(res => {
if (loadmore) goodList.value.push(...res.data.lists);
else goodList.value = res.data.lists;
//
if (!STORE_INFO.value.name || !STORE_INFO.value.detailed_address) {
STORE_INFO.value.name = res.data.store.name;
@ -548,20 +554,49 @@
left: 0
});
//
const shareInfo = ref({
uid: '',
real_name: '',
store_id: ''
});
onLoad(async (opt) => {
// id
if (opt.id) {
where.value.store_id = opt.id;
const info = await shopDetailApi({
store_id: opt.id
});
STORE_INFO.value = info.data;
uni.setStorageSync('STORE_INFO', JSON.stringify(info.data));
//
if (opt.spread_uid) {
shareInfo.value.uid = opt.spread_uid;
shareInfo.value.real_name = opt.real_name;
shareInfo.value.store_id = opt.id;
console.log(shareInfo.value);
uni.setStorageSync('SHARE_INFO', shareInfo.value);
} else {
//
const i = uni.getStorageSync('SHARE_INFO');
if (i)
shareInfo.value = i;
}
} else {
//
const info = uni.getStorageSync('STORE_INFO');
if (info)
if (info) {
STORE_INFO.value = JSON.parse(info);
where.value.store_id = STORE_INFO.value.id;
}
//
const i = uni.getStorageSync('SHARE_INFO');
if (i)
shareInfo.value = i;
}
getgoodClassList(0);

View File

@ -362,6 +362,7 @@
width: 100%;
display: flex;
justify-content: center;
align-items: center;
color: #444;
image {

View File

@ -356,7 +356,10 @@
const createOrder = () => {
if (!pay_type.value) return uni.$u.toast('请选择支付方式');
let shareInfo = uni.getStorageSync('SHARE_INFO');
createOrderApi({
spread_uid: (shareInfo && shareInfo.uid) ? shareInfo.uid : '',
cart_id: cartStore.cartList,
address_id: addressInfo.value.address_id,
pay_type: pay_type.value,