report.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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-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="checkResult.imgPath+'mid/img_sun.jpg'" 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.redDetectTypeNam">{{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. }
  69. },
  70. computed: {
  71. ...mapState(['hasLogin']),
  72. userInfo(){
  73. return this.$store.state.vuex_userInfo
  74. }
  75. },
  76. onReady() {
  77. // 检测是否登录
  78. this.$store.dispatch('checkLogin',()=>{
  79. this.pageInit()
  80. })
  81. },
  82. onLoad() {
  83. // 获取数据字典
  84. // this.getListLookUp();
  85. // 获取支付,收款方式
  86. // this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
  87. // 刷新首页数据
  88. uni.$on("refashHome",()=>{
  89. this.pageInit()
  90. })
  91. },
  92. onUnload() {
  93. uni.$off('refashHome')
  94. },
  95. // 下拉刷新
  96. onPullDownRefresh(){
  97. this.pageInit()
  98. setTimeout(function () {
  99. uni.stopPullDownRefresh();
  100. }, 1000);
  101. },
  102. onShareAppMessage() {},
  103. methods: {
  104. pageInit(){
  105. if(this.hasLogin){
  106. // 获取扫描记录
  107. this.getbundle(1)
  108. }
  109. },
  110. // 获取数据字典
  111. getListLookUp() {
  112. const _this = this;
  113. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  114. if (res.status == 200) {
  115. _this.$store.state.vuex_allLookUp = res.data;
  116. }
  117. });
  118. },
  119. // 或某一项字典列表,参数code
  120. getLookUpList(code, vuexKey) {
  121. getLookUpDatas({ type: code }).then(res => {
  122. if (res.status == 200) {
  123. this.$store.state[vuexKey] = res.data || [];
  124. }
  125. });
  126. },
  127. // scroll-view到底部加载更多
  128. onreachBottom() {
  129. console.log(this.list.length < this.total)
  130. if(this.list.length < this.total){
  131. this.status = 'loading';
  132. this.pageNo += 1
  133. this.getbundle()
  134. }else{
  135. this.status = "nomore"
  136. }
  137. },
  138. // 查询列表
  139. getbundle (pageNo) {
  140. if (pageNo) {
  141. this.pageNo = pageNo
  142. }
  143. let params = {
  144. pageNo: this.pageNo,
  145. pageSize: this.pageSize,
  146. }
  147. this.status = "loading"
  148. checkBillQueryList(params).then(res => {
  149. if (res.status == 200) {
  150. if(this.pageNo>1){
  151. this.list = this.list.concat(res.data.list || [])
  152. }else{
  153. this.list = res.data.list || []
  154. }
  155. this.total = res.data.count || 0
  156. } else {
  157. this.list = []
  158. this.total = 0
  159. this.noDataText = res.message
  160. }
  161. if(this.list.length<this.total){
  162. this.status = "loadmore"
  163. }else{
  164. this.status = "nomore"
  165. }
  166. })
  167. },
  168. toUser(){
  169. if(!this.hasLogin){
  170. uni.navigateTo({
  171. url:"/pages/login/login"
  172. })
  173. }else{
  174. // 退出登录
  175. this.$refs.openModal.open()
  176. }
  177. },
  178. onOk(){
  179. this.$refs.openModal.close()
  180. this.$store.dispatch('userLogout');
  181. },
  182. toDetail(item){
  183. uni.navigateTo({
  184. url:"/pages/h5Page/index?src=https://md.test.baibaibai.net/checkReport/index/mini/"+item.id
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="less">
  191. .content {
  192. margin: 0;
  193. padding: 0;
  194. height: 100vh;
  195. display: flex;
  196. flex-direction: column;
  197. .ml10{
  198. margin-left: 0.2em;
  199. }
  200. .list-box{
  201. flex-grow: 1;
  202. overflow: auto;
  203. position: relative;
  204. .swiper-item{
  205. width: 100%;
  206. height: 100%;
  207. overflow: hidden;
  208. .scroll-box{
  209. width: 100%;
  210. height: 100%;
  211. overflow: auto;
  212. .item-box{
  213. border-bottom: 1px solid #eee;
  214. padding: 1em;
  215. &:active{
  216. background: #f8f8f8;
  217. }
  218. .l_box{
  219. font-size: 1.1em;
  220. flex-grow: 1;
  221. }
  222. .l_imgs{
  223. width: 5em;
  224. }
  225. .l_time{
  226. color: #999;
  227. padding-top: 0.5em;
  228. }
  229. .r_box{
  230. color: #999;
  231. > view{
  232. padding: 0 0.1em;
  233. text-align: right;
  234. }
  235. }
  236. }
  237. .des{
  238. text-align: center;
  239. padding: 3em 0;
  240. color: #999;
  241. font-size: 0.9em;
  242. }
  243. }
  244. }
  245. }
  246. }
  247. </style>