index.vue 1.9 KB

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