|
|
@@ -1,5 +1,5 @@
|
|
|
<script setup lang="ts">
|
|
|
-import type { CouponInfoAppVo, GasStationDetailVO } from '@/api/globals'
|
|
|
+import type { CouponInfoAppVo, DistanceStoreVO, GasStationDetailVO } from '@/api/globals'
|
|
|
import router from '@/router'
|
|
|
|
|
|
definePage({ name: 'refuelDetaile', islogin: false, style: { navigationBarTitleText: '加油站详情', navigationStyle: 'custom' } })
|
|
|
@@ -8,6 +8,9 @@ const showModel = ref(false)
|
|
|
const storeDetail = ref<GasStationDetailVO>()
|
|
|
const dklist = ref<CouponInfoAppVo[]>([])
|
|
|
const clickItem = ref<CouponInfoAppVo>()
|
|
|
+const showModelReful = ref(false)
|
|
|
+const storeVOList = ref<DistanceStoreVO[]>([])
|
|
|
+const { lat, lng } = storeToRefs(useUserStore())
|
|
|
onLoad(async (options: any) => {
|
|
|
await getData(options.id)
|
|
|
})
|
|
|
@@ -40,6 +43,31 @@ function handleExchange(item: CouponInfoAppVo) {
|
|
|
function handleKf() {
|
|
|
useUserStore().handleCommonWx('pages/my/index', '')
|
|
|
}
|
|
|
+async function handlePay() {
|
|
|
+ if (Number(storeDetail.value?.distanceShow) > 1) {
|
|
|
+ useGlobalMessage().confirm({
|
|
|
+ title: '提示',
|
|
|
+ msg: '您距离加油站过远,请在油站附近下单',
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ const { data } = await Apis.general.post_smqjh_pms_app_api_v1_product_oil_querydistancefence({ data: { lat: lat.value, lon: lng.value, storeId: storeDetail.value?.storeId } })
|
|
|
+ if (data?.isClosest) {
|
|
|
+ showModelReful.value = true
|
|
|
+ storeVOList.value = data.storeVOS as DistanceStoreVO[]
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ router.push({ name: 'confimOrder', params: { storeId: String(storeDetail.value?.storeId) } })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+function handleSelectStore(item: DistanceStoreVO) {
|
|
|
+ if (item.storeId === storeDetail.value?.storeId)
|
|
|
+ return
|
|
|
+ router.replace({ name: 'refuelDetaile', params: { id: String(item.storeId) } })
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -133,12 +161,51 @@ function handleKf() {
|
|
|
<view class="h200rpx" />
|
|
|
</view>
|
|
|
<FixedLayout>
|
|
|
- <wd-button block size="large" @click="router.push({ name: 'confimOrder', params: { storeId: String(storeDetail.storeId) } })">
|
|
|
+ <wd-button block size="large" @click="handlePay">
|
|
|
立即加油
|
|
|
</wd-button>
|
|
|
</FixedLayout>
|
|
|
<IntegralPopup v-model="showModel" :coupon-id="String(clickItem?.id)" />
|
|
|
</template>
|
|
|
+ <Zpopup v-model="showModelReful" bg="#fff">
|
|
|
+ <view class="px24rpx py28rpx">
|
|
|
+ <view class="mb24rpx text-center text-32rpx font-semibold">
|
|
|
+ 请确认
|
|
|
+ </view>
|
|
|
+ <view class="text-28rpx">
|
|
|
+ 您当前位置最近的油站是
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <scroll-view v-if="storeDetail" scroll-y class="h600rpx">
|
|
|
+ <view v-for="item in storeVOList" :key="item.storeId" class="px24rpx" @click="handleSelectStore(item)">
|
|
|
+ <view v-if="item.storeId === storeDetail?.storeId" class="mb20rpx mt14rpx text-28rpx text-#333333">
|
|
|
+ 您确定在
|
|
|
+ </view>
|
|
|
+ <view class="text-32rpx text-#333333 font-semibold">
|
|
|
+ ({{ item.storeName }}) {{ item.storeId === storeDetail?.storeId ? '下单吗' : '' }}
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="mt20rpx text-28rpx">
|
|
|
+ 距离 {{ item.distance }} km
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+ <template #footer>
|
|
|
+ <view class="my24rpx h2rpx w-full bg-#F0F0F0" />
|
|
|
+ <view class="w-full flex items-center justify-between pb20rpx">
|
|
|
+ <view class="w-45%">
|
|
|
+ <wd-button type="info" block size="large" @click="showModelReful = false">
|
|
|
+ 取消
|
|
|
+ </wd-button>
|
|
|
+ </view>
|
|
|
+ <view class="w-45%">
|
|
|
+ <wd-button block size="large" @click="router.push({ name: 'confimOrder', params: { storeId: String(storeDetail?.storeId) } }), showModelReful = false">
|
|
|
+ 继续
|
|
|
+ </wd-button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </Zpopup>
|
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|