| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <div>
- <van-nav-bar title="商户列表" @click-left="$router.back()" left-arrow fixed placeholder safe-area-inset-top />
- <div class="page_list">
- <div v-for="(item,index) in merList" :key="index">
- <div class="item_bg" @click="detailTap(item.id)">
- <div class="top_bg">
- <div class="name">{{item.name}}</div>
- <div class="distance_bg">
- <van-image class="distance_icon" :src="require('../../assets/images/elderly/location.png')" />
- <span class="dis_text">{{item.distance| distanceConversion}}</span>
- </div>
- </div>
- <div class="judge_bg">
- <div v-for="(starItem,starIndex) in starTotal" :key="starIndex">
- <van-image class="star_icon" :src="item.score > starIndex ? require('../../assets/images/elderly/xx.png') : require('../../assets/images/elderly/collection.png')" />
- </div>
- </div>
- <div class="address_bg">
- <van-image class="location_icon" :src="require('../../assets/images/elderly/icondistance.png')" />
- <div>{{item.detailedAddress}}</div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {institutions_search} from '../../api/index.js'
- export default {
- data() {
- return {
- merList:[],
- starTotal:5,
- radius:0,
- longitude:'',
- latitude:'',
- categoryId:''
- }
- },
- filters: {
- distanceConversion(num) {
- var dis
- if (num >= 5000) {
- dis = '>5km'
- } else if (num >= 1000 && num < 10000) {
- dis = (num / 1000).toFixed(2) + 'km'
- } else {
- dis = num + 'm'
- }
- return dis
- }
- },
- mounted() {
- },
- created() {
- this.longitude = this.$route.query.longitude
- this.latitude = this.$route.query.latitude
- this.radius = this.$route.query.radius
- this.categoryId = this.$route.query.categoryId
- this.getInstitutions_search()
- },
- methods: {
- async getInstitutions_search() {
- var institutionSearch = await institutions_search({
- "radius": this.radius,
- "institutionalTypeList":this.categoryId,
- "lat": this.latitude,
- "lng": this.longitude,
- "pageNum":1,
- 'pageSize':10
- })
- let merListTemp=[]
- institutionSearch.rows.forEach((e) => {
- // e.distance = util.getDistance(this.data.latitude,this.data.longitude,e.lat,e.lng)
- e.score = 4
- merListTemp.push(e)
- });
- this.merList =merListTemp
- },
- detailTap(id) {
- console.log('商户id')
- console.log(id)
- this.$router.push({path:'/detail',query:{institutionsId:id}})
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .page_list {
- width: 100%;
- height: 100%;
- background-color: #f1f1f1;
- }
- .item_bg {
- padding: 10px 15px;
- box-sizing: border-box;
- width: 96%;
- min-height: 220px;
- border-radius: 10px;
- background-color: white;
- margin: 10px auto;
- font-size: 32px;
- }
- .top_bg {
- width: 100%;
- height: auto;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .name {
- flex: .8;
- }
- .distance_bg {
- flex: .2;
- }
- .distance_icon {
- width: 30px;
- height: 30px;
- margin-right: 10rpx;
- }
- .dis_text {
- color: rgb(243, 99, 80);
- font-size: 28px;
- }
- .judge_bg {
- width: 100%;
- height: auto;
- }
- .address_bg {
- width: 100%;
- height: auto;
- color: #3a3939;
- font-size: 30px;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- }
- .location_icon {
- width: 30px;
- height: 30px;
- margin: 7px 10px 0 0;
- }
- .judge_bg {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- margin: 6px 0;
- }
- .star_icon {
- width: 30px;
- height: 30px;
- margin-right: 6px;
- }
- </style>
|