card2.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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/del/map1.png" mode=""></image>
  18. <text>距离 {{distance(item.latitude,item.longitude)}} 米</text>
  19. </view>
  20. <view class="" @click.stop="checkLine(item)">
  21. <image style="width: 40rpx;height: 40rpx;" src="../../../static/del/lx.png" mode=""></image>
  22. <text>查看路线</text>
  23. </view>
  24. <view class="">
  25. <image src="../../../static/del/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 (lat1,lng1) => {
  46. if (this.vuex_location!=null) {
  47. let distance=this.$util.calculateDistance(lat1,lng1,this.vuex_location.latitude,this.vuex_location.longitude)
  48. console.log(distance);
  49. return distance
  50. }else{
  51. return 0
  52. }
  53. };
  54. },
  55. },
  56. methods:{
  57. checkLine(item){
  58. uni.openLocation({
  59. latitude:parseFloat(item.latitude),
  60. longitude:parseFloat(item.longitude),
  61. name:item.mallName,
  62. address:item.location
  63. })
  64. },
  65. goDetail(id){
  66. uni.navigateTo({
  67. url:"/pages/activity/activity?id="+id
  68. })
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. .card{
  75. background-color: #FFFFFF;
  76. border-bottom: 1rpx solid #ececec;
  77. }
  78. .card:last-child{
  79. border: none;
  80. }
  81. .content{
  82. display: flex;
  83. flex-direction: column;
  84. .top{
  85. .title{
  86. font-weight: 800;
  87. font-size: 28rpx;
  88. }
  89. .desc{
  90. margin-top: 10rpx;
  91. color: #919191;
  92. font-size: 24rpx;
  93. }
  94. }
  95. .bottom{
  96. margin-top: 20rpx;
  97. display: flex;
  98. width: 100%;
  99. view{
  100. width: calc(100% / 3);
  101. display: flex;
  102. align-items: center;
  103. image{
  104. width: 30rpx;
  105. height: 30rpx;
  106. }
  107. text{
  108. font-size: 28rpx;
  109. margin-left: 6rpx;
  110. }
  111. }
  112. view:nth-child(1){
  113. justify-content: flex-start;
  114. }
  115. view:nth-child(2){
  116. justify-content: center;
  117. }
  118. view:nth-child(3){
  119. justify-content: flex-end;
  120. }
  121. }
  122. }
  123. </style>