lilei 3 tahun lalu
induk
melakukan
4e21fb2215
9 mengubah file dengan 358 tambahan dan 49 penghapusan
  1. 29 0
      pages.json
  2. 4 49
      pages/index/index.vue
  3. 74 0
      pages/index/userBar.vue
  4. 248 0
      pages/report/report.vue
  5. TEMPAT SAMPAH
      static/tab/tab_home_normal.png
  6. TEMPAT SAMPAH
      static/tab/tab_home_pressed.png
  7. TEMPAT SAMPAH
      static/tab/tab_personal_normal.png
  8. TEMPAT SAMPAH
      static/tab/tab_personal_pressed.png
  9. 3 0
      store/index.js

+ 29 - 0
pages.json

@@ -49,11 +49,40 @@
             }
             
         }
+        ,{
+            "path" : "pages/report/report",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "诊断报告",
+                "enablePullDownRefresh": true,
+                "navigationBarBackgroundColor": "#58c4c4"
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "uni-app",
 		"navigationBarBackgroundColor": "#F8F8F8",
 		"backgroundColor": "#F8F8F8"
+	},
+	"tabBar": {
+		"color": "#7A7E83",
+		"selectedColor": "#191919",
+		"backgroundColor": "#ffffff",
+		"fontSize": "14px",
+		"list": [{
+				"pagePath": "pages/index/index",
+				"iconPath": "static/tab/tab_home_normal.png",
+				"selectedIconPath": "static/tab/tab_home_pressed.png",
+				"text": "会员/套餐"
+			},
+			{
+				"pagePath": "pages/report/report",
+				"iconPath": "static/tab/tab_personal_normal.png",
+				"selectedIconPath": "static/tab/tab_personal_pressed.png",
+				"text": "诊断报告"
+			}
+		]
 	}
 }

+ 4 - 49
pages/index/index.vue

@@ -1,28 +1,7 @@
 <template>
 	<view class="content">
 		<!-- 用户信息 -->
-		<view class="userCard flex align_center justify_between" @click="toUser">
-			<view class="userCard-info flex align_center justify_between">
-				<view>
-					<u-image v-if="!hasLogin" src="/static/def_personal_avatar.png" width="80" height="80"></u-image>
-					<u-image v-if="userInfo.sex==1" src="/static/def_patient_boy@2x.png" width="80" height="80"></u-image>
-					<u-image v-if="userInfo.sex==0" src="/static/def_patient_girl@2x.png" width="80" height="80"></u-image>
-				</view>
-				<view>
-					<view v-if="!hasLogin" style="font-size: 40rpx;">
-						请点击登录
-					</view>
-					<view v-else style="color: #FFEB3B;">
-						<view>{{userInfo.name}}</view>
-						<view>{{userInfo.mobile}}</view>
-					</view>
-				</view>
-			</view>
-			<view :style="{color: hasLogin?'#fff':''}">
-				<text v-if="hasLogin">退出</text>
-				<u-icon name="arrow-right"></u-icon>
-			</view>
-		</view>
+		<userBar :isLogin="hasLogin" :userInfo="userInfo" @toUser="toUser"></userBar>
 		<!-- 套餐记录 -->
 		<view class="list-box">
 			<swiper-item class="swiper-item">
@@ -64,9 +43,10 @@
 	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
 	import { listLookUp, getLookUpDatas } from '@/api/data.js';
 	import { getCustomerBundle } from '@/api/bundel.js'
+	import userBar from './userBar.vue'
 	export default {
 		components: {
-			uniPopup,uniPopupDialog
+			uniPopup,uniPopupDialog,userBar
 		},
 		data() {
 			return {
@@ -190,11 +170,6 @@
 			onOk(){
 				this.$refs.openModal.close()
 				this.$store.dispatch('userLogout');
-				setTimeout(function(){
-					  uni.redirectTo({
-						  url: '/pages/login/login'
-					  });
-				},300)
 			},
 			toDetail(item){
 				uni.navigateTo({
@@ -212,27 +187,7 @@
 		height: 100vh;
 		display: flex;
 		flex-direction: column;
-		.userCard{
-			padding:1.2em 1em;
-			background-image: linear-gradient(#58c4c4 30%,#65e2e2);
-			.userCard-info{
-				> view{
-					&:last-child{
-						margin-left: 0.5em;
-						>view{
-							padding: 0.2em;
-						}
-					}
-				}
-			}
-			.user-photo{
-				display: block;
-				width: 120rpx;
-				height: 120rpx;
-				border-radius: 50%;
-				overflow: hidden;
-			}
-		}
+		
 		.ml10{
 			margin-left: 0.2em;
 		}

+ 74 - 0
pages/index/userBar.vue

@@ -0,0 +1,74 @@
+<template>
+	<view>
+		<view class="userCard flex align_center justify_between" @click="toUser">
+			<view class="userCard-info flex align_center justify_between">
+				<view>
+					<u-image v-if="!isLogin" src="/static/def_personal_avatar.png" width="80" height="80"></u-image>
+					<u-image v-if="userInfo.sex==1" src="/static/def_patient_boy@2x.png" width="80" height="80"></u-image>
+					<u-image v-if="userInfo.sex==0" src="/static/def_patient_girl@2x.png" width="80" height="80"></u-image>
+				</view>
+				<view>
+					<view v-if="!isLogin" style="font-size: 40rpx;">
+						请点击登录
+					</view>
+					<view v-else style="color: #FFEB3B;">
+						<view>{{userInfo.name}}</view>
+						<view>{{userInfo.mobile}}</view>
+					</view>
+				</view>
+			</view>
+			<view :style="{color: isLogin?'#fff':''}">
+				<text v-if="isLogin">退出</text>
+				<u-icon name="arrow-right"></u-icon>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props:{
+			isLogin:{
+				type: Boolean,
+				default: false
+			},
+			userInfo: {
+				type: Object
+			}
+		},
+		data() {
+			return {
+				
+			}
+		},
+		methods: {
+			toUser(){
+				this.$emit('toUser')
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+.userCard{
+	padding:1.2em 1em;
+	background-image: linear-gradient(#58c4c4 30%,#65e2e2);
+	.userCard-info{
+		> view{
+			&:last-child{
+				margin-left: 0.5em;
+				>view{
+					padding: 0.2em;
+				}
+			}
+		}
+	}
+	.user-photo{
+		display: block;
+		width: 120rpx;
+		height: 120rpx;
+		border-radius: 50%;
+		overflow: hidden;
+	}
+}
+</style>

+ 248 - 0
pages/report/report.vue

@@ -0,0 +1,248 @@
+<template>
+	<view class="content">
+		<!-- 用户信息 -->
+		<userBar :isLogin="hasLogin" :userInfo="userInfo" @toUser="toUser"></userBar>
+		<!-- 套餐记录 -->
+		<view class="list-box">
+			<swiper-item class="swiper-item">
+					<scroll-view scroll-y class="scroll-box" @scrolltolower="onreachBottom">
+						 <view class="flex align_center justify_between item-box" v-for="item in list" :key="item.id" @click="toDetail(item)">
+						 	<view class="l_box flex align_center">
+								<view class="l_imgs">
+									<u-image height="7em" border-radius="0.4em"></u-image>
+								</view>
+								<view class="flex_1" style="padding: 0 0.6em;">
+									<view style="line-height: 1.5em;">{{item.bundleName}}</view>
+									<view class="l_time flex align_center justify_between ">
+										<view>{{item.store.name}}</view>
+										<view>{{item.createDate.split(' ')[0]}}</view>
+									</view>
+								</view>
+							</view>
+						 	<view class="flex align_center r_box">
+						 		<view>
+						 			<u-icon name="arrow-right"></u-icon>
+						 		</view>
+						 	</view>
+						 </view>
+						  
+						 <view style="padding: 20upx;" v-if="hasLogin">
+						 	<u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
+						 	<u-loadmore v-if="list.length||status=='loading'" :status="status" />
+						 </view>
+						 <view v-if="!hasLogin" class="des">请登录后查看诊断报告</view>
+					</scroll-view>
+				</swiper-item>
+			</swiper>
+		</view>
+		<uni-popup ref="openModal" type="center">
+			<uni-popup-dialog content="确定退出登录吗?" @confirm="onOk" title="提示"></uni-popup-dialog>
+		</uni-popup>
+	</view>
+</template>
+
+<script>
+	import {
+	    mapState,
+	    mapMutations,
+	} from 'vuex'
+	import uniPopup from '@/components/uni-popup/uni-popup.vue'
+	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
+	import { listLookUp, getLookUpDatas } from '@/api/data.js';
+	import { getCustomerBundle } from '@/api/bundel.js'
+	import userBar from '../index/userBar.vue'
+	export default {
+		components: {
+			uniPopup,uniPopupDialog,userBar
+		},
+		data() {
+			return {
+				status: '',
+				noDataText: '暂无数据',
+				pageNo: 1,
+				pageSize: 15,
+				list: [],
+				total: 0,
+			}
+		},
+		computed: {
+			...mapState(['hasLogin']),
+			userInfo(){
+				return this.$store.state.vuex_userInfo
+			}
+		},
+		onReady() {
+			// 检测是否登录
+			this.$store.dispatch('checkLogin',()=>{
+				this.pageInit()
+			})
+		},
+		onLoad() {
+			// 获取数据字典
+			// this.getListLookUp();
+			// 获取支付,收款方式
+			// this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
+			// 刷新首页数据
+			uni.$on("refashHome",()=>{
+				this.pageInit()
+			})
+		},
+		onUnload() {
+			uni.$off('refashHome')
+		},
+		// 下拉刷新
+		onPullDownRefresh(){
+			this.pageInit()
+			setTimeout(function () {
+				uni.stopPullDownRefresh();
+			}, 1000);
+		},
+		onShareAppMessage() {},
+		methods: {
+			pageInit(){
+				if(this.hasLogin){
+					// 获取扫描记录
+					this.getbundle(1)
+				}
+			},
+			//  获取数据字典
+			getListLookUp() {
+				const _this = this;
+				listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
+					if (res.status == 200) {
+						_this.$store.state.vuex_allLookUp = res.data;
+					}
+				});
+			},
+			// 或某一项字典列表,参数code
+			getLookUpList(code, vuexKey) {
+				getLookUpDatas({ type: code }).then(res => {
+					if (res.status == 200) {
+						this.$store.state[vuexKey] = res.data || [];
+					}
+				});
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				console.log(this.list.length < this.total)
+				if(this.list.length < this.total){
+					this.status = 'loading';
+					this.pageNo += 1
+					this.getbundle()
+				}else{
+					this.status = "nomore"
+				}
+			},
+			// 查询列表
+			getbundle (pageNo) {
+			  if (pageNo) {
+			    this.pageNo = pageNo
+			  }
+			  let params = {
+			    pageNo: this.pageNo,
+			    pageSize: this.pageSize,
+			  }
+			  this.status = "loading"
+			  getCustomerBundle(params).then(res => {
+				console.log(params,res,'+++++++++++')
+				if (res.status == 200) {
+				  if(this.pageNo>1){
+					  this.list = this.list.concat(res.data.list || [])
+				  }else{
+					  this.list = res.data.list || []
+				  }
+				  this.total = res.data.count || 0
+				} else {
+				  this.list = []
+				  this.total = 0
+				  this.noDataText = res.message
+				}
+				if(this.list.length<this.total){
+					this.status = "loadmore"
+				}else{
+					this.status = "nomore"
+				}
+			  })
+			},
+			toUser(){
+				if(!this.hasLogin){
+					uni.navigateTo({
+						url:"/pages/login/login"
+					})
+				}else{
+					// 退出登录
+					this.$refs.openModal.open()
+				}
+			},
+			onOk(){
+				this.$refs.openModal.close()
+				this.$store.dispatch('userLogout');
+			},
+			toDetail(item){
+				uni.navigateTo({
+					url:"/pages/h5Page/index?src=https://md.test.baibaibai.net/checkReport/index/mini/316546464645"
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.content {
+		margin: 0;
+		padding: 0;
+		height: 100vh;
+		display: flex;
+		flex-direction: column;
+		
+		.ml10{
+			margin-left: 0.2em;
+		}
+		.list-box{
+			flex-grow: 1;
+			overflow: auto;
+			position: relative;
+			.swiper-item{
+				width: 100%;
+				height: 100%;
+				overflow: hidden;
+				 .scroll-box{
+				 	width: 100%;
+				 	height: 100%;
+				 	overflow: auto;
+				 	.item-box{
+				 		border-bottom: 1px solid #eee;
+				 		padding: 1em;
+				 		&:active{
+				 			background: #f8f8f8;
+				 		}
+				 		.l_box{
+				 			font-size: 1.1em;
+				 			flex-grow: 1;
+				 		}
+						.l_imgs{
+							width: 5em;
+						}
+						.l_time{
+							color: #999;
+							padding-top: 0.5em;
+						}
+				 		.r_box{
+				 			color: #999;
+				 			> view{
+				 				padding: 0 0.1em;
+								text-align: right;
+				 			}
+				 		}
+				 	}
+				 	.des{
+				 		text-align: center;
+				 		padding: 3em 0;
+				 		color: #999;
+				 		font-size: 0.9em;
+				 	}
+				 }
+			}
+		}
+	}
+</style>

TEMPAT SAMPAH
static/tab/tab_home_normal.png


TEMPAT SAMPAH
static/tab/tab_home_pressed.png


TEMPAT SAMPAH
static/tab/tab_personal_normal.png


TEMPAT SAMPAH
static/tab/tab_personal_pressed.png


+ 3 - 0
store/index.js

@@ -119,6 +119,9 @@ const store = new Vuex.Store({
 				console.log(res,'out')
 				if(res.status == 200){
 					context.commit('logout')
+					uni.navigateTo({
+						url: '/pages/login/login'
+					});
 				}
 			})
 		},