index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="home" :style="'padding-top:'+padtop+'px'">
  3. <!-- 头部 -->
  4. <navbar :back="false" title="首页" :bgcolor="backgroundColor" color="#fff" fixed zIndex="1010" :center="true" :custom='true' @getTop="getTop"/>
  5. <view class="main">
  6. <!-- <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
  7. :duration="duration">
  8. <swiper-item>
  9. <image :src="swipeimg" class="mainswip"></image>
  10. </swiper-item>
  11. </swiper> -->
  12. <image v-if="photoPath" :src="photoPath" class="mainswip" @click="getYouFn"></image>
  13. <view class="flexcj mainus">
  14. <view class="mainuse flex" @click="getUse">
  15. <view class="mainusea">
  16. <view class="mainuseb">使用指南</view>
  17. <view class="mainusec overtwo">查看使用指南了 解核销操作方法</view>
  18. </view>
  19. <image :src="znimg" class="mainused flex0"></image>
  20. </view>
  21. <view class="mainuse flex" @click="getRecord">
  22. <view class="mainusea">
  23. <view class="mainuseb">核销记录</view>
  24. <view class="mainusec overtwo">查看核销记录了 解核销记录信息</view>
  25. </view>
  26. <image :src="znhimg" class="mainused flex0"></image>
  27. </view>
  28. </view>
  29. <view class="hbox" @click="getCode">
  30. <view class="flex1"><view class="htit">核销操作</view>
  31. <view class="htxt">扫描用户出示的二维码即可实现核销</view></view>
  32. <image :src="rimg" class="himg"></image>
  33. </view>
  34. </view>
  35. <!-- 底部 导航栏 currentPage 当前页面ID -->
  36. <tab-bar :currentPage="0"></tab-bar>
  37. </view>
  38. </template>
  39. <script>
  40. import url from "@/util/url";
  41. let {host} = url
  42. //导入组件
  43. // import tabBar from '@/components/tabbar/tabbar.vue'
  44. import tabBar from "@/components/tabbar/tabbar.vue"
  45. export default {
  46. data() {
  47. return {
  48. padtop:this.$http._GET.customBarH||0,
  49. backgroundColor: 'linear-gradient(90deg, #A00517, #E93030)',
  50. swipeimg: require('static/images/banner.png'),
  51. znimg: require('static/images/use.png'),
  52. znhimg: require('static/images/hicon.png'),
  53. rimg:require('static/images/rico.png'),
  54. indicatorDots: true,
  55. autoplay: true,
  56. interval: 2000,
  57. duration: 500,
  58. photoPath:''
  59. };
  60. },
  61. components: {
  62. tabBar
  63. },
  64. mounted() {
  65. // console.log(7)
  66. },
  67. onLoad() {
  68. this.getDataFn()
  69. },
  70. methods: {
  71. checkLogin() {
  72. var token = uni.getStorageSync('token')
  73. // var token = "df057579-73c8-4bdd-8312-f64db8efd699"
  74. if (token == undefined || token == '') {
  75. uni.reLaunch({
  76. url: '/pages/login/login'
  77. })
  78. return false
  79. }
  80. return true
  81. },
  82. getDataFn(){
  83. var that=this;
  84. that.$http.get("system/welfare/new").then(res => {
  85. if (res.code == 200) {
  86. if(res.data.photoPath){
  87. that.photoPath=host + res.data.photoPath
  88. }else{
  89. that.photoPath=""
  90. }
  91. } else {
  92. uni.showToast({
  93. title: res.msg,
  94. duration: 1000,
  95. icon: 'none'
  96. });
  97. }
  98. })
  99. },
  100. goBack() {
  101. // console.log(5)
  102. },
  103. getCode(){
  104. // 判断是否能核销
  105. if (!this.checkLogin()) {
  106. return
  107. }
  108. // 判断是否能核销
  109. var businessId=uni.getStorageSync('businessId');
  110. if(businessId&&businessId=='-1'){
  111. uni.showToast({
  112. title:'暂无扫码核销权限',
  113. icon:"none"
  114. })
  115. }else{
  116. uni.navigateTo({
  117. url:'/pages/code/code'
  118. })
  119. }
  120. },
  121. getYouFn(){
  122. // 判断是否能核销
  123. if (!this.checkLogin()) {
  124. return
  125. }
  126. this.$http.routePage('/pages/index/guidedetail?type=welfare','nav')
  127. },
  128. getUse(){
  129. // 判断是否能核销
  130. if (!this.checkLogin()) {
  131. return
  132. }
  133. this.$http.routePage('/pages/index/guidedetail?type=use','nav')
  134. },
  135. getRecord(){
  136. // 判断是否能核销
  137. if (!this.checkLogin()) {
  138. return
  139. }
  140. var businessId=uni.getStorageSync('businessId')
  141. if(businessId&&businessId=='-1'){
  142. uni.showToast({
  143. title:'暂无核销记录',
  144. icon:"none"
  145. })
  146. }else{
  147. this.$http.routePage('/pages/index/record','nav')
  148. }
  149. },
  150. getTop(e){
  151. this.padtop=e;
  152. }
  153. }
  154. };
  155. </script>
  156. <style scoped>
  157. image{display: block;}
  158. .pl16{padding: 0 32rpx;}
  159. .mb14{margin-bottom: 28rpx;}
  160. .flex{display: flex;}
  161. .flex1{flex: 1;}
  162. .flex0{flex: 0 0 auto;}
  163. .flexcj{display: flex;align-items: center;justify-content: space-between;}
  164. .ovone{overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
  165. .overtwo{word-break: break-all;
  166. text-overflow: ellipsis;
  167. overflow: hidden;
  168. display: -webkit-box;
  169. -webkit-line-clamp: 2;
  170. -webkit-box-orient: vertical;white-space: normal;}
  171. .home{min-height: 100vh;background: #f5f5f5;box-sizing: border-box;}
  172. .main{padding-top: 28rpx;}
  173. .mainswip{width: 686rpx;height: 260rpx;margin:0 auto 32rpx;box-shadow: 0px 4rpx 14rpx 0px rgba(97,96,95,0.3600);border-radius: 20rpx;}
  174. .mainus{width: 686rpx;margin: 0 auto 28rpx;}
  175. .mainuse{width: 328rpx;min-height: 170rpx;background: #FFFFFF;box-shadow: 0px 4rpx 14rpx 0px rgba(97,96,95,0.3600);
  176. border-radius: 6rpx;padding: 30rpx 18rpx 30rpx 26rpx;box-sizing: border-box;}
  177. .mainuseb{font-size: 22rpx;background: linear-gradient(0deg, #B54A1D 0%, #FFB97D 100%);
  178. -webkit-background-clip: text;
  179. -webkit-text-fill-color: transparent;font-weight: bold;position: relative;margin-bottom: 20rpx;}
  180. .mainuseb::after{width: 22rpx;
  181. height: 2rpx;
  182. background: #A70919;content: "";position: absolute;left: 0;bottom: -15rpx;}
  183. .mainusec{font-size: 24rpx;color: #666666;}
  184. .mainused{width: 86rpx;height: 86rpx;margin-top: 16rpx;}
  185. .hbox{width: 684rpx;min-height: 128rpx;background: linear-gradient(90deg, #A00517, #E93030);
  186. box-shadow: 0px 4rpx 14rpx 0px rgba(131,46,15,0.3600);border-radius: 14rpx;display: flex;align-items: center;margin: auto;padding: 20rpx 26rpx 20rpx 30rpx;box-sizing: border-box;}
  187. .htit{font-size: 34rpx;font-weight: bold;color: #FFFFFF;margin-bottom: 14rpx;}
  188. .htxt{font-size: 24rpx;color: #FFC5CB;}
  189. .himg{width: 16rpx;height: 28rpx;flex: 0 0 auto;}
  190. </style>