list.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921
  1. <template>
  2. <view class="container" slot="gBody">
  3. <view class="main" v-if="state == 1">
  4. <view class="content" :style="height">
  5. <scroll-view class="menus" :scroll-into-view="view" scroll-with-animation scroll-y>
  6. <view class="wrapper">
  7. <view class="menu" :id="`menu-${v.id}`" :class="{'current': k == cate_index}" v-for="(v, k) in fetch.cate" :key="k" @tap="menu(k, v.id)">
  8. <text>{{ v.name }}</text>
  9. </view>
  10. </view>
  11. </scroll-view>
  12. <!-- goods list begin -->
  13. <scroll-view class="goods" scroll-with-animation scroll-y :scroll-top="top">
  14. <view class="wrapper">
  15. <swiper class="ads" id="ads" autoplay :interval="3000" indicator-dots v-if="fetch.focus.length > 0">
  16. <swiper-item v-for="(v, k) in fetch.focus" :key="k" @tap="go" :data-url="v.link">
  17. <image :src="v.pic"></image>
  18. </swiper-item>
  19. </swiper>
  20. <view class="list">
  21. <!-- category begin -->
  22. <view class="category" v-for="(v, k) in fetch.cate" :key="k" :id="`cate-${v.id}`" v-if="k == cate_index">
  23. <view class="items">
  24. <!-- 商品 begin -->
  25. <view class="good" v-for="(v1, k1) in fetch.info[v.id]" :key="k1">
  26. <image :src="v1.pic_cover" class="image" @tap="location(v1.id_code)"></image>
  27. <view class="right" @tap="location(v1.id_code)">
  28. <text class="name">{{ v1.name }}</text>
  29. <text class="tips">{{ v1.desc }}</text>
  30. <view class="price_and_action" v-if="v1.buy == 1">
  31. <text class="price">¥{{ v1.buy_price }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- 商品 end -->
  36. </view>
  37. </view>
  38. <!-- category end -->
  39. </view>
  40. </view>
  41. </scroll-view>
  42. <!-- goods list end -->
  43. </view>
  44. <!-- content end -->
  45. </view>
  46. <view v-if="state == 2" class="d-flex w-100 h-100 flex-column just-content-center align-items-center" style="margin-top:200rpx;">
  47. <view class="tips d-flex flex-column align-items-center font-size-base text-color-assist">
  48. <view>您还没有任何阅览的小记</view>
  49. <view>小记可能就在你身边,快去寻找吧~</view>
  50. </view>
  51. <button type="primary" class="drink-btn" size="default" @tap="home">我的家园</button>
  52. <view class="font-size-sm text-color-primary" @tap="qun" style="display: none;">加入官方微信群</view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. export default {
  58. components: {
  59. },
  60. data() {
  61. return {
  62. state : 0,
  63. fetch : {
  64. cate : [],
  65. info : [],
  66. hot : [],
  67. },
  68. height : 'height:100%',
  69. cate_index: 0,//默认分类
  70. top: 0,
  71. view: '',
  72. }
  73. },
  74. onLoad() {
  75. },
  76. onShow() {
  77. //this.Dever.checkLogin();
  78. this.getData();
  79. },
  80. // 重新加载
  81. onPullDownRefresh: function() {
  82. this.getData();
  83. },
  84. //下拉加载
  85. onReachBottom() {
  86. this.getData();
  87. },
  88. methods: {
  89. getData : function() {
  90. var self = this;
  91. this.Dever.get(this, 'app/collection/?l=api.getList', {id:-1}, function(t) {
  92. if (t.cate.length > 0) {
  93. self.state = 1;
  94. } else {
  95. self.state = 2;
  96. }
  97. uni.getSystemInfo({
  98. success: function (res) {
  99. self.height = 'height:' + res.windowHeight + 'px';
  100. }
  101. })
  102. });
  103. },
  104. home : function() {
  105. this.Dever.location('index/index');
  106. },
  107. location : function(id) {
  108. this.Dever.location('dream/index?id=' + id);
  109. },
  110. go : function(e) {
  111. var link = e.currentTarget.dataset.url;
  112. if (link) {
  113. this.Dever.location(link);
  114. }
  115. },
  116. menu : function(index, id) {
  117. this.cate_index = index
  118. },
  119. }
  120. };
  121. </script>
  122. <style lang="scss" scoped>
  123. /* #ifdef H5 */
  124. page {
  125. min-height: 100%;
  126. }
  127. /* #endif */
  128. .order-box {
  129. padding: 20rpx;
  130. /* #ifdef H5 */
  131. margin-bottom: 100rpx;
  132. /* #endif */
  133. }
  134. .drinks-img {
  135. width: 260rpx;
  136. height: 260rpx;
  137. }
  138. .tips {
  139. margin: 60rpx 0 80rpx;
  140. line-height: 48rpx;
  141. }
  142. .drink-btn {
  143. width: 320rpx;
  144. border-radius: 50rem !important;
  145. margin-bottom: 40rpx;
  146. font-size: $font-size-base;
  147. line-height: 3.0;
  148. }
  149. uni-button {
  150. background-color: #ADB838;
  151. }
  152. .container {
  153. overflow: hidden;
  154. position: relative;
  155. }
  156. .loading {
  157. width: 100%;
  158. height: 100%;
  159. display: flex;
  160. align-items: center;
  161. justify-content: center;
  162. image {
  163. width: 260rpx;
  164. height: 260rpx;
  165. position: relative;
  166. margin-top: -200rpx;
  167. /* #ifdef h5 */
  168. margin-top: 0;
  169. /* #endif */
  170. }
  171. }
  172. .stores {
  173. width: 100%;
  174. display: flex;
  175. flex-direction: column;
  176. justify-content: flex-start;
  177. margin-bottom: -40rpx;
  178. .store {
  179. width: 100%;
  180. background-color: $bg-color-grey;
  181. padding: 20rpx;
  182. display: flex;
  183. align-items: center;
  184. margin-bottom: 20rpx;
  185. border-radius: 6rpx;
  186. .iconfont {
  187. font-size: 50rpx;
  188. margin-right: 15rpx;
  189. &.iconradio-button-off {
  190. color: $text-color-assist;
  191. }
  192. &.iconradio-button-on {
  193. color: $color-primary;
  194. }
  195. }
  196. .infos {
  197. flex: 1;
  198. display: flex;
  199. flex-direction: column;
  200. color: $text-color-base;
  201. overflow: hidden;
  202. .name_and_distance {
  203. width: 100%;
  204. display: flex;
  205. justify-content: space-between;
  206. margin-bottom: 10rpx;
  207. overflow: hidden;
  208. .name {
  209. flex: 1;
  210. flex-shrink: 0;
  211. overflow: hidden;
  212. text-overflow: ellipsis;
  213. white-space: nowrap;
  214. font-size: $font-size-lg;
  215. }
  216. .distance {
  217. flex-shrink: 0;
  218. font-size: $font-size-lg;
  219. font-weight: bold;
  220. margin-left: 20rpx;
  221. }
  222. }
  223. .street {
  224. color: $text-color-assist;
  225. font-size: $font-size-sm;
  226. }
  227. }
  228. }
  229. }
  230. .main {
  231. width: 100%;
  232. height: 100%;
  233. position: relative;
  234. display: flex;
  235. flex-direction: column;
  236. }
  237. .nav {
  238. width: 100%;
  239. height: 212rpx;
  240. flex-shrink: 0;
  241. display: flex;
  242. flex-direction: column;
  243. .header {
  244. width: 100%;
  245. display: flex;
  246. align-items: center;
  247. justify-content: space-between;
  248. padding: 20rpx;
  249. background-color: #ffffff;
  250. height: 140rpx;
  251. .left {
  252. flex: 1;
  253. display: flex;
  254. flex-direction: column;
  255. .store-name {
  256. display: flex;
  257. justify-content: flex-start;
  258. align-items: center;
  259. font-size: $font-size-lg;
  260. margin-bottom: 10rpx;
  261. .iconfont {
  262. margin-left: 10rpx;
  263. line-height: 100%;
  264. }
  265. }
  266. .store-location {
  267. display: flex;
  268. justify-content: flex-start;
  269. align-items: center;
  270. color: $text-color-assist;
  271. font-size: $font-size-sm;
  272. .iconfont {
  273. vertical-align: middle;
  274. display: table-cell;
  275. color: $color-primary;
  276. line-height: 100%;
  277. }
  278. }
  279. }
  280. .right {
  281. background-color: $bg-color-grey;
  282. border-radius: 38rpx;
  283. display: flex;
  284. align-items: center;
  285. font-size: $font-size-sm;
  286. padding: 0 38rpx;
  287. color: $text-color-assist;
  288. .dinein, .takeout {
  289. position: relative;
  290. display: flex;
  291. align-items: center;
  292. &.active {
  293. padding: 14rpx 38rpx;
  294. color: #ffffff;
  295. background-color: $color-primary;
  296. border-radius: 38rpx;
  297. }
  298. }
  299. .takeout {
  300. margin-left: 20rpx;
  301. height: 100%;
  302. flex: 1;
  303. padding: 14rpx 0;
  304. }
  305. .dinein.active {
  306. margin-left: -38rpx;
  307. }
  308. .takeout.active {
  309. margin-right: -38rpx;
  310. }
  311. }
  312. }
  313. .coupon {
  314. flex: 1;
  315. width: 100%;
  316. background-color: $bg-color-primary;
  317. font-size: $font-size-base;
  318. color: $color-primary;
  319. padding: 0 20rpx;
  320. display: flex;
  321. align-items: center;
  322. overflow: hidden;
  323. .title {
  324. flex: 1;
  325. margin-left: 10rpx;
  326. overflow: hidden;
  327. white-space: nowrap;
  328. text-overflow: ellipsis;
  329. }
  330. .iconfont {
  331. line-height: 100%;
  332. }
  333. }
  334. }
  335. .content {
  336. flex: 1;
  337. overflow: hidden;
  338. width: 100%;
  339. display: flex;
  340. .menus {
  341. width: 200rpx;
  342. height: 100%;
  343. overflow: hidden;
  344. background-color: $bg-color-grey;
  345. .wrapper {
  346. width: 100%;
  347. height: 100%;
  348. .menu {
  349. display: flex;
  350. align-items: center;
  351. justify-content: flex-start;
  352. padding: 30rpx 20rpx;
  353. font-size: 26rpx;
  354. color: $text-color-assist;
  355. position: relative;
  356. &:nth-last-child(1) {
  357. margin-bottom: 130rpx;
  358. }
  359. &.current {
  360. background-color: #ffffff;
  361. color: $text-color-base;
  362. }
  363. .dot {
  364. position: absolute;
  365. width: 34rpx;
  366. height: 34rpx;
  367. line-height: 34rpx;
  368. font-size: 22rpx;
  369. background-color: $color-primary;
  370. color: #ffffff;
  371. top: 16rpx;
  372. right: 10rpx;
  373. border-radius: 100%;
  374. text-align: center;
  375. }
  376. }
  377. }
  378. }
  379. .goods {
  380. flex: 1;
  381. height: 100%;
  382. overflow: hidden;
  383. background-color: #ffffff;
  384. .wrapper {
  385. width: 100%;
  386. height: 100%;
  387. padding: 20rpx;
  388. .ads {
  389. height: calc(300 / 550 * 510rpx);
  390. image {
  391. width: 100%;
  392. height: 100%;
  393. border-radius: 8rpx;
  394. }
  395. }
  396. .list {
  397. width: 100%;
  398. font-size: $font-size-base;
  399. padding-bottom: 130rpx;
  400. .category {
  401. width: 100%;
  402. .title {
  403. padding: 30rpx 0;
  404. display: flex;
  405. align-items: center;
  406. color: $text-color-base;
  407. .icon {
  408. width: 38rpx;
  409. height: 38rpx;
  410. margin-left: 10rpx;
  411. }
  412. }
  413. }
  414. .items {
  415. display: flex;
  416. flex-direction: column;
  417. padding-bottom: -30rpx;
  418. .good {
  419. display: flex;
  420. align-items: center;
  421. margin-bottom: 30rpx;
  422. .image {
  423. width: 160rpx;
  424. height: 160rpx;
  425. margin-right: 20rpx;
  426. border-radius: 8rpx;
  427. }
  428. .right {
  429. flex: 1;
  430. height: 160rpx;
  431. overflow: hidden;
  432. display: flex;
  433. flex-direction: column;
  434. align-items: flex-start;
  435. justify-content: space-between;
  436. padding-right: 14rpx;
  437. .name {
  438. font-size: $font-size-base;
  439. margin-bottom: 10rpx;
  440. }
  441. .tips {
  442. width: 100%;
  443. height: 100rpx;
  444. line-height: 40rpx;
  445. overflow: hidden;
  446. text-overflow: ellipsis;
  447. white-space: nowrap;
  448. font-size: $font-size-sm;
  449. color: $text-color-assist;
  450. margin-bottom: 10rpx;
  451. }
  452. .price_and_action {
  453. width: 100%;
  454. display: flex;
  455. justify-content: space-between;
  456. align-items: center;
  457. .price {
  458. font-size: $font-size-base;
  459. font-weight: 600;
  460. }
  461. .btn-group {
  462. display: flex;
  463. justify-content: space-between;
  464. align-items: center;
  465. position: relative;
  466. .btn {
  467. padding: 0 20rpx;
  468. box-sizing: border-box;
  469. font-size: $font-size-sm;
  470. height: 44rpx;
  471. line-height: 44rpx;
  472. &.property_btn {
  473. border-radius: 24rpx;
  474. }
  475. &.add_btn,
  476. &.reduce_btn {
  477. padding: 0;
  478. width: 44rpx;
  479. border-radius: 44rpx;
  480. }
  481. }
  482. .dot {
  483. position: absolute;
  484. background-color: #ffffff;
  485. border: 1px solid $color-primary;
  486. color: $color-primary;
  487. font-size: $font-size-sm;
  488. width: 36rpx;
  489. height: 36rpx;
  490. line-height: 36rpx;
  491. text-align: center;
  492. border-radius: 100%;
  493. right: -12rpx;
  494. top: -10rpx;
  495. }
  496. .number {
  497. width: 44rpx;
  498. height: 44rpx;
  499. line-height: 44rpx;
  500. text-align: center;
  501. }
  502. }
  503. }
  504. }
  505. }
  506. }
  507. }
  508. }
  509. }
  510. }
  511. .modal-box {
  512. max-height: 90vh;
  513. }
  514. .good-detail-modal {
  515. width: 100%;
  516. height: 100%;
  517. display: flex;
  518. flex-direction: column;
  519. .cover {
  520. height: 320rpx;
  521. padding: 30rpx 0;
  522. display: flex;
  523. justify-content: center;
  524. align-items: center;
  525. position: relative;
  526. .image {
  527. width: 260rpx;
  528. height: 260rpx;
  529. }
  530. .btn-group {
  531. position: absolute;
  532. right: 10rpx;
  533. top: 30rpx;
  534. display: flex;
  535. align-items: center;
  536. justify-content: space-around;
  537. image {
  538. width: 80rpx;
  539. height: 80rpx;
  540. }
  541. }
  542. }
  543. .detail {
  544. width: 100%;
  545. min-height: 1vh;
  546. max-height: calc(90vh - 320rpx - 80rpx - 120rpx);
  547. .wrapper {
  548. width: 100%;
  549. height: 100%;
  550. overflow: hidden;
  551. .basic {
  552. padding: 0 20rpx 30rpx;
  553. display: flex;
  554. flex-direction: column;
  555. .name {
  556. font-size: $font-size-base;
  557. color: $text-color-base;
  558. margin-bottom: 10rpx;
  559. }
  560. .tips {
  561. font-size: $font-size-sm;
  562. color: $text-color-grey;
  563. }
  564. }
  565. .properties {
  566. width: 100%;
  567. border-top: 2rpx solid $bg-color-grey;
  568. padding: 10rpx 30rpx 0;
  569. display: flex;
  570. flex-direction: column;
  571. .property {
  572. width: 100%;
  573. display: flex;
  574. flex-direction: column;
  575. margin-bottom: 30rpx;
  576. padding-bottom: -16rpx;
  577. .title {
  578. width: 100%;
  579. display: flex;
  580. justify-content: flex-start;
  581. align-items: center;
  582. margin-bottom: 20rpx;
  583. .name {
  584. font-size: 26rpx;
  585. color: $text-color-base;
  586. margin-right: 20rpx;
  587. }
  588. .desc {
  589. flex: 1;
  590. font-size: $font-size-sm;
  591. color: $color-primary;
  592. overflow: hidden;
  593. text-overflow: ellipsis;
  594. white-space: nowrap;
  595. }
  596. }
  597. .values {
  598. width: 100%;
  599. display: flex;
  600. flex-wrap: wrap;
  601. .value {
  602. border-radius: 8rpx;
  603. background-color: $bg-color-grey;
  604. padding: 16rpx 30rpx;
  605. font-size: 26rpx;
  606. color: $text-color-assist;
  607. margin-right: 16rpx;
  608. margin-bottom: 16rpx;
  609. &.default {
  610. background-color: $color-primary;
  611. color: $text-color-white;
  612. }
  613. }
  614. }
  615. }
  616. }
  617. }
  618. }
  619. .action {
  620. display: flex;
  621. align-items: center;
  622. justify-content: space-between;
  623. background-color: $bg-color-grey;
  624. height: 120rpx;
  625. padding: 0 26rpx;
  626. .left {
  627. flex: 1;
  628. display: flex;
  629. flex-direction: column;
  630. justify-content: center;
  631. margin-right: 20rpx;
  632. overflow: hidden;
  633. .price {
  634. font-size: $font-size-lg;
  635. color: $text-color-base;
  636. }
  637. .props {
  638. color: $text-color-assist;
  639. font-size: 24rpx;
  640. width: 100%;
  641. overflow: hidden;
  642. text-overflow: ellipsis;
  643. white-space: nowrap;
  644. }
  645. }
  646. .btn-group {
  647. display: flex;
  648. align-items: center;
  649. justify-content: space-around;
  650. .number {
  651. font-size: $font-size-base;
  652. width: 44rpx;
  653. height: 44rpx;
  654. line-height: 44rpx;
  655. text-align: center;
  656. }
  657. .btn {
  658. padding: 0;
  659. font-size: $font-size-base;
  660. width: 44rpx;
  661. height: 44rpx;
  662. line-height: 44rpx;
  663. border-radius: 100%;
  664. }
  665. }
  666. }
  667. .add-to-cart-btn {
  668. display: flex;
  669. justify-content: center;
  670. align-items: center;
  671. background-color: $color-primary;
  672. color: $text-color-white;
  673. font-size: $font-size-base;
  674. height: 80rpx;
  675. border-radius: 0 0 12rpx 12rpx;
  676. }
  677. }
  678. .cart-box {
  679. position: absolute;
  680. bottom: 30rpx;
  681. left: 30rpx;
  682. right: 30rpx;
  683. height: 96rpx;
  684. border-radius: 48rpx;
  685. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
  686. background-color: #FFFFFF;
  687. display: flex;
  688. align-items: center;
  689. justify-content: space-between;
  690. z-index: 9999;
  691. .cart-img {
  692. width: 96rpx;
  693. height: 96rpx;
  694. position: relative;
  695. margin-top: -48rpx;
  696. }
  697. .pay-btn {
  698. height: 100%;
  699. padding: 0 30rpx;
  700. color: #FFFFFF;
  701. border-radius: 0 50rpx 50rpx 0;
  702. display: flex;
  703. align-items: center;
  704. font-size: $font-size-base;
  705. }
  706. .mark {
  707. padding-left: 46rpx;
  708. margin-right: 30rpx;
  709. position: relative;
  710. .tag {
  711. background-color: $color-warning;
  712. color: $text-color-white;
  713. display: flex;
  714. justify-content: center;
  715. align-items: center;
  716. font-size: $font-size-sm;
  717. position: absolute;
  718. right: -10rpx;
  719. top: -50rpx;
  720. border-radius: 100%;
  721. padding: 4rpx;
  722. width: 40rpx;
  723. height: 40rpx;
  724. opacity: .9;
  725. }
  726. }
  727. .price {
  728. flex: 1;
  729. color: $text-color-base;
  730. }
  731. }
  732. .cart-popup {
  733. .top {
  734. background-color: $bg-color-primary;
  735. color: $color-primary;
  736. padding: 10rpx 30rpx;
  737. font-size: 24rpx;
  738. text-align: right;
  739. }
  740. .cart-list {
  741. background-color: #FFFFFF;
  742. width: 100%;
  743. overflow: hidden;
  744. min-height: 1vh;
  745. max-height: 60vh;
  746. .wrapper {
  747. height: 100%;
  748. display: flex;
  749. flex-direction: column;
  750. padding: 0 30rpx;
  751. margin-bottom: 156rpx;
  752. .item {
  753. display: flex;
  754. justify-content: space-between;
  755. align-items: center;
  756. padding: 30rpx 0;
  757. position: relative;
  758. &::after {
  759. content: ' ';
  760. position: absolute;
  761. bottom: 0;
  762. left: 0;
  763. width: 100%;
  764. background-color: $border-color;
  765. height: 2rpx;
  766. transform: scaleY(.6);
  767. }
  768. .left {
  769. flex: 1;
  770. display: flex;
  771. flex-direction: column;
  772. overflow: hidden;
  773. margin-right: 30rpx;
  774. .name {
  775. font-size: $font-size-sm;
  776. color: $text-color-base;
  777. }
  778. .props {
  779. color: $text-color-assist;
  780. font-size: 24rpx;
  781. overflow: hidden;
  782. text-overflow: ellipsis;
  783. white-space: nowrap;
  784. }
  785. }
  786. .center {
  787. margin-right: 120rpx;
  788. font-size: $font-size-base;
  789. }
  790. .right {
  791. display: flex;
  792. align-items: center;
  793. justify-content: space-between;
  794. .btn {
  795. width: 46rpx;
  796. height: 46rpx;
  797. border-radius: 100%;
  798. padding: 0;
  799. text-align: center;
  800. line-height: 46rpx;
  801. }
  802. .number {
  803. font-size: $font-size-base;
  804. width: 46rpx;
  805. height: 46rpx;
  806. text-align: center;
  807. line-height: 46rpx;
  808. }
  809. }
  810. }
  811. }
  812. }
  813. }
  814. </style>