activity.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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. this.$store.commit('mutationsckshopInfo', '')
  84. uni.navigateTo({
  85. url: 'jkDetail?id=' + id
  86. })
  87. /* uni.navigateTo({
  88. url: '../subPack/jkDetail?id=' + id
  89. }) */
  90. },
  91. myOrderCoupon() {
  92. uni.showLoading({
  93. title: '加载中'
  94. })
  95. this.$http('openHome/queryActivityList', {
  96. // page: this.page,
  97. // limit: 10,
  98. unionId:this.ext.unionId
  99. }, 'GET').then(res => {
  100. uni.hideLoading();
  101. // var list = res.data.Items
  102. var list = res.data
  103. // 处理 undefined和null转为空白字符串
  104. // list.forEach((item, index) => {
  105. // for (const key in item) {
  106. // item[key] = this.$praseStrEmpty(item[key])
  107. // }
  108. // })
  109. if (this.page == 1) {
  110. this.itemData = list
  111. } else {
  112. this.itemData = this.itemData.concat(list)
  113. }
  114. if (list.length < 10) {
  115. this.noMoreShow = true
  116. } else {
  117. this.noMoreShow = false
  118. }
  119. })
  120. },
  121. },
  122. // 下拉刷新 上拉加载更多
  123. onPullDownRefresh() {
  124. this.page = 1
  125. this.myOrderCoupon()
  126. setTimeout(function() {
  127. uni.stopPullDownRefresh();
  128. }, 1000);
  129. },
  130. onReachBottom() {
  131. // this.page++;
  132. this.myOrderCoupon()
  133. },
  134. }
  135. </script>
  136. <style scoped lang="less">
  137. .box {
  138. background: #F4F5F7;
  139. min-height: 100vh;
  140. padding-top: 20rpx;
  141. }
  142. .authorizBox {
  143. width: 100vw;
  144. height: 100vh;
  145. background: rgba(0, 0, 0, 0.5);
  146. position: fixed;
  147. top: 0;
  148. left: 0;
  149. }
  150. .authorizCont {
  151. margin-top: 30vh;
  152. width: 564rpx;
  153. height: 408rpx;
  154. background: #FFFFFF;
  155. border-radius: 24rpx;
  156. margin-left: 93rpx;
  157. position: relative;
  158. }
  159. .authorizCloseImg {
  160. width: 62rpx;
  161. height: 62rpx;
  162. }
  163. .sqLogoBox {
  164. width: 180rpx;
  165. height: 180rpx;
  166. background: #FFFFFF;
  167. border-radius: 90rpx;
  168. text-align: center;
  169. position: absolute;
  170. top: -50rpx;
  171. left: 192rpx;
  172. }
  173. .authorizName {
  174. color: #333333;
  175. line-height: 42rpx;
  176. font-size: 30rpx;
  177. text-align: center;
  178. padding-top: 58rpx;
  179. }
  180. .authorizMs {
  181. color: #999999;
  182. line-height: 36rpx;
  183. font-size: 26rpx;
  184. width: 452rpx;
  185. padding-top: 24rpx;
  186. text-align: center;
  187. margin-left: 56rpx;
  188. }
  189. .authorizContbutton {
  190. width: 422rpx;
  191. height: 88rpx;
  192. background: #D53533;
  193. border-radius: 44rpx;
  194. line-height: 88rpx;
  195. text-align: center;
  196. font-size: 30rpx;
  197. color: #FFFFFF;
  198. margin-top: 62rpx;
  199. margin-left: 71rpx;
  200. }
  201. .itemHistory {
  202. margin: 0rpx 24rpx 20rpx;
  203. background-color: #FFFFFF;
  204. border-radius: 10rpx;
  205. position: relative;
  206. }
  207. .groupType{
  208. width: 76rpx;color: #FFFFFF;
  209. height: 36rpx;line-height: 36rpx;text-align: center;
  210. background: linear-gradient(109deg, #FD5A04 0%, #FD0900 100%);
  211. border-radius: 0rpx 10rpx 0rpx 10rpx;
  212. position: absolute;font-weight: 500;
  213. top: 0;right: 0;font-size: 24rpx;
  214. }
  215. .itemImg {
  216. height: 280rpx;
  217. width: 702rpx;
  218. border-radius: 10rpx 10rpx 0px 0px;
  219. display: block;
  220. }
  221. .timeBox {
  222. display: flex;
  223. margin-top: -61rpx;
  224. align-items: flex-end;
  225. }
  226. .state{
  227. width: 102rpx;
  228. height: 53rpx;
  229. position: relative;
  230. }
  231. .time {
  232. padding: 5rpx 10rpx;
  233. color: #FFFFFF;
  234. font-size: 24rpx;
  235. background: rgba(0, 0, 0, 0.5);
  236. margin-left: -8rpx;
  237. border-radius: 0 10rpx 0 0;
  238. }
  239. .name {
  240. padding: 24rpx 20rpx;
  241. color: #333333;
  242. font-size: 28rpx;
  243. background: #FFFFFF;
  244. border-radius: 0 0 10rpx 10rpx;
  245. }
  246. .noMore {
  247. text-align: center;
  248. line-height: 50rpx;
  249. color: #999999;
  250. font-size: 28rpx;
  251. }
  252. </style>