index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  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.twoTypeActive = 0
  275. this.option.page = 1
  276. this.option.size = 10
  277. this.option.associationsInfoId = this.clubsData[0].id
  278. this.taskList(this.option)
  279. }
  280. },
  281. async getNoticeStatus() {
  282. this.$getConfigData('club_notice_open').then(res => {
  283. if (res.code === 200) {
  284. this.noticeStatus = res.msg !== "false"
  285. if (this.noticeStatus) {
  286. this.containerHeight -= 75
  287. } else {
  288. this.containerHeight -= 40
  289. }
  290. }
  291. })
  292. },
  293. async addGoods(data) {
  294. // 发送请求
  295. const {
  296. data: res
  297. } = await this.$httpRequest({
  298. url: '/app/eventOrder?eventId=' + data.id,
  299. method: 'get',
  300. urlType: this.$getUrlType()
  301. });
  302. if (res.code === 200) {
  303. uni.showModal({
  304. showCancel: false,
  305. content: '预约成功'
  306. })
  307. this.taskList(this.option)
  308. } else {
  309. this.$showModal(res.msg)
  310. }
  311. },
  312. async getNotice() {
  313. this.$getConfigData('club_notice').then(res => {
  314. this.noticeText = res.msg
  315. })
  316. },
  317. async taskList(paging) {
  318. this.loadingLock = 1
  319. this.status = 'loading'
  320. // 发送请求
  321. const {
  322. data: res
  323. } = await this.$httpRequest({
  324. url: '/app/events?pageNum=' + paging.page + '&pageSize=' + paging.size +
  325. "&associationsInfoId=" + paging.associationsInfoId,
  326. method: 'get',
  327. isNotErrorMsg: true,
  328. urlType: this.$getUrlType()
  329. });
  330. if (res.code === 200) {
  331. if (paging.page === 1) {
  332. this.total = res.total
  333. this.list = res.rows
  334. } else if (paging.page > 1) {
  335. for (var i = 0; i < res.rows.length; i++) {
  336. this.list.push(res.rows[i])
  337. }
  338. }
  339. this.loadingLock = 0
  340. if (this.total === this.list.length) {
  341. this.status = 'nomore'
  342. } else {
  343. this.status = 'loadmore'
  344. }
  345. }
  346. },
  347. scroll: function(e) {
  348. this.old.scrollTop = e.detail.scrollTop
  349. },
  350. confirm1(e) {
  351. uni.setStorageSync('orderType', 1)
  352. uni.navigateTo({
  353. url: 'appoint'
  354. })
  355. },
  356. // 刷新刷剧
  357. refresh() {
  358. this.taskList(this.option)
  359. },
  360. scrolltolower(e) {},
  361. load(paging) {
  362. this.taskList(paging)
  363. },
  364. loadSuccess(list) {
  365. this.list = list
  366. }
  367. }
  368. }
  369. </script>
  370. <style lang="scss" scoped>
  371. .foodBody {
  372. padding-top: 10rpx;
  373. padding-left: 10rpx;
  374. display: flex;
  375. flex-flow: row wrap;
  376. justify-content: center;
  377. border-radius: 30rpx;
  378. }
  379. .gwxx {
  380. padding-top: 10rpx;
  381. }
  382. .scroll-view_H_MY {
  383. white-space: nowrap;
  384. width: 100%;
  385. letter-spacing: 10rpx;
  386. // padding: 20rpx;
  387. background-color: rgb(255, 255, 255);
  388. // background: linear-gradient(to bottom right, rgb(47, 203, 198), rgb(127, 241, 209));
  389. }
  390. .scroll-view-item_H_MY {
  391. color: #8c8c8c;
  392. height: 35px;
  393. width: 33.4%;
  394. font-size: 30rpx;
  395. display: inline-flex; // item的外层定义成行内元素才可进行滚动 inline-block / inline-flex 均可
  396. flex-direction: column;
  397. align-items: center;
  398. border-right: 1rpx #f3f3f3 solid;
  399. }
  400. .scroll-view-item_H_MY-active {
  401. // background-color: rgb(153, 241, 224);
  402. border-bottom: 5rpx rgb(96, 182, 158) solid;
  403. }
  404. .giftTypeItem {
  405. color: #8c8c8c;
  406. padding: 20rpx 10rpx;
  407. font-size: 25rpx;
  408. letter-spacing: 5rpx;
  409. background-color: #f0f0f0;
  410. border-bottom: 1rpx #f3f3f3 solid;
  411. }
  412. .giftTypeItem-active {
  413. background-color: #ffffff;
  414. }
  415. .isNumNull {
  416. color: #FF0000;
  417. }
  418. .addGwc:active {
  419. color: #ffffff;
  420. }
  421. .yyButton:active {
  422. background-color: #dedede;
  423. }
  424. .content {
  425. display: flex;
  426. flex-direction: column;
  427. align-items: center;
  428. justify-content: center;
  429. }
  430. .touch {
  431. position: fixed;
  432. right: -5rpx;
  433. bottom: 60rpx;
  434. width: 105rpx;
  435. height: 105rpx;
  436. padding: 5rpx;
  437. background-color: rgb(10, 185, 156);
  438. border-top-left-radius: 50%;
  439. border-bottom-left-radius: 50%;
  440. color: #fff;
  441. font-size: 50rpx;
  442. /* 去除标签点击事件高亮效果 */
  443. -webkit-tap-highlight-color: transparent;
  444. /* 使用transform: translate3d 处理性能高 GUP */
  445. }
  446. #button_div {
  447. position: fixed;
  448. bottom: var(--window-bottom);
  449. }
  450. .mybackColor {
  451. background-color: #8c8c8c;
  452. }
  453. .shopHand {
  454. font-weight: bold;
  455. font-size: 20px;
  456. height: 20%;
  457. padding: 10% 0 10px 10px;
  458. margin-bottom: 5px;
  459. //background: linear-gradient(to bottom right, #85c1bf, #f1fef9);
  460. //background: rgb(55,186,189);
  461. background: #9ED6CF;
  462. }
  463. .cuisineImg {
  464. border-radius: 10px;
  465. max-height: 600rpx;
  466. height: auto;
  467. width: auto;
  468. padding: 0rpx 5rpx 2rpx;
  469. }
  470. .doFoodConfigView {
  471. width: 93%;
  472. margin: 0 auto;
  473. margin-top: 5px;
  474. padding: 2% 5px;
  475. background-color: #ffffff;
  476. border-radius: 10px;
  477. border: 1px solid #d3d3d3;
  478. }
  479. .gwcNum {
  480. width: 15px;
  481. top: 17px;
  482. left: 21px;
  483. position: relative;
  484. }
  485. /* 商品列表 */
  486. .goodsContent {
  487. width: 100%;
  488. margin: 0 auto;
  489. flex-direction: column;
  490. background: #f3f3f3;
  491. display: flex;
  492. justify-content: center;
  493. }
  494. .goodsItem {
  495. width: 280rpx;
  496. background: #FFFFFF;
  497. // border-radius: 10px;
  498. padding: 10rpx 0;
  499. // margin: 5rpx;
  500. // border: 1px solid #ebebeb;
  501. }
  502. .goodsName {
  503. font-size: 24rpx;
  504. color: #2e2e2e;
  505. padding: 10rpx 20rpx;
  506. overflow: hidden;
  507. text-overflow: ellipsis;
  508. display: -webkit-box;
  509. -webkit-line-clamp: 2;
  510. -webkit-box-orient: vertical;
  511. }
  512. .goodsPrice {
  513. color: #ffac29;
  514. font-size: 24rpx;
  515. padding: 0 5rpx;
  516. }
  517. .addFood {
  518. margin-left: 20rpx;
  519. color: #8c8c8c;
  520. }
  521. .minus {
  522. width: 26px;
  523. height: 26px;
  524. background-color: #efefef;
  525. border-width: 1px;
  526. border-color: #c6c6c6;
  527. border-top-left-radius: 100px;
  528. border-top-right-radius: 100px;
  529. border-bottom-left-radius: 100px;
  530. border-bottom-right-radius: 100px;
  531. @include flex;
  532. justify-content: center;
  533. align-items: center;
  534. }
  535. .input {
  536. padding: 0;
  537. }
  538. .plus {
  539. width: 20px;
  540. height: 20px;
  541. background-color: #FF0000;
  542. border-radius: 50%;
  543. /* #ifndef APP-NVUE */
  544. display: flex;
  545. /* #endif */
  546. justify-content: center;
  547. align-items: center;
  548. }
  549. </style>