app-reservation.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <!--预约-->
  2. <template>
  3. <view class="app-reservation">
  4. <view class="app-list-mode" v-if="listStyle === -1">
  5. <view class="app-item dir-left-nowrap main-between cross-center" :class="{'app-border': goodsStyle === 2}" v-for="(item, index) in list" :key="index">
  6. <app-jump-button form>
  7. <image class="app-icon" lazy-load="true" v-if="showGoodsTag" :src="goodsTagPicUrl"></image>
  8. <image class="app-image" lazy-load="true" :src="item.cover_pic" :mode="fill === 1 ? 'scaleToFill' : fill === 0 ? 'aspectFit' : ''"></image>
  9. <view class="app-content" :class="{'app-name-padding': !showGoodsName}">
  10. <text class="app-name" v-if="showGoodsName">{{item.name}}</text>
  11. <view class="app-price-button dir-left-nowrap main-between cross-center">
  12. <text class="app-price">{{item.price_content === '¥0.00' ? '免费' : item.price_content}}</text>
  13. <button v-if="showBuyBtn" class="app-button"
  14. :style="{
  15. color: buyBtnStyle === 2 || buyBtnStyle === 4 ? buttonColor : 'white',
  16. borderColor: buttonColor,
  17. backgroundColor: buyBtnStyle === 1 || buyBtnStyle === 3 ? buttonColor : 'white',
  18. }"
  19. :class="{
  20. 'app-filling': buyBtnStyle === 1,
  21. 'app-line': buyBtnStyle === 2,
  22. 'app-fillet-fill': buyBtnStyle === 3,
  23. 'app-rounded-line': buyBtnStyle === 4
  24. }"
  25. >{{buyBtnText}}</button>
  26. </view>
  27. </view>
  28. </app-jump-button>
  29. </view>
  30. </view>
  31. <view class="app-one-per-line" v-if="listStyle === 0">
  32. <view class="app-item dir-top-nowrap"
  33. :class="{'app-border': goodsStyle === 2 || goodsStyle === 4}"
  34. v-for="(item, index) in list"
  35. :key="index"
  36. >
  37. <app-jump-button form arrangement="column">
  38. <image class="app-icon"
  39. lazy-load="true"
  40. v-if="showGoodsTag"
  41. :src="goodsTagPicUrl"
  42. ></image>
  43. <image class="app-image"
  44. :class="{'app-image-square' : goodsCoverProportion === '1-1', 'app-image-rectangle': goodsCoverProportion === '3-2'}"
  45. lazy-load="true"
  46. :src="item.cover_pic"
  47. :mode="fill === 1 ? 'scaleToFill' : fill === 0 ? 'aspectFit' : ''"
  48. ></image>
  49. <text class="app-name"
  50. v-if="showGoodsName"
  51. :class="{'app-text-align': goodsStyle === 3 || goodsStyle === 4 }"
  52. >{{item.name}}</text>
  53. <view class="app-price-button dir-left-nowrap cross-center"
  54. :class="{'main-between': goodsStyle === 1 || goodsStyle === 2, 'main-center': goodsStyle === 3 || goodsStyle === 4, 'app-margin-no-name': !showGoodsName}"
  55. >
  56. <view class="app-group-price">
  57. <text class="app-price">{{item.price_content === '¥0.00' ? '免费' : item.price_content}}</text>
  58. </view>
  59. <button class="app-button"
  60. :style="{
  61. color: buyBtnStyle === 2 || buyBtnStyle === 4 ? buttonColor : 'white',
  62. borderColor: buttonColor,
  63. backgroundColor: buyBtnStyle === 1 || buyBtnStyle === 3 ? buttonColor : 'white',
  64. }"
  65. :class="{
  66. 'app-filling': buyBtnStyle === 1,
  67. 'app-line': buyBtnStyle === 2,
  68. 'app-fillet-fill': buyBtnStyle === 3,
  69. 'app-rounded-line': buyBtnStyle === 4
  70. }"
  71. v-if="showBuyBtn && goodsStyle !== 3 && goodsStyle !== 4"
  72. >{{buyBtnText}}</button>
  73. </view>
  74. </app-jump-button>
  75. </view>
  76. </view>
  77. <view class="app-two-per-line dir-left-wrap" v-if="listStyle === 1">
  78. <view v-for="(item, index) in list"
  79. :key="index"
  80. class="app-item dir-top-nowrap"
  81. :class="{'app-border': goodsStyle === 2 || goodsStyle === 4, 'app-item-margin': index%2 === 0}"
  82. >
  83. <app-jump-button form arrangement="column">
  84. <image class="app-icon"
  85. lazy-load="true"
  86. v-if="showGoodsTag"
  87. :src="goodsTagPicUrl"
  88. ></image>
  89. <image class="app-image"
  90. lazy-load="true"
  91. :src="item.cover_pic"
  92. :mode="fill === 1 ? 'scaleToFill' : fill === 0 ? 'aspectFit' : ''"
  93. ></image>
  94. <text class="app-name"
  95. v-if="showGoodsName"
  96. :class="{'app-text-align': goodsStyle === 3 || goodsStyle === 4 }"
  97. >{{item.name}}</text>
  98. <view class="app-group-price-button dir-left-nowrap" :class="{'main-center': goodsStyle === 3 || goodsStyle === 4, 'app-margin-no-name': !showGoodsName}">
  99. <view class="app-group-price dir-top-wrap main-center">
  100. <text class="app-price">{{item.price_content === '¥0.00' ? '免费' : item.price_content}}</text>
  101. </view>
  102. <button class="app-button"
  103. :style="{
  104. color: buyBtnStyle === 2 || buyBtnStyle === 4 ? buttonColor : 'white',
  105. borderColor: buttonColor,
  106. backgroundColor: buyBtnStyle === 1 || buyBtnStyle === 3 ? buttonColor : 'white',
  107. }"
  108. :class="{
  109. 'app-filling': buyBtnStyle === 1,
  110. 'app-line': buyBtnStyle === 2,
  111. 'app-fillet-fill': buyBtnStyle === 3,
  112. 'app-rounded-line': buyBtnStyle === 4
  113. }"
  114. v-if="showBuyBtn && goodsStyle !== 3 && goodsStyle !== 4">
  115. {{buyBtnText}}
  116. </button>
  117. </view>
  118. </app-jump-button>
  119. </view>
  120. </view>
  121. <app-load-text v-if="!request"></app-load-text>
  122. </view>
  123. </template>
  124. <script>
  125. import appLoadText from '../../basic-component/app-load-text/app-load-text.vue';
  126. export default {
  127. name: 'app-reservation',
  128. components: {
  129. 'app-load-text': appLoadText,
  130. },
  131. props: {
  132. buttonColor: {
  133. type: String,
  134. default: function() {
  135. return "blue";
  136. }
  137. },
  138. buyBtnStyle: {
  139. type: Number,
  140. default: function() {
  141. return 4;
  142. }
  143. },
  144. buyBtnText: {
  145. type: String,
  146. default: function() {
  147. return "预约";
  148. }
  149. },
  150. customizeGoodsTag: {
  151. type: Boolean,
  152. default: function() {
  153. return false;
  154. }
  155. },
  156. fill: {
  157. type: Number,
  158. default: function() {
  159. return 0;
  160. }
  161. },
  162. goodsCoverProportion: {
  163. type: String,
  164. default: function() {
  165. return "3-2";
  166. }
  167. },
  168. goodsStyle: {
  169. type: Number,
  170. default: function() {
  171. return 3;
  172. }
  173. },
  174. goodsTagPicUrl: {
  175. type: String,
  176. default: function() {
  177. return "http://v4test2.zjhejiang.com/plugins/diy/assets/images/goods-tag-xp.png";
  178. }
  179. },
  180. list: {
  181. type: Array,
  182. default: function() {
  183. return [
  184. ];
  185. }
  186. },
  187. listStyle: {
  188. type: Number,
  189. default: function() {
  190. return 1;
  191. }
  192. },
  193. showBuyBtn: {
  194. type: Boolean,
  195. default: function() {
  196. return true;
  197. }
  198. },
  199. showGoodsName: {
  200. type: Boolean,
  201. default: function() {
  202. return false;
  203. }
  204. },
  205. showGoodsTag: {
  206. type: Boolean,
  207. default: function() {
  208. return false;
  209. }
  210. },
  211. scrollTop: {
  212. type: Number,
  213. default: function() {
  214. return 0;
  215. }
  216. },
  217. value: {
  218. type: Boolean,
  219. default: function() {
  220. return true;
  221. }
  222. }
  223. },
  224. data() {
  225. return {
  226. height: 0,
  227. request: this.value,
  228. }
  229. },
  230. created() {
  231. let that = this;
  232. wx.getSystemInfo({
  233. success: function(response) {
  234. that.height = response.windowHeight
  235. }
  236. })
  237. },
  238. methods: {
  239. autoEnd() {
  240. this.$lazyLoadingData('app-reservation').then(response => {
  241. if (response[0].height + response[0].top < this.height) {
  242. this.request = false;
  243. this.$emit('input', this.request);
  244. }
  245. });
  246. }
  247. },
  248. watch: {
  249. scrollTop: {
  250. handler: function(n,o) {
  251. if (n > o && this.request) this.autoEnd();
  252. }
  253. }
  254. }
  255. }
  256. </script>
  257. <style scoped lang="scss">
  258. .app-reservation {
  259. width: #{750rpx};
  260. overflow: hidden;
  261. }
  262. .app-border {
  263. border-color: #e2e2e2 !important;
  264. }
  265. .app-list-mode {
  266. width: #{750rpx};
  267. .app-item {
  268. margin-top: #{15rpx};
  269. width: #{702rpx};
  270. margin-left: #{24rpx};
  271. margin-right: #{24rpx};
  272. height: #{200rpx};
  273. border-bottom-right-radius: #{20rpx};
  274. border-top-right-radius: #{20rpx};
  275. position: relative;
  276. padding-right: #{24rpx};
  277. border: #{1rpx} solid transparent;
  278. .app-icon {
  279. position: absolute;
  280. top: 0;
  281. left: 0;
  282. width: #{65rpx};
  283. height: #{55rpx};
  284. }
  285. .app-image {
  286. width: #{199rpx};
  287. height: #{199rpx};
  288. margin-right: #{33rpx};
  289. }
  290. .app-name-padding {
  291. padding-top: #{81rpx};
  292. }
  293. .app-content {
  294. width: #{446rpx};
  295. height: #{200rpx};
  296. border-bottom-right-radius: #{20rpx};
  297. border-top-right-radius: #{20rpx};
  298. .app-name {
  299. word-break: break-all;
  300. text-overflow: ellipsis;
  301. display: -webkit-box;
  302. -webkit-box-orient: vertical;
  303. -webkit-line-clamp: 2;
  304. overflow: hidden;
  305. font-size: #{28rpx};
  306. color: #353535;
  307. line-height: #{28rpx};
  308. height: #{58rpx};
  309. width: #{702-199-33rpx};
  310. margin-top: #{23rpx};
  311. }
  312. .app-price-button {
  313. margin-top: #{38rpx};
  314. width: #{446rpx};
  315. height: #{48rpx};
  316. .app-price {
  317. display: inline-block;
  318. height: #{48rpx};
  319. line-height: #{48rpx};
  320. color: #ff4544;
  321. font-size: #{22rpx};
  322. }
  323. .app-button {
  324. display: inline-block;
  325. height: #{48rpx};
  326. line-height: #{48rpx};
  327. padding: 0 #{20rpx};
  328. font-size: #{28rpx};
  329. margin: 0;
  330. border: #{1rpx} solid #ff4544;
  331. }
  332. .app-button:after {
  333. display: none;
  334. }
  335. .app-filling {
  336. background-color: #ff4544;
  337. color: white;
  338. }
  339. .app-line {
  340. background-color: white;
  341. color: #ff4544;
  342. }
  343. .app-fillet-fill {
  344. background-color: #ff4544;
  345. color: white;
  346. border-radius: #{20rpx};
  347. }
  348. .app-rounded-line {
  349. background-color: white;
  350. color: #ff4544;
  351. border-radius: #{20rpx};
  352. }
  353. }
  354. }
  355. }
  356. }
  357. .app-one-per-line {
  358. width: #{750rpx};
  359. padding: #{2rpx} #{24rpx};
  360. .app-item {
  361. width: #{702rpx};
  362. position: relative;
  363. border: #{1rpx} solid transparent;
  364. margin-top: #{24rpx};
  365. border-bottom-right-radius: #{10rpx};
  366. border-bottom-left-radius: #{10rpx};
  367. overflow: hidden;
  368. .app-icon {
  369. position: absolute;
  370. top: 0;
  371. left: 0;
  372. width: #{65rpx};
  373. height: #{55rpx};
  374. }
  375. .app-image {
  376. width: #{702rpx};
  377. }
  378. .app-image-square {
  379. height: #{702rpx};
  380. }
  381. .app-image-rectangle {
  382. height: #{280.8rpx};
  383. }
  384. .app-name {
  385. word-break: break-all;
  386. text-overflow: ellipsis;
  387. display: -webkit-box;
  388. -webkit-box-orient: vertical;
  389. -webkit-line-clamp: 1;
  390. overflow: hidden;
  391. width: #{702rpx};
  392. padding: 0 #{24rpx};
  393. margin-top: #{28rpx};
  394. font-size: #{26rpx};
  395. color: #353535;
  396. }
  397. .app-text-align {
  398. text-align: center;
  399. }
  400. .app-price-button {
  401. width: #{702rpx};
  402. padding: 0 #{24rpx};
  403. height: #{48rpx};
  404. margin-top: #{36rpx};
  405. margin-bottom: #{24rpx};
  406. .app-group-price {
  407. .app-price {
  408. font-size: #{22rpx};
  409. color: #ff4544;
  410. }
  411. }
  412. .app-margin-no-name {
  413. margin-top: #{92rpx};
  414. }
  415. .app-button {
  416. height: #{48rpx};
  417. padding: 0 #{20rpx};
  418. font-size: #{26rpx};
  419. line-height: #{48rpx};
  420. margin: 0;
  421. border-radius: 0;
  422. border: #{1rpx} solid #ff4544;
  423. }
  424. .app-button:after {
  425. display: none;
  426. }
  427. .app-filling {
  428. background-color: #ff4544;
  429. color: white;
  430. }
  431. .app-line {
  432. background-color: white;
  433. color: #ff4544;
  434. }
  435. .app-fillet-fill {
  436. background-color: #ff4544;
  437. color: white;
  438. border-radius: #{20rpx};
  439. }
  440. .app-rounded-line {
  441. background-color: white;
  442. color: #ff4544;
  443. border-radius: #{20rpx};
  444. }
  445. }
  446. }
  447. }
  448. .app-two-per-line {
  449. width: #{750rpx};
  450. padding: #{2rpx} #{24rpx};
  451. .app-item {
  452. width: #{346rpx};
  453. height: #{534rpx};
  454. border-bottom-left-radius: #{10rpx};
  455. border-bottom-right-radius: #{10rpx};
  456. border: #{1rpx} solid transparent;
  457. overflow: hidden;
  458. position: relative;
  459. margin-top: #{24rpx};
  460. margin-bottom: #{24rpx};
  461. padding-bottom: #{24rpx};
  462. .app-icon {
  463. position: absolute;
  464. top: 0;
  465. left: 0;
  466. width: #{65rpx};
  467. height: #{55rpx};
  468. }
  469. .app-image {
  470. width: #{346rpx};
  471. height: #{346rpx};
  472. }
  473. .app-name {
  474. word-break: break-all;
  475. text-overflow: ellipsis;
  476. display: -webkit-box;
  477. -webkit-box-orient: vertical;
  478. -webkit-line-clamp: 2;
  479. overflow: hidden;
  480. margin-top: #{24rpx};
  481. padding: 0 #{24rpx};
  482. font-size: #{25rpx};
  483. width: #{346rpx};
  484. height: #{49rpx};
  485. line-height: #{25rpx};
  486. color: #353535;
  487. }
  488. .app-margin-no-name {
  489. margin-top: #{24+49rpx};
  490. }
  491. .app-text-align {
  492. text-align: center;
  493. }
  494. .app-group-price-button {
  495. width: #{346rpx};
  496. padding: 0 #{24rpx};
  497. height: #{36+48rpx};
  498. position: relative;
  499. .app-group-price {
  500. height: #{36+48rpx};
  501. .app-fight-group {
  502. display: inline-block;
  503. height: #{30rpx};
  504. border-radius: #{10rpx};
  505. border: #{1rpx} solid #ff4544;
  506. font-size: #{20rpx};
  507. line-height: #{30rpx};
  508. text-align: center;
  509. padding: 0 #{13rpx};
  510. color: #ff4544;
  511. margin-top: #{16rpx};
  512. }
  513. .app-price {
  514. font-size: #{20rpx};
  515. color: #ff4544;
  516. /* #ifndef MP-BAIDU || MP-WEIXIN */
  517. margin-top: #{13rpx};
  518. /* #endif */
  519. /* #ifdef MP-BAIDU */
  520. margin-top: #{10rpx};
  521. /* #endif */
  522. /* #ifdef MP-WEIXIN */
  523. margin-top: #{11rpx};
  524. /* #endif */
  525. }
  526. }
  527. .app-button {
  528. display: inline-block;
  529. margin: #{36rpx} 0 0 0;
  530. padding: 0 #{10rpx};
  531. min-width: #{120rpx};
  532. height: #{48rpx};
  533. font-size: #{26rpx};
  534. line-height: #{48rpx};
  535. border-radius: 0;
  536. border: #{1rpx} solid #ff4544;
  537. position: absolute;
  538. right: #{24rpx};
  539. }
  540. .app-button:after {
  541. display: none;
  542. }
  543. .app-filling {
  544. background-color: #ff4544;
  545. color: white;
  546. }
  547. .app-line {
  548. background-color: white;
  549. color: #ff4544;
  550. }
  551. .app-fillet-fill {
  552. background-color: #ff4544;
  553. color: white;
  554. border-radius: #{20rpx};
  555. }
  556. .app-rounded-line {
  557. background-color: white;
  558. color: #ff4544;
  559. border-radius: #{20rpx};
  560. }
  561. }
  562. }
  563. .app-item-margin {
  564. margin-right: #{10rpx};
  565. }
  566. }
  567. </style>