activity.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view class="box">
  3. <view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item.id)">
  4. <image :src="item.img" mode="" class="itemImg"></image>
  5. <view class="timeBox">
  6. <image v-if="item.state==2" src="http://dmsphoto.66km.com.cn/thFiles/85EAAA7F-01A6-41A6-B25B-72FAD3E451AC.png" mode="" class="state"></image>
  7. <image v-if="item.state==1" src="http://dmsphoto.66km.com.cn/thFiles/EB46639B-85C9-4246-A3E3-EA87944DFC36.png" mode="" class="state"></image>
  8. <view class="time" v-if="item.startTime">{{item.startTime.slice(0,10)}}-{{item.endTime.slice(0,10)}}</view>
  9. </view>
  10. <view class="name">{{item.activityName}}</view>
  11. <view class="groupType" v-if="item.groupType">拼团</view>
  12. </view>
  13. <!-- 上拉 加载更多 -->
  14. <view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>
  15. <!-- 无数据空白页 -->
  16. <nodata v-if="itemData.length==0"></nodata>
  17. <!-- 手机号授权 -->
  18. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  19. <view class="authorizCont" @click.stop="">
  20. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  21. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  22. <button class="authorizContbutton" type="default" open-type="getPhoneNumber"
  23. @getphonenumber="decryptPhoneNumber">授权</button>
  24. </view>
  25. <view style="text-align: center;padding-top: 56rpx;">
  26. <image src="../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script scoped>
  32. import nodata from '../../components/nodata/nodata.vue'
  33. export default {
  34. components: {
  35. nodata,
  36. },
  37. data() {
  38. return {
  39. userInfo: '',
  40. authorizShow: false,
  41. code: '',
  42. wxOpenData: '',
  43. page: 1,
  44. itemData: [],
  45. noMoreShow: false,
  46. ext:'',
  47. themeColor:'',
  48. }
  49. },
  50. onLoad() {
  51. this.userInfo = this.$store.state.userInfo;
  52. this.wxOpenData = this.$store.state.wxOpenData
  53. this.ext=this.$common.getExtStoreId();
  54. this.page = 1
  55. this.myOrderCoupon();
  56. this.themeColor = uni.getStorageSync("themeColor");
  57. if(this.themeColor){
  58. if(this.themeColor=='6F2BE8'){
  59. var backgroundImage='/static/tabimg/activty6F2BE8.png'
  60. }
  61. if(this.themeColor=='1677FF'){
  62. var backgroundImage='/static/tabimg/activty1677FF.png'
  63. }
  64. if(this.themeColor=='FF4F00'){
  65. var backgroundImage='/static/tabimg/activtyFF4F00.png'
  66. }
  67. if(this.themeColor=='D53533'){
  68. var backgroundImage='/static/tabimg/activity1.png'
  69. }
  70. uni.setTabBarStyle({
  71. // color: '#FF0000',
  72. selectedColor: '#'+this.themeColor,
  73. })
  74. uni.setTabBarItem({
  75. index: 2,
  76. text: '活动',
  77. selectedIconPath: backgroundImage
  78. })
  79. }
  80. },
  81. methods: {
  82. goDetail(id) {
  83. uni.navigateTo({
  84. url: 'jkDetail?id=' + id
  85. })
  86. },
  87. myOrderCoupon() {
  88. uni.showLoading({
  89. title: '加载中'
  90. })
  91. this.$http('openHome/queryActivityList', {
  92. // page: this.page,
  93. // limit: 10,
  94. unionId:this.ext.unionId
  95. }, 'GET').then(res => {
  96. uni.hideLoading();
  97. // var list = res.data.Items
  98. var list = res.data
  99. // 处理 undefined和null转为空白字符串
  100. // list.forEach((item, index) => {
  101. // for (const key in item) {
  102. // item[key] = this.$praseStrEmpty(item[key])
  103. // }
  104. // })
  105. if (this.page == 1) {
  106. this.itemData = list
  107. } else {
  108. this.itemData = this.itemData.concat(list)
  109. }
  110. if (list.length < 10) {
  111. this.noMoreShow = true
  112. } else {
  113. this.noMoreShow = false
  114. }
  115. })
  116. },
  117. },
  118. // 下拉刷新 上拉加载更多
  119. onPullDownRefresh() {
  120. this.page = 1
  121. this.myOrderCoupon()
  122. setTimeout(function() {
  123. uni.stopPullDownRefresh();
  124. }, 1000);
  125. },
  126. onReachBottom() {
  127. // this.page++;
  128. this.myOrderCoupon()
  129. },
  130. }
  131. </script>
  132. <style scoped lang="less">
  133. .box {
  134. background: #F4F5F7;
  135. min-height: 100vh;
  136. padding-top: 20rpx;
  137. }
  138. .authorizBox {
  139. width: 100vw;
  140. height: 100vh;
  141. background: rgba(0, 0, 0, 0.5);
  142. position: fixed;
  143. top: 0;
  144. left: 0;
  145. }
  146. .authorizCont {
  147. margin-top: 30vh;
  148. width: 564rpx;
  149. height: 408rpx;
  150. background: #FFFFFF;
  151. border-radius: 24rpx;
  152. margin-left: 93rpx;
  153. position: relative;
  154. }
  155. .authorizCloseImg {
  156. width: 62rpx;
  157. height: 62rpx;
  158. }
  159. .sqLogoBox {
  160. width: 180rpx;
  161. height: 180rpx;
  162. background: #FFFFFF;
  163. border-radius: 90rpx;
  164. text-align: center;
  165. position: absolute;
  166. top: -50rpx;
  167. left: 192rpx;
  168. }
  169. .authorizName {
  170. color: #333333;
  171. line-height: 42rpx;
  172. font-size: 30rpx;
  173. text-align: center;
  174. padding-top: 58rpx;
  175. }
  176. .authorizMs {
  177. color: #999999;
  178. line-height: 36rpx;
  179. font-size: 26rpx;
  180. width: 452rpx;
  181. padding-top: 24rpx;
  182. text-align: center;
  183. margin-left: 56rpx;
  184. }
  185. .authorizContbutton {
  186. width: 422rpx;
  187. height: 88rpx;
  188. background: #D53533;
  189. border-radius: 44rpx;
  190. line-height: 88rpx;
  191. text-align: center;
  192. font-size: 30rpx;
  193. color: #FFFFFF;
  194. margin-top: 62rpx;
  195. margin-left: 71rpx;
  196. }
  197. .itemHistory {
  198. margin: 0rpx 24rpx 20rpx;
  199. background-color: #FFFFFF;
  200. border-radius: 10rpx;
  201. position: relative;
  202. }
  203. .groupType{
  204. width: 76rpx;color: #FFFFFF;
  205. height: 36rpx;line-height: 36rpx;text-align: center;
  206. background: linear-gradient(109deg, #FD5A04 0%, #FD0900 100%);
  207. border-radius: 0rpx 10rpx 0rpx 10rpx;
  208. position: absolute;
  209. top: 0;right: 0;
  210. }
  211. .itemImg {
  212. height: 280rpx;
  213. width: 702rpx;
  214. border-radius: 10rpx 10rpx 0px 0px;
  215. display: block;
  216. }
  217. .timeBox {
  218. display: flex;
  219. margin-top: -61rpx;
  220. align-items: flex-end;
  221. }
  222. .state{
  223. width: 102rpx;
  224. height: 53rpx;
  225. position: relative;
  226. }
  227. .time {
  228. padding: 5rpx 10rpx;
  229. color: #FFFFFF;
  230. font-size: 24rpx;
  231. background: rgba(0, 0, 0, 0.5);
  232. margin-left: -8rpx;
  233. border-radius: 0 10rpx 0 0;
  234. }
  235. .name {
  236. padding: 24rpx 20rpx;
  237. color: #333333;
  238. font-size: 28rpx;
  239. background: #FFFFFF;
  240. border-radius: 0 0 10rpx 10rpx;
  241. }
  242. .noMore {
  243. text-align: center;
  244. line-height: 50rpx;
  245. color: #999999;
  246. font-size: 28rpx;
  247. }
  248. </style>