lalala 6 лет назад
Родитель
Сommit
a5c29a0d22
1 измененных файлов с 68 добавлено и 59 удалено
  1. 68 59
      mobile-code/src/pages/home/index.vue

+ 68 - 59
mobile-code/src/pages/home/index.vue

@@ -16,69 +16,78 @@
 </template>
 
 <script>
-import AppSwiper from '@/components/app-swiper'
-import AppTrademark from '@/components/module/app-trademark'
-// 商品组件
-import goodsListBig from '@/pages/home/components/goods-list-big'
-import goodsListMiddle from '@/pages/home/components/goods-list-middle'
-import goodsListSmall from '@/pages/home/components/goods-list-small'
-// import AppFooter from '@/components/app-footer'
-// api
-import { getMainIndex } from '@/api/home'
-export default {
-	name: 'home',
-	components: {
-		AppSwiper,
-		AppTrademark,
-		goodsListBig,
-		goodsListMiddle,
-		goodsListSmall
-		// AppFooter
-	},
-	data() {
-		return {
-			data: {},
-			ad: [],
-			category: [],
-			columnStyle: null
-		}
-	},
-	onLoad(option) {
-		// if (this.$util.isLogin()) {
-		// 	this.init()
-		// }
-	},
-	mounted() {
-	},
-	methods: {
-		init() {
-			uni.setNavigationBarTitle({
-				title: '国兰花尚'
-			})
-			this._detail()
+	import { mapGetters } from 'vuex'
+	import AppSwiper from '@/components/app-swiper'
+	import AppTrademark from '@/components/module/app-trademark'
+	// 商品组件
+	import goodsListBig from '@/pages/home/components/goods-list-big'
+	import goodsListMiddle from '@/pages/home/components/goods-list-middle'
+	import goodsListSmall from '@/pages/home/components/goods-list-small'
+	// import AppFooter from '@/components/app-footer'
+	// api
+	import { getMainIndex } from '@/api/home'
+	import { getOrderShop } from '@/utils/config'
+	export default {
+		name: 'home',
+		components: {
+			AppSwiper,
+			AppTrademark,
+			goodsListBig,
+			goodsListMiddle,
+			goodsListSmall
+			// AppFooter
 		},
-		_detail() {
-			getMainIndex().then(res => {
-				this.data = res.data
-				if (this.$util.isEmpty(res.data)) return false
-				this.ad = res.data.ad.map(e => {
-					e.img = e.adImg
-					return e
-				})
-				this.category = res.data.category
-				this.columnStyle = res.data.columnStyle
-			})
+		data() {
+			return {
+				data: {},
+				ad: [],
+				category: [],
+				columnStyle: null
+			}
+		},
+		computed: {
+			...mapGetters({ orderShop: 'getOrderShop' })
 		},
-		// operate
-		adDetailFn(item) {
-			// #ifdef H5
-			location.href = item.url
-			// #endif
-			// #ifndef H5
-			// #endif
+		onLoad(option) {
+			// if (this.$util.isLogin()) {
+			// 	this.init()
+			// }
+		},
+		mounted() {},
+		methods: {
+			init() {
+				getOrderShop().then(res => {
+					uni.setNavigationBarTitle({
+						title: `${res.shop.merchantName}`
+					})
+				})
+				// uni.setNavigationBarTitle({
+				// 	title: '国兰花尚'
+				// })
+				this._detail()
+			},
+			_detail() {
+				getMainIndex().then(res => {
+					this.data = res.data
+					if (this.$util.isEmpty(res.data)) return false
+					this.ad = res.data.ad.map(e => {
+						e.img = e.adImg
+						return e
+					})
+					this.category = res.data.category
+					this.columnStyle = res.data.columnStyle
+				})
+			},
+			// operate
+			adDetailFn(item) {
+				// #ifdef H5
+				location.href = item.url
+				// #endif
+				// #ifndef H5
+				// #endif
+			}
 		}
 	}
-}
 </script>
 
 <style lang="scss" scoped>