index.vue 5.6 KB

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