app-index-advance.vue 8.2 KB

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