index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view style="background-color: #FFFFFF;height: 100%;" class="u-skeleton">
  3. <view class="status_bar">
  4. <!-- 这里是状态栏 -->
  5. </view>
  6. <view class="u-page" style="margin-bottom: 20rpx;">
  7. <view class="u-m-t-20">
  8. <u-swiper :list="bannersList" :height="310" :effect3d="true" border-radius="20" effect3d-previous-margin="20"
  9. bg-color="#FFF" class="u-skeleton-fillet"></u-swiper>
  10. </view>
  11. <view class="u-flex u-m-t-20 u-m-l-20 u-m-r-20 u-skeleton-fillet" style="width:710rpx;">
  12. <!-- <view class="u-flex u-row-center" style="width: 150rpx; height: 70rpx;border-radius: 50rpx;background: rgba(52,140,245,0.1);font-size: 20rpx;color: #348CF5; font-size: 500;">
  13. <u-image width="45rpx" height="35rpx" src="../../static/sailun/speaker.png" style="margin:10rpx;"></u-image>公告
  14. <u-notice-bar mode="horizontal" :list="noticebarList" :volume-icon="false" bg-color="#FFF" color="#2B2B2B" padding="18rpx 12rpx" :is-circular="false"></u-notice-bar> -->
  15. <u-notice-bar mode="vertical" :list="noticebarList" style="width: 710rpx;" type="primary"></u-notice-bar>
  16. </view>
  17. <view class="u-flex u-m-t-20 u-row-around u-m-l-10 u-m-r-10">
  18. <u-image width="350rpx" src="../../static/sailun/scan_in.png" @click="scancodeIn" mode="widthFix" class="u-skeleton-fillet"></u-image>
  19. <u-image width="350rpx" src="../../static/sailun/scan_out.png" @click="scancodeOut" mode="widthFix" class="u-skeleton-fillet"></u-image>
  20. </view>
  21. <view class="u-m-t-20">
  22. <view class="u-m-l-30" style="font-size: 34rpx;">
  23. 快捷服务
  24. </view>
  25. <view class="u-flex u-flex-wrap u-row-center">
  26. <u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/1.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
  27. @click="inStock"></u-image>
  28. <u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/2.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"></u-image>
  29. <u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/3.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
  30. @click="inInlineshop"></u-image>
  31. <u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/4.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
  32. @click="inIntegral"></u-image>
  33. </view>
  34. </view>
  35. <view class="u-flex u-row-center u-m-t-30">
  36. <u-image class="u-skeleton-fillet" width="680rpx" src="../../static/sailun/88reward.png" mode="widthFix"></u-image>
  37. </view>
  38. </view>
  39. <!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
  40. <!-- <u-tabbar v-model="current" :list="list"></u-tabbar> -->
  41. <u-skeleton :loading="loading" :animation="true"></u-skeleton>
  42. <u-toast ref="ulogin" />
  43. </view>
  44. </template>
  45. <script>
  46. import {
  47. request
  48. } from '../../common/request/request'
  49. require("promise.prototype.finally").shim()
  50. export default {
  51. data() {
  52. return {
  53. bannersList: [],
  54. noticebarList: [],
  55. loading: true, // 是否显示骨架屏组件
  56. };
  57. },
  58. onLoad() {
  59. uni.$on('login', (data) => {
  60. this.loginStatus=data.msg
  61. })
  62. },
  63. onReady() {
  64. if (this.loginStatus="登录成功") {
  65. this.$refs.ulogin.show({
  66. title:"登录成功",
  67. })
  68. }
  69. },
  70. created() {
  71. this.getBanners();
  72. this.getTiceList()
  73. },
  74. methods: {
  75. //轮播图
  76. getBanners() {
  77. uni.showLoading({
  78. title: '加载中...'
  79. });
  80. request({
  81. url: '/homepage/getBanners',
  82. method: 'post',
  83. data: {
  84. "storeId": '1000',
  85. "showPosition": 0, //门店0
  86. }
  87. }).then(res => {
  88. this.list = res.data.data
  89. this.bannersList = this.list.map(t => t.imgPath)
  90. }).catch(err => {
  91. console.log(err)
  92. })
  93. .finally(() => {
  94. setTimeout(() => {
  95. uni.hideLoading();
  96. this.loading = false;
  97. }, 300)
  98. })
  99. },
  100. //消息文字跑马灯
  101. getTiceList() {
  102. uni.showLoading({
  103. title: '加载中...'
  104. });
  105. request({
  106. url: '/homepage/noticeList',
  107. method: 'post',
  108. data: {
  109. "storeId": "1000",
  110. "contentType": "1" //门店1
  111. }
  112. }).then(res => {
  113. this.list = res.data.data
  114. this.noticebarList = this.list.map(t => t.msgContent)
  115. }).catch(err => {
  116. console.log(err)
  117. })
  118. .finally(() => {
  119. setTimeout(() => {
  120. uni.hideLoading();
  121. this.loading = false;
  122. }, 300)
  123. })
  124. },
  125. scancodeIn() {
  126. this.$u.route({
  127. url: 'pages/home/scancode/index',
  128. })
  129. },
  130. scancodeOut() {
  131. this.$u.route({
  132. url: 'pages/home/scancode/index',
  133. })
  134. },
  135. inStock() {
  136. this.$u.route({
  137. url: 'pages/home/my-stock/my-stock',
  138. })
  139. },
  140. inInlineshop() {
  141. this.$u.route({
  142. url: 'pages/home/inline-shop/inline_shop',
  143. })
  144. },
  145. inIntegral() {
  146. this.$u.route({
  147. url: 'pages/home/integral-mall/integral_mall',
  148. })
  149. }
  150. }
  151. }
  152. </script>
  153. <style lang="scss" scoped>
  154. .status_bar {
  155. height: var(--status-bar-height);
  156. width: 100%;
  157. background-color: #FFF;
  158. }
  159. </style>