index.vue 7.1 KB

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