index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. <image :src='item.image'></image>
  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. image {
  69. width: 100%;
  70. height: 100%;
  71. border-radius: 12rpx;
  72. }
  73. }
  74. .money {
  75. font-size: 30rpx;
  76. color: var(--view-priceColor);
  77. margin-top: 10rpx;
  78. overflow: hidden; //超出的文本隐藏
  79. text-overflow: ellipsis; //溢出用省略号显示
  80. white-space: nowrap; //溢出不换行
  81. margin: 0 auto;
  82. .rmb {
  83. font-weight: bold;
  84. color: var(--view-priceColor);
  85. font-size: 20rpx;
  86. margin-right: 2rpx;
  87. }
  88. .price {
  89. font-weight: bold;
  90. }
  91. .ot-price {
  92. color: #999;
  93. text-decoration: line-through;
  94. font-size: 20rpx;
  95. margin-left: 4rpx;
  96. }
  97. }
  98. }
  99. }
  100. </style>