app-index-booking.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="app-index-booking">
  3. <view class="top dir-left-nowrap cross-center">
  4. <image class="box-grow-0" src="../../../static/image/icon/icon-home-booking.png"></image>
  5. <view class="box-grow-1">预约</view>
  6. <app-form-id @click="jump(`/plugins/book/index/index`)">
  7. <view class="dir-left-nowrap cross-center">
  8. <view class="box-grow-0 more">更多</view>
  9. <image class="box-grow-0 icon" src="../../../static/image/icon/arrow-right.png"></image>
  10. </view>
  11. </app-form-id>
  12. </view>
  13. <view v-if="style == '1'" class="dir-left-nowrap list">
  14. <block v-for="(book, key) in newData.list" :key="key">
  15. <app-form-id @click="router_jump(book)">
  16. <view class="box-grow-0 dir-top-nowrap item">
  17. <view class="box-grow-0 cover-pic">
  18. <view class="out-dialog" v-if="book.goods_stock == 0 && appSetting.is_show_stock == '1'">
  19. <image :src="appSetting.is_use_stock == '1' ? appImg.plugins_out : appSetting.sell_out_pic"></image>
  20. </view>
  21. <app-image :img-src="book.cover_pic" width="224rpx" height="224rpx"></app-image>
  22. </view>
  23. <view class="box-grow-0 title t-omit-two">{{book.name}}</view>
  24. <view class="content dir-top-nowrap main-right">
  25. <view class="box-grow-1 dir-top-nowrap main-right price">
  26. <view v-if="book.is_level == 1">
  27. <app-member-price :price="book.level_price"></app-member-price>
  28. </view>
  29. <app-sup-vip :is_vip_card_user="book.vip_card_appoint.is_vip_card_user" margin="4rpx 0 0" v-if="book.vip_card_appoint.discount > 0" :discount="book.vip_card_appoint.discount"></app-sup-vip>
  30. <view :class="getTheme + '-m-text ' + getTheme">{{book.price_content}}</view>
  31. </view>
  32. </view>
  33. </view>
  34. </app-form-id>
  35. </block>
  36. </view>
  37. <view v-if="style === '2'">
  38. <app-goods-list :theme="getTheme" :list="newData.list" sign="booking"></app-goods-list>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import {mapState, mapGetters} from 'vuex';
  44. import appGoodsList from "../app-goods-list/app-goods-list.vue";
  45. export default {
  46. name: "app-index-booking",
  47. props: {
  48. theme: String,
  49. index: Number,
  50. page_id: Number,
  51. is_required: Boolean
  52. },
  53. data() {
  54. return {
  55. newData: {},
  56. style: '1',
  57. goods_num: 20
  58. };
  59. },
  60. components: {
  61. appGoodsList
  62. },
  63. computed: {
  64. ...mapState({
  65. appImg: state => state.mallConfig.__wxapp_img.mall,
  66. appSetting: state => state.mallConfig.mall.setting,
  67. }),
  68. ...mapGetters('mallConfig', {
  69. getVideo: 'getVideo'
  70. }),
  71. ...mapGetters('mallConfig', {
  72. getTheme: 'getTheme',
  73. }),
  74. },
  75. methods: {
  76. jump(url) {
  77. this.$jump({
  78. url: url,
  79. open_type: 'navigate'
  80. })
  81. },
  82. router_jump(data) {
  83. // #ifndef MP-BAIDU
  84. if (data.video_url && this.getVideo == 1) {
  85. uni.navigateTo({
  86. url: `/pages/goods/video?goods_id=${data.id}&sign=booking`
  87. });
  88. } else {
  89. uni.navigateTo({
  90. url: data.page_url
  91. });
  92. }
  93. // #endif
  94. // #ifdef MP-BAIDU
  95. uni.navigateTo({
  96. url: data.page_url
  97. });
  98. // #endif
  99. },
  100. loadData() {
  101. let para = {
  102. type: this.page_id === 0 ? 'mall' : 'diy',
  103. key: 'booking',
  104. page_id: this.page_id,
  105. index: this.index
  106. }
  107. if(this.goods_num) {
  108. para.goods_num = this.goods_num
  109. }
  110. this.$request({
  111. url: this.$api.index.extra,
  112. data: para
  113. }).then(e => {
  114. this.newData = e.data;
  115. if (e.code ===0 && e.data && this.page_id === 0) {
  116. let storage = this.$storage.getStorageSync('INDEX_MALL');
  117. storage.home_pages[this.index].list = this.newData;
  118. this.$storage.setStorageSync('INDEX_MALL', storage);
  119. }
  120. })
  121. }
  122. },
  123. created() {
  124. let storage = this.$storage.getStorageSync('INDEX_MALL');
  125. this.style = storage.home_pages[this.index].style;
  126. this.goods_num = storage.home_pages[this.index].goods_num;
  127. if (this.is_required) {
  128. this.loadData();
  129. } else {
  130. this.newData = storage.home_pages[this.index].list;
  131. }
  132. },
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. .vip-price {
  137. width: #{148upx};
  138. height: #{27upx};
  139. margin-top: #{4upx};
  140. .vip-item {
  141. height: #{27upx};
  142. width: 50%;
  143. }
  144. .vip-left {
  145. border-top-left-radius: #{13upx};
  146. border-bottom-left-radius: #{13upx};
  147. background-color: #4e4040;
  148. position: relative;
  149. }
  150. .vip-right {
  151. border-top-right-radius: #{13upx};
  152. border-bottom-right-radius: #{13upx};
  153. background: linear-gradient(45deg, #edc9a8, #fdebde);
  154. font-size: #{18upx};
  155. line-height: #{27upx};
  156. text-align: center;
  157. color: #4e4040;
  158. }
  159. .vip-icon {
  160. width: #{51upx};
  161. height: #{14upx};
  162. position:absolute;
  163. top: 50%;
  164. left: 50%;
  165. transform: translate(-50%, -50%);
  166. }
  167. }
  168. .app-index-booking {
  169. background-color: #f7f7f7;
  170. margin-bottom: #{20upx};
  171. .top {
  172. padding: #{0 24rpx};
  173. color: #ff4544;
  174. font-size: $uni-font-size-general-one;
  175. height: #{72rpx};
  176. background-color: white;
  177. image {
  178. width: #{46rpx};
  179. height: #{46rpx};
  180. display: block;
  181. margin-right: #{8rpx};
  182. }
  183. .more {
  184. font-size: $uni-font-size-general-two;
  185. margin-right: #{12rpx};
  186. color: $uni-general-color-two;
  187. }
  188. .icon {
  189. width: #{12rpx};
  190. height: #{22rpx};
  191. display: block;
  192. }
  193. }
  194. .list {
  195. overflow-x: auto;
  196. -webkit-overflow-scrolling: touch;
  197. background-color: #f7f7f7;
  198. margin-top: #{4rpx};
  199. .item {
  200. margin-right: #{4rpx};
  201. font-size: $uni-font-size-general-one;
  202. width: #{260rpx};
  203. padding: #{0 20rpx 20upx 20rpx};
  204. background-color: white;
  205. overflow: hidden;
  206. .cover-pic {
  207. width: #{224rpx};
  208. height: #{224rpx};
  209. display: block;
  210. margin-top: #{20rpx};
  211. position: relative;
  212. .out-dialog {
  213. width: #{220rpx};
  214. height: #{220rpx};
  215. position: absolute;
  216. top: 0;
  217. left: 0;
  218. z-index: 10;
  219. will-change: transform;
  220. background-color: rgba(0,0,0,.5);
  221. image {
  222. width: #{220rpx};
  223. height: #{220rpx};
  224. }
  225. }
  226. }
  227. .title {
  228. width: #{224rpx};
  229. height: #{64rpx};
  230. font-size: #{25rpx};
  231. line-height: #{32upx};
  232. margin-top: #{10upx};
  233. color: $uni-important-color-black;
  234. }
  235. .content {
  236. height: #{100rpx};
  237. }
  238. .member-price {
  239. height: #{28upx};
  240. margin-bottom: #{8upx};
  241. margin-top: #{4upx};
  242. }
  243. .price {
  244. .text {
  245. text-overflow: ellipsis;
  246. -webkit-box-orient: vertical;
  247. -webkit-line-clamp: 1;
  248. overflow: hidden;
  249. line-height: 1;
  250. vertical-align: sub;
  251. }
  252. }
  253. .old-price {
  254. font-size: #{21upx};
  255. line-height: 1;
  256. color: #999999;
  257. text-decoration:line-through;
  258. margin: #{5upx 0 20upx 0};
  259. }
  260. .des-price {
  261. display: inline-block;
  262. font-size: #{19rpx};
  263. color: #ffffff;
  264. line-height: 1;
  265. border-radius: #{7rpx};
  266. padding: #{5rpx 5rpx};
  267. word-break: break-all;
  268. text-overflow: ellipsis;
  269. -webkit-box-orient: vertical;
  270. -webkit-line-clamp: 1;
  271. overflow: hidden;
  272. margin: #{4upx 0};
  273. }
  274. }
  275. }
  276. }
  277. </style>