guhongwei 2 rokov pred
rodič
commit
8350d940b5

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 31 - 0
libs/amap-wx.130.js


+ 7 - 1
manifest.json

@@ -119,7 +119,13 @@
             "scope.userLocation" : {
             "scope.userLocation" : {
                 "desc" : "定位当前位置,选在收获地址"
                 "desc" : "定位当前位置,选在收获地址"
             }
             }
-        }
+        },
+		"plugins": {
+		        "chooseLocation": {
+		        "version": "1.0.9",
+		        "provider": "wx76a9a06e5b4e693e"
+		        }
+		    }
     },
     },
     "mp-alipay" : {
     "mp-alipay" : {
         "usingComponents" : true
         "usingComponents" : true

+ 6 - 3
pages/home/index.vue

@@ -20,7 +20,7 @@
 						</view>
 						</view>
 					</view>
 					</view>
 				</view>
 				</view>
-			<!-- 	<view class="zero four">
+				<!-- 	<view class="zero four">
 					<view class="recomList" v-for="(item,index) in recomList" :key="index">
 					<view class="recomList" v-for="(item,index) in recomList" :key="index">
 						<view class="list" v-for="(tag,indexs) in item.list" :key="indexs">
 						<view class="list" v-for="(tag,indexs) in item.list" :key="indexs">
 							<view class="title">
 							<view class="title">
@@ -41,7 +41,7 @@
 						</view>
 						</view>
 						<view class="other">
 						<view class="other">
 							<view class="money">
 							<view class="money">
-								<text>¥</text><text>{{item.money||'暂无'}}</text>
+								<text>¥</text><text>{{item.sell_money||'暂无'}}</text>
 							</view>
 							</view>
 							<view class="btn">
 							<view class="btn">
 								<button type="default" size="mini">购买</button>
 								<button type="default" size="mini">购买</button>
@@ -101,8 +101,11 @@
 					});
 					});
 					that.$set(that, `btnList`, data);
 					that.$set(that, `btnList`, data);
 				}
 				}
-				res = await that.$api(`/goods`, `GET`, {});
+				res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
+					limit: 20
+				});
 				if (res.errcode == '0') {
 				if (res.errcode == '0') {
+					console.log(res);
 					that.$set(that, `marketList`, res.data)
 					that.$set(that, `marketList`, res.data)
 				}
 				}
 			},
 			},

+ 12 - 0
pages/index/index.vue

@@ -25,6 +25,7 @@
 
 
 			};
 			};
 		},
 		},
+		onLoad: function() {},
 		onShow: function() {
 		onShow: function() {
 			const that = this;
 			const that = this;
 			// 监听用户是否登录
 			// 监听用户是否登录
@@ -38,6 +39,17 @@
 				});
 				});
 			},
 			},
 			watchLogin() {
 			watchLogin() {
+				// const key = '5WLBZ-H6RWU-NQVVO-BQG7I-XEHFK-PAFSF'; //使用在腾讯位置服务申请的key
+				// const referer = 'test'; //调用插件的app的名称
+				// const location = JSON.stringify({
+				// 	latitude: 39.89631551,
+				// 	longitude: 116.323459711
+				// });
+				// const category = '';
+				// console.log('1');
+				// uni.navigateTo({
+				// 	url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&location=' + location + '&category=' + category
+				// });
 				uni.redirectTo({
 				uni.redirectTo({
 					url: `/pages/home/index`
 					url: `/pages/home/index`
 				})
 				})

+ 48 - 24
pagesHome/market/search.vue

@@ -26,7 +26,7 @@
 						</view>
 						</view>
 						<view class="two_2">
 						<view class="two_2">
 							<view class="list" v-for="(item,index) in list" :key="index">
 							<view class="list" v-for="(item,index) in list" :key="index">
-								<image class="image" :src="item.url" mode=""></image>
+								<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode=""></image>
 								<view class="sale" v-if="item.is_sale==true">
 								<view class="sale" v-if="item.is_sale==true">
 									<text>已售尽</text>
 									<text>已售尽</text>
 								</view>
 								</view>
@@ -36,7 +36,7 @@
 								<view class="other">
 								<view class="other">
 									<view class="money">
 									<view class="money">
 										<text>¥</text>
 										<text>¥</text>
-										<text>{{item.money}}</text>
+										<text>{{item.sell_money}}</text>
 									</view>
 									</view>
 									<view class="btn" v-if="item.is_sale==false">
 									<view class="btn" v-if="item.is_sale==false">
 										<text class="iconfont icon-gouwuche"></text>
 										<text class="iconfont icon-gouwuche"></text>
@@ -56,26 +56,11 @@
 		data() {
 		data() {
 			return {
 			return {
 				searchInfo: {},
 				searchInfo: {},
-				list: [ //商品列表
-					{
-						url: require('@/static/test.png'),
-						name: '商品名称',
-						money: '10.00',
-						is_sale: false
-					},
-					{
-						url: require('@/static/test.png'),
-						name: '商品名称',
-						money: '10.00',
-						is_sale: false
-					},
-					{
-						url: require('@/static/test.png'),
-						name: '商品名称',
-						money: '10.00',
-						is_sale: true
-					},
-				],
+				list: [],
+				total: 0,
+				page: 0,
+				skip: 0,
+				limit: 5,
 				condActive: 0,
 				condActive: 0,
 				shang: false,
 				shang: false,
 				xia: false,
 				xia: false,
@@ -107,10 +92,49 @@
 				]
 				]
 			};
 			};
 		},
 		},
-		onShow: function() {},
+		onShow: function() {
+			const that = this;
+			that.search();
+		},
 		methods: {
 		methods: {
+			async search() {
+				const that = this;
+				let info = {
+					skip: that.skip,
+					limit: that.limit
+				}
+				const res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
+					...info
+				})
+				if (res.errcode == '0') {
+					let list = [...that.list, ...res.data];
+					that.$set(that, `list`, list)
+					that.$set(that, `total`, res.total)
+				} else {
+					uni.showToast({
+						title: res.errmsg,
+					});
+				}
+			},
 			// 分页
 			// 分页
-			toPage(e) {
+			toPage() {
+				const that = this;
+				let list = that.list;
+				let limit = that.limit;
+				if (that.total > list.length) {
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					})
+					let page = that.page + 1;
+					that.$set(that, `page`, page)
+					let skip = page * limit;
+					that.$set(that, `skip`, skip)
+					that.search();
+					uni.hideLoading();
+				} else uni.showToast({
+					title: '没有更多数据了'
+				});
 
 
 			},
 			},
 			// 输入框
 			// 输入框

+ 32 - 91
pagesHome/market/type.vue

@@ -19,13 +19,13 @@
 						<view class="list-scroll-view">
 						<view class="list-scroll-view">
 							<view class="list" v-for="(item,index) in list" :key="index">
 							<view class="list" v-for="(item,index) in list" :key="index">
 								<view class="title">
 								<view class="title">
-									{{item.name}}
+									{{item.label}}
 								</view>
 								</view>
 								<view class="market">
 								<view class="market">
-									<view class="marketList" v-for="(tag,indexs) in item.marketList" :key="indexs">
+									<view class="marketList" v-for="(tag,indexs) in item.children" :key="indexs">
 										<image class="image" :src="tag.url" mode=""></image>
 										<image class="image" :src="tag.url" mode=""></image>
 										<view class="name">
 										<view class="name">
-											{{tag.name}}
+											{{tag.label}}
 										</view>
 										</view>
 									</view>
 									</view>
 								</view>
 								</view>
@@ -40,93 +40,18 @@
 
 
 <script>
 <script>
 	export default {
 	export default {
-		name: 'sort',
+		name: 'type',
 		data() {
 		data() {
 			return {
 			return {
 				active: '0',
 				active: '0',
-				typeList: [ //商品分类
-					{
-						name: '休闲食品'
-					},
-					{
-						name: '进口食品'
-					},
-					{
-						name: '粮油调味'
-					},
-					{
-						name: '酒饮冲调'
-					},
-					{
-						name: '时令水果'
-					},
-					{
-						name: '品质生鲜'
-					},
-					{
-						name: '居家用品'
-					},
-					{
-						name: '个护清洁'
-					},
-					{
-						name: '3C产品'
-					},
-					{
-						name: '母婴玩具'
-					},
-					{
-						name: '服饰配件'
-					},
-					{
-						name: '礼卡专区'
-					},
-					{
-						name: '植物饮食'
-					}
-				],
-				list: [ //
-					{
-						name: '商品一',
-						marketList: [ //
-							{
-								url: require('@/static/test.png'),
-								name: '核桃'
-							},
-							{
-								url: require('@/static/test.png'),
-								name: '核桃'
-							},
-							{
-								url: require('@/static/test.png'),
-								name: '核桃'
-							},
-							{
-								url: require('@/static/test.png'),
-								name: '核桃2'
-							}
-						]
-					},
-					{
-						name: '商品二',
-						marketList: [ //
-							{
-								url: require('@/static/test.png'),
-								name: '核桃'
-							},
-							{
-								url: require('@/static/test.png'),
-								name: '核桃2'
-							}
-						]
-					}
-				]
-
+				typeList: [],
+				list: []
 			};
 			};
 		},
 		},
 		onShow: function() {
 		onShow: function() {
 			const that = this;
 			const that = this;
-			that.searchOther()
+			that.searchOther();
+
 		},
 		},
 		methods: {
 		methods: {
 			async searchOther() {
 			async searchOther() {
@@ -135,19 +60,35 @@
 				res = await that.$api(`/goodsTags`, 'GET', {
 				res = await that.$api(`/goodsTags`, 'GET', {
 					status: '0'
 					status: '0'
 				})
 				})
-				if (res.errcode == '0') that.$set(that, `typeList`, res.data);
+				if (res.errcode == '0') {
+					that.$set(that, `typeList`, res.data);
+					if (res.total > 0) that.searchRight(res.data[0]);
+				}
 			},
 			},
 			toChange(index, e) {
 			toChange(index, e) {
 				const that = this;
 				const that = this;
-				that.$set(that, `active`, index)
+				that.$set(that, `active`, index);
+				that.searchRight(e);
 			},
 			},
-			// 公共跳转
-			toCommon(e) {
-				uni.navigateTo({
-					url: `/${e}`
+			// 查询左侧信息
+			async searchRight(e) {
+				const that = this;
+				let info = {};
+				if (e.id) info.pid = e.id;
+				const res = await that.$api(`/goodsTags/tree`, 'GET', {
+					...info
 				})
 				})
-			},
-		}
+				if (res.errcode == '0' && res.data.length > 0) {
+					that.$set(that, `list`, res.data[0].children)
+				}
+			}
+		},
+		// 公共跳转
+		toCommon(e) {
+			uni.navigateTo({
+				url: `/${e}`
+			})
+		},
 	}
 	}
 </script>
 </script>