浏览代码

商品详情

mr-zhou-zhou 2 年之前
父节点
当前提交
f7ba580371

+ 2 - 1
App.vue

@@ -2,7 +2,8 @@
 	import Vue from 'vue';
 	export default {
 		onLaunch: function() {
-			// this.$store.dispatch('userInfo/getinfo');
+			this.$store.dispatch('userInfo/getinfo');
+			this.$store.dispatch('userInfo/getAddrInfo');
 			// this.$store.dispatch('userInfo/getopenid');
 			uni.getSystemInfo({
 				success: function(e) {

+ 0 - 0
common/amap-wx.js → common/amap-wx-删除.js


+ 53 - 0
common/loc-amap删除.js

@@ -0,0 +1,53 @@
+import Tools from './tools.js';
+const amapFile = require('@/common/amap-wx.js')
+var myAmapFun = new amapFile.AMapWX({key: '01d42bb16e23baca11f1227164a200fd'}); //01d42bb16e23baca11f1227164a200fd使用本人高德
+
+//逆向解析
+function getNameByLatLng(latitude,longitude){
+	return new Promise((resolve,reject)=>{
+		//未使用微信授权api
+		myAmapFun.getRegeo({
+			location:longitude+','+latitude,
+			success: function(data){
+				// console.log("getRegeo data--",data);
+				resolve(data[0]);
+			},
+			fail: err=> {
+				reject("逆向地址解析错误");
+				console.log(err)
+			}
+		})
+	})
+}
+
+async function chooseLoc(){
+	return new Promise(async (resolve,reject)=>{
+	   let [cErr,cRes] = await uni.chooseLocation({type:'gcj02'});
+	   if(cErr){
+		   reject(cErr)
+		   return;
+	   }
+	   let {latitude,longitude} = cRes
+	   let loc = await getNameByLatLng(latitude,longitude) || {};
+	   // console.log('getNameByLatLng===',loc,loc.regeocodeData.addressComponent.province);
+	   if(loc.regeocodeData && loc.regeocodeData.addressComponent){
+		   let {province,city,district,township} = loc.regeocodeData.addressComponent;
+		   let address = district+township+loc.desc;
+		   resolve({
+			   province,
+			   city, 
+			   area:district,
+			   address,
+			   latitude,
+			   longitude,   
+		   })
+		   return;
+	   }
+	   return reject(false);	
+	})
+}
+
+export{
+   getNameByLatLng,
+   chooseLoc,
+}

+ 22 - 20
common/loc.js

@@ -1,16 +1,18 @@
-import Tools from './tools.js';
-const amapFile = require('@/common/amap-wx.js')
-var myAmapFun = new amapFile.AMapWX({key: '01d42bb16e23baca11f1227164a200fd'}); //01d42bb16e23baca11f1227164a200fd使用本人高德
+const QQMapWX = require('./qqmap-wx-jssdk.min.js')
+// key: 'QNVBZ-FOQK3-ZOT3S-3GADS-7KAG3-LBBQB' //测即成key
+const qqmapsdk = new QQMapWX({
+	key: 'RXSBZ-GUOYJ-OZOFI-FBMOP-3CMF3-D6FGE'  //hjt
+})
+
 
 //逆向解析
 function getNameByLatLng(latitude,longitude){
 	return new Promise((resolve,reject)=>{
-		//未使用微信授权api
-		myAmapFun.getRegeo({
-			location:longitude+','+latitude,
-			success: function(data){
-				// console.log("getRegeo data--",data);
-				resolve(data[0]);
+		qqmapsdk.reverseGeocoder({
+			location: {latitude,longitude},
+			success: res=> {
+				// console.log("getNameByLatLng--",res.result)
+				resolve(res.result);
 			},
 			fail: err=> {
 				reject("逆向地址解析错误");
@@ -19,7 +21,6 @@ function getNameByLatLng(latitude,longitude){
 		})
 	})
 }
-
 async function chooseLoc(){
 	return new Promise(async (resolve,reject)=>{
 	   let [cErr,cRes] = await uni.chooseLocation({type:'gcj02'});
@@ -29,17 +30,18 @@ async function chooseLoc(){
 	   }
 	   let {latitude,longitude} = cRes
 	   let loc = await getNameByLatLng(latitude,longitude) || {};
-	   // console.log('getNameByLatLng===',loc,loc.regeocodeData.addressComponent.province);
-	   if(loc.regeocodeData && loc.regeocodeData.addressComponent){
-		   let {province,city,district,township} = loc.regeocodeData.addressComponent;
-		   let address = district+township+loc.desc;
+	   // console.log('getNameByLatLng===',loc);
+	   if( loc.address_component){
+		   let {province,city,district} = loc.address_component;
+		   let {lat,lng} = loc.location;
+		   let desc = loc.formatted_addresses.recommend;
 		   resolve({
 			   province,
 			   city, 
-			   area:district,
-			   address,
-			   latitude,
-			   longitude,   
+			   district,
+			   desc,
+			   latitude:lat,
+			   longitude:lng,   
 		   })
 		   return;
 	   }
@@ -47,7 +49,7 @@ async function chooseLoc(){
 	})
 }
 
+
 export{
-   getNameByLatLng,
-   chooseLoc,
+	chooseLoc,
 }

+ 3 - 3
common/mixin.js

@@ -8,7 +8,8 @@ export default{
 	},
 	computed:{
 		...mapState('userInfo',{
-			userInfo: (state) => state.userInfo
+			userInfo: (state) => state.userInfo,
+			addrInfo: (state) => state.addrInfo,
 		}),
 		//isOpen 为字符串'1或0'
 		// ...mapState('baseConfig',{
@@ -43,7 +44,7 @@ export default{
 			opt={type:'push',isCheckLogin:false ,...opt}; //opt传一值补全
 			if(opt.isCheckLogin && !this.hasInfo()){
 				uni.navigateTo({
-					url:'/pages/login/login'
+					url:'/pages/login/login?toPath='+path
 				})
 				return;
 			}
@@ -84,6 +85,5 @@ export default{
 		// goDownload(){
 		// 	this.navTo('/pages/index/download')
 		// },
-		
 	},
 }

文件差异内容过多而无法显示
+ 0 - 0
common/qqmap-wx-jssdk.min.js


+ 76 - 1
common/request/api.js

@@ -70,9 +70,84 @@ export default {
 			method:'POST',
 			isNprogress:false
 		},
+		energy:{
+			url:'api/index/energy',
+			auth:false,
+			method:'POST',
+			isNprogress:false
+		},
+		banner:{
+			url:'api/index/banner',
+			auth:false,
+			method:'POST',
+			isNprogress:false
+		},
+		info:{
+			url:'api/user_goods/info',
+			auth:false,
+			method:'POST',
+			isNprogress:true
+		},
+	},
+	favorite:{
+		add:{
+			url:'api/user_favorite_shop/add',
+			auth:false,
+			method:'POST',
+			isNprogress:true
+		},
+		cancel:{
+			url:'api/user_favorite_shop/cancel',
+			auth:false,
+			method:'POST',
+			isNprogress:true
+		},
+		list:{
+			url:'api/user_favorite_shop/list',
+			auth:false,
+			method:'POST',
+			isNprogress:false
+		},
 	},
 	addr:{
-		
+		getDefault:{
+			url:'api/user_address/getDefault',
+			auth:false,
+			method:'POST',
+			isNprogress:false,
+		},
+		save:{
+			url:'api/user_address/save',
+			auth:false,
+			method:'POST',
+			isNprogress:false,
+		},
+		list:{
+			url:'api/user_address/list',
+			auth:false,
+			method:'POST',
+			isNprogress:false,
+		},
+		del:{
+			url:'api/user_address/del',
+			auth:false,
+			method:'POST',
+			isNprogress:false,
+		},
+		info:{
+			url:'api/user_address/info',
+			auth:false,
+			method:'POST',
+			isNprogress:false,
+		},
+	},
+	home:{
+		company:{
+			url:'api/index/company',
+			auth:false,
+			method:'POST',
+			isNprogress:false,
+		},
 	},
 	
 };

+ 2 - 2
components/single-list.vue

@@ -57,13 +57,13 @@
 				const sendData={
 					...this.sendData,
 					page: this.pageNum,
-					pagenum: this.pageSize,
+					limit: this.pageSize,
 				}
 				let res = await this.$request(this.url,sendData);
 				uni.stopPullDownRefresh();
 				// this.isTriggerRefresh=false;
 				// this.isLoaded = true;
-				let result = res.data || [];
+				let result = res.data.row || [];
 				
 				if ( this.pageSize > result.length) {
 					this.loadingType = 'noMore';

+ 11 - 0
pages.json

@@ -241,6 +241,17 @@
             }
             
         }
+		,{
+		    "path" : "pages/mang/list",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": "",
+		        "enablePullDownRefresh": false,
+				"navigationBarBackgroundColor": "#f8f8f8",
+				"backgroundColor": "#f8f8f8"
+		    }
+		    
+		}
     ],
 	"tabBar": {
 		"color": "#999999",

+ 72 - 130
pages/address/address.vue

@@ -1,35 +1,30 @@
 <template>
 	<view class="page b-t">
-		<!-- 
-		<singleList ref="listRef" url="cang.mycollectionsecond" :sendData="reqData" @reqEnd="searchEnd">
+		<singleList ref="listRef" url="addr.list" :sendData="reqData" @reqEnd="searchEnd">
 			<template v-slot:items="{list}">
-		 -->		
-		 <!--  -->
-				<view class="list b-b" v-for="(item, index) in addressList" :key="index" @click="checkAddress(item)">
-					<image :src="item.checked? '/static/check-do.png' : '/static/check-un.png' " mode="aspectFill" class="check"></image>
+				<view class="list b-b" v-for="(item, index) in list" :key="index" @click="checkAddress(item)">
+					<image :src="item.checked? '/static/check-do.png' : '/static/check-un.png' " mode="aspectFill" class="check" v-if="sourcePage==='mang'"></image>
 					<view class="content flex-col">
 						<view class="u-box align-center">
-							<text class="name">{{item.name}}</text>
+							<text class="name">{{item.consignee}}</text>
 							<text class="mobile">{{item.mobile}}</text>
-							<text v-if="item.is_default"  class="tag">默认</text>
+							<text v-if="item.is_default==='1'"  class="tag">默认</text>
 							<view class="ic-wrap del align-center justify-center">
-								<image src="/static/addr-del.png" mode="aspectFill" class="ic" @click.stop="deleteAddress(item.id,index)"></image>
+								<image src="/static/addr-del.png" mode="aspectFill" class="ic" @click.stop="deleteAddress(item)"></image>
 							</view>
 							<view class="ic-wrap edit align-center justify-center">
-								<image src="/static/addr-edit.png" mode="aspectFill" class="ic" @click.stop="addAddress('edit', item.id)"></image>
+								<image src="/static/addr-edit.png" mode="aspectFill" class="ic" @click.stop="addAddress(item.id)"></image>
 							</view>
 						</view>
 						<view class="address-box">
-							<text class="address">{{item.addr+' '+item.desc}}</text>
+							<text class="address">{{item.full_address}}</text>
 						</view>	
 					</view>
 				</view>
-		<!-- 		
-			    <empty v-else-if="sRes && sRes==='empty'"/>
+			    <empty v-if="sRes && sRes==='empty'"/>
 			</template>
 		</singleList>
-		-->
-		<button class="add-btn" @click="addAddress('add')">新增地址</button>
+		<view class="add-btn" @click="addAddress()">新增地址</view>
 		<safe-area bgColor="#f8f8f8"/>
 	</view>
 </template>
@@ -38,146 +33,93 @@
 	export default {
 		data() {
 			return {
-				source: 0,
-				addressList: [
-					{
-						id:1,
-						is_default:true,
-						addr:'山东省临沂市河东区',
-						desc:'山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区',
-						name:'mork',
-						mobile:'15263970923',
-						checked:true,
-					},
-					{
-						id:1,
-						is_default:false,
-						addr:'山东省临沂市河东区',
-						desc:'山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区',
-						name:'mork',
-						mobile:'15263970923',
-						checked:false,
-					},
-					{
-						id:1,
-						is_default:true,
-						addr:'山东省临沂市河东区',
-						desc:'山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区',
-						name:'mork',
-						mobile:'15263970923',
-						checked:true,
-					},
-					{
-						id:1,
-						is_default:false,
-						addr:'山东省临沂市河东区',
-						desc:'山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区',
-						name:'mork',
-						mobile:'15263970923',
-						checked:false,
-					},
-					{
-						id:1,
-						is_default:true,
-						addr:'山东省临沂市河东区',
-						desc:'山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区',
-						name:'mork',
-						mobile:'15263970923',
-						checked:true,
-					},
-					{
-						id:1,
-						is_default:false,
-						addr:'山东省临沂市河东区',
-						desc:'山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区',
-						name:'mork',
-						mobile:'15263970923',
-						checked:false,
-					},
-					{
-						id:1,
-						is_default:true,
-						addr:'山东省临沂市河东区',
-						desc:'山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区',
-						name:'mork',
-						mobile:'15263970923',
-						checked:true,
-					},
-					{
-						id:1,
-						is_default:false,
-						addr:'山东省临沂市河东区',
-						desc:'山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区',
-						name:'mork',
-						mobile:'15263970923',
-						checked:false,
-					},
-				],
+				sourcePage: '',
+				// addressList: [
+					// {
+					// 	id:1,
+					// 	is_default:true,
+					// 	addr:'山东省临沂市河东区',
+					// 	desc:'山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区山东省临沂市河东区',
+					// 	name:'mork',
+					// 	mobile:'15263970923',
+					// 	checked:true,
+					// }
+				// ],
 				reqData:{}, //请求数据
 				sRes:'', //搜索结果 empty,noMore
 			}
 		},
 		onLoad(option) {
 			// console.log(option.source);
-			this.source = option.source;
-			// this.$nextTick(()=>{
-			// 	this.reqData={
-			// 		type: this.cats[this.curCatIdx].state,
-			// 	}	
-			// })	
+			this.sourcePage = option.sourcePage;
+			
 		},
 		onShow() {
+			this.$nextTick(()=>{
+				this.$refs.listRef.getList(true);
+			})	
 			// this.refreshList();
 		},
+		onReachBottom() {
+			this.$refs.listRef.getList();
+		},
 		methods: {
 			//获取我的收货地址
-			async getList() {
-				let res = await this.$api.request('/addons/unishop/address/all', 'POST', {
-					page: 1,
-					pagesize: 50
-				});
-				let list = res.data;
-				if (list) {
-					this.addressList = list;
+			// async getList() {
+			// 	let res = await this.$api.request('/addons/unishop/address/all', 'POST', {
+			// 		page: 1,
+			// 		pagesize: 50
+			// 	});
+			// 	let list = res.data;
+			// 	if (list) {
+			// 		this.addressList = list;
+			// 	}
+			// },
+			//添加或修改成功之后回调
+			// refreshList(data, type) {
+			// 	//添加或修改后事件,这里直接在最前面添加了一条数据,实际应用中直接刷新地址列表即可
+			// 	// this.addressList.unshift(data);
+			// 	this.addressList=[];
+			// 	this.getList();
+			// },
+			searchEnd({loadingType,pageOneRes}){
+				if(loadingType === 'noMore' && pageOneRes && pageOneRes.length === 0){
+					this.sRes='empty';
+				}else{
+					this.sRes=loadingType;
 				}
 			},
 			//选择地址
 			checkAddress(item) {
-				if (this.source == 1) {
-					//this.$api.prePage()获取上一页实例,在App.vue定义
-					this.$api.prePage().addressData = item;
+				// if (this.source == 1) {
+					// 上一页盲盒页情况
+					// if(this.$tools.prePage().setDefaultAddr){
+					// 	this.$tools.prePage().setDefaultAddr(item);
+					// 	uni.navigateBack()
+					// }
+				// }
+				//盲盒页进
+				if(this.sourcePage === 'mang'){
+					this.$store.commit('userInfo/ADDR_INFO',item)
 					uni.navigateBack()
 				}
 			},
-			addAddress(type, id = 0) {
-				uni.navigateTo({
-					url: `/pages/address/addressManage?type=${type}&id=${id}`
-				})
+			addAddress(id = 0) {
+				this.navTo('/pages/address/addressManage',{id})
 			},
-			//添加或修改成功之后回调
-			refreshList(data, type) {
-				//添加或修改后事件,这里直接在最前面添加了一条数据,实际应用中直接刷新地址列表即可
-				// this.addressList.unshift(data);
-				this.addressList=[];
-				this.getList();
-			},
-			async deleteAddress(id, index) {
+		
+			async deleteAddress(item) {
 				let [error, res] = await uni.showModal({
 					title: '确定删除地址?',
-					content: this.addressList[index].address
+					content: item.address
 				})
-
 				if (res.confirm) {
-					let res = await this.$api.request('/addons/unishop/address/delete?id=' + id);
-					let data = res.data;
-					if (data) {
-						if (this.$api.prePage().addressData && this.$api.prePage().addressData.id) {
-							if (this.$api.prePage().addressData.id == this.addressList[index].id) {
-								this.$api.prePage().addressData = {};
-							}
-						}
-						this.addressList.splice(index, 1);
+					await this.$request('addr.del',{id:item.id});
+					this.$refs.listRef.getList(true);
+					if(item.id === this.addrInfo.id){
+						this.$store.commit('userInfo/ADDR_INFO',{});
 					}
+					
 				}
 
 			}

+ 94 - 56
pages/address/addressManage.vue

@@ -2,22 +2,22 @@
 	<view class="page">
 		<view class="row b-b">
 			<text class="tit">收货人</text>
-			<input class="input" type="text" v-model="name" placeholder="收货人姓名" placeholder-class="placeholder" />
+			<input class="input" type="text"  placeholder="收货人姓名" placeholder-class="placeholder" v-model="consignee" />
 		</view>
 		<view class="row b-b">
 			<text class="tit">联系电话</text>
-			<input class="input" type="number" v-model="mobile" placeholder="联系电话" placeholder-class="placeholder" />
+			<input class="input" type="number"  placeholder="联系电话" placeholder-class="placeholder" v-model="mobile" />
 		</view>
 		<view class="row b-b" v-on:click="chooseLoc()">
 			<text class="tit">收货地址</text>
-			<view class="input clamp2" :class="{placeholder: !addr}">
-				{{addr ? addr :'定位地址'}}
+			<view class="input clamp2" :class="{placeholder: !addrTop}">
+				{{addrTop ? addrTop :'定位地址'}}
 			</view>
 			<image src="/static/r-arrow.png" mode="aspectFill" class="ic"></image>
 		</view>
 		<view class="row b-b">
 			<text class="tit">详细地址</text>
-			<input class="input clamp2" type="text" v-model="desc" placeholder="详细地址,楼号" placeholder-class="placeholder" />
+			<input class="input clamp2" type="text"  placeholder="详细地址,楼号" placeholder-class="placeholder" v-model="address" />
 		</view>
 
 		<view class="row default-row">
@@ -26,10 +26,15 @@
 				<text class="tips">每次下单会默认推荐使用该地址</text>
 			</div>
 			
-			<switch :checked="is_default" color="#92B99C" @change="switchChange" />
+			<switch :checked="is_default=='1' ? true :false" color="#92B99C" @change="switchChange" />
 		</view>
-		<button class="add-btn" @click="confirm">提交</button>
 		
+		
+		<submit-btn @submit="submit" ref="submitRef">
+			<template v-slot:btns="{isSubmitted}">
+				<view class="add-btn" :class="{'disabled':isSubmitted}" >提交</view>
+			</template>
+		</submit-btn>
 	
 	</view>
 </template>
@@ -39,22 +44,30 @@
 	export default {
 		data() {
 			return {
-				name: '',
+				sourcePage: '', //mang
+				consignee: '',
 				mobile: '',
-				addr:'',
-				desc:'',
-				is_default:'',
+				addrTop:'',
+				is_default:1,
+				
+				province:'',
+				city:'',
+				district:'',
+				address:'',
+				address_lng:'',
+				address_lat:'',
 			}
 		},
 		onLoad(option) {
+			this.sourcePage = option.sourcePage;
 			let title = '新增收货地址';
-			if (option.type === 'edit') {
-				// this.getInfo(option.id);
+			if (+option.id) {
+				this.id = option.id;
+				this.getInfo(option.id);
 				title = '编辑收货地址'
 			} else {
 				// this.$refs.mpvueCityPicker.creat(this.pickerValueDefault);
 			}
-			this.manageType = option.type;
 			uni.setNavigationBarTitle({ 
 				title
 			})
@@ -62,67 +75,89 @@
 		methods: {
 			// 获取地址详情
 			async getInfo(id){
-				let  res= await this.$api.request(`/addons/unishop/address/info?id=${id}`);
-				let addressData = res.data;
-				if (addressData) {
-					console.log(addressData);
-					
-					this.addressData = addressData;
-					let pickerValueDefault = [];
-					pickerValueDefault.push(addressData.province_id);
-					pickerValueDefault.push(addressData.city_id);
-					pickerValueDefault.push(addressData.area_id);
-					this.pickerValueDefault = pickerValueDefault;
-					
-					this.$refs.mpvueCityPicker.creat(pickerValueDefault);
-				}
+				let  res= await this.$request(`addr.info`,{id});
+				let data = res.data || {};
+				this.consignee = data.consignee;
+				this.mobile = data.mobile;
+				this.province = data.province;
+				this.city = data.city;
+				this.district = data.district;
+				this.address = data.address;
+				this.is_default = data.is_default;
+				this.address_lng = data.address_lng;
+				this.address_lat = data.address_lat;
+				this.addrTop = `${data.province}${data.city}${data.district}`;
 			},
 			// 城市选择器
 			async chooseLoc() {
 				let  {
-				   province,
-				   city, 
-				   area,
-				   address,
-				   latitude,
-				   longitude,
+				  province,
+				  city, 
+				  district,
+				  desc,
+				  latitude,
+				  longitude,   
 				} =await chooseLoc();
-				this.addr = `${province}${city} ${area}`;
-				this.desc = address;
+				this.addrTop = `${province}${city}${district}`;
+				
+				this.province = province;
+				this.city = city;
+				this.district = district;
+				this.address = desc;
+				this.address_lng = longitude;
+				this.address_lat = latitude;
 			},
 			//默认地址
 			switchChange(e) {
-				this.is_default = e.detail.value;
+				this.is_default = e.detail.value ? 1 : 0;
 			},
 			//提交
-			async confirm() {
-				//Deep Clone
-				if(this.$api.inAction('confirm',this)){
+			async submit() {
+				if (!this.consignee) {
+					this.$tools.msg('请填写收货人姓名');
 					return;
 				}
-				let data = JSON.parse(JSON.stringify(this.addressData));
-				if (!data.name) {
-					this.$api.msg('请填写收货人姓名');
+				if (!this.$tools.match(this.mobile,'mobile')) {
 					return;
 				}
-				if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(data.mobile)) {
-					this.$api.msg('请输入正确的手机号码');
+				if (!this.addrTop) {
+					this.$tools.msg('请选择地址');
 					return;
 				}
-				if (!data.address) {
-					this.$api.msg('请填详细地址信息');
+				if (!this.address) {
+					this.$tools.msg('请填详细地址信息');
 					return;
 				}
-				console.log(data.is_default);
-				data.is_default = data.is_default == true ? 1 : 0;
-				let action = this.manageType == 'edit' ? 'edit' : 'add';
-				let result = await this.$api.request('/addons/unishop/address/' + action, 'POST', data);
-				if (result) {
-					this.$api.prePage().refreshList(data, this.manageType);
-					setTimeout(() => {
-						uni.navigateBack()
-					}, 800)
+				let sendData = {
+					consignee :this.consignee,
+					mobile :this.mobile,
+					province :this.province,
+					city :this.city,
+					district :this.district,
+					address :this.address,
+					is_default :this.is_default,
+					address_lng :this.address_lng,
+					address_lat :this.address_lat,
+				};
+				if(this.id){
+					sendData = {...sendData,id:this.id}
+				}
+				let res = await this.$request('addr.save' , sendData);
+				if(!this.id){
+					sendData = {...sendData,id:res.data.id}
 				}
+				this.$refs.submitRef.chgeStatus();
+				// 无默认地址直接添加情况
+				// if(this.$tools.prePage().setDefaultAddr){
+				// 	this.$tools.prePage().setDefaultAddr(sendData)
+				// }
+				//盲盒页进
+				if(this.sourcePage === 'mang'){
+					this.$store.commit('userInfo/ADDR_INFO',sendData)
+				}
+				setTimeout(() => {
+					uni.navigateBack()
+				}, 800)
 			},
 		}
 	}
@@ -195,5 +230,8 @@
 		color: #fff;
 		background-color: $base-color;
 		border-radius: 38upx;
+		&.disabled{
+			background-color: #eee;
+		}
 	}
 </style>

+ 23 - 16
pages/home/home.vue

@@ -4,7 +4,7 @@
 			<image src="/static/home_logo.png" mode="widthFix" class="logo"></image>
 		</navbar-line>
 		<view class="content">
-			
+			<rich-text :nodes="rich" class="rich"></rich-text>
 		</view>
 	</view>
 </template>
@@ -17,11 +17,18 @@
 		},
 		data() {
 			return {
-				
+				rich:'',
 			}
 		},
+		onLoad() {
+			this.getInfo();
+		},
 		methods: {
-			
+			async getInfo(){
+				let res = await this.$request('home.company');
+				this.rich = this.$tools.replaceDetail(res.data.content)
+			},
+
 		}
 	}
 </script>
@@ -31,19 +38,19 @@ page{
 	background-color: #fff;
 }
 
-	.logo{
-		width: 60rpx;
-		height: 60rpx;
-		font-family: PingFang SC;
-		
-		margin-left: 30rpx;
-		position: absolute;
-		top: 50%;
-		transform: translateY(-50%);
-	}
-	.content{
-		height: 1000rpx;
-		background-color: rgba(0,0,0,.6)
+.logo{
+	width: 60rpx;
+	height: 60rpx;
+	font-family: PingFang SC;
+	margin-left: 30rpx;
+	position: absolute;
+	top: 50%;
+	transform: translateY(-50%);
+}
+.content{
+	.rich{
+		line-height: normal;
 	}
+}
 	
 </style>

+ 13 - 4
pages/login/login.vue

@@ -5,7 +5,7 @@
 			<text class="txt">盲go小程序</text>
 		</view>
 		<button open-type="getPhoneNumber"  class="btn-auth" @getphonenumber="getphonenumber">微信用户一键登录</button>
-		<view class="btn-mobile" @tap="navTo('/pages/login/mobileLogin')">手机号码登录</view>
+		<view class="btn-mobile" @tap="goMobileLogin">手机号码登录</view>
 	</view>
 </template>
 
@@ -16,8 +16,8 @@
 				
 			};
 		},
-	    async onLoad() {
-	    	
+	    async onLoad(e) {
+	    	this.toPath = e.toPath;
 	    },
 		methods:{
 			async getphonenumber(e){
@@ -30,9 +30,18 @@
 				this.$store.dispatch('userInfo/getinfo');
 				this.$tools.msg(res.msg);
 				setTimeout(()=>{
+					if(this.toPath){
+						uni.redirectTo({
+							url:this.toPath
+						})
+						return;
+					}
 					this.goBack();
 				},800)
-			}
+			},
+			goMobileLogin(){
+				this.navTo('/pages/login/mobileLogin',{toPath:this.toPath},{type:'replace'})
+			},
 		}
 	}
 </script>

+ 10 - 5
pages/login/mobileLogin.vue

@@ -69,12 +69,10 @@
 				// invite_no:'',
 			};
 		},
-		onLoad(opt) {
+		onLoad(e) {
 			// this.openid = this.$Route.query.openid;
 			// this.accessToken = this.$Route.query.accessToken;
-			if(opt.code){
-				this.invite_no = opt.code;
-			}
+			this.toPath = e.toPath;
 		},
 		methods:{
 			chgeCode(){
@@ -100,10 +98,17 @@
 				let res=await this.$request('login.mobilelogin',sendData);
 				let userInfo = res.data.userinfo || {};
 				uni.setStorageSync("token",userInfo.token);
+				this.$store.dispatch('userInfo/getinfo');
 				this.$tools.msg(res.msg);
 				this.$refs.submitRef.chgeStatus();
 				setTimeout(()=>{
-					this.goBack(2)
+					if(this.toPath){
+						uni.redirectTo({
+							url:this.toPath
+						})
+						return;
+					}
+					this.goBack()
 				},800)
 			},
 		},

+ 167 - 0
pages/mang/components/pro-item.vue

@@ -0,0 +1,167 @@
+<template>
+	<view class="flex-row section_2 view_6"  @tap="navTo('/pages/mang/detail',{id:info.id})">
+	  <image
+		:src="info.goods_img"
+		class="group_11"
+		mode="aspectFill"
+	  />
+	  <view class="flex-col text_21 view_7">
+		<text class="text_25 clamp">{{info.goods_name}}</text>
+		<view class="stars align-center">
+			 <image
+			  src="/static/mang_star.png"
+			  class="image_14"
+			  v-for="(item,idx) in info.rank"
+			  :key="idx"
+			/>	
+		</view>
+		<text class="text_26">随机搭配</text>
+		<view class="flex-row group_16">
+		  <view class="group_17">
+			<text class="text_27">¥</text>
+			<text class="text_28">{{info.shop_price}}</text>
+		  </view>
+		  <text class="text_29">¥{{info.market_price}}</text>
+		</view>
+	  </view>
+	  <text class="text_30" v-if="info.distance">{{info.distance}}</text>
+	  <view class="flex-col text-wrapper_2"><text class="text_23 text_31 clamp">仅剩{{info.num}}份</text></view>
+	</view>	
+</template>
+
+<script>
+export default {
+  data() {
+    return {};
+  },
+  props: {
+	//请求数据
+	info:{
+		type:Object,
+		default:()=>({})
+	},
+  },
+  methods: {
+  }
+};
+</script>
+<style lang="scss" scoped>
+	.section_2 {
+	  width: 690rpx;
+	  margin:0 auto 24rpx;
+	  padding: 24rpx 14rpx 24rpx 24rpx;
+	  background-color: #ffffff;
+	  box-shadow: 0px 6rpx 10rpx #2a2a2a14;
+	  border-radius: 20rpx;
+	  position: relative;
+	  .text-wrapper_2 {
+	    padding: 8rpx 0 16rpx;
+	    background-image: url('/static/mang-listbg.png');
+	    background-size: 100% 100%;
+	    background-repeat: no-repeat;
+	    position: absolute;
+	    right: -10rpx;
+	    top: 26rpx;
+		width: 120rpx;
+	  }
+	  .text_23 {
+	    margin-left: 12rpx;
+	    margin-right: 6rpx;
+	    color: #ffffff;
+	    font-size: 24rpx;
+	    font-family: PingFang;
+		max-width: 120rpx;
+	  }
+	  // .text_31 {
+	  //   margin-left: 12rpx;
+	  //   margin-right: 6rpx;
+	  // }
+	}
+	.view_6 {
+	  padding: 24rpx 18rpx 24rpx 24rpx;
+	}
+	.group_11 {
+	  flex-shrink: 0;
+	  width: 200rpx;
+	  height: 200rpx;
+	  border-radius: 20rpx;
+	}
+	.text_21 {
+	  margin-top: 100rpx;
+	  color: #999999;
+	  font-size: 24rpx;
+	  font-family: PingFang;
+	  line-height: 18rpx;
+	}
+	.view_7 {
+	  margin-top: initial;
+	  color: initial;
+	  font-size: initial;
+	  font-family: initial;
+	  line-height: initial;
+	  margin-left: 19rpx;
+	  flex: 1 1 auto;
+	  align-self: center;
+	}
+	.text_25 {
+	  color: #333333;
+	  font-size: 30rpx;
+	  font-family: PingFang;
+	  max-width: 360rpx;
+	}
+	.stars{
+		 margin-top: 12rpx;
+		.image_14 {
+		  width: 28rpx;
+		  height: 28rpx;
+		  margin-right: 4rpx;
+		}
+	}
+	
+	.text_26 {
+	  margin-top: 20rpx;
+	  align-self: flex-start;
+	  color: #999999;
+	  font-size: 24rpx;
+	  font-family: PingFang;
+	  line-height: 23rpx;
+	}
+	.group_16 {
+	  margin-top: 37rpx;
+	  padding: 0 2rpx;
+	}
+	.group_17 {
+	  line-height: 28rpx;
+	  height: 29rpx;
+	}
+	.text_27 {
+	  color: #ff3e3e;
+	  font-size: 24rpx;
+	  font-family: PingFang;
+	  line-height: 19rpx;
+	}
+	.text_28 {
+	  color: #ff3e3e;
+	  font-size: 36rpx;
+	  font-family: PingFang;
+	  line-height: 28rpx;
+	}
+	.text_29 {
+	  margin-left: 10rpx;
+	  margin-top: 9rpx;
+	  color: #999999;
+	  font-size: 24rpx;
+	  font-family: PingFang;
+	  line-height: 20rpx;
+	  text-decoration: line-through;
+	}
+	.text_30 {
+	  z-index: 2;
+	  position: absolute;
+	  top: 130rpx;
+	  right: 20rpx;
+	  color: #999999;
+	  font-size: 24rpx;
+	  font-family: PingFang;
+	}
+</style>

+ 3 - 1
pages/mang/components/zetank-notice.vue

@@ -1,9 +1,11 @@
 <template>
 	<view class="notice">
 		<view class="right_notice">
+			<!-- noticeList -->
 		  <swiper class="notice_swiper" vertical easing-function="easeInOutCubic" :circular="true" :autoplay="true" :interval="interval">
 			<swiper-item v-for="(item,index) in noticeList" :key="index" class="sw_item" @click="clickNotice(item)">
-			   <text class="sw_text clamp">{{item.title}}</text>
+				<!-- {{item.content}} -->
+			   <text class="sw_text clamp">{{item.content}}</text>
 			</swiper-item>
 		  </swiper>
 		</view>

+ 27 - 0
pages/mang/detail.vue

@@ -122,10 +122,37 @@ export default {
 	},
 	data() {
 		return {
+			info:{},
+			loadingType:'more',
+			page:1,
+			pageSize:20,
+			list:[],
 			richTxt:'<p>你知道吗,盲go good</p>', //	this.richTxt = this.$tools.replaceDetail(this.info.content || '');
 		};
 	},
+	onLoad(e) {
+		this.id = e.id;
+		this.getInfo();
+	},
 	methods:{
+		async getInfo(){
+			let sendData={
+				id:this.id,
+				page: this.page,
+				limit: this.pageSize,
+				lng: this.addrInfo.address ? this.addrInfo.address_lng : '',
+				lat: this.addrInfo.address ? this.addrInfo.address_lat : '',
+			}
+			let res = await this.$request('goods.info',sendData);
+			
+		},
+		// async tapLove(type){
+		// 	let url = type === 'add' ? 'favorite.add' : 'favorite.cancel'
+		// 	let sendData={
+		// 		id:this.id,
+		// 	}
+		// 	let res = await this.$request(url,sendData);
+		// },
 		previewImg(idx){
 			let url = [];
 			this.$tools.previewImg(url)

+ 131 - 0
pages/mang/list.vue

@@ -0,0 +1,131 @@
+<template>
+	<view class="page">
+		<view class="p-content" >
+			<singleList ref="listRef" url="goods.list" :sendData="reqData" @reqEnd="searchEnd">
+				<template v-slot:items="{list}">
+          			<proItem :info="item" v-for="(item,i) in list" :key="i" />
+				    <empty v-if="sRes && sRes==='empty'"/>
+				</template>
+			</singleList>
+		</view>
+	</view>
+</template>
+
+<script>
+	import proItem from './components/pro-item.vue'
+	export default {
+		components:{
+			proItem
+		},
+		data() {
+			return {
+				// keyword:'',
+				// search_lishi:[],
+				reqData:{}, //请求数据
+				sRes:'', //搜索结果 empty,noMore
+			};
+		},
+		onLoad(e) {
+			this.id = e.id;
+			let name = e.name;
+			uni.setNavigationBarTitle({
+				title: name
+			})
+		},
+		onShow(){  //这里一进来就查询之前留下的搜索内容  别忘了退出登录的时候删掉
+			this.$nextTick(()=>{
+				this.reqData = {goods_cate_id:this.id}
+				// this.$refs.listRef.getList(true);
+			})
+		},
+		onReachBottom() {
+			this.$refs.listRef.getList();
+		},
+		methods:{
+			searchEnd({loadingType,pageOneRes}){
+				if(loadingType === 'noMore' && pageOneRes && pageOneRes.length === 0){
+					this.sRes='empty';
+				}else{
+					this.sRes=loadingType;
+				}
+			},
+		},
+	}
+</script>
+
+<style lang="scss">
+page{
+	background-color: #f8f8f8;
+}
+.page{
+	padding: 30rpx;
+}
+.p-bar{
+	.bar {
+	  flex: 1 1 auto;
+	  border-radius: 32rpx;
+	  height: 64rpx;
+	  border: solid 2rpx #92b99c;
+	  padding: 0 20rpx;
+	}
+	.image_5 {
+	  flex-shrink: 0;
+	  width: 31rpx;
+	  height: 31rpx;
+	}
+	.inpt {
+	  margin-left: 17rpx;
+	  height: 60rpx;
+	  line-height: 60rpx;
+	  color: #333;
+	  font-size: 28rpx;
+	  font-family: PingFang;
+	  letter-spacing: 1.12rpx;
+	}
+	.image_6 {
+	  margin-bottom: 3rpx;
+	  width: 28rpx;
+	  height: 28rpx;
+	}
+	.text_3 {
+	  margin-left: 28rpx;
+	  margin-right: 4rpx;
+	  align-self: center;
+	  color: #92b99c;
+	  font-size: 28rpx;
+	  font-family: PingFang;
+	  line-height: 27rpx;
+	  letter-spacing: 1.12rpx;
+	}
+}
+.p-history{
+	padding-top: 10rpx;
+	.title{
+		height: 90rpx;
+		line-height: 90rpx;
+		font-size: 32rpx;
+		font-family: PingFang SC;
+		font-weight: bold;
+		color: #333333;
+	}
+	.item-wrap{
+		flex-wrap: wrap;
+	}
+	.item{
+		height: 54rpx;
+		line-height: 54rpx;
+		padding: 0 20rpx;
+		background: #ECEFED;
+		border-radius: 27px;
+		margin-right: 24rpx;
+		margin-bottom: 24rpx;
+		
+		font-size: 24rpx;
+		font-family: PingFang SC;
+		font-weight: 500;
+		color: #333333;
+	}
+}
+.p-content{
+}
+</style>

+ 76 - 172
pages/mang/mang.vue

@@ -1,19 +1,29 @@
 <template>
 	<view class="page">
 		<navbar-line :bgColor="bgColor" :hasPlacer="false">
-			<view class="header-loc  align-center" @tap="navTo('/pages/address/address')">
-				<image src="/static/mang-loc.png" class="image_19" mode="aspectFill" />
-				<text class="text_43">沂蒙云谷·创意孵化中心</text>
+			<view class="header-loc  align-center" >
+				<image src="/static/mang-loc.png" class="image_19" mode="aspectFill"  />
+				<text class="text_43 clamp" v-if="addrInfo.address" @tap="golocAddr">
+				    {{addrInfo.address}}
+				</text>
+				<text class="text_43 clamp" v-else @tap="golocAddr">
+					请选择您的位置
+				</text>
 			</view>
 		</navbar-line>
-		<view class="p-header"><image src="/static/mang-bg.png" mode="aspectFill" class="img"></image></view>
-		<view class="align-center p-ads">
-			<image src="/static/mang-sear.png" class="image_20" mode="aspectFill" />
+		<!-- /static/mang-bg.png -->
+		<view class="p-header"><image :src="banner" mode="aspectFill" class="img"></image></view>
+		<view class="align-center p-ads" v-if="ads.length>0">
+			<image src="/static/mang-sear.png" class="image_20" mode="aspectFill" @tap="navTo('/pages/mang/search')" />
 
-			<view class="group_20"><zetank-notice colors="#55aaff" :noticeList="ads" :interval="3000"></zetank-notice></view>
+			<view class="group_20">
+				<zetank-notice :noticeList="ads" :interval="3000"/>
+			</view>
 		</view>
 		<view class="p-entry">
-			<view class="flex-col items-center grid-item" v-for="(item,i) in cats" :key="i">
+			<view class="flex-col items-center grid-item" 
+			  v-for="(item,i) in cats" :key="i" @tap="navTo('/pages/mang/list',{id:item.id,name:item.cate_name})"
+			>
 				<image
 					:src="item.cate_logo"
 					class="image"
@@ -36,55 +46,29 @@
 		</view>
 		
 		<view class="p-list">
-			<view class="flex-row section_2 view_6" v-for="(item,idx) in tabs[tabCurrentIndex].list" :key="idx" @tap="navTo('/pages/mang/detail')">
-			  <image
-			    :src="item.goods_img"
-			    class="group_11"
-				mode="aspectFill"
-			  />
-			  <view class="flex-col text_21 view_7">
-			    <text class="text_25 clamp">{{item.goods_name}}</text>
-				<view class="stars align-center">
-					 <image
-					  src="/static/mang_star.png"
-					  class="image_14"
-					  v-for="(item,idx) in item.rank"
-					  :key="idx"
-					/>	
-				</view>
-			    <text class="text_26">随机搭配</text>
-			    <view class="flex-row group_16">
-			      <view class="group_17">
-			        <text class="text_27">¥</text>
-			        <text class="text_28">{{item.shop_price}}</text>
-			      </view>
-			      <text class="text_29">¥{{item.market_price}}</text>
-			    </view>
-			  </view>
-			  <text class="text_30" v-if="item.distance">{{item.distance}}</text>
-			  <view class="flex-col text-wrapper_2"><text class="text_23 text_31 clamp">仅剩{{item.num}}份</text></view>
-			</view>
+            <proItem :info="item" v-for="(item,i) in tabs[tabCurrentIndex].list" :key="i" />
+			<empty v-if="tabs[tabCurrentIndex].list.length == 0 && tabs[tabCurrentIndex].loaded "/>
 		</view>
-		
-	
 	</view>
 </template>
 
 <script>
 import navbarLine from '@/components/navbar-line.vue';
 import zetankNotice from './components/zetank-notice.vue';
+import proItem from './components/pro-item.vue'
 export default {
 	components: {
+		proItem,
 		navbarLine,
 		zetankNotice
 	},
 	data() {
 		return {
+			// defaultAddr:{},
+			banner:'', // 首页图片
 			ads: [],
 			bgColor:'transparent',
-			cats:[
-				{img:'/static/mang-all.png',name:'全部'},
-			],
+			cats:[],
 			tabCurrentIndex: 0,
 			tabs:[
 				{name:'智能排序',type:1,loadingType: 'more', list: [], page: 1,loaded:false},
@@ -95,7 +79,6 @@ export default {
 		};
 	},
 	onPageScroll(e) {
-		// console.log('---',e);
 		let scrollTop = e.scrollTop;
 		if(scrollTop > this.CustomBar - 10){
 			this.bgColor = "#ffffff";
@@ -103,28 +86,44 @@ export default {
 			this.bgColor = "transparent";
 		}
 	},
+	// onLoad() {
+		//app.vue已调用
+	// 	this.getDefaultAddr();
+	// },
 	onShow() {
 		this.getList('refresh')
 		this.getCats();
 		this.getAds();
+		this.getBanner();
 	},
-	onPullDownRefresh() {
-		this.getList('refresh')
-		this.getCats();
-		this.getAds();
-	},
+	// onPullDownRefresh() {
+	// 	this.getList('refresh')
+	// 	this.getCats();
+	// 	this.getAds();
+	// 	this.getBanner();
+	// 	this.getDefaultAddr();
+	// },
 	onReachBottom() {
 		this.getList()
 	},
 	methods:{
-		getAds(){
-			this.ads=[{ title: '1已帮助减少2486g数量的食品浪费' }, { title: '2已帮助减少2486g数量的食品浪费' }]
+		// async getDefaultAddr(){
+		// 	this.$store.dispatch('userInfo/getDefaultAddr');
+		// },
+		async getBanner(){
+			let res = await this.$request('goods.banner');
+			this.banner = res.data.image;
+		},
+		async getAds(){
+			let res = await this.$request('goods.energy');
+			let data = res.data
+			this.ads= data ? [data] : [];
 		},
 		async getCats(){
 			let res = await this.$request('goods.catelist')
 			let cats =res.data || [];
 			this.cats = cats.slice(0,7);
-			this.cats.push({cate_logo:'/static/mang-all.png',cate_name:'全部'})
+			this.cats.push({cate_logo:'/static/mang-all.png',cate_name:'全部',id:0})
 		},
 		async getList(source){
 			//这里是将订单挂载到tab列表下
@@ -147,7 +146,9 @@ export default {
 			let res = await this.$request('goods.list',{
 				sort_type:navItem.type,
 				page: navItem.page,
-				limit: this.pageSize
+				limit: this.pageSize,
+				lng: this.addrInfo.address ? this.addrInfo.address_lng : '',
+				lat: this.addrInfo.address ? this.addrInfo.address_lat : '',
 			});
 			uni.stopPullDownRefresh();
 			let result = res.data.row || [];
@@ -168,15 +169,35 @@ export default {
 				navItem.list.push(item);
 			});
 		},
-		tapTab(idx){
+		async golocAddr(){
+			//有地址进入地址列表选择,无新增
+			// let res = await this.$request('addr.list')
+			// let list = res.data || [];
+			// if(list.length > 0){
+				
+			// }
+			this.navTo('/pages/address/address',{sourcePage:'mang'},{isCheckLogin:true})
+		},
+		
+		async tapTab(idx){
 			if(idx === this.tabCurrentIndex){
 				return;
 			}
+			
+			if(idx === 1 && !this.addrInfo.address){
+				let [mErr,mRes] = await uni.showModal({title:'请选择您的地址'})
+				if(mRes.cancel){
+					return ;
+				}
+				this.golocAddr();
+				return;
+			}
 			this.tabCurrentIndex = idx;
 			this.getList('refresh');
 		},
-		
-		
+		// tapCat(item){
+		// 	this.navTo('/pages/mang/list',{goods_cate:item.name})
+		// }
 	}
 };
 </script>
@@ -201,6 +222,7 @@ page {
 		font-size: 28rpx;
 		font-family: PingFang;
 		letter-spacing: 1.12rpx;
+		max-width: 400rpx;
 	}
 }
 .p-header {
@@ -291,123 +313,5 @@ page {
 
 }
 .p-list{
-	.section_2 {
-	  width: 690rpx;
-	  margin:0 auto 24rpx;
-	  padding: 24rpx 14rpx 24rpx 24rpx;
-	  background-color: #ffffff;
-	  box-shadow: 0px 6rpx 10rpx #2a2a2a14;
-	  border-radius: 20rpx;
-	  position: relative;
-	  .text-wrapper_2 {
-	    padding: 8rpx 0 16rpx;
-	    background-image: url('/static/mang-listbg.png');
-	    background-size: 100% 100%;
-	    background-repeat: no-repeat;
-	    position: absolute;
-	    right: -10rpx;
-	    top: 26rpx;
-		width: 120rpx;
-	  }
-	  .text_23 {
-	    margin-left: 12rpx;
-	    margin-right: 6rpx;
-	    color: #ffffff;
-	    font-size: 24rpx;
-	    font-family: PingFang;
-		max-width: 120rpx;
-	  }
-	  // .text_31 {
-	  //   margin-left: 12rpx;
-	  //   margin-right: 6rpx;
-	  // }
-	}
-	.view_6 {
-	  padding: 24rpx 18rpx 24rpx 24rpx;
-	}
-	.group_11 {
-	  flex-shrink: 0;
-	  width: 200rpx;
-	  height: 200rpx;
-	  border-radius: 20rpx;
-	}
-	.text_21 {
-	  margin-top: 100rpx;
-	  color: #999999;
-	  font-size: 24rpx;
-	  font-family: PingFang;
-	  line-height: 18rpx;
-	}
-	.view_7 {
-	  margin-top: initial;
-	  color: initial;
-	  font-size: initial;
-	  font-family: initial;
-	  line-height: initial;
-	  margin-left: 19rpx;
-	  flex: 1 1 auto;
-	  align-self: center;
-	}
-	.text_25 {
-	  color: #333333;
-	  font-size: 30rpx;
-	  font-family: PingFang;
-	  max-width: 360rpx;
-	}
-	.stars{
-		 margin-top: 12rpx;
-		.image_14 {
-		  width: 28rpx;
-		  height: 28rpx;
-		  margin-right: 4rpx;
-		}
-	}
-	
-	.text_26 {
-	  margin-top: 20rpx;
-	  align-self: flex-start;
-	  color: #999999;
-	  font-size: 24rpx;
-	  font-family: PingFang;
-	  line-height: 23rpx;
-	}
-	.group_16 {
-	  margin-top: 37rpx;
-	  padding: 0 2rpx;
-	}
-	.group_17 {
-	  line-height: 28rpx;
-	  height: 29rpx;
-	}
-	.text_27 {
-	  color: #ff3e3e;
-	  font-size: 24rpx;
-	  font-family: PingFang;
-	  line-height: 19rpx;
-	}
-	.text_28 {
-	  color: #ff3e3e;
-	  font-size: 36rpx;
-	  font-family: PingFang;
-	  line-height: 28rpx;
-	}
-	.text_29 {
-	  margin-left: 10rpx;
-	  margin-top: 9rpx;
-	  color: #999999;
-	  font-size: 24rpx;
-	  font-family: PingFang;
-	  line-height: 20rpx;
-	  text-decoration: line-through;
-	}
-	.text_30 {
-	  z-index: 2;
-	  position: absolute;
-	  top: 130rpx;
-	  right: 20rpx;
-	  color: #999999;
-	  font-size: 24rpx;
-	  font-family: PingFang;
-	}
 }
 </style>

+ 39 - 38
pages/mang/search.vue

@@ -7,70 +7,51 @@
 				src="/static/mang-sear.png"
 				class="image_5"
 			  />
-			  <input type="text" placeholder="请输入商家或商品名称" class="inpt" v-model="keyword">
+			  <input type="text" placeholder="请输入商品名称" class="inpt" v-model="keyword" @confirm="search">
 			</view>
 			<image
 			  src="/static/mang-quxiao.png"
 			  class="image_6"
 			  v-if="hasKeyword"
+			  @tap='clearKW'
 			/>
 		  </view>
-		  <!-- <text class="text_3" v-if="hasKeyword">取消</text> -->
 		  <text class="text_3" @tap="search">搜索</text>
 		</view>
-		<!-- v-if="!hasKeyword" -->
-		<view class="p-history" v-if="true && search_lishi.length>0">
+		<view class="p-history" v-if="!hasKeyword && search_lishi.length>0">
 			<view class="title">
 				历史搜索
 			</view>
 			<view class="item-wrap align-center">
-				<view class="item" v-for="(item,i) in search_lishi" :key="i">
+				<view class="item" v-for="(item,i) in search_lishi" :key="i" @tap="tapKeyword(item)">
 					{{item}}
 				</view>	
 			</view>
 		</view>
-		<view class="p-content" v-else-if="false">
-			<view class="item-wrap flex-row justify-between" v-for="(item,i) in 3" :key="i">
-				  <view class="flex-row">
-				    <image
-				      src="/static/temp/pro.png"
-				      class="image_7"
-					  mode="aspectFill"
-				    />
-				    <view class="flex-col group_8">
-				      <view class="flex-col items-start">
-				        <text class="text_4 clamp">幸福西饼Rice盲盒</text>
-						<view class="stars align-center">
-							 <image
-							  src="/static/mang_star.png"
-							  class="image_8"
-							  v-for="(item,idx) in 3"
-							  :key="idx"
-							/>	
-						</view>
-				        <text class="text_5">随机搭配</text>
-				      </view>
-				      <view class="flex-row group_10">
-				        <view class="group_11">
-				          <text class="text_6">¥</text>
-				          <text class="text_7">18.8</text>
-				        </view>
-				        <text class="text_8">¥24~33</text>
-				      </view>
-				    </view>
-				  </view>
-				  <text class="text_9">1.5km</text>
-			</view>
-		</view>
+		
+		<singleList ref="listRef" url="goods.list" :sendData="reqData" @reqEnd="searchEnd" v-else>
+			<template v-slot:items="{list}">
+				<view class="p-content">
+					<proItem :info="item" v-for="(item,i) in list" :key="i" />
+					<empty v-if="sRes && sRes==='empty'"/>
+				</view>
+			</template>
+		</singleList>
 	</view>
 </template>
 
 <script>
+	import proItem from './components/pro-item.vue'
 	export default {
+		components: {
+			proItem,
+		},
 		data() {
 			return {
 				keyword:'',
 				search_lishi:[],
+				reqData:{},
+				sRes:'',
 			};
 		},
 		computed:{
@@ -85,11 +66,24 @@
 			// console.log(uni.getStorageSync('history'))
 			this.search_lishi = uni.getStorageSync('history') || [] //存放历史记录的数组
 		},
+		onReachBottom() {
+			this.$refs.listRef.getList();
+		},
 		methods:{
 			search(){
 				if(this.hasKeyword){
 					this.add_history(this.keyword)
 				}
+				this.$nextTick(()=>{
+					this.reqData = {keyword:this.keyword}
+				})
+			},
+			tapKeyword(item){
+				this.keyword = item;
+				this.search();
+			},
+			clearKW(){
+				this.keyword = '';
 			},
 			//添加新的历史记录 当有搜索新的历史记录时就会进入这个方法
 			add_history(e){  
@@ -116,6 +110,13 @@
 					//TODO handle the exception
 				}
 			},
+		    searchEnd({loadingType,pageOneRes}){
+		    	if(loadingType === 'noMore' && pageOneRes && pageOneRes.length === 0){
+		    		this.sRes='empty';
+		    	}else{
+		    		this.sRes=loadingType;
+		    	}
+		    },
 		},
 	}
 </script>

+ 1 - 1
pages/mine/mine.vue

@@ -38,7 +38,7 @@
 					<image src="/static/m-addr.png" class="image_1" />
 					<text class="text_14">我的收藏</text>
 				</view>
-				<view class="flex-col items-center equal-division-item_2">
+				<view class="flex-col items-center equal-division-item_2" @tap="navTo('/pages/address/address')">
 					<image src="/static/m-addr.png" class="image_1" />
 					<text class="text_14">收货地址</text>
 				</view>

+ 36 - 16
store/modules/userInfo.js

@@ -4,28 +4,48 @@ const userInfo = {
     namespaced:true,
     state:{
         userInfo:{},   
+		addrInfo:{},  //默认地址,有可能默认
     },
     mutations:{
         USER_INFO(state,info){
             state.userInfo = info;
-        }        
+        },
+		ADDR_INFO(state,info){
+			state.addrInfo = info;
+		},
     },
 	actions: {
-		getopenid(){
-			return new Promise(async (resolve,reject)=>{
-				let [lErr,lRes] = await uni.login({
-					provider: 'weixin'
-				});
-				console.log('openid loginRes===',lRes)
-				if (lRes.hasOwnProperty('code')) {
-					// let codeRes=await Request('user.getUserOpenid',{ code: lRes.code});
-					// console.log('openid codeRes===',codeRes.data)
-					// resolve(codeRes.data.openid)
-				} else {
-					Tools.msg('登录失败,请重启应用');
-					reject(false);
-				}       
-			})
+		// getopenid(){
+		// 	return new Promise(async (resolve,reject)=>{
+		// 		let [lErr,lRes] = await uni.login({
+		// 			provider: 'weixin'
+		// 		});
+		// 		console.log('openid loginRes===',lRes)
+		// 		if (lRes.hasOwnProperty('code')) {
+		// 			// let codeRes=await Request('user.getUserOpenid',{ code: lRes.code});
+		// 			// console.log('openid codeRes===',codeRes.data)
+		// 			// resolve(codeRes.data.openid)
+		// 		} else {
+		// 			Tools.msg('登录失败,请重启应用');
+		// 			reject(false);
+		// 		}       
+		// 	})
+		// },
+		getAddrInfo({ dispatch,commit }) {
+		   return new Promise((resolve, reject) => {
+			   let token = uni.getStorageSync('token')
+			   if(!token){
+				   resolve(false);
+				   return;
+			   }
+			   Request('addr.getDefault').then(res => {
+				   let myData= res.data || {}
+				   commit('ADDR_INFO', myData);
+				   resolve(myData)	
+			   }).catch(e => {
+				   reject(e)
+			   })
+		   })
 		},
 	    getinfo({ dispatch,commit }) {
 		   /**onLaunch即调用,查看token是否过期 */

部分文件因为文件数量过多而无法显示