Quellcode durchsuchen

fix(refuel): 优化加油站距离判断及支付相关逻辑

- 取消确认弹窗,简化确认订单的加油站距离判断逻辑
- 修正支付请求中openChannel字段为1,保证支付渠道一致性
- 在加油站详情页新增距离判断,并弹出最近油站确认弹窗
- 修改订单详情页用户手机号字段,修正显示支付时间数据来源
- 更新优惠券详情页金额显示,去除除以100的错误处理
- 调整用户定位默认经纬度,修正地理位置信息
- 调整微信跳转链接环境版本为release,保障正式环境跳转
- 修正transition页面处理支付状态显示,防止状态读取异常
zhangtao vor 16 Stunden
Ursprung
Commit
f5cde45e10

+ 2 - 2
.env.development

@@ -2,10 +2,10 @@
 # 在开发模式下使用 (npm run dev)
 
 # API 基础 URL - 开发环境
-# VITE_API_BASE_URL=http://192.168.0.19:8080
+VITE_API_BASE_URL=http://192.168.0.19:8080
 # VITE_API_BASE_URL=http://192.168.0.11:8080
 # VITE_API_BASE_URL=http://192.168.1.166:8080
-VITE_API_BASE_URL=https://smqjh.api.zswlgz.com
+# VITE_API_BASE_URL=https://smqjh.api.zswlgz.com
 # VITE_API_BASE_URL=https://7a8e0952.r28.cpolar.top
 # VITE_API_BASE_URL=https://52e7774d.r24.cpolar.top
 

+ 3 - 43
src/pages/confirmOrder/index.vue

@@ -11,7 +11,6 @@ const selectDk = ref()
 const storeDetail = ref<GasStationDetailVO>()
 const isSelect = ref(false)
 const refuelMoney = ref(null)
-const showModelReful = ref(false)
 const { lat, lng } = storeToRefs(useUserStore())
 const ThreePrice = ref<QueryCalPriceResponse>()
 const dkList = ref<AppMemberCouponOrderVO>()
@@ -32,7 +31,7 @@ const refuelGunList = computed(() => {
 const priceData = computed(() => {
   return storeDetail.value?.itemInfoList ? storeDetail.value?.itemInfoList.find(item => item.itemId === refuelNumber.value) : null
 })
-function handlePay() {
+async function handlePay() {
   if (!selectDk.value) {
     return useGlobalToast().show('如需不使用优惠卷,请选择暂不使用优惠卷')
   }
@@ -45,26 +44,7 @@ function handlePay() {
   if (!refuelMoney.value) {
     return useGlobalToast().show('请输入加油金额')
   }
-  if (Number(storeDetail.value?.distanceShow) > 1) {
-    useGlobalMessage().confirm({
-      title: '提示',
-      msg: '您距离加油站过远,请在油站附近下单',
-      confirmButtonText: '确认',
-      cancelButtonText: '取消',
-      success: async () => {
-        const { data } = await Apis.general.post_smqjh_pms_app_api_v1_product_oil_querydistancefence({ data: { lat: lat.value, lon: lng.value } })
-        if (data?.isClosest) {
-          showModelReful.value = true
-        }
-        else {
-          goPay()
-        }
-      },
-    })
-  }
-  else {
-    goPay()
-  }
+  goPay()
   console.log('handlePay')
 }
 async function handleBlur() {
@@ -102,7 +82,7 @@ async function getMoney() {
     storeId: storeDetail.value?.storeId as string,
     itemName: nams as string,
     amount: Number(refuelMoney.value) * 100,
-    openChannel: 0,
+    openChannel: 1,
     outUserId: '',
     mobile: '',
     promotionInfo: selectDk.value === 'nodk' ? [] : [{ allowanceId: selectDk.value }],
@@ -452,26 +432,6 @@ function getSelectDkInfo() {
         </wd-button>
       </view>
     </FixedLayout>
-    <Zpopup v-model="showModelReful" bg="#fff">
-      <view class="px24rpx py28rpx">
-        <view class="mb24rpx text-center text-32rpx font-semibold">
-          请确认
-        </view>
-        <view>您当前位置最近的油站是</view>
-      </view>
-      <view class="h200rpx" />
-      <template #footer>
-        <view class="my24rpx h2rpx w-full bg-#F0F0F0" />
-        <view class="flex items-center justify-between pb20rpx">
-          <wd-button type="info" block size="large">
-            取消
-          </wd-button>
-          <wd-button block size="large">
-            继续
-          </wd-button>
-        </view>
-      </template>
-    </Zpopup>
   </view>
 </template>
 

+ 2 - 2
src/pages/orderDetail/index.vue

@@ -171,10 +171,10 @@ function handleContact() {
         用户信息
       </view>
       <view class="text-26rpx text-#666 leading-48rpx">
-        <view>用户手机:{{ orderInfo.memberMobile || '-' }}</view>
+        <view>用户手机:{{ orderInfo.consigneeMobile || '-' }}</view>
         <view>外部用户ID:{{ orderInfo.memberId || '-' }}</view>
         <view>下单时间:{{ orderInfo.createTime || '-' }}</view>
-        <view>支付时间:{{ oilInfo.payTime || '-' }}</view>
+        <view>支付时间:{{ orderInfo.payTime || '-' }}</view>
       </view>
     </view>
 

+ 69 - 2
src/pages/refuelDetaile/index.vue

@@ -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>

+ 7 - 3
src/pages/transition/index.vue

@@ -11,15 +11,19 @@ definePage({
 })
 
 const loading = ref(true)
+const payStatus = ref(0)
 
 onLoad((options: any) => {
-  const payStatus = Number(options.payStatus)
+  if (options.payStatus) {
+    payStatus.value = Number(options.payStatus)
+  }
   const outerOrderId = options.outerOrderId || ''
+
   // 延迟跳转,显示 loading 效果
   setTimeout(() => {
     loading.value = false
 
-    if (payStatus === 1) {
+    if (payStatus.value === 1) {
       // 支付成功,跳转支付成功页
       router.replace({
         name: 'paySuccess',
@@ -38,7 +42,7 @@ onLoad((options: any) => {
   <view class="min-h-100vh flex flex-col items-center justify-center bg-#f5f5f5">
     <wd-loading v-if="loading" size="64rpx" />
     <view v-if="loading" class="mt24rpx text-28rpx text-#999">
-      正在处理中...
+      正在处理中... {{ payStatus }}
     </view>
   </view>
 </template>

+ 3 - 3
src/pages/voucherDetail/index.vue

@@ -145,9 +145,9 @@ function handleContact() {
         <view>油站:{{ couponInfo.storeName || '-' }}</view>
         <view>油号:{{ couponInfo.itemName || '-' }}</view>
         <view>枪号:{{ couponInfo.gunNo ? `${couponInfo.gunNo}号枪` : '-' }}</view>
-        <view>订单金额:¥{{ couponInfo.totalMoney ? (couponInfo.totalMoney / 100) : 0 }}</view>
+        <view>订单金额:¥{{ couponInfo.totalMoney ? (couponInfo.totalMoney) : 0 }}</view>
         <view>抵扣金额:¥{{ couponInfo.discountMoney }}</view>
-        <view>实付金额:¥{{ couponInfo.realMoney ? (couponInfo.realMoney / 100) : 0 }}</view>
+        <view>实付金额:¥{{ couponInfo.realMoney ? (couponInfo.realMoney) : 0 }}</view>
       </view>
     </view>
 
@@ -166,7 +166,7 @@ function handleContact() {
         <view class="flex items-center">
           支付剩余时间:<wd-count-down :time="getCountdownTime(couponInfo.orderCreateTime)" format="mm分ss秒" />
         </view>
-        <view>订单金额:¥{{ couponInfo.totalMoney ? (couponInfo.totalMoney / 100) : 0 }}</view>
+        <view>订单金额:¥{{ couponInfo.totalMoney ? (couponInfo.totalMoney) : 0 }}</view>
         <view>抵扣金额:¥{{ couponInfo.discountMoney }}</view>
       </view>
     </view>

+ 3 - 3
src/store/user.ts

@@ -81,8 +81,8 @@ export const useUserStore = defineStore('user', {
             console.log('H5位置获取成功', res)
             // this.lat = Number(res.latitude.toFixed(6))
             // this.lng = Number(res.longitude.toFixed(6))
-            this.lat = 30.282
-            this.lng = 120.09
+            this.lat = 24.9861
+            this.lng = 102.606
             resolve(true)
           },
           fail: (err) => {
@@ -262,7 +262,7 @@ export const useUserStore = defineStore('user', {
       this.handleCommonWx('subPack-refueling/orderDetaile/index', queryString)
     },
     handleCommonWx(path: string, queryString: string) {
-      window.location.href = `weixin://dl/business/?appid=wx43b5b906cc30ed0b&path=${path}&query=${queryString}&env_version=trial`
+      window.location.href = `weixin://dl/business/?appid=wx43b5b906cc30ed0b&path=${path}&query=${queryString}&env_version=release`
     },
     async handleCommonGoXiaoJuPay(orderNumber: string) {
       try {