123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- <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-if="hasLogin" v-for="item in list" :key="item.id" @click="toDetail(item)">
- <view class="l_box flex align_center">
- <view class="l_imgs">
- <u-image :src="getImg(item)" height="7em" border-radius="0.4em"></u-image>
- </view>
- <view class="flex_1" style="padding: 0 0.6em;">
- <view style="line-height: 1.5em;">
- <view v-if="item.blackDetectTypeName">{{item.blackDetectTypeName}}</view>
- <view v-if="item.redDetectTypeName">{{item.redDetectTypeName}}</view>
- <view v-if="item.yellowDetectTypeName">{{item.yellowDetectTypeName}}</view>
- </view>
- <view class="l_time flex align_center justify_between ">
- <view>{{item.store.name}}</view>
- <view>{{item.checkDate}}</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 { checkBillQueryList } 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,
- baseUrl:''
- }
- },
- 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()
- })
- this.baseUrl = getApp().globalData.baseUrl.replace('beauty-customer/','')
- console.log(this.baseUrl)
- },
- onUnload() {
- uni.$off('refashHome')
- },
- // 下拉刷新
- onPullDownRefresh(){
- this.pageInit()
- setTimeout(function () {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- onShareAppMessage() {},
- methods: {
- pageInit(){
- if(this.hasLogin){
- // 获取扫描记录
- this.getbundle(1)
- }
- },
- getImg(item){
- let url =item.customer.sex==1?'/static/def_boy@2x.png':'/static/def_gri@2x.png'
- if(item.checkResult){
- url = item.checkResult.imgPath+'mid/img_sun.jpg'
- }
- return url
- },
- // 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"
- checkBillQueryList(params).then(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){
- const url = this.baseUrl.indexOf('.test.')>=0 ? 'https://md.test.baibaibai.net/' : 'https://md.test.baibaibai.net/'
- uni.navigateTo({
- url:"/pages/h5Page/index?src="+url+"checkReport/index/mini/"+item.id
- })
- }
- }
- }
- </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>
|