yijianjun il y a 9 heures
Parent
commit
afc9722a3a

+ 36 - 0
mer_uniapp/mixins/tags.js

@@ -0,0 +1,36 @@
+import request from "@/utils/request.js";
+
+export default {
+	data() {
+		return {
+			labelList: [{
+				id: 0,
+				label: "销量排行",
+				checked: true
+			}],
+		};
+	},
+	onLoad() {
+		this.getMeasures()
+	},
+	methods: {
+		getTag(){
+			return this.labelList.filter((ite => ite.checked)).map(ite => ite.id).join(',')
+		},
+		getApiData() {
+			return request.get(`merchant/get/prefere/measures`, {});
+		},
+		async getMeasures(){
+			const {data} = await this.getApiData()
+			console.log(data,'data')
+			let res =[]
+			res = data.map(ite => ({label: ite.measure,checked: false,id: ite.id}))
+			this.labelList = [{
+				id: 0,
+				label: "销量排行",
+				checked: true
+			},...res]
+			console.log(this.labelList,'this.labelList')
+		}
+	}
+};

+ 22 - 20
mer_uniapp/pages/index/index.vue

@@ -170,9 +170,11 @@
 		BACK_URL
 	} from '@/config/cache';
 	import Cache from '@/utils/cache';
+	import tags from '../../mixins/tags';
 	var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
 	let app = getApp();
 	export default {
+		mixins:[tags],
 		computed: mapGetters(['isLogin']),
 		data() {
 			return {
@@ -188,23 +190,23 @@
 				cateList: [],
 				cateId: 0,
 				proList: [],
-				labelList: [{
-					id: 1,
-					label: "销量排行",
-					checked: true
-				}, {
-					id: 2,
-					label: "满减大促",
-					checked: false
-				}, {
-					id: 3,
-					label: "首单立减",
-					checked: false
-				}, {
-					id: 4,
-					label: "减配送费",
-					checked: false
-				}],
+				// labelList: [{
+				// 	id: 1,
+				// 	label: "销量排行",
+				// 	checked: true
+				// }, {
+				// 	id: 2,
+				// 	label: "满减大促",
+				// 	checked: false
+				// }, {
+				// 	id: 3,
+				// 	label: "首单立减",
+				// 	checked: false
+				// }, {
+				// 	id: 4,
+				// 	label: "减配送费",
+				// 	checked: false
+				// }],
 				merchantList: [],
 				currentIndex: 0,
 				offset: 0,
@@ -260,9 +262,9 @@
 					});
 				})
 			},
-			getTag(){
-				return this.labelList.filter((ite => ite.checked)).map(ite => ite.id).join(',')
-			},
+			// getTag(){
+			// 	return this.labelList.filter((ite => ite.checked)).map(ite => ite.id).join(',')
+			// },
 			getHomeData() {
 				getHomeInfo({
 					latitude: uni.getStorageSync('user_latitude'),

+ 22 - 20
mer_uniapp/pages/merchant_search/index.vue

@@ -104,6 +104,7 @@
 	import {
 		getProduct
 	} from '@/api/takeout.js';
+		import tags from '../../mixins/tags';
 	let app = getApp();
 	export default {
 		components: {
@@ -111,6 +112,7 @@
 			navBar
 			// #endif
 		},
+			mixins:[tags],
 		data() {
 			return {
 				optionData: [],
@@ -124,23 +126,23 @@
 				hotSearchList: [],
 				theme: app.globalData.theme,
 				page: 1,
-				labelList: [{
-					id: 1,
-					label: "销量排行",
-					checked: true
-				}, {
-					id: 2,
-					label: "满减大促",
-					checked: false
-				}, {
-					id: 3,
-					label: "首单立减",
-					checked: false
-				}, {
-					id: 4,
-					label: "减配送费",
-					checked: false
-				}],
+				// labelList: [{
+				// 	id: 1,
+				// 	label: "销量排行",
+				// 	checked: true
+				// }, {
+				// 	id: 2,
+				// 	label: "满减大促",
+				// 	checked: false
+				// }, {
+				// 	id: 3,
+				// 	label: "首单立减",
+				// 	checked: false
+				// }, {
+				// 	id: 4,
+				// 	label: "减配送费",
+				// 	checked: false
+				// }],
 				urlDomain: this.$Cache.get("imgHost"),
 				merchantList: [],
 				noDataTip: '',
@@ -185,9 +187,9 @@
 			})
 		},
 		methods: {
-			getTag(){
-				return this.labelList.filter((ite => ite.checked)).map(ite => ite.id).join(',')
-			},
+			// getTag(){
+			// 	return this.labelList.filter((ite => ite.checked)).map(ite => ite.id).join(',')
+			// },
 			getMatchedData() {
 				if (this.loading) return;
 				this.loading = true

+ 22 - 20
mer_uniapp/pages/takeout/index.vue

@@ -131,12 +131,14 @@
 		getTakeoutList,
 		getProduct
 	} from '@/api/takeout.js';
+	import tags from '../../mixins/tags';
 	let app = getApp();
 	var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'rpx';
 	export default {
 		components: {
 			navBar
 		},
+		mixins:[tags],
 		data() {
 			return {
 				statusBarHeight: app.globalData.statusBarHeight,
@@ -148,23 +150,23 @@
 				optionIndex: 0,
 				noDataTip: '',
 				urlDomain: this.$Cache.get("imgHost"),
-				labelList: [{
-					id: 1,
-					label: "销量排行",
-					checked: true
-				}, {
-					id: 2,
-					label: "满减大促",
-					checked: false
-				}, {
-					id: 3,
-					label: "首单立减",
-					checked: false
-				}, {
-					id: 4,
-					label: "减配送费",
-					checked: false
-				}],
+				// labelList: [{
+				// 	id: 1,
+				// 	label: "销量排行",
+				// 	checked: true
+				// }, {
+				// 	id: 2,
+				// 	label: "满减大促",
+				// 	checked: false
+				// }, {
+				// 	id: 3,
+				// 	label: "首单立减",
+				// 	checked: false
+				// }, {
+				// 	id: 4,
+				// 	label: "减配送费",
+				// 	checked: false
+				// }],
 				merchantList: [],
 				loadTitle:'',
 				loading: false,
@@ -225,9 +227,9 @@
 					this.getMatchedData()
 				}
 			},
-			getTag(){
-				return this.labelList.filter((ite => ite.checked)).map(ite => ite.id).join(',')
-			},
+			// getTag(){
+			// 	return this.labelList.filter((ite => ite.checked)).map(ite => ite.id).join(',')
+			// },
 			getMatchedData() {
 				if (this.loading) return;
 				this.loading = true