index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="content">
  3. <view class="navBarBox">
  4. <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view>
  5. <view class="navBar">
  6. <view>活动管理</view>
  7. <image class="logo" mode="scaleToFill"></image>
  8. </view>
  9. </view>
  10. <view class="nvBarBox">
  11. <!-- -->
  12. <view @click="onClickStatus(item)" v-for="item in status" :class="[query.state === item.value ? 'active' : '']">{{
  13. item.name }}</view>
  14. </view>
  15. <zs-list mt="0" @load="loadMore" :status="listStatus">
  16. <uni-card v-for="item in list" :key="item" padding="0" spacing="0">
  17. <view @click.stop="onClick(item)">
  18. <view class='img-veiew'>
  19. <view class="badge">{{ item.status }}</view>
  20. <image slot="cover" class="cover" :src="item.activityCover">
  21. </image>
  22. </view>
  23. <view class="content-box">
  24. <view class="title">{{ item.activityName }}</view>
  25. <view class="sub-title">
  26. 活动时间: {{ item.activityStartTime }} 至 {{ item.activityEndTime }}
  27. </view>
  28. <view class="sub-title">
  29. 活动地点:{{ item.address }}
  30. </view>
  31. <u-line :customStyle="{ marginTop: '20rpx' }"></u-line>
  32. <view class="actionBox">
  33. <view class="actionItem">
  34. <view>活动介绍</view>
  35. </view>
  36. <view class="actionItem">
  37. <view>报名记录</view>
  38. </view>
  39. <view class="actionItem">
  40. <view>查看订单</view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </uni-card>
  46. </zs-list>
  47. <!-- <zs-tab-bar :value="1"></zs-tab-bar> -->
  48. </view>
  49. </template>
  50. <script>
  51. import uniCard from "@/uni_modules/uni-card/components/uni-card/uni-card.vue";
  52. import { getActivityList } from "../../api/activity";
  53. export default {
  54. components: {
  55. uniCard,
  56. },
  57. data() {
  58. return {
  59. navBarHeight: 0,
  60. statusBarHeight: 0,
  61. list: [],
  62. triggered: false,
  63. loading: false,
  64. status: [
  65. // wait 未开始 doing 进行中 over 已结束
  66. { name: "全部", value: null },
  67. { name: "未开始", value: 'wait' },
  68. { name: "进行中", value: 'doing' },
  69. { name: "已结束", value: 'over' },
  70. ],
  71. shopId: uni.getStorageSync("gdShopId"),
  72. query: {
  73. currentPage: 1,
  74. pageSize: 10,
  75. activityEnable: 1,
  76. state: null,
  77. },
  78. listStatus: "more", // more noMore loading
  79. };
  80. },
  81. onShow() {
  82. this.getList();
  83. this.query.state = null;
  84. },
  85. created() {
  86. this.navBarHeight = this.$navHight(1);
  87. this.statusBarHeight = uni.getSystemInfoSync()["statusBarHeight"];
  88. this.navBarHeight = this.navBarHeight + 10 + "px";
  89. },
  90. methods: {
  91. getList() {
  92. getActivityList({
  93. shopId: this.shopId,
  94. ...this.query,
  95. }).then(res => {
  96. this.list = res.content.records || [];
  97. this.loading = false;
  98. this.list = res.content.records;
  99. let total = this.list.length
  100. if (total >= res.content.total) {
  101. this.listStatus = "noMore";
  102. } else {
  103. this.listStatus = "more";
  104. this.query.currentPage++;
  105. }
  106. })
  107. },
  108. onClickStatus(item) {
  109. this.query.state = item.value;
  110. this.getList();
  111. },
  112. onClick(row) {
  113. uni.navigateTo({
  114. url: "/pages/activity/detail",
  115. });
  116. },
  117. onRefresh() {
  118. console.log("下拉刷新了", this.triggered);
  119. this.triggered = true
  120. setTimeout(() => {
  121. this.triggered = false;
  122. }, 1000)
  123. },
  124. loadMore() {
  125. console.log("加载更多了");
  126. },
  127. },
  128. };
  129. </script>
  130. <style>
  131. page {
  132. background-color: #fafafa;
  133. }
  134. </style>
  135. <style lang="scss" scoped>
  136. .navBarBox .navBar .logo {
  137. width: 0rpx;
  138. height: 82rpx;
  139. // margin-right: 10rpx;
  140. }
  141. .navBarBox .navBar {
  142. font-size: 35rpx;
  143. font-weight: bold;
  144. padding: 3rpx 50rpx;
  145. padding-bottom: 8rpx;
  146. display: flex;
  147. flex-direction: row;
  148. justify-content: center;
  149. align-items: center;
  150. }
  151. .content {
  152. // padding-top: 24%;
  153. }
  154. // .view-content {
  155. // height: 600px;
  156. // background-color: red;
  157. // }
  158. .nvBarBox {
  159. display: flex;
  160. flex-direction: row;
  161. justify-content: space-around;
  162. align-items: center;
  163. // background-color: #fff;
  164. padding: 10rpx 0;
  165. font-size: 30rpx;
  166. color: #999999;
  167. .active {
  168. color: #333333;
  169. font-weight: bold;
  170. }
  171. }
  172. .img-veiew {
  173. position: relative;
  174. overflow: hidden;
  175. .badge {
  176. position: absolute;
  177. top: 0;
  178. right: 0;
  179. width: 120rpx;
  180. text-align: center;
  181. background-color: #DBDBDB;
  182. color: #7A7A7A;
  183. font-size: 24rpx;
  184. padding: 5rpx 10rpx;
  185. }
  186. }
  187. .cover {
  188. width: 100%;
  189. height: 320rpx;
  190. }
  191. .content-box {
  192. padding: 10rpx 20rpx;
  193. // height: 150rpx;
  194. .title {
  195. font-weight: bold;
  196. color: black;
  197. font-size: 32rpx;
  198. // 超出文本使用...
  199. overflow: hidden;
  200. text-overflow: ellipsis;
  201. white-space: nowrap;
  202. }
  203. .sub-title {
  204. font-size: 30rpx;
  205. margin-top: 20rpx;
  206. overflow: hidden;
  207. text-overflow: ellipsis;
  208. white-space: nowrap;
  209. }
  210. .actionBox {
  211. display: flex;
  212. flex-direction: row;
  213. justify-content: space-around;
  214. margin-top: 10rpx;
  215. .actionItem {
  216. width: 100%;
  217. height: 100%;
  218. display: flex;
  219. justify-content: center;
  220. font-size: 24rpx;
  221. color: #212222;
  222. }
  223. // 前2个后面加线
  224. .actionItem:nth-child(1),
  225. .actionItem:nth-child(2) {
  226. border-right: 1px solid #ccc;
  227. }
  228. }
  229. }
  230. </style>