【新增】自提门店选择

pull/68/head
puhui999 2024-08-05 18:01:47 +08:00
parent b98f848be1
commit 1bc75b2ff5
1 changed files with 68 additions and 66 deletions

View File

@ -1,48 +1,50 @@
<template> <template>
<view class="storeBox" ref="container"> <s-layout title="选择自提门店" :bgStyle="{ color: '#FFF' }">
<view class="storeBox-box" v-for="(item, index) in state.storeList" :key="index" @tap="checked(item)"> <view class="storeBox" ref="container">
<view class="store-img"> <view class="storeBox-box" v-for="(item, index) in state.storeList" :key="index" @tap="checked(item)">
<image :src="item.logo" class="img"/> <view class="store-img">
</view> <image :src="item.logo" class="img" />
<view class="store-cent-left">
<view class="store-name">{{ item.name }}</view>
<view class="store-address line1">
{{ item.areaName }}{{ ', ' + item.detailAddress }}
</view> </view>
</view> <view class="store-cent-left">
<view class="row-right ss-flex-col ss-col-center"> <view class="store-name">{{ item.name }}</view>
<view> <view class="store-address line1">
<!-- #ifdef H5 --> {{ item.areaName }}{{ ', ' + item.detailAddress }}
<a class="store-phone" :href="'tel:' + item.phone">
<view class="iconfont">
<view class="ss-rest-button">
<text class="_icon-forward" />
</view>
</view>
</a>
<!-- #endif -->
<!-- #ifdef MP -->
<view class="store-phone" @click="call(item.phone)">
<view class="iconfont">
<view class="ss-rest-button">
<text class="_icon-forward" />
</view>
</view>
</view> </view>
<!-- #endif -->
</view> </view>
<view class="store-distance ss-flex ss-row-center" @tap="showMaoLocation(item)"> <view class="row-right ss-flex-col ss-col-center">
<text class="addressTxt" v-if="item.distance">{{ item.distance.toFixed(2) }}</text> <view>
<text class="addressTxt" v-else></text> <!-- #ifdef H5 -->
<view class="iconfont"> <a class="store-phone" :href="'tel:' + item.phone">
<view class="ss-rest-button"> <view class="iconfont">
<text class="_icon-forward" /> <view class="ss-rest-button">
<text class="_icon-forward" />
</view>
</view>
</a>
<!-- #endif -->
<!-- #ifdef MP -->
<view class="store-phone" @click="call(item.phone)">
<view class="iconfont">
<view class="ss-rest-button">
<text class="_icon-forward" />
</view>
</view>
</view>
<!-- #endif -->
</view>
<view class="store-distance ss-flex ss-row-center" @tap="showMaoLocation(item)">
<text class="addressTxt" v-if="item.distance">{{ item.distance.toFixed(2) }}</text>
<text class="addressTxt" v-else></text>
<view class="iconfont">
<view class="ss-rest-button">
<text class="_icon-forward" />
</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </s-layout>
</template> </template>
<script setup> <script setup>
@ -82,24 +84,24 @@
// getList(); // getList();
// }); // });
// } else { // } else {
// #endif // #endif
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
success: (res) => { success: (res) => {
try { try {
state.user_latitude = res.latitude; state.user_latitude = res.latitude;
state.user_longitude = res.longitude; state.user_longitude = res.longitude;
uni.setStorageSync(LATITUDE, res.latitude); uni.setStorageSync(LATITUDE, res.latitude);
uni.setStorageSync(LONGITUDE, res.longitude); uni.setStorageSync(LONGITUDE, res.longitude);
} catch { } catch {
} }
getList(); getList();
}, },
complete: () => { complete: () => {
getList(); getList();
}, },
}); });
// #ifdef H5 // #ifdef H5
// } // }
// #endif // #endif
}; };
@ -114,17 +116,17 @@
// console.log('success'); // console.log('success');
// }); // });
// } else { // } else {
// #endif // #endif
uni.openLocation({ uni.openLocation({
latitude: Number(e.latitude), latitude: Number(e.latitude),
longitude: Number(e.longitude), longitude: Number(e.longitude),
name: e.name, name: e.name,
address: `${e.areaName}-${e.detailAddress}`, address: `${e.areaName}-${e.detailAddress}`,
success: function() { success: function() {
console.log('success'); console.log('success');
}, },
}); });
// #ifdef H5 // #ifdef H5
// } // }
// #endif // #endif
}; };
@ -134,7 +136,7 @@
*/ */
const checked = (addressInfo) => { const checked = (addressInfo) => {
uni.$emit('SELECT_PICK_UP_INFO', { uni.$emit('SELECT_PICK_UP_INFO', {
addressInfo addressInfo,
}); });
sheep.$router.back(); sheep.$router.back();
}; };