index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="content">
  3. <!-- 用户信息 -->
  4. <view class="userCard flex align_center justify_between" @click="toUser">
  5. <view class="userCard-info flex align_center justify_between">
  6. <view>
  7. <u-image v-if="!hasLogin" src="/static/def_personal_avatar.png" width="60" height="60"></u-image>
  8. <open-data v-else type="userAvatarUrl" class="user-photo"></open-data>
  9. </view>
  10. <view>
  11. <view v-if="!hasLogin" style="font-size: 40rpx;">
  12. 请点击登录
  13. </view>
  14. <view v-else>
  15. <view>{{userInfo.userNameCN}}</view>
  16. <view>{{userInfo.orgName}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view>
  21. <u-icon name="arrow-right"></u-icon>
  22. </view>
  23. </view>
  24. <!-- 套餐记录 -->
  25. <view class="list-box">
  26. <view class="scroll-box">
  27. <view class="flex align_center justify_between item-box" v-for="item in 26" @click="toDetail(item)">
  28. <view class="l_box">99会员礼包</view>
  29. <view class="flex align_center r_box">
  30. <view>
  31. <view>2022-05-28</view>
  32. <view>高新天佑店</view>
  33. </view>
  34. <view>
  35. <u-icon name="arrow-right"></u-icon>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- <view style="padding: 20upx;">
  40. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="vinList.length==0 && status!='loading'" mode="list"></u-empty>
  41. <u-loadmore v-if="status=='loading'" :status="status" />
  42. </view> -->
  43. <view class="des">请登录后查看套餐记录</view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import {
  50. mapState,
  51. mapMutations,
  52. } from 'vuex'
  53. import { listLookUp, getLookUpDatas } from '@/api/data.js';
  54. import { scanVinLogQueryRoll, getScanVinLogList }from '@/api/car.js'
  55. export default {
  56. components: {
  57. },
  58. data() {
  59. return {
  60. status: 'loading',
  61. noDataText: '暂无数据',
  62. vinList: [],
  63. }
  64. },
  65. computed: {
  66. ...mapState(['hasLogin']),
  67. userInfo(){
  68. return this.$store.state.vuex_userInfo
  69. }
  70. },
  71. onReady() {
  72. // 检测是否登录
  73. this.$store.dispatch('checkLogin',()=>{
  74. this.pageInit()
  75. })
  76. },
  77. onLoad() {
  78. // 获取数据字典
  79. this.getListLookUp();
  80. // 获取支付,收款方式
  81. this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
  82. // 刷新首页数据
  83. uni.$on("refashHome",()=>{
  84. this.pageInit()
  85. })
  86. },
  87. onUnload() {
  88. uni.$off('refashHome')
  89. },
  90. // 下拉刷新
  91. onPullDownRefresh(){
  92. this.pageInit()
  93. setTimeout(function () {
  94. uni.stopPullDownRefresh();
  95. }, 1000);
  96. },
  97. onShareAppMessage() {},
  98. methods: {
  99. pageInit(){
  100. if(this.hasLogin){
  101. // 获取扫描记录
  102. this.getVinLog()
  103. }
  104. },
  105. // 获取数据字典
  106. getListLookUp() {
  107. const _this = this;
  108. listLookUp({ pageNo: 1, pageSize: 1000 }).then(res => {
  109. if (res.status == 200) {
  110. _this.$store.state.vuex_allLookUp = res.data;
  111. }
  112. });
  113. },
  114. // 或某一项字典列表,参数code
  115. getLookUpList(code, vuexKey) {
  116. getLookUpDatas({ type: code }).then(res => {
  117. if (res.status == 200) {
  118. this.$store.state[vuexKey] = res.data || [];
  119. }
  120. });
  121. },
  122. getVinLog(){
  123. this.vinList = []
  124. this.status = "loading"
  125. getScanVinLogList({pageNo:1,pageSize:10}).then(res => {
  126. this.vinList = res.data.list || []
  127. this.vinList = this.vinList.filter(item => item.vinCode)
  128. this.status = 'nomore'
  129. })
  130. },
  131. toDetail(item){
  132. uni.navigateTo({
  133. url:"/pages/bundelDetail/index"
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="less">
  140. .content {
  141. margin: 0;
  142. padding: 0;
  143. height: 100vh;
  144. display: flex;
  145. flex-direction: column;
  146. .userCard{
  147. padding:1.2em 1em;
  148. background-image: linear-gradient(#58c4c4 10%,#65e2e2);
  149. .userCard-info{
  150. > view{
  151. &:last-child{
  152. margin-left: 0.5em;
  153. >view{
  154. padding: 0.2em;
  155. }
  156. }
  157. }
  158. }
  159. .user-photo{
  160. display: block;
  161. width: 120rpx;
  162. height: 120rpx;
  163. border-radius: 50%;
  164. overflow: hidden;
  165. }
  166. }
  167. .ml10{
  168. margin-left: 0.2em;
  169. }
  170. .list-box{
  171. flex-grow: 1;
  172. overflow: auto;
  173. .scroll-box{
  174. height: 100%;
  175. .item-box{
  176. border-bottom: 1px solid #eee;
  177. padding: 1em;
  178. &:active{
  179. background: #f8f8f8;
  180. }
  181. .l_box{
  182. font-size: 1.1em;
  183. flex-grow: 1;
  184. }
  185. .r_box{
  186. color: #999;
  187. > view{
  188. padding: 0 0.1em;
  189. }
  190. }
  191. }
  192. .des{
  193. text-align: center;
  194. padding: 3em 0;
  195. color: #999;
  196. font-size: 0.9em;
  197. }
  198. }
  199. }
  200. }
  201. </style>