app-index-pintuan.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="app-index-pintuan">
  3. <view class="top dir-left-nowrap cross-center" @click="jump(`/plugins/pt/index/index`)">
  4. <image class="box-grow-0" src="/static/image/icon/icon-home-pintuan.png" mode="aspectFit"></image>
  5. <view class="box-grow-1 cross-bottom">限量拼团,每日必逛</view>
  6. <view class="dir-left-nowrap cross-center">
  7. <view class="box-grow-0 more">更多</view>
  8. <image class="box-grow-0 icon" src="../../../static/image/icon/arrow-right.png"></image>
  9. </view>
  10. </view>
  11. <view v-if="style == '1'" class="dir-left-nowrap list">
  12. <block v-for="(item, key) in newData.list" :key="key">
  13. <app-form-id @click="jump_router(item)">
  14. <view class="item box-grow-0 dir-top-nowrap">
  15. <view class="cover-pic box-grow-0">
  16. <view class="out-dialog" v-if="item.goods_stock == 0 && appSetting.is_show_stock == '1'">
  17. <image :src="appSetting.is_use_stock == '1' ? appImg.plugins_out : appSetting.sell_out_pic"></image>
  18. </view>
  19. <app-image :img-src="item.cover_pic" width="220rpx" height="220rpx"></app-image>
  20. </view>
  21. <view class="title t-omit-two box-grow-0">{{item.name}}</view>
  22. <view class="box-grow-1 dir-top-nowrap main-right">
  23. <view v-if="item.is_level == 1">
  24. <app-member-price :price="item.level_price"></app-member-price>
  25. </view>
  26. <app-sup-vip :is_vip_card_user="item.vip_card_appoint.is_vip_card_user" margin="4rpx 0 0" v-if="item.vip_card_appoint.discount > 0" :discount="item.vip_card_appoint.discount"></app-sup-vip>
  27. <view class="price" :class="theme + '-m-text ' + theme">{{item.price_content}}</view>
  28. </view>
  29. <view class="cross-center count">{{item.group_count}}</view>
  30. </view>
  31. </app-form-id>
  32. </block>
  33. </view>
  34. <view v-if="style === '2'">
  35. <app-goods-list :theme="theme" :list="newData.list" sign="pintuan"></app-goods-list>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import {mapState, mapGetters} from 'vuex';
  41. import routeJump from '../../../core/routeJump.js';
  42. import appGoodsList from "../app-goods-list/app-goods-list.vue";
  43. export default {
  44. name: "app-index-pintuan",
  45. props: {
  46. theme: Object,
  47. index: Number,
  48. page_id: Number,
  49. is_required: Boolean
  50. },
  51. data() {
  52. return {
  53. newData: {},
  54. style: '1',
  55. goods_num: 10
  56. };
  57. },
  58. components: {
  59. appGoodsList
  60. },
  61. computed: {
  62. ...mapState({
  63. appImg: state => state.mallConfig.__wxapp_img.mall,
  64. appSetting: state => state.mallConfig.mall.setting,
  65. }),
  66. ...mapGetters('mallConfig', {
  67. getVideo: 'getVideo'
  68. }),
  69. },
  70. mounted() {
  71. let storage = this.$storage.getStorageSync('INDEX_MALL');
  72. this.style = storage.home_pages[this.index].style;
  73. this.goods_num = storage.home_pages[this.index].goods_num;
  74. if (this.is_required) {
  75. this.loadData();
  76. } else {
  77. this.newData = storage.home_pages[this.index].list;
  78. }
  79. },
  80. methods: {
  81. jump(url) {
  82. routeJump({
  83. open_type: 'navigate',
  84. page_url: url,
  85. params: []
  86. })
  87. },
  88. jump_router(data) {
  89. // #ifndef MP-BAIDU
  90. if (data.video_url && this.getVideo == 1) {
  91. uni.navigateTo({
  92. url: `/pages/goods/video?goods_id=${data.id}&sign=pintuan`
  93. });
  94. } else {
  95. uni.navigateTo({
  96. url: data.page_url
  97. })
  98. }
  99. // #endif
  100. // #ifdef MP-BAIDU
  101. uni.navigateTo({
  102. url: data.page_url
  103. })
  104. // #endif
  105. },
  106. async loadData() {
  107. let para = {
  108. type: this.page_id === 0 ? 'mall' : 'diy',
  109. key: 'pintuan',
  110. page_id: this.page_id,
  111. index: this.index
  112. }
  113. if(this.goods_num) {
  114. para.goods_num = this.goods_num
  115. }
  116. const e = await this.$request({
  117. url: this.$api.index.extra,
  118. data: para
  119. });
  120. this.newData = e.data;
  121. if (e.code ===0 && e.data && this.page_id === 0) {
  122. let storage = this.$storage.getStorageSync('INDEX_MALL');
  123. storage.home_pages[this.index].list = this.newData;
  124. this.$storage.setStorageSync('INDEX_MALL', storage);
  125. }
  126. }
  127. },
  128. }
  129. </script>
  130. <style scoped lang="scss">
  131. .text1 {
  132. color: #ff8831;
  133. font-size: $uni-font-size-general-one;
  134. }
  135. .app-index-pintuan {
  136. .top {
  137. background-color: #ffffff;
  138. padding: #{16rpx} #{24rpx};
  139. color: $uni-general-color-two;
  140. font-size: $uni-font-size-weak-one;
  141. image {
  142. width: #{88rpx};
  143. height: #{40rpx};
  144. display: block;
  145. margin-right: #{20rpx};
  146. }
  147. .more {
  148. font-size: $uni-font-size-general-two;
  149. margin-right: #{12rpx};
  150. color: $uni-general-color-two;
  151. }
  152. .icon {
  153. width: #{12rpx};
  154. height: #{22rpx};
  155. display: block;
  156. margin: 0;
  157. }
  158. }
  159. .list {
  160. margin-top: #{8rpx};
  161. overflow-x: auto;
  162. -webkit-overflow-scrolling: touch;
  163. .item {
  164. background-color: #ffffff;
  165. margin-right: #{8rpx};
  166. padding: #{20rpx 20rpx 24rpx 20rpx};
  167. height: 100%;
  168. border-radius: #{8rpx};
  169. .cover-pic {
  170. width: #{220rpx};
  171. height: #{220rpx};
  172. display: block;
  173. margin-bottom: #{20rpx};
  174. .out-dialog {
  175. width: #{220rpx};
  176. height: #{220rpx};
  177. position: absolute;
  178. top: #{20rpx};
  179. left: #{20rpx};
  180. z-index: 10;
  181. background-color: rgba(0,0,0,.5);
  182. image {
  183. width: #{220rpx};
  184. height: #{220rpx};
  185. }
  186. }
  187. }
  188. .title {
  189. font-size: 26upx;
  190. color: $uni-important-color-black;
  191. width: #{220rpx};
  192. /*#ifdef MP-ALIPAY*/
  193. height: 55upx;
  194. /* #endif */
  195. }
  196. .price {
  197. font-size: $uni-font-size-import-two;
  198. margin-bottom: #{10rpx};
  199. }
  200. .count {
  201. font-size: $uni-font-size-weak-one;
  202. color: $uni-general-color-two;
  203. }
  204. }
  205. }
  206. }
  207. </style>