index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class='promotionGood' :style="colorStyle">
  3. <block v-for="(item,index) in benefit" :key="index">
  4. <view class='item' @tap="goDetail(item)" hover-class="none">
  5. <view class='pictrue'>
  6. <easy-loadimage mode="widthFix" :image-src="item.image"></easy-loadimage>
  7. </view>
  8. <view class='money'>
  9. <text class="rmb">{{$t(`¥`)}} </text><text class="price"> {{item.price}}</text>
  10. <!-- <text class="ot-price">{{item.ot_price}}</text> -->
  11. </view>
  12. </view>
  13. </block>
  14. </view>
  15. </template>
  16. <script>
  17. import {
  18. mapGetters
  19. } from "vuex";
  20. import {
  21. goPage,
  22. goShopDetail
  23. } from '@/libs/order.js'
  24. import colors from "@/mixins/color";
  25. export default {
  26. computed: mapGetters(['uid']),
  27. mixins: [colors],
  28. props: {
  29. benefit: {
  30. type: Array,
  31. default: function() {
  32. return [];
  33. }
  34. }
  35. },
  36. data() {
  37. return {
  38. };
  39. },
  40. methods: {
  41. goDetail(item) {
  42. goPage().then(res => {
  43. goShopDetail(item, this.uid).then(res => {
  44. uni.navigateTo({
  45. url: `/pages/goods_details/index?id=${item.id}`
  46. })
  47. })
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style scoped lang='scss'>
  54. .promotionGood {
  55. padding: 0 30rpx;
  56. display: flex;
  57. flex-wrap: wrap;
  58. padding: 15rpx 24rpx;
  59. .item {
  60. width: 215rpx;
  61. display: flex;
  62. flex-direction: column;
  63. justify-content: center;
  64. padding: 9rpx;
  65. .pictrue {
  66. height: 198rpx;
  67. border-radius: 12rpx;
  68. /deep/,
  69. /deep/image,
  70. /deep/.easy-loadimage,
  71. /deep/uni-image {
  72. width: 100%;
  73. height: 198rpx;
  74. border-radius: 12rpx;
  75. }
  76. image {
  77. width: 100%;
  78. height: 100%;
  79. border-radius: 12rpx;
  80. }
  81. }
  82. .money {
  83. font-size: 30rpx;
  84. color: var(--view-priceColor);
  85. margin-top: 10rpx;
  86. overflow: hidden; //超出的文本隐藏
  87. text-overflow: ellipsis; //溢出用省略号显示
  88. white-space: nowrap; //溢出不换行
  89. margin: 0 auto;
  90. .rmb {
  91. font-weight: bold;
  92. color: var(--view-priceColor);
  93. font-size: 20rpx;
  94. margin-right: 2rpx;
  95. }
  96. .price {
  97. font-weight: bold;
  98. }
  99. .ot-price {
  100. color: #999;
  101. text-decoration: line-through;
  102. font-size: 20rpx;
  103. margin-left: 4rpx;
  104. }
  105. }
  106. }
  107. }
  108. </style>