card2.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="">
  3. <view class="cu-card case card" v-for="(item,index) in list" :key="index" @click="goDetail(item.id)">
  4. <view class="cu-item shadow">
  5. <view class="image">
  6. <image style="width: 100%;height: 450rpx;" :src="item.logo"></image>
  7. </view>
  8. <view class="content">
  9. <view class="top">
  10. <text class="title">{{item.mallName}}</text>
  11. <view v-if="item.intro" class="desc text-cut-2">
  12. {{item.intro}}
  13. </view>
  14. </view>
  15. <view class="bottom">
  16. <view class="">
  17. <image src="@/static/icon/map1.png" mode=""></image>
  18. <text>距离 {{distance(item.address)}} 米</text>
  19. </view>
  20. <view class="" @click.stop="checkLine(item)">
  21. <image style="width: 40rpx;height: 40rpx;" src="@/static/icon/lx.png" mode=""></image>
  22. <text>查看路线</text>
  23. </view>
  24. <view class="">
  25. <image src="@/static/icon/activitys.png" mode=""></image>
  26. <text>{{item.activityNums}}个活动</text>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default{
  36. props:{
  37. list:Array
  38. },
  39. data(){
  40. return {
  41. }
  42. },
  43. computed:{
  44. distance() {
  45. return (address) => {
  46. let location= address.split(",")
  47. let lat1=location[1]
  48. let lng1=location[0]
  49. if (this.vuex_location!=null) {
  50. let distance=this.$util.calculateDistance(lat1,lng1,this.vuex_location.latitude,this.vuex_location.longitude)
  51. console.log(distance);
  52. return distance
  53. }else{
  54. return 0
  55. }
  56. };
  57. },
  58. },
  59. methods:{
  60. checkLine(item){
  61. uni.openLocation({
  62. latitude:parseFloat(item.latitude),
  63. longitude:parseFloat(item.longitude),
  64. name:item.mallName,
  65. address:item.location
  66. })
  67. },
  68. goDetail(id){
  69. uni.navigateTo({
  70. url:"/pages/activity/activity?id="+id
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. .card{
  78. background-color: #FFFFFF;
  79. border-bottom: 1rpx solid #ececec;
  80. }
  81. .card:last-child{
  82. border: none;
  83. }
  84. .content{
  85. display: flex;
  86. flex-direction: column;
  87. .top{
  88. .title{
  89. font-weight: 800;
  90. font-size: 28rpx;
  91. }
  92. .desc{
  93. margin-top: 10rpx;
  94. color: #919191;
  95. font-size: 24rpx;
  96. }
  97. }
  98. .bottom{
  99. margin-top: 20rpx;
  100. display: flex;
  101. width: 100%;
  102. view{
  103. width: calc(100% / 3);
  104. display: flex;
  105. align-items: center;
  106. image{
  107. width: 30rpx;
  108. height: 30rpx;
  109. }
  110. text{
  111. font-size: 28rpx;
  112. margin-left: 6rpx;
  113. }
  114. }
  115. view:nth-child(1){
  116. justify-content: flex-start;
  117. }
  118. view:nth-child(2){
  119. justify-content: center;
  120. }
  121. view:nth-child(3){
  122. justify-content: flex-end;
  123. }
  124. }
  125. }
  126. </style>