|
@ -1,37 +1,161 @@ |
|
|
<script setup> |
|
|
<script setup> |
|
|
import { onLoad } from '@dcloudio/uni-app'; |
|
|
import { onLoad } from '@dcloudio/uni-app'; |
|
|
import { reactive, ref } from "vue"; |
|
|
|
|
|
|
|
|
import { reactive, ref, watch } from "vue"; |
|
|
import searchBar from "../components/search_bar.vue"; |
|
|
import searchBar from "../components/search_bar.vue"; |
|
|
onLoad(() => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { countCity, stadiumFind } from "../api"; |
|
|
|
|
|
import { routeTo, showModal } from '@/utils/polish'; |
|
|
|
|
|
import { debounce } from '@/utils'; |
|
|
|
|
|
const cityLs = ref([]); |
|
|
|
|
|
const cityName = ref(''); // 当前城市 |
|
|
|
|
|
const stadiumKey = ref(''); // 搜索门店 |
|
|
|
|
|
const stadiumLs = ref([]); |
|
|
|
|
|
const appid = tt.getEnvInfoSync()?.microapp?.appId ?? ''; |
|
|
|
|
|
|
|
|
|
|
|
watch(cityName, val=>{ |
|
|
|
|
|
stadiumLs.value = []; |
|
|
|
|
|
stadiumFind({ |
|
|
|
|
|
data: { |
|
|
|
|
|
appid: appid, |
|
|
|
|
|
city: val ?? '', |
|
|
|
|
|
key: stadiumKey.value ?? '', |
|
|
|
|
|
}, |
|
|
|
|
|
}) |
|
|
|
|
|
.then(sRes=> { |
|
|
|
|
|
if(val !== cityName.value) return; // 值在多次变化时候直接丢掉 |
|
|
|
|
|
let _ls = sRes?.data?.list || []; |
|
|
|
|
|
if(!_ls?.length) return showModal({ content: '暂无门店' }); |
|
|
|
|
|
stadiumLs.value = _ls; |
|
|
|
|
|
}) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onLoad(opts => { |
|
|
|
|
|
countCity({ |
|
|
|
|
|
data: { brand_id: opts?.brand_id ?? '' } |
|
|
|
|
|
}) |
|
|
|
|
|
.then(res=>{ |
|
|
|
|
|
console.log('城市列表--->', res); |
|
|
|
|
|
return cityLs.value = res.data?.list || []; |
|
|
|
|
|
}) |
|
|
|
|
|
.then(cityLs => { |
|
|
|
|
|
if(!cityLs?.length) return showModal({ content: '暂无城市' }); |
|
|
|
|
|
if(opts?.appid)appid = opts?.appid; |
|
|
|
|
|
cityName.value = cityLs[0]?.city ?? ''; |
|
|
|
|
|
}) |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function updateStadiumLs({ |
|
|
|
|
|
appid = '', |
|
|
|
|
|
city = '', |
|
|
|
|
|
key = '', |
|
|
|
|
|
}){ |
|
|
|
|
|
return stadiumFind({ |
|
|
|
|
|
data: { appid, city, key, }, |
|
|
|
|
|
}) |
|
|
|
|
|
.then(stadiumRes => { |
|
|
|
|
|
let _ls = stadiumRes?.data?.list || []; |
|
|
|
|
|
if(!_ls?.length) return showModal({ content: '暂无门店' }); |
|
|
|
|
|
stadiumLs.value = _ls; |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getBusinessTime(stadiumInfo){ // 营业时间 |
|
|
|
|
|
let _businessTime = stadiumInfo?.business_times || []; |
|
|
|
|
|
let _str = '' |
|
|
|
|
|
if(_businessTime?.length){ |
|
|
|
|
|
_businessTime.forEach(el =>{ |
|
|
|
|
|
let _wStr = '', _tStr = ''; |
|
|
|
|
|
if(el?.weeks?.length){ |
|
|
|
|
|
_wStr = el.weeks.join('、') || ''; |
|
|
|
|
|
} |
|
|
|
|
|
if(el?.stimes?.length){ |
|
|
|
|
|
el.stimes.forEach((sRes, sIdx) =>{ |
|
|
|
|
|
_tStr += `${sRes.start || ''}-${sRes.end || ''}`; |
|
|
|
|
|
_tStr += sIdx === el.stimes.length -1 ? ';' : ',' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
_str += `${_wStr || ''} ${_tStr || ''}`; |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
return _str || '-'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function phoneCall(phone) { |
|
|
|
|
|
if(!phone) return showModal({ content: '暂无联系电话' }); |
|
|
|
|
|
uni.makePhoneCall({ phoneNumber: phone, |
|
|
|
|
|
success: () => { |
|
|
|
|
|
console.log('拨打电话成功'); |
|
|
|
|
|
}, |
|
|
|
|
|
fail: (err) => { |
|
|
|
|
|
showModal({ content: err?.errMsg || '拨打电话失败' }); |
|
|
|
|
|
console.error('拨打电话失败', err); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function openMap(res){ |
|
|
|
|
|
uni.openLocation({ |
|
|
|
|
|
latitude: +(res?.lat || 0), |
|
|
|
|
|
longitude: +(res?.lng || 0), |
|
|
|
|
|
name: res?.name || '', |
|
|
|
|
|
address: res?.address || '', |
|
|
|
|
|
success: () => { |
|
|
|
|
|
console.log('打开地图成功'); |
|
|
|
|
|
}, |
|
|
|
|
|
fail: (err) => { |
|
|
|
|
|
showModal({ content: err?.errMsg || '打开地图失败' }); |
|
|
|
|
|
console.error('打开地图失败', err); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function searchKeyConfrim(val){ |
|
|
|
|
|
stadiumLs.value = []; |
|
|
|
|
|
stadiumFind({ |
|
|
|
|
|
data: { |
|
|
|
|
|
appid: appid, |
|
|
|
|
|
city: cityName.value, |
|
|
|
|
|
key: val, |
|
|
|
|
|
}, |
|
|
|
|
|
}) |
|
|
|
|
|
.then(stadiumRes => { |
|
|
|
|
|
let _ls = stadiumRes?.data?.list || []; |
|
|
|
|
|
stadiumLs.value = _ls; |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<view class="stadium-select"> |
|
|
<view class="stadium-select"> |
|
|
<search-bar></search-bar> |
|
|
|
|
|
|
|
|
<view class="ss-search"> |
|
|
|
|
|
<search-bar |
|
|
|
|
|
:cityLs="cityLs" |
|
|
|
|
|
v-model:city="cityName" |
|
|
|
|
|
v-model:iptkey="stadiumKey" |
|
|
|
|
|
@input:confirm="searchKeyConfrim" |
|
|
|
|
|
></search-bar> |
|
|
|
|
|
</view> |
|
|
<view class="stadium-ls"> |
|
|
<view class="stadium-ls"> |
|
|
<view class="sl-item" v-for="i in 3" :key="i"> |
|
|
|
|
|
|
|
|
<view class="sl-item" v-for="(e, i) in stadiumLs" :key="i"> |
|
|
<view class="si-info"> |
|
|
<view class="si-info"> |
|
|
<view class="si-top"> |
|
|
<view class="si-top"> |
|
|
<view class="st-logo"></view> |
|
|
|
|
|
<view class="st-name">MJ体育(天空篮球从云店)</view> |
|
|
|
|
|
|
|
|
<image class="st-logo" mode="aspectFit" :src="e.logo"></image> |
|
|
|
|
|
<view class="st-name">{{ e?.name || '-' }}</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="si-line"> |
|
|
<view class="si-line"> |
|
|
<view class="sl-icon"></view> |
|
|
<view class="sl-icon"></view> |
|
|
<view class="sl-txt">周一、周日09:05-12:00,14:30-24;周二、周四、周五...</view> |
|
|
|
|
|
|
|
|
<view class="sl-txt">{{ getBusinessTime(e) }}</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="si-line"> |
|
|
<view class="si-line"> |
|
|
<view class="sl-icon"></view> |
|
|
<view class="sl-icon"></view> |
|
|
<view class="sl-txt">白云区从云路822号城市像素6楼(电梯5楼走到6楼)</view> |
|
|
|
|
|
|
|
|
<view class="sl-txt">{{ e.address || '-' }}</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="si-right"> |
|
|
<view class="si-right"> |
|
|
<view class="sr-txt">去核销</view> |
|
|
<view class="sr-txt">去核销</view> |
|
|
<view class="sr-icons"> |
|
|
<view class="sr-icons"> |
|
|
<view class="si-item"></view> |
|
|
|
|
|
<view class="si-item"></view> |
|
|
|
|
|
|
|
|
<view class="si-item" @click="phoneCall(e.contact_mobile)"></view> |
|
|
|
|
|
<view class="si-item" @click="openMap(e)"></view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
@ -41,6 +165,11 @@ onLoad(() => { |
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
<style lang="scss" scoped> |
|
|
.stadium-select{ |
|
|
.stadium-select{ |
|
|
|
|
|
.ss-search{ |
|
|
|
|
|
position: sticky; |
|
|
|
|
|
left: 0; |
|
|
|
|
|
top: 0; |
|
|
|
|
|
} |
|
|
.stadium-ls{ |
|
|
.stadium-ls{ |
|
|
padding: 24upx; |
|
|
padding: 24upx; |
|
|
@include isPd(24upx); |
|
|
@include isPd(24upx); |
|
@ -64,7 +193,6 @@ onLoad(() => { |
|
|
margin-right: 20upx; |
|
|
margin-right: 20upx; |
|
|
width: 36upx; |
|
|
width: 36upx; |
|
|
height: 36upx; |
|
|
height: 36upx; |
|
|
background: skyblue; |
|
|
|
|
|
} |
|
|
} |
|
|
.st-name{ |
|
|
.st-name{ |
|
|
flex-grow: 1; |
|
|
flex-grow: 1; |
|
|