app-reservation.vue 15 KB

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