activity.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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. <view class="sqLine">
  23. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  24. <view class="sqRefuse" @click="authorizShowHide">拒绝</view>
  25. </view>
  26. </view>
  27. <view style="text-align: center;padding-top: 56rpx;">
  28. <image src="../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script scoped>
  34. import nodata from '../../components/nodata/nodata.vue'
  35. export default {
  36. components: {
  37. nodata,
  38. },
  39. data() {
  40. return {
  41. userInfo: '',
  42. authorizShow: false,
  43. code: '',
  44. wxOpenData: '',
  45. page: 1,
  46. itemData: [],
  47. noMoreShow: false,
  48. ext:'',
  49. themeColor:'',
  50. }
  51. },
  52. onLoad() {
  53. this.userInfo = this.$store.state.userInfo;
  54. this.wxOpenData = this.$store.state.wxOpenData
  55. this.ext=this.$common.getExtStoreId();
  56. this.page = 1
  57. this.myOrderCoupon();
  58. this.themeColor = uni.getStorageSync("themeColor");
  59. if(this.themeColor){
  60. if(this.themeColor=='6F2BE8'){
  61. var backgroundImage='/static/tabimg/activty6F2BE8.png'
  62. }
  63. if(this.themeColor=='1677FF'){
  64. var backgroundImage='/static/tabimg/activty1677FF.png'
  65. }
  66. if(this.themeColor=='FF4F00'){
  67. var backgroundImage='/static/tabimg/activtyFF4F00.png'
  68. }
  69. if(this.themeColor=='D53533'){
  70. var backgroundImage='/static/tabimg/activity1.png'
  71. }
  72. uni.setTabBarStyle({
  73. // color: '#FF0000',
  74. selectedColor: '#'+this.themeColor,
  75. })
  76. uni.setTabBarItem({
  77. index: 2,
  78. text: '活动',
  79. selectedIconPath: backgroundImage
  80. })
  81. }
  82. },
  83. methods: {
  84. goDetail(id) {
  85. this.$store.commit('mutationsckshopInfo', '')
  86. uni.navigateTo({
  87. url: 'jkDetail?id=' + id
  88. })
  89. /* uni.navigateTo({
  90. url: '../subPack/jkDetail?id=' + id
  91. }) */
  92. },
  93. myOrderCoupon() {
  94. uni.showLoading({
  95. title: '加载中'
  96. })
  97. this.$http('openHome/queryActivityList', {
  98. // page: this.page,
  99. // limit: 10,
  100. unionId:this.ext.unionId
  101. }, 'GET').then(res => {
  102. uni.hideLoading();
  103. // var list = res.data.Items
  104. var list = res.data
  105. // 处理 undefined和null转为空白字符串
  106. // list.forEach((item, index) => {
  107. // for (const key in item) {
  108. // item[key] = this.$praseStrEmpty(item[key])
  109. // }
  110. // })
  111. if (this.page == 1) {
  112. this.itemData = list
  113. } else {
  114. this.itemData = this.itemData.concat(list)
  115. }
  116. if (list.length < 10) {
  117. this.noMoreShow = true
  118. } else {
  119. this.noMoreShow = false
  120. }
  121. })
  122. },
  123. },
  124. // 下拉刷新 上拉加载更多
  125. onPullDownRefresh() {
  126. this.page = 1
  127. this.myOrderCoupon()
  128. setTimeout(function() {
  129. uni.stopPullDownRefresh();
  130. }, 1000);
  131. },
  132. onReachBottom() {
  133. // this.page++;
  134. this.myOrderCoupon()
  135. },
  136. }
  137. </script>
  138. <style scoped lang="less">
  139. .box {
  140. background: #F4F5F7;
  141. min-height: 100vh;
  142. padding-top: 20rpx;
  143. }
  144. .authorizBox {
  145. width: 100vw;
  146. height: 100vh;
  147. background: rgba(0, 0, 0, 0.5);
  148. position: fixed;
  149. top: 0;
  150. left: 0;
  151. }
  152. .authorizCont {
  153. margin-top: 30vh;
  154. width: 564rpx;
  155. height: 408rpx;
  156. background: #FFFFFF;
  157. border-radius: 24rpx;
  158. margin-left: 93rpx;
  159. position: relative;
  160. }
  161. .authorizCloseImg {
  162. width: 62rpx;
  163. height: 62rpx;
  164. }
  165. .sqLogoBox {
  166. width: 180rpx;
  167. height: 180rpx;
  168. background: #FFFFFF;
  169. border-radius: 90rpx;
  170. text-align: center;
  171. position: absolute;
  172. top: -50rpx;
  173. left: 192rpx;
  174. }
  175. .authorizName {
  176. color: #333333;
  177. line-height: 42rpx;
  178. font-size: 30rpx;
  179. text-align: center;
  180. padding-top: 58rpx;
  181. }
  182. .authorizMs {
  183. color: #999999;
  184. line-height: 36rpx;
  185. font-size: 26rpx;
  186. width: 452rpx;
  187. padding-top: 24rpx;
  188. text-align: center;
  189. margin-left: 56rpx;
  190. }
  191. .authorizContbutton{
  192. width: 210rpx;
  193. height: 66rpx;
  194. background: #D53533;
  195. border-radius: 44rpx;
  196. line-height: 66rpx;
  197. text-align: center;
  198. font-size:30rpx;
  199. color: #FFFFFF;
  200. margin-left:40rpx;
  201. }
  202. .sqRefuse{
  203. width: 210rpx;
  204. height: 66rpx;
  205. border: 1px solid #eaeaea;
  206. line-height: 66rpx;
  207. border-radius: 36rpx;
  208. text-align: center;
  209. font-size:30rpx;
  210. margin-right:40rpx;
  211. color: #999999;
  212. }
  213. .sqLine{
  214. margin-top: 62rpx;
  215. display: flex;
  216. justify-content: space-between;
  217. }
  218. .itemHistory {
  219. margin: 0rpx 24rpx 20rpx;
  220. background-color: #FFFFFF;
  221. border-radius: 10rpx;
  222. position: relative;
  223. }
  224. .groupType{
  225. width: 76rpx;color: #FFFFFF;
  226. height: 36rpx;line-height: 36rpx;text-align: center;
  227. background: linear-gradient(109deg, #FD5A04 0%, #FD0900 100%);
  228. border-radius: 0rpx 10rpx 0rpx 10rpx;
  229. position: absolute;font-weight: 500;
  230. top: 0;right: 0;font-size: 24rpx;
  231. }
  232. .itemImg {
  233. height: 280rpx;
  234. width: 702rpx;
  235. border-radius: 10rpx 10rpx 0px 0px;
  236. display: block;
  237. }
  238. .timeBox {
  239. display: flex;
  240. margin-top: -61rpx;
  241. align-items: flex-end;
  242. }
  243. .state{
  244. width: 102rpx;
  245. height: 53rpx;
  246. position: relative;
  247. }
  248. .time {
  249. padding: 5rpx 10rpx;
  250. color: #FFFFFF;
  251. font-size: 24rpx;
  252. background: rgba(0, 0, 0, 0.5);
  253. margin-left: -8rpx;
  254. border-radius: 0 10rpx 0 0;
  255. }
  256. .name {
  257. padding: 24rpx 20rpx;
  258. color: #333333;
  259. font-size: 28rpx;
  260. background: #FFFFFF;
  261. border-radius: 0 0 10rpx 10rpx;
  262. }
  263. .noMore {
  264. text-align: center;
  265. line-height: 50rpx;
  266. color: #999999;
  267. font-size: 28rpx;
  268. }
  269. </style>