app-index-pick.vue 9.5 KB

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