| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 | 
							- <!-- 店铺首页,支持店铺装修 -->
 
- <template>
 
- 	<view v-if="template">
 
- 		<su-navbar :title="state.shopName" statusBar :color="color" :tools="tools"
 
- 			:opacityBgUi="opacityBgUi" @search="(e) => emits('search', e)" :defaultSearch="defaultSearch" />
 
- 			
 
- 		<s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
 
- 			
 
- 			<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
 
- 		</s-block>
 
- 		
 
- 		<s-tabbar path="/pages/shop/index" :tabbar="tabbar" />
 
- 		<s-menu-tools />
 
- 	</view>
 
- </template>
 
- <script setup>
 
- 	import {
 
- 		computed,
 
- 		reactive,
 
- 		ref
 
- 	} from 'vue';
 
- 	import {
 
- 		onLoad,
 
- 		onShow,
 
- 		onPageScroll,
 
- 		onPullDownRefresh
 
- 	} from '@dcloudio/uni-app';
 
- 	import sheep from '@/sheep';
 
- 	import $share from '@/sheep/platform/share';
 
- 	import PageApi from '@/sheep/api/promotion/page';
 
- 	import {
 
- 		t
 
- 	} from '@/locale'
 
- 	// 隐藏原生tabBar
 
- 	uni.hideTabBar();
 
- 	const template = ref({})
 
- 	const shopName = ref('')
 
- 	const state = reactive({
 
- 		shopName : '',
 
- 		merchantId: 0,
 
- 		shopId:0
 
- 	})
 
- 	const tabbar = ref({
 
- 		"theme": "red",
 
- 		"style": {
 
- 			"bgType": "color",
 
- 			"bgColor": "#ffffff",
 
- 			"color": "#3c3c3c",
 
- 			"activeColor": "#1fa380"
 
- 		},
 
- 		"items": [{
 
- 				"text": t('common.shop_index'),
 
- 				"url": "/pages/shop/index",
 
- 				"iconUrl": sheep.$url.static('/static/shopIndex/shopIndex.svg'),
 
- 				"activeIconUrl": sheep.$url.static('/static/shopIndex/shopIndex-active.svg')
 
- 			},
 
- 			{
 
- 				"text": t('common.shop_category'),
 
- 				"url": "/pages/shop/category",
 
- 				"iconUrl": sheep.$url.static('/static/shopIndex/category.svg'),
 
- 				"activeIconUrl": sheep.$url.static('/static/shopIndex/category-active.svg')
 
- 			},
 
- 			{
 
- 				"text": t('common.all_product'),
 
- 				"url": "/pages/shop/allproduct",
 
- 				"iconUrl": sheep.$url.static('/static/shopIndex/allProduct.svg'),
 
- 				"activeIconUrl": sheep.$url.static('/static/shopIndex/allProduct-active.svg')
 
- 			},
 
- 			
 
- 		]
 
- 	});
 
- 	onLoad(async(options) => {
 
- 		
 
- 		// #ifdef MP
 
- 		// 小程序识别二维码
 
- 		if (options.scene) {
 
- 			const sceneParams = decodeURIComponent(options.scene).split('=');
 
- 			options[sceneParams[0]] = sceneParams[1];
 
- 		}
 
- 		// #endif
 
- 		// 预览模板
 
- 		if (options.templateId) {
 
- 			sheep.$store('app').init(options.templateId);
 
- 		}
 
- 		// 解析分享信息
 
- 		if (options.spm) {
 
- 			$share.decryptSpm(options.spm);
 
- 		}
 
- 		// 进入指定页面(完整页面路径)
 
- 		if (options.page) {
 
- 			sheep.$router.go(decodeURIComponent(options.page));
 
- 		}
 
- 		
 
- 		state.merchantId = options.merchantId;
 
- 		state.shopId = options.shopId;
 
- 		state.shopName = options.shopName;
 
- 		tabbar.value.items = tabbar.value.items.map(item => {
 
- 		    // 为每个 URL 添加参数
 
- 		    item.url = `${item.url}?shopId=${state.shopId}&shopName=${encodeURIComponent(state.shopName)}&merchantId=${state.merchantId}`;
 
- 		    return item;
 
- 		});
 
- 		console.log(options)
 
- 		const { code,data } = await PageApi.getPage({shopId:options.shopId,merchantId:options.merchantId});
 
- 		console.log(data)
 
- 		template.value = data.property
 
- 	});
 
- 	onPageScroll(() => {});
 
- </script>
 
- <style></style>
 
 
  |