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

View File

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

View File

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

View File

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