Переглянути джерело

Merge branch 'deploy' of http://git.chelingzhu.com/chelingzhu-web/qhsxKx-mini-html into deploy

lilei 4 роки тому
батько
коміт
6660fbd288
6 змінених файлів з 135 додано та 100 видалено
  1. 11 3
      api/store.js
  2. 32 49
      pages/index/index.vue
  3. 79 20
      pages/store/storeDetail.vue
  4. 11 9
      pages/store/storeList.vue
  5. 0 18
      pages/userCenter/index.vue
  6. 2 1
      store/index.js

+ 11 - 3
api/store.js

@@ -6,7 +6,7 @@ export const getMapStoreList = params => {
     url: `store/findList`,
     method: 'post',
 	data: params
-  })
+  },true)
 };
 
 // 获取网点列表
@@ -20,7 +20,15 @@ export const getStoreList = params => {
 // 获取网点详情
 export const getStoreDetail = params => {
   return axios.request({
-    url: `store/find/${params.id}`,
-    method: 'get',
+    url: `store/findDetail`,
+    method: 'post',
+	data: params
+  })
+};
+// 获取当前排队情况照片
+export const getWaitPhoto = params => {
+  return axios.request({
+    url: `device/image/${params.deviceNo}`,
+    method: 'get'
   })
 };

+ 32 - 49
pages/index/index.vue

@@ -59,6 +59,7 @@
 	import uniPopup from '@/components/uni-popup/uni-popup.vue'
 	import {checkLogin} from '@/api/login.js'
 	import {getMapStoreList} from '@/api/store.js'
+	import {getLookUpDatas} from '@/api/data.js'
 	export default {
 		components: {
 			uniNavBar, uniPopup
@@ -70,49 +71,6 @@
 				markers: [], // 标注点
 				lng: '',
 				lat: '',
-				markData: [{
-						id: '1',
-						name: '洗车机',
-						latitude: '34.29318',
-						longitude: '108.94712',
-						status: 1
-					},
-					{
-						id: '22',
-						name: '洗车机',
-						latitude: '34.29318',
-						longitude: '108.96712',
-						status: 1
-					},
-					{
-						id: '2',
-						name: '洗车机',
-						latitude: '34.29318',
-						longitude: '118.94712',
-						status: 2
-					},
-					{
-						id: '11',
-						name: '洗车机',
-						latitude: '34.29318',
-						longitude: '110.94712',
-						status: 1
-					},
-					{
-						id: '12',
-						name: '洗车机',
-						latitude: '34.39318',
-						longitude: '108.94712',
-						status: 0
-					},
-					{
-						id: '13',
-						name: '洗车机',
-						latitude: '44.29318',
-						longitude: '108.94712',
-						status: 1
-					}
-				],
 			}
 		},
 		onReady() {
@@ -125,8 +83,35 @@
 		},
 		onLoad() {
 			this.getUserLocation()
+			// 获取订单状态数据字典
+			this.getCodeList('ORDER_STATUS')
+			// 获取支付方式数据字典
+			this.getCodeList('PAY_TYPE')
+			// 获取网点标签数据字典
+			this.getCodeList('STORE_LABEL')
 		},
 		methods: {
+			// 获取数据字典
+			getCodeList (code) {
+				getLookUpDatas({type:code}).then(res =>{
+					if (res.status == 200) {
+						console.log(res.data,'res.data')
+						switch (code){
+							case 'ORDER_STATUS':
+							    this.$u.vuex('vuex_payStatus', res.data)
+								break;
+							case 'PAY_TYPE':
+							    this.$u.vuex('vuex_payType', res.data)
+								break;
+							case 'STORE_LABEL':
+							    this.$u.vuex('vuex_storeLabel', res.data)
+								break;
+							default:
+								break;
+						}
+					}
+				})
+			},
 			// 如果机器正在运行,提示并点击跳转的运行界面
 			toWork(){
 				uni.navigateTo({
@@ -170,10 +155,8 @@
 						console.log(res,'rrrr')
 						let latitude = res.latitude;
 						let longitude = res.longitude;
-						// this.lng = longitude
-						// this.lat = latitude
-						this.lng = '116.510229'
-						this.lat = '39.848974'
+						this.lng = longitude
+						this.lat = latitude
 						this.markers = this.getMarkersData()
 					},
 					// 定位失败默认展示青海西宁位置地图
@@ -197,8 +180,8 @@
 					title: '加载中...'
 				})
 				let params = {
-					lat: '39.848974',
-					lng: '116.510229'
+					lat: this.lat,
+					lng: this.lng
 				}
 				getMapStoreList(params).then(res=>{
 					uni.hideLoading()

+ 79 - 20
pages/store/storeDetail.vue

@@ -2,36 +2,35 @@
 	<view class="content">
 		<view class="page-content">
 			<view class="header">
-				<u-image width="160rpx" height="160rpx" :border-radius="10" src="/static/img/mddef.jpg"></u-image>
+				<u-image width="160rpx" height="160rpx" :border-radius="10" :src="storeInfo?storeInfo.icon:''"></u-image>
 				<view class="store-info">
 					<view class="name">
-						{{storeInfo.name}}
+						{{storeInfo ?storeInfo.name : ''}}
 					</view>
 					<view class="address">
-						{{storeInfo.addrDetail}}
+						{{storeInfo?storeInfo.addrDetail:''}}
 					</view>
 					<view class="location">
 						<view class="left">
 							<uni-icons class="icon" size="16" type="paperplane"></uni-icons>
-							<text>0.1km</text>
+							<text>{{storeInfo?storeInfo.distance:''}}km</text>
 						</view>
 						<view class="right">
 							<u-icon class="icon" size="32" name="clock"></u-icon>
-							<text>{{storeInfo.beginTime}}-{{storeInfo.endTime}} 营业</text>
+							<text>{{storeInfo?storeInfo.beginTime:''}}-{{storeInfo?storeInfo.endTime:''}} 营业</text>
 						</view>
 					</view>
 				</view>
 			</view>
 			<!-- 网点标签 -->
 			<view class="store-mark">
-				<text v-for="(item,index) in storeInfo.labelList" :key="index" class="mark-item">
+				<text v-for="(item,index) in labelList" :key="index" class="mark-item">
 					{{item}}
 				</text>
 			</view>
 			<view class="store-server">
 				服务项目:
-				<text>标准速洗</text>
-				<text>标准速洗</text>
+				<text v-for="item in storeInfo.itemVOList" :key="item.id">{{item.itemName}}</text>
 			</view>
 			<!-- 路线指引 -->
 			<view class="store-rich store-line">
@@ -39,7 +38,7 @@
 					* 路线指引 *
 				</view>
 				<view class="line-content">
-					{{storeInfo.guidance}}
+					<u-parse :html="storeInfo&&storeInfo.guidance?storeInfo.guidance:''"></u-parse>
 				</view>
 			</view>
 			<!-- 温馨提示 -->
@@ -48,35 +47,60 @@
 					* 温馨提示 *
 				</view>
 				<view class="line-content">
-					{{storeInfo.reminder}}
+					<u-parse :html="storeInfo&&storeInfo.reminder?storeInfo.reminder:''"></u-parse>
 				</view>
 			</view>
 		</view>
 		<view class="footer">
-			<button type="warn" plain @click="showPop=true">排队情况</button>
+			<button type="warn" plain @click="getWaitPhoto">排队情况</button>
 			<button type="warn" @click="openLocation">立刻导航</button>
 		</view>
 		<u-popup v-model="showPop" mode="center" width="90%" height="60%" closeable>
-			<image class="pop-img" :src="'/static/img/mddef.jpg'"></image>
+			<image class="pop-img" :src="waitPhoto"></image>
 		</u-popup>
 	</view>
 </template>
 
 <script>
-	import {getStoreDetail} from '@/api/store.js'
+	import {getStoreDetail, getWaitPhoto} from '@/api/store.js'
 	export default {
 		components: {
 		},
 		data() {
 			return {
+				// 用户拒绝授权位置信息时默认展示青海西宁位置地图
+				currentPosition: {
+					lat: '36.636193',
+					lng: '101.760521'
+				},
 				showPop: false, // 是否显示排队弹窗
-				storeInfo: {}
+				storeInfo: null, // 网点详细信息
+				labelList: [], // 网点标签
+				waitPhoto: ''  // 排队照片
 			}
 		},
 		onLoad(option) {
-			if (option.id) {
-				this.getStoreDetail(option.id)
-			}
+			// 获取当前经纬度
+			let _this = this
+			uni.getLocation({
+				type: 'wgs84', // 默认wgs84
+				success: function(res) {
+					_this.currentPosition.lat = res.latitude;
+					_this.currentPosition.lng = res.longitude;
+					// 查询门店信息
+					if (option.id) {
+						_this.getStoreDetail(option.id)
+					}
+				},
+				fail: function(res) {
+					console.log(res)
+					// 查询门店信息
+					if (option.id) {
+						_this.getStoreDetail(option.id)
+					}
+				},
+			});
+			
 		},
 		methods: {
 			// 获取网点详情信息
@@ -84,7 +108,12 @@
 				uni.showLoading({
 					title: '加载中...'
 				})
-				getStoreDetail({id:id}).then(res=>{
+				let params = {
+					id: id,
+					lat: this.currentPosition.lat,
+					lng: this.currentPosition.lng
+				}
+				getStoreDetail(params).then(res=>{
 					uni.hideLoading()
 					if (res.status == 200) {
 						this.storeInfo = Object.assign({},res.data)
@@ -100,15 +129,44 @@
 								this.storeInfo.addrDetail = this.storeInfo.addrProvinceName + this.storeInfo.addrCityName + this.storeInfo.addrDistrictName + this.storeInfo.addrDetail
 							}
 						}
+						this.getOptionName()
 						this.storeInfo.distance = this.storeInfo.distanct && this.storeInfo.distanct.distance ? Math.round(this.storeInfo.distanct.distance / 1000) : ''
 					} else {
 						this.toashMsg(res.message)
 					}
 				})
 			},
+			// 匹配数据字典 获取相应的name
+			getOptionName () {
+				console.log(222)
+				let storeLabelList = this.$store.state.vuex_storeLabel  // 网点标签数据字典列表
+				let arr = []
+				this.storeInfo.labelList.map(item =>{
+					let p = storeLabelList.find((i) => {
+						return i.code == item
+					})
+					if (p) {
+						arr.push(p.dispName)
+					} 
+				})
+				this.labelList = arr
+			},
 			// 获取排队情况
-			getWaitPhone () {
-				
+			getWaitPhoto () {
+				uni.showLoading({
+					title: '加载中...',
+					mask: true
+				})
+				// let deviceNo = this.storeInfo.deviceVOList.length? this.storeInfo.deviceVOList[0].deviceNo :''
+				getWaitPhoto({deviceNo:9898}).then(res=>{
+					uni.hideLoading()
+					if(res.status==200) {
+						this.waitPhoto = res.data
+						this.showPop=true
+					} else {
+						this.toashMsg(res.message)
+					}
+				})
 			},
 			// 打开导航位置信息界面
 			openLocation () {
@@ -138,6 +196,7 @@
 <style lang="scss" scoped>
 	.content{
 		padding: 0 20rpx;
+		width: 100%;
 		.page-content{
 			flex: 1;
 			overflow-y: scroll;

+ 11 - 9
pages/store/storeList.vue

@@ -25,7 +25,7 @@
 					<u-image width="110rpx" height="110rpx" :border-radius="10" :src="getStoreStatus(item)"></u-image>
 				</view>
 			</view>
-			<u-empty :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
+			<u-empty class="noData" :text="noDataText" img-width="120" v-if="storeList.length==0 && status!='loading'" mode="list"></u-empty>
 			<view style="padding: 20upx;">
 				<u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
 			</view>
@@ -67,15 +67,14 @@
 					_this.currentPosition.lat = res.latitude;
 					_this.currentPosition.lng = res.longitude;
 					// 查询门店信息
-					// _this.getStoresList()
+					_this.getStoresList()
 				},
 				fail: function(res) {
 					console.log(res)
 					// 查询门店信息
-					// _this.getStoresList()
+					_this.getStoresList()
 				},
 			});
-			this.getStoresList()
 		},
 
 		computed: {},
@@ -85,8 +84,8 @@
 				let lat = this.currentPosition.lat
 				let lng = this.currentPosition.lng
 				getStoreList({
-					lat: '39.848974',
-					lng: '116.510229'
+					lat: lat,
+					lng: lng
 				}).then(res => {
 					console.log(res)
 					uni.hideLoading()
@@ -145,15 +144,18 @@
 </script>
 
 <style lang="scss" scoped>
+	page{
+		height: 100%;
+	}
 	.content {
 		padding: 0 20rpx;
-
+		width: 100%;
+		height: 100%;
 		.scroll-Y {
 			width: 100%;
 			height: 100%;
-
+			padding: 20rpx 0;
 			.list {
-				padding: 20rpx 0;
 				display: flex;
 				border-bottom: 1px solid #eee;
 				.store-info {

+ 0 - 18
pages/userCenter/index.vue

@@ -27,7 +27,6 @@
 
 <script>
 	import {logout} from '@/api/login.js'
-	import {getLookUpDatas} from '@/api/data.js'
 	export default {
 		data() {
 			return {
@@ -37,25 +36,8 @@
 		onShow() {
 		},
 		onLoad() {
-			// 获取订单状态数据字典
-			this.getCodeList('ORDER_STATUS')
-			// 获取支付方式数据字典
-			this.getCodeList('PAY_TYPE')
 		},
 		methods:{
-			// 获取数据字典
-			getCodeList (code) {
-				getLookUpDatas({type:code}).then(res =>{
-					if (res.status == 200) {
-						console.log(res.data,'res.data')
-						if (code == 'ORDER_STATUS') {
-							this.$u.vuex('vuex_payStatus', res.data)
-						} else {
-							this.$u.vuex('vuex_payType', res.data)
-						}
-					}
-				})
-			},
 			// 打开对应的页面
 			toPage(index){
 				let pageUrl=['/pages/coupon/index/index','/pages/order/order','/pages/agreement/agreement?fromPage=usercenter']

+ 2 - 1
store/index.js

@@ -12,7 +12,7 @@ try{
 }
 
 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
-let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_userData','vuex_payType','vuex_payStatus','vuex_orderInfo','vuex_workStatus'];
+let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_userData','vuex_payType','vuex_payStatus','vuex_storeLabel','vuex_orderInfo','vuex_workStatus'];
 
 // 保存变量到本地存储中
 const saveLifeData = function(key, value){
@@ -37,6 +37,7 @@ const store = new Vuex.Store({
 		vuex_userData: lifeData.vuex_userData ? lifeData.vuex_userData : '',
 		vuex_payType: lifeData.vuex_payType ? lifeData.vuex_payType : [], // 支付方式数据字典
 		vuex_payStatus: lifeData.vuex_payStatus ? lifeData.vuex_payStatus : [], // 支付状态数据字典
+		vuex_storeLabel: lifeData.vuex_storeLabel ? lifeData.vuex_storeLabel : [], // 网点标签数据字典
 		// 如果无需保存到本地永久存储,无需lifeData.xx方式
 		vuex_socket: null,
 		vuex_wsMessageData: '',