index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <template>
  2. <view>
  3. <view v-if="noticeStatus">
  4. <u-notice-bar :text="noticeText"></u-notice-bar>
  5. </view>
  6. <u-sticky>
  7. <view>
  8. <!-- @click="oneTypeClick(item,index)" -->
  9. <scroll-view class="scroll-view_H_MY" :scroll-x="true" @scroll="scroll">
  10. <view :class="index=== oneTypeActive ? 'scroll-view-item_H_MY-active':''"
  11. v-for="(item,index) in ['活动']" class="scroll-view-item_H_MY">
  12. {{item}}
  13. </view>
  14. </scroll-view>
  15. </view>
  16. </u-sticky>
  17. <view style="display: flex;flex-flow: row wrap;">
  18. <view style="width: 20%; text-align: center;background-color: #f0f0f0;">
  19. <scroll-view scroll-y scroll-with-animation :scrollTop="scrollLeftTop"
  20. :style="[{height: containerHeight + 'px'}]">
  21. <view :class="index === twoTypeActive ? 'giftTypeItem-active':''" @click="twoTypeClick(item,index)"
  22. v-for="(item,index) in clubsData" class="giftTypeItem">
  23. {{item.projectName}}
  24. </view>
  25. </scroll-view>
  26. </view>
  27. <view style="width: 80%;background-color: #ffffff;text-align:center;">
  28. <scroll-view scroll-y scroll-with-animation :scrollTop="scrollLeftTop" :lower-threshold="110"
  29. @scrolltolower="refreshGift" :style="[{height: containerHeight + 'px'}]">
  30. <view class="foodBody">
  31. <view style="width: 48%;">
  32. <view v-if="index %2 === 0" class="goodsItem" v-for="(item, index) in list" :key="index">
  33. <view @click="toMorePage(item)">
  34. <img class="cuisineImg" width="100%" height="100%" :src=" baseURL+item.eventImgUrl"
  35. mode="widthFix" radius="5"></img>
  36. <view class="goodsName">{{item.eventPlace}}</view>
  37. <view style="text-align: left;">
  38. <view>
  39. <uni-row>
  40. <uni-col span="4">
  41. <view style="font-size: 18rpx;">
  42. 地点
  43. </view>
  44. </uni-col>
  45. <uni-col span="20">
  46. <view style="font-size: 20rpx;">
  47. {{item.eventPlaceSite}}
  48. </view>
  49. </uni-col>
  50. </uni-row>
  51. </view>
  52. <view style="font-size: 20rpx;">
  53. 开始:{{item.eventStartTime}}
  54. </view>
  55. <view style="font-size: 20rpx;">
  56. 结束:{{item.eventEndTime}}
  57. </view>
  58. </view>
  59. <view class="goodsPrice">
  60. <u-row>
  61. <u-col span="6">
  62. <view
  63. :style="{'font-size': '12px','color': item.alreadyHave === 0 ? 'rgb(10, 185, 156)':'rgb(0, 0, 0)'}">
  64. {{'已报:'+item.alreadyHave}}
  65. </view>
  66. </u-col>
  67. <u-col span="6" textAlign="right">
  68. <view style="font-size: 12px;color: rgb(0, 0, 0)">
  69. {{'剩余:'+(item.limitNum - item.alreadyHave)}}
  70. </view>
  71. </u-col>
  72. </u-row>
  73. </view>
  74. </view>
  75. <view class="gwxx">
  76. </view>
  77. <view class="gwxx">
  78. <!-- <view style="display: flex;flex-wrap: wrap-reverse;padding: 0 10rpx;"> -->
  79. <view style="text-align: center;">
  80. <view class="yyButton" style="border: 1rpx solid rgb(10, 185, 156);
  81. color: rgb(10, 185, 156);font-size: 22rpx; padding: 5rpx 15rpx;
  82. border-radius: 10rpx;" @click="addGoods(item)">
  83. 预约
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. <view style="width: 48%;">
  90. <view v-if="index %2 !== 0" class="goodsItem" v-for="(item, index) in list" :key="index">
  91. <view @click="toMorePage(item)">
  92. <img class="cuisineImg" width="100%" height="100%" :src=" baseURL+item.eventImgUrl"
  93. mode="widthFix" radius="5"></img>
  94. <view class="goodsName">{{item.eventPlace}}</view>
  95. <view style="text-align: left;">
  96. <view>
  97. <uni-row>
  98. <uni-col span="4">
  99. <view style="font-size: 18rpx;">
  100. 地点
  101. </view>
  102. </uni-col>
  103. <uni-col span="20">
  104. <view style="font-size: 20rpx;">
  105. {{item.eventPlaceSite}}
  106. </view>
  107. </uni-col>
  108. </uni-row>
  109. </view>
  110. <view style="font-size: 18rpx;">
  111. 开始:{{item.eventStartTime}}
  112. </view>
  113. <view style="font-size: 18rpx;">
  114. 结束:{{item.eventEndTime}}
  115. </view>
  116. </view>
  117. <view class="goodsPrice">
  118. <u-row>
  119. <u-col span="6">
  120. <view
  121. :style="{'font-size': '12px','color': item.alreadyHave === 0 ? 'rgb(10, 185, 156)':'rgb(0, 0, 0)'}">
  122. {{'已报:'+item.alreadyHave}}
  123. </view>
  124. </u-col>
  125. <u-col span="6" textAlign="right">
  126. <view style="font-size: 12px;color: rgb(0, 0, 0)">
  127. {{'剩余:'+(item.limitNum - item.alreadyHave)}}
  128. </view>
  129. </u-col>
  130. </u-row>
  131. </view>
  132. </view>
  133. <view class="gwxx">
  134. </view>
  135. <view class="gwxx">
  136. <view style="text-align: center;">
  137. <view class="yyButton" style="border: 1rpx solid rgb(10, 185, 156);
  138. color: rgb(10, 185, 156);font-size: 22rpx; padding: 5rpx 15rpx;
  139. border-radius: 10rpx;" @click="addGoods(item)">
  140. 预约
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. </view>
  147. <u-loadmore :status="status" />
  148. </scroll-view>
  149. </view>
  150. </view>
  151. <view class="content">
  152. <!-- @touchstart="handleStart" @touchmove="handleMove" @touchend="handleEnd" -->
  153. <view :style="{'transform':'translate3d('+0+'px,'+-180+'px,0)'}" class="touch">
  154. <view @click="confirm1">
  155. <view style="margin-left: 25rpx;">
  156. <uni-row>
  157. 预约
  158. </uni-row>
  159. <uni-row>
  160. 记录
  161. </uni-row>
  162. </view>
  163. </view>
  164. </view>
  165. </view>
  166. <!-- <wp-tabbar pagePath="/pages/integral/index" :type="type"></wp-tabbar> -->
  167. </view>
  168. </template>
  169. <script>
  170. export default {
  171. data() {
  172. return {
  173. containerHeight: 0,
  174. stickyOffsetTop: 20,
  175. scrollLeftTop: 0,
  176. height: 0,
  177. option: {
  178. page: 1,
  179. size: 10,
  180. auto: true
  181. },
  182. noticeText: '',
  183. page: 1,
  184. oneTypeActive: 0,
  185. twoTypeActive: 0,
  186. list: [],
  187. clubsData: [],
  188. total: 0,
  189. from: {
  190. consumerType: uni.getStorageSync("userInfo").userType,
  191. jgid: uni.getStorageSync("orgInfo").organizationCode,
  192. organizationCode: uni.getStorageSync("orgInfo").organizationCode
  193. },
  194. gwcType: 0,
  195. scrollTop: 0,
  196. gwcNum: 0,
  197. xMove: 0,
  198. yMove: -80,
  199. baseURL: this.$BASE_URL,
  200. loading: false,
  201. oName: uni.getStorageSync("orgInfo").organizationName,
  202. maxNum: 0,
  203. timeStop: 0,
  204. goodsList: [],
  205. gwcGoodsList: [],
  206. menuData: {},
  207. status: 'loadmore',
  208. //上滑列表锁 避免多次上滑导致出错
  209. loadingLock: 0,
  210. noticeStatus: false
  211. }
  212. },
  213. mounted() {
  214. uni.removeStorageSync('shopData')
  215. this.getClubs()
  216. this.getNoticeStatus()
  217. this.getNotice()
  218. let that = this
  219. uni.getSystemInfo({
  220. success: res => {
  221. console.log(res)
  222. const height = that.height
  223. const windowHeight = res.windowHeight // 可使用窗口高度
  224. if (windowHeight) {
  225. // 限制containerHeight的值,避免传入的height值过大而出现滚动条
  226. that.containerHeight = windowHeight
  227. }
  228. }
  229. })
  230. },
  231. onShow() {
  232. this.getClubs()
  233. },
  234. onPullDownRefresh() {},
  235. onReachBottom() {},
  236. methods: {
  237. // 上滑
  238. refreshGift() {
  239. if (this.total === this.list.length) {
  240. this.status = 'nomore'
  241. return
  242. }
  243. if (this.loadingLock === 0) {
  244. ++this.option.page
  245. this.taskList(this.option)
  246. }
  247. },
  248. twoTypeClick(type, index) {
  249. this.list = []
  250. this.twoTypeActive = index
  251. this.option.page = 1
  252. this.option.size = 10
  253. this.option.associationsInfoId = type.id
  254. this.taskList(this.option)
  255. },
  256. toMorePage(item) {
  257. uni.setStorageSync("eventId", item.id)
  258. uni.setStorageSync("isUpload", 0)
  259. uni.navigateTo({
  260. url: "more"
  261. })
  262. },
  263. async getClubs() {
  264. // 发送请求
  265. const {
  266. data: res
  267. } = await this.$httpRequest({
  268. url: '/app/clubs',
  269. method: 'get',
  270. urlType: this.$getUrlType()
  271. });
  272. if (res.code === 200) {
  273. this.clubsData = res.data;
  274. this.option.page = 1
  275. this.option.size = 10
  276. this.option.associationsInfoId = this.clubsData[0].id
  277. this.taskList(this.option)
  278. }
  279. },
  280. async getNoticeStatus() {
  281. this.$getConfigData('club_notice_open').then(res => {
  282. if (res.code === 200) {
  283. this.noticeStatus = res.msg !== "false"
  284. if (this.noticeStatus) {
  285. this.containerHeight -= 75
  286. } else {
  287. this.containerHeight -= 40
  288. }
  289. }
  290. })
  291. },
  292. async addGoods(data) {
  293. // 发送请求
  294. const {
  295. data: res
  296. } = await this.$httpRequest({
  297. url: '/app/eventOrder?eventId=' + data.id,
  298. method: 'get',
  299. urlType: this.$getUrlType()
  300. });
  301. if (res.code === 200) {
  302. uni.showModal({
  303. showCancel: false,
  304. content: '预约成功'
  305. })
  306. this.taskList(this.option)
  307. } else {
  308. this.$showModal(res.msg)
  309. }
  310. },
  311. async getNotice() {
  312. this.$getConfigData('club_notice').then(res => {
  313. this.noticeText = res.msg
  314. })
  315. },
  316. async taskList(paging) {
  317. this.loadingLock = 1
  318. this.status = 'loading'
  319. // 发送请求
  320. const {
  321. data: res
  322. } = await this.$httpRequest({
  323. url: '/app/events?pageNum=' + paging.page + '&pageSize=' + paging.size +
  324. "&associationsInfoId=" + paging.associationsInfoId,
  325. method: 'get',
  326. isNotErrorMsg: true,
  327. urlType: this.$getUrlType()
  328. });
  329. if (res.code === 200) {
  330. if (paging.page === 1) {
  331. this.total = res.total
  332. this.list = res.rows
  333. } else if (paging.page > 1) {
  334. for (var i = 0; i < res.rows.length; i++) {
  335. this.list.push(res.rows[i])
  336. }
  337. }
  338. this.loadingLock = 0
  339. if (this.total === this.list.length) {
  340. this.status = 'nomore'
  341. } else {
  342. this.status = 'loadmore'
  343. }
  344. }
  345. },
  346. scroll: function(e) {
  347. this.old.scrollTop = e.detail.scrollTop
  348. },
  349. confirm1(e) {
  350. uni.setStorageSync('orderType', 1)
  351. uni.navigateTo({
  352. url: 'appoint'
  353. })
  354. },
  355. // 刷新刷剧
  356. refresh() {
  357. this.taskList(this.option)
  358. },
  359. scrolltolower(e) {},
  360. load(paging) {
  361. this.taskList(paging)
  362. },
  363. loadSuccess(list) {
  364. this.list = list
  365. }
  366. }
  367. }
  368. </script>
  369. <style lang="scss" scoped>
  370. .foodBody {
  371. padding-top: 10rpx;
  372. padding-left: 10rpx;
  373. display: flex;
  374. flex-flow: row wrap;
  375. justify-content: center;
  376. border-radius: 30rpx;
  377. }
  378. .gwxx {
  379. padding-top: 10rpx;
  380. }
  381. .scroll-view_H_MY {
  382. white-space: nowrap;
  383. width: 100%;
  384. letter-spacing: 10rpx;
  385. // padding: 20rpx;
  386. background-color: rgb(255, 255, 255);
  387. // background: linear-gradient(to bottom right, rgb(47, 203, 198), rgb(127, 241, 209));
  388. }
  389. .scroll-view-item_H_MY {
  390. color: #8c8c8c;
  391. height: 35px;
  392. width: 33.4%;
  393. font-size: 30rpx;
  394. display: inline-flex; // item的外层定义成行内元素才可进行滚动 inline-block / inline-flex 均可
  395. flex-direction: column;
  396. align-items: center;
  397. border-right: 1rpx #f3f3f3 solid;
  398. }
  399. .scroll-view-item_H_MY-active {
  400. // background-color: rgb(153, 241, 224);
  401. border-bottom: 5rpx rgb(96, 182, 158) solid;
  402. }
  403. .giftTypeItem {
  404. color: #8c8c8c;
  405. padding: 20rpx 10rpx;
  406. font-size: 25rpx;
  407. letter-spacing: 5rpx;
  408. background-color: #f0f0f0;
  409. border-bottom: 1rpx #f3f3f3 solid;
  410. }
  411. .giftTypeItem-active {
  412. background-color: #ffffff;
  413. }
  414. .isNumNull {
  415. color: #FF0000;
  416. }
  417. .addGwc:active {
  418. color: #ffffff;
  419. }
  420. .yyButton:active {
  421. background-color: #dedede;
  422. }
  423. .content {
  424. display: flex;
  425. flex-direction: column;
  426. align-items: center;
  427. justify-content: center;
  428. }
  429. .touch {
  430. position: fixed;
  431. right: -5rpx;
  432. bottom: 60rpx;
  433. width: 105rpx;
  434. height: 105rpx;
  435. padding: 5rpx;
  436. background-color: rgb(10, 185, 156);
  437. border-top-left-radius: 50%;
  438. border-bottom-left-radius: 50%;
  439. color: #fff;
  440. font-size: 50rpx;
  441. /* 去除标签点击事件高亮效果 */
  442. -webkit-tap-highlight-color: transparent;
  443. /* 使用transform: translate3d 处理性能高 GUP */
  444. }
  445. #button_div {
  446. position: fixed;
  447. bottom: var(--window-bottom);
  448. }
  449. .mybackColor {
  450. background-color: #8c8c8c;
  451. }
  452. .shopHand {
  453. font-weight: bold;
  454. font-size: 20px;
  455. height: 20%;
  456. padding: 10% 0 10px 10px;
  457. margin-bottom: 5px;
  458. //background: linear-gradient(to bottom right, #85c1bf, #f1fef9);
  459. //background: rgb(55,186,189);
  460. background: #9ED6CF;
  461. }
  462. .cuisineImg {
  463. border-radius: 10px;
  464. max-height: 600rpx;
  465. height: auto;
  466. width: auto;
  467. padding: 0rpx 5rpx 2rpx;
  468. }
  469. .doFoodConfigView {
  470. width: 93%;
  471. margin: 0 auto;
  472. margin-top: 5px;
  473. padding: 2% 5px;
  474. background-color: #ffffff;
  475. border-radius: 10px;
  476. border: 1px solid #d3d3d3;
  477. }
  478. .gwcNum {
  479. width: 15px;
  480. top: 17px;
  481. left: 21px;
  482. position: relative;
  483. }
  484. /* 商品列表 */
  485. .goodsContent {
  486. width: 100%;
  487. margin: 0 auto;
  488. flex-direction: column;
  489. background: #f3f3f3;
  490. display: flex;
  491. justify-content: center;
  492. }
  493. .goodsItem {
  494. width: 280rpx;
  495. background: #FFFFFF;
  496. // border-radius: 10px;
  497. padding: 10rpx 0;
  498. // margin: 5rpx;
  499. // border: 1px solid #ebebeb;
  500. }
  501. .goodsName {
  502. font-size: 24rpx;
  503. color: #2e2e2e;
  504. padding: 10rpx 20rpx;
  505. overflow: hidden;
  506. text-overflow: ellipsis;
  507. display: -webkit-box;
  508. -webkit-line-clamp: 2;
  509. -webkit-box-orient: vertical;
  510. }
  511. .goodsPrice {
  512. color: #ffac29;
  513. font-size: 24rpx;
  514. padding: 0 5rpx;
  515. }
  516. .addFood {
  517. margin-left: 20rpx;
  518. color: #8c8c8c;
  519. }
  520. .minus {
  521. width: 26px;
  522. height: 26px;
  523. background-color: #efefef;
  524. border-width: 1px;
  525. border-color: #c6c6c6;
  526. border-top-left-radius: 100px;
  527. border-top-right-radius: 100px;
  528. border-bottom-left-radius: 100px;
  529. border-bottom-right-radius: 100px;
  530. @include flex;
  531. justify-content: center;
  532. align-items: center;
  533. }
  534. .input {
  535. padding: 0;
  536. }
  537. .plus {
  538. width: 20px;
  539. height: 20px;
  540. background-color: #FF0000;
  541. border-radius: 50%;
  542. /* #ifndef APP-NVUE */
  543. display: flex;
  544. /* #endif */
  545. justify-content: center;
  546. align-items: center;
  547. }
  548. </style>