index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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 class="lsit-box" mt="0" @load="loadMore" :status="listStatus">
  16. <uni-card v-for="item in dataList" :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 @click.stop="activityInfo(item)" class="actionItem">
  34. <view>活动介绍</view>
  35. </view>
  36. <view @click.stop="signUp(item)" class="actionItem">
  37. <view>报名记录</view>
  38. </view>
  39. <view @click.stop="orderInfo(item)" 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 { search } from "../../api/activity";
  53. export default {
  54. components: {
  55. uniCard,
  56. },
  57. data() {
  58. return {
  59. navBarHeight: 0,
  60. statusBarHeight: 0,
  61. list: [],
  62. dataList: [],
  63. triggered: false,
  64. loading: false,
  65. status: [
  66. // wait 未开始 doing 进行中 over 已结束
  67. { name: "全部", value: null },
  68. { name: "未开始", value: 'wait' },
  69. { name: "进行中", value: 'doing' },
  70. { name: "已结束", value: 'over' },
  71. ],
  72. shopId: uni.getStorageSync("gdShopId"),
  73. query: {
  74. currentPage: 1,
  75. pageSize: 3,
  76. activityEnable: 1,
  77. state: null,
  78. },
  79. listStatus: "more", // more noMore loading
  80. };
  81. },
  82. onLoad() {
  83. this.getList("onLoad");
  84. this.listStatus = "loading"
  85. this.query = {
  86. currentPage: 1,
  87. pageSize: 3,
  88. activityEnable: 1,
  89. state: null,
  90. }
  91. },
  92. created() {
  93. this.navBarHeight = this.$navHight(1);
  94. this.statusBarHeight = uni.getSystemInfoSync()["statusBarHeight"];
  95. this.navBarHeight = this.navBarHeight + 10 + "px";
  96. },
  97. methods: {
  98. getList(where) {
  99. console.log('触发了!', where, this.query.currentPage);
  100. this.listStatus = "loading"
  101. search({
  102. shopId: this.shopId,
  103. ...this.query,
  104. }).then(res => {
  105. this.list = res.content.records || [];
  106. this.dataList = this.dataList.concat(this.list.map(e => {
  107. return {
  108. ...e.signupVo,
  109. orderNo: e.orderNo,
  110. }
  111. }));
  112. this.$forceUpdate();
  113. this.loading = false;
  114. // this.list = res.content.records;
  115. let total = this.dataList.length
  116. if (total >= res.content.total) {
  117. this.listStatus = "noMore";
  118. } else {
  119. this.listStatus = "more";
  120. console.log('pageChange', this.query.currentPage);
  121. this.query.currentPage = this.query.currentPage + 1;
  122. }
  123. })
  124. },
  125. onClickStatus(item) {
  126. this.dataList = []
  127. this.query = {
  128. currentPage: 1,
  129. pageSize: 3,
  130. activityEnable: 1,
  131. }
  132. this.query.state = item.value;
  133. this.getList("click");
  134. },
  135. onClick(row) {
  136. uni.navigateTo({
  137. url: "/pages/activity/detail",
  138. });
  139. },
  140. onRefresh() {
  141. console.log("下拉刷新了", this.triggered);
  142. this.triggered = true
  143. setTimeout(() => {
  144. this.triggered = false;
  145. }, 1000)
  146. },
  147. loadMore() {
  148. // console.log("加载更多了");
  149. this.getList("loadMore")
  150. },
  151. signUp(row) {
  152. uni.navigateTo({
  153. url: "/my/activityManage/detail?id=" + row.orderNo,
  154. });
  155. },
  156. orderInfo(row) {
  157. uni.navigateTo({
  158. url: "/signUp/orderDetail?id=" + row.orderNo,
  159. });
  160. },
  161. activityInfo(row) {
  162. uni.navigateTo({
  163. url: "/signUp/index?scene=" + row.id,
  164. });
  165. }
  166. },
  167. };
  168. </script>
  169. <style>
  170. page {
  171. background-color: #fafafa;
  172. }
  173. </style>
  174. <style lang="scss" scoped>
  175. .navBarBox .navBar .logo {
  176. width: 0rpx;
  177. height: 82rpx;
  178. // margin-right: 10rpx;
  179. }
  180. .navBarBox .navBar {
  181. font-size: 35rpx;
  182. font-weight: bold;
  183. padding: 3rpx 50rpx;
  184. padding-bottom: 8rpx;
  185. display: flex;
  186. flex-direction: row;
  187. justify-content: center;
  188. align-items: center;
  189. }
  190. ::v-deep .zs-list {
  191. height: 80vh;
  192. overflow-y: scroll;
  193. }
  194. .content {
  195. // padding-top: 24%;
  196. }
  197. // .view-content {
  198. // height: 600px;
  199. // background-color: red;
  200. // }
  201. .nvBarBox {
  202. display: flex;
  203. flex-direction: row;
  204. justify-content: space-around;
  205. align-items: center;
  206. // background-color: #fff;
  207. padding: 10rpx 0;
  208. font-size: 30rpx;
  209. color: #999999;
  210. .active {
  211. color: #333333;
  212. font-weight: bold;
  213. position: relative;
  214. &:after {
  215. content: "";
  216. display: block;
  217. width: 100%;
  218. height: 4rpx;
  219. background-color: $uni-color-primary;
  220. border-radius: 2rpx;
  221. position: absolute;
  222. bottom: -4rpx;
  223. left: 0;
  224. }
  225. }
  226. }
  227. .img-veiew {
  228. position: relative;
  229. overflow: hidden;
  230. .badge {
  231. position: absolute;
  232. top: 0;
  233. right: 0;
  234. width: 120rpx;
  235. text-align: center;
  236. background-color: #DBDBDB;
  237. color: #7A7A7A;
  238. font-size: 24rpx;
  239. padding: 5rpx 10rpx;
  240. }
  241. }
  242. .cover {
  243. width: 100%;
  244. height: 320rpx;
  245. }
  246. .content-box {
  247. padding: 10rpx 20rpx;
  248. // height: 150rpx;
  249. .title {
  250. font-weight: bold;
  251. color: black;
  252. font-size: 32rpx;
  253. // 超出文本使用...
  254. overflow: hidden;
  255. text-overflow: ellipsis;
  256. white-space: nowrap;
  257. }
  258. .sub-title {
  259. font-size: 30rpx;
  260. margin-top: 20rpx;
  261. overflow: hidden;
  262. text-overflow: ellipsis;
  263. white-space: nowrap;
  264. }
  265. .actionBox {
  266. display: flex;
  267. flex-direction: row;
  268. justify-content: space-around;
  269. margin-top: 10rpx;
  270. .actionItem {
  271. width: 100%;
  272. height: 100%;
  273. display: flex;
  274. justify-content: center;
  275. font-size: 24rpx;
  276. color: #212222;
  277. }
  278. // 前2个后面加线
  279. .actionItem:nth-child(1),
  280. .actionItem:nth-child(2) {
  281. border-right: 1px solid #ccc;
  282. }
  283. }
  284. }
  285. </style>