app-index-pick.vue 9.4 KB

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