giftBag.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view class="container padding-t-20">
  3. <view class="uservip flex margin-b-20" v-for="(ls, index) in userServant" @click="navToDetailPage(ls)">
  4. <image @error="onImageError('userServant', index)" lazy-load :src="ls.image" mode="aspectFill"></image>
  5. <view class="detail">
  6. <view class="title">{{ ls.store_name }}</view>
  7. <view class="icon" v-if="ls.mer_id == 0">自营</view>
  8. <view class="flex price-box">
  9. <view class="price">
  10. <text class="font-size-sm">¥</text>
  11. {{ ls.price }}
  12. </view>
  13. <view class="text">售出{{ ls.sales }}</view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import { loadIndexs } from '@/api/index.js';
  21. export default {
  22. data() {
  23. return {
  24. userServant: []
  25. };
  26. },
  27. onLoad(option) {
  28. this.loadData();
  29. },
  30. methods: {
  31. navToDetailPage: function(ls) {
  32. uni.navigateTo({
  33. url: '/pages/product/product?id=' + ls.id
  34. });
  35. },
  36. // 请求载入数据
  37. async loadData() {
  38. loadIndexs({}).then(({ data }) => {
  39. this.userServant = data.info.platoonList; //服务商品
  40. });
  41. },
  42. }
  43. };
  44. </script>
  45. <style lang="scss">
  46. page {
  47. background: $page-color-base;
  48. }
  49. // 会员升级礼包
  50. .uservip {
  51. border-radius: $border-radius-sm;
  52. background-color: white;
  53. box-shadow: $box-shadow;
  54. height: 300rpx;
  55. margin: 0 30rpx;
  56. image {
  57. height: 100%;
  58. width: 300rpx;
  59. }
  60. .detail {
  61. position: relative;
  62. padding: 20rpx;
  63. height: 100%;
  64. flex-grow: 1;
  65. .icon {
  66. margin-right: 10rpx;
  67. display: inline-block;
  68. padding: 2rpx 10rpx;
  69. border: 1rpx solid $color-yellow;
  70. color: $color-yellow;
  71. line-height: 1;
  72. font-size: $font-base;
  73. border-radius: 10rpx;
  74. }
  75. .price-box {
  76. position: absolute;
  77. bottom: 20rpx;
  78. width: calc(100% - 40rpx);
  79. .price {
  80. font-size: $font-lg + 2rpx;
  81. font-weight: bold;
  82. color: $font-color-base;
  83. }
  84. .text {
  85. color: $color-gray;
  86. font-size: $font-sm;
  87. }
  88. }
  89. .title {
  90. font-size: $font-lg;
  91. font-weight: bold;
  92. }
  93. }
  94. }
  95. </style>