123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- <template>
- <block>
- <view class="item" v-for="(item,index) in list" :key='index' @click="opMap(item.lat,item.lng,item.storename,item.storeaddress)">
- <image class="sImg" :src="item.image"
- mode=""></image>
- <view class="info">
- <view class="ititle">
- <view>{{item.storename}}</view>
- <image
- src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/758f62af7f9f4e5b1d96b51619d07b19.png"
- mode=""></image>
- </view>
- <view class="iphone">
- <image
- src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/658f859a103b4c4f20e3645fa557b592.png"
- mode=""></image>
- <view>{{item.phone}}</view>
- </view>
- <view class="iaddress">
- <view class="addressLeft">
- <image
- src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/f598a75a5fcbbcb06f90f2858fbf08af.png"
- mode=""></image>
- <view>{{item.storeaddress}}</view>
- </view>
- <view class="addressRight">
- {{item.distance||0}}m
- </view>
- </view>
- </view>
- </view>
- <view v-if="!list.length&&loaded" style='color:#999;text-align:center;margin:150rpx 0;font-size:30rpx'>暂无数据</view>
- </block>
- </template>
- <script module="parse" lang="wxs">
- module.exports = {
- filterNum: function(value) {
- var value = value + ''
- console.log(value)
- var card = value.replace(getRegExp('(/^(\d{4})\d+(\d{4})$/)', 'g'), '$1 **** **** $2')
- return card
- }
- }
- </script>
- <script>
- // pages/tabbar/index/index.js
- var app = getApp();
- export default {
- data() {
- return {
- navIndex: 0,
- list: [
- // {
- // account: "hhD",
- // bank_name: "农业银行",
- // card_no: "6228481561378773113",
- // card_no_end: "3113",
- // create_time: "1659088920",
- // id: "7",
- // is_default: "0",
- // status: "1",
- // uniacid: "3",
- // update_time: "1659088920",
- // user_id: "1"
- // }
- ],
- loaded: false,
- page: 1,
- type: '',
- pageSize: 10
- };
- },
- onLoad: function(options) {
- var that = this;
- uni.getLocation({
- type: 'gcj02',
- success (res) {
-
- that.latitude = res.latitude
- that.longitude = res.longitude
-
- that.getlist();
-
- }
- })
-
- },
- onShow() {
- },
- onPullDownRefresh: function() {},
- onReachBottom: function() {
- this.loaded || this.getlist();
- },
- onShareAppMessage: function() {},
- methods: {
- opMap(lat,lng,name,address) {
- uni.openLocation({
- latitude: Number(lat),
- longitude: Number(lng),
- name,
- address,
- success(e) {
- }
- })
- },
- toPage(e) {
- app.globalData.toPage(e);
- },
- init() {
- this.page = 1
- this.loaded = false
- this.list = []
- },
- async getlist() {
- var that = this;
- let res = await this.$api.request('/Store/index', 'GET', {
- page: this.page,
- pagesize: this.pageSize,
- lat: this.latitude,
- lng: this.longitude,
- });
- console.log(res.list)
- if (res) {
- if (res.list.length > 0) {
- this.list = this.list.concat(res.list);
- this.page++;
- } else {
- this.loaded = true
- this.$api.msg('没有更多数据');
- }
- }
- }
- }
- };
- </script>
- <style>
- page {
- background: #F5F5F5;
- }
- .item {
- background: #fff;
- border-radius: 12rpx;
- overflow: hidden;
- margin: 30rpx;
- display: flex;
- align-items: center;
- padding: 30rpx 22rpx;
- box-sizing: border-box;
- }
- .sImg {
- width: 120rpx;
- height: 120rpx;
- border-radius: 12rpx;
- }
- .info {
- margin-left: 17rpx;
- flex: 1;
- }
- .ititle {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .ititle>image {
- width: 30rpx;
- height: 30rpx;
- }
- .ititle>view {
- color: #010101;
- font-size: 32rpx;
- }
- .iphone {
- display: flex;
- align-items: center;
- margin: 12rpx 0;
- }
- .iphone>image {
- width: 36rpx;
- height: 36rpx;
- }
- .iphone>view {
- font-size: 26rpx;
- color: #8E8E8E;
- margin-left: 4rpx;
- }
- .iaddress {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- }
- .addressLeft {
- display: flex;
- align-items: center;
- align-items: flex-start;
- }
- .addressLeft>image {
- width: 36rpx;
- height: 36rpx;
- }
- .addressLeft>view {
- font-size: 26rpx;
- width: 326rpx;
- color: #8E8E8E;
- display: -webkit-box;
- overflow: hidden;
- text-overflow: ellipsis;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- margin-left: 4rpx;
- }
- .addressRight {
- font-size: 26rpx;
- color: #8E8E8E;
- }
- </style>
|