index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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;"
  29. @click="inMonthlyPolicy"></u-image>
  30. <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;"
  31. @click="inInlineshop"></u-image>
  32. <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;"
  33. @click="inIntegral"></u-image>
  34. </view>
  35. </view>
  36. <view class="u-flex u-row-center u-m-t-30">
  37. <u-image class="u-skeleton-fillet" width="680rpx" src="../../static/sailun/88reward.png" mode="widthFix"></u-image>
  38. </view>
  39. </view>
  40. <!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
  41. <!-- <u-tabbar v-model="current" :list="list"></u-tabbar> -->
  42. <u-skeleton :loading="loading" :animation="true"></u-skeleton>
  43. <u-toast ref="ulogin" />
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. request
  49. } from '../../common/request/request'
  50. require("promise.prototype.finally").shim()
  51. import axios from 'axios'
  52. export default {
  53. data() {
  54. return {
  55. bannersList: [],
  56. noticebarList: [],
  57. loading: true, // 是否显示骨架屏组件
  58. };
  59. },
  60. onLoad() {
  61. uni.$on('login', (data) => {
  62. this.loginStatus = data.msg
  63. })
  64. },
  65. onReady() {
  66. if (this.loginStatus == "登录成功") {
  67. this.$refs.ulogin.show({
  68. title: "登录成功",
  69. })
  70. }
  71. },
  72. created() {
  73. uni.showLoading({
  74. title: '加载中...'
  75. });
  76. axios.all([this.getBanners(), this.getTiceList()])
  77. .then(axios.spread((one, two) => {
  78. this.bannersList = one.data.data.map(t => t.imgPath)
  79. this.noticebarList = two.data.data.map(t => t.msgContent)
  80. }))
  81. .catch(err => {
  82. console.log(err)
  83. })
  84. .finally(() => {
  85. this.loading = false;
  86. uni.hideLoading();
  87. })
  88. },
  89. methods: {
  90. //轮播图
  91. getBanners() {
  92. return request({
  93. url: '/homepage/getBanners',
  94. method: 'post',
  95. data: {
  96. "storeId": '1000',
  97. "showPosition": 0, //门店0
  98. }
  99. })
  100. },
  101. //消息文字跑马灯
  102. getTiceList() {
  103. return request({
  104. url: '/homepage/noticeList',
  105. method: 'post',
  106. data: {
  107. "storeId": "1000",
  108. "contentType": "1" //门店1
  109. }
  110. })
  111. },
  112. scancodeIn() {
  113. this.$u.route({
  114. url: 'pages/home/scancode/index',
  115. })
  116. },
  117. scancodeOut() {
  118. this.$u.route({
  119. url: 'pages/home/scancode/index',
  120. })
  121. },
  122. inStock() {
  123. this.$u.route({
  124. url: 'pages/home/my-stock/my-stock',
  125. })
  126. },
  127. inMonthlyPolicy: function() {
  128. this.$u.route({
  129. url: 'pages/home/monthly-policy/monthly-policy',
  130. })
  131. },
  132. inInlineshop() {
  133. this.$u.route({
  134. url: 'pages/home/inline-shop/inline_shop',
  135. })
  136. },
  137. inIntegral() {
  138. this.$u.route({
  139. url: 'pages/home/integral-mall/integral_mall',
  140. })
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. .status_bar {
  147. height: var(--status-bar-height);
  148. width: 100%;
  149. background-color: #FFF;
  150. }
  151. </style>