report.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view class="content">
  3. <!-- 用户信息 -->
  4. <userBar :isLogin="hasLogin" :userInfo="userInfo" @toUser="toUser"></userBar>
  5. <!-- 套餐记录 -->
  6. <view class="list-box">
  7. <swiper-item class="swiper-item">
  8. <scroll-view scroll-y class="scroll-box" @scrolltolower="onreachBottom">
  9. <view class="flex align_center justify_between item-box" v-if="hasLogin" v-for="item in list" :key="item.id" @click="toDetail(item)">
  10. <view class="l_box flex align_center">
  11. <view class="l_imgs">
  12. <u-image :src="getImg(item)" height="7em" border-radius="0.4em"></u-image>
  13. </view>
  14. <view class="flex_1" style="padding: 0 0.6em;">
  15. <view style="line-height: 1.5em;">
  16. <view v-if="item.blackDetectTypeName">{{item.blackDetectTypeName}}</view>
  17. <view v-if="item.redDetectTypeName">{{item.redDetectTypeName}}</view>
  18. <view v-if="item.yellowDetectTypeName">{{item.yellowDetectTypeName}}</view>
  19. </view>
  20. <view class="l_time flex align_center justify_between ">
  21. <view>{{item.store.name}}</view>
  22. <view>{{item.checkDate}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="flex align_center r_box">
  27. <view>
  28. <u-icon name="arrow-right"></u-icon>
  29. </view>
  30. </view>
  31. </view>
  32. <view style="padding: 20upx;" v-if="hasLogin">
  33. <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>
  34. <u-loadmore v-if="list.length||status=='loading'" :status="status" />
  35. </view>
  36. <view v-if="!hasLogin" class="des">请登录后查看诊断报告</view>
  37. </scroll-view>
  38. </swiper-item>
  39. </swiper>
  40. </view>
  41. <uni-popup ref="openModal" type="center">
  42. <uni-popup-dialog content="确定退出登录吗?" @confirm="onOk" title="提示"></uni-popup-dialog>
  43. </uni-popup>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. mapState,
  49. mapMutations,
  50. } from 'vuex'
  51. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  52. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
  53. import { listLookUp, getLookUpDatas } from '@/api/data.js';
  54. import { checkBillQueryList } from '@/api/bundel.js'
  55. import userBar from '../index/userBar.vue'
  56. export default {
  57. components: {
  58. uniPopup,uniPopupDialog,userBar
  59. },
  60. data() {
  61. return {
  62. status: '',
  63. noDataText: '暂无数据',
  64. pageNo: 1,
  65. pageSize: 15,
  66. list: [],
  67. total: 0,
  68. baseUrl:''
  69. }
  70. },
  71. computed: {
  72. ...mapState(['hasLogin']),
  73. userInfo(){
  74. return this.$store.state.vuex_userInfo
  75. }
  76. },
  77. onReady() {
  78. // 检测是否登录
  79. this.$store.dispatch('checkLogin',()=>{
  80. this.pageInit()
  81. })
  82. },
  83. onLoad() {
  84. // 获取数据字典
  85. // this.getListLookUp();
  86. // 获取支付,收款方式
  87. // this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
  88. // 刷新首页数据
  89. uni.$on("refashHome",()=>{
  90. this.pageInit()
  91. })
  92. this.baseUrl = getApp().globalData.baseUrl.replace('beauty-customer/','')
  93. console.log(this.baseUrl)
  94. },
  95. onUnload() {
  96. uni.$off('refashHome')
  97. },
  98. // 下拉刷新
  99. onPullDownRefresh(){
  100. this.pageInit()
  101. setTimeout(function () {
  102. uni.stopPullDownRefresh();
  103. }, 1000);
  104. },
  105. onShareAppMessage() {},
  106. methods: {
  107. pageInit(){
  108. if(this.hasLogin){
  109. // 获取扫描记录
  110. this.getbundle(1)
  111. }
  112. },
  113. getImg(item){
  114. let url =item.customer.sex==1?'/static/def_boy@2x.png':'/static/def_gri@2x.png'
  115. if(item.checkResult){
  116. url = item.checkResult.imgPath+'mid/img_sun.jpg'
  117. }
  118. return url
  119. },
  120. // scroll-view到底部加载更多
  121. onreachBottom() {
  122. console.log(this.list.length < this.total)
  123. if(this.list.length < this.total){
  124. this.status = 'loading';
  125. this.pageNo += 1
  126. this.getbundle()
  127. }else{
  128. this.status = "nomore"
  129. }
  130. },
  131. // 查询列表
  132. getbundle (pageNo) {
  133. if (pageNo) {
  134. this.pageNo = pageNo
  135. }
  136. let params = {
  137. pageNo: this.pageNo,
  138. pageSize: this.pageSize,
  139. }
  140. this.status = "loading"
  141. checkBillQueryList(params).then(res => {
  142. if (res.status == 200) {
  143. if(this.pageNo>1){
  144. this.list = this.list.concat(res.data.list || [])
  145. }else{
  146. this.list = res.data.list || []
  147. }
  148. this.total = res.data.count || 0
  149. } else {
  150. this.list = []
  151. this.total = 0
  152. this.noDataText = res.message
  153. }
  154. if(this.list.length<this.total){
  155. this.status = "loadmore"
  156. }else{
  157. this.status = "nomore"
  158. }
  159. })
  160. },
  161. toUser(){
  162. if(!this.hasLogin){
  163. uni.navigateTo({
  164. url:"/pages/login/login"
  165. })
  166. }else{
  167. // 退出登录
  168. this.$refs.openModal.open()
  169. }
  170. },
  171. onOk(){
  172. this.$refs.openModal.close()
  173. this.$store.dispatch('userLogout');
  174. },
  175. toDetail(item){
  176. const url = this.baseUrl.indexOf('.test.')>=0 ? 'https://md.test.baibaibai.net/' : 'https://md.test.baibaibai.net/'
  177. uni.navigateTo({
  178. url:"/pages/h5Page/index?src="+url+"checkReport/index/mini/"+item.id
  179. })
  180. }
  181. }
  182. }
  183. </script>
  184. <style lang="less">
  185. .content {
  186. margin: 0;
  187. padding: 0;
  188. height: 100vh;
  189. display: flex;
  190. flex-direction: column;
  191. .ml10{
  192. margin-left: 0.2em;
  193. }
  194. .list-box{
  195. flex-grow: 1;
  196. overflow: auto;
  197. position: relative;
  198. .swiper-item{
  199. width: 100%;
  200. height: 100%;
  201. overflow: hidden;
  202. .scroll-box{
  203. width: 100%;
  204. height: 100%;
  205. overflow: auto;
  206. .item-box{
  207. border-bottom: 1px solid #eee;
  208. padding: 1em;
  209. &:active{
  210. background: #f8f8f8;
  211. }
  212. .l_box{
  213. font-size: 1.1em;
  214. flex-grow: 1;
  215. }
  216. .l_imgs{
  217. width: 5em;
  218. }
  219. .l_time{
  220. color: #999;
  221. padding-top: 0.5em;
  222. }
  223. .r_box{
  224. color: #999;
  225. > view{
  226. padding: 0 0.1em;
  227. text-align: right;
  228. }
  229. }
  230. }
  231. .des{
  232. text-align: center;
  233. padding: 3em 0;
  234. color: #999;
  235. font-size: 0.9em;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. </style>