Explorar o código

fix(api): 修正开发环境接口地址及积分兑换逻辑

- 将开发环境 .env 文件中的 API 基础 URL 切换为正式地址
- 优化油订单开票功能,添加 loading 状态与错误捕获
- 修正积分兑换中库存判断条件,避免已兑完状态误判
- 调整积分兑换组件样式和文本显示逻辑
- 修复小程序跳转链接参数名及环境版本配置错误
zhangtao hai 19 horas
pai
achega
38f6b65098
Modificáronse 4 ficheiros con 24 adicións e 13 borrados
  1. 2 2
      .env.development
  2. 14 2
      src/pages/paySuccess/index.vue
  3. 6 6
      src/pages/refuelDetaile/index.vue
  4. 2 3
      src/store/user.ts

+ 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
 

+ 14 - 2
src/pages/paySuccess/index.vue

@@ -33,8 +33,20 @@ onLoad((options: any) => {
 })
 
 // 申请开票(占位)
-function handleInvoice() {
-  useGlobalToast().show('功能开发中')
+async function handleInvoice() {
+  // useGlobalToast().show('功能开发中')
+  uni.showLoading({ mask: true })
+  try {
+    const res = await Apis.general.post_smqjh_oms_api_v1_oil_order_invoiceorder({ params: { orderId: orderInfo.value?.orderNumber as string } })
+    window.location.href = res.data as string
+  }
+  catch (error) {
+    console.log(error)
+    // useGlobalToast().show('获取支付信息失败')
+  }
+  finally {
+    uni.hideLoading()
+  }
 }
 
 // 查看订单

+ 6 - 6
src/pages/refuelDetaile/index.vue

@@ -32,7 +32,7 @@ function handleExchange(item: CouponInfoAppVo) {
   console.log('exchange', item)
   if (item.receiveSign)
     return
-  if ((Number(item.inventoryTotal) - Number(item.inventoryActual)) === 0)
+  if ((Number(item.inventoryActual)) === 0)
     return
   clickItem.value = item
   showModel.value = true
@@ -91,17 +91,17 @@ function handleExchange(item: CouponInfoAppVo) {
           </template>
         </view>
         <view v-if="!storeDetail.allowanceClientScheme" class="mt24rpx flex overflow-x-scroll">
-          <view v-for="item in dklist" :key="item.id" :class="[(Number(item.inventoryTotal) - Number(item.inventoryActual)) === 0 || item.receiveSign ? 'bg-#F0F0F0' : 'jf-box']" class="mr16rpx flex-shrink-0 rounded-16rpx p20rpx">
-            <view class="text-center text-36rpx font-semibold" :class="[(Number(item.inventoryTotal) - Number(item.inventoryActual)) === 0 || item.receiveSign ? 'text-#aaa' : 'text-#FF4D3A']">
+          <view v-for="item in dklist" :key="item.id" :class="[Number(item.inventoryActual) === 0 || item.receiveSign ? 'bg-#F0F0F0' : 'jf-box']" class="mr16rpx flex-shrink-0 rounded-16rpx p20rpx">
+            <view class="text-center text-36rpx font-semibold" :class="[Number(item.inventoryActual) === 0 || item.receiveSign ? 'text-#aaa' : 'text-#FF4D3A']">
               <text class="text-20rpx">
               </text> {{ item.discountMoney }}
             </view>
-            <view class="my8rpx text-center" :class="[(Number(item.inventoryTotal) - Number(item.inventoryActual)) === 0 || item.receiveSign ? 'text-#aaa' : '']">
+            <view class="my8rpx text-center" :class="[Number(item.inventoryActual) === 0 || item.receiveSign ? 'text-#aaa' : '']">
               {{ item.amountMoney && item.amountMoney > 0 ? `满${item.amountMoney}减${item.discountMoney}` : `无门槛使用` }}
             </view>
-            <view class="rounded-26rpx px24rpx py6rpx text-center" :class="[(Number(item.inventoryTotal) - Number(item.inventoryActual)) === 0 || item.receiveSign ? 'bg-#E6E6E6 text-#aaa' : 'bg-#FF4A39 text-white']" @click="handleExchange(item)">
-              {{ !item.receiveSign ? (Number(item.inventoryTotal) - Number(item.inventoryActual)) === 0 ? '已兑完' : '积分兑换' : '已兑换' }}
+            <view class="rounded-26rpx px24rpx py6rpx text-center" :class="[Number(item.inventoryActual) === 0 || item.receiveSign ? 'bg-#E6E6E6 text-#aaa' : 'bg-#FF4A39 text-white']" @click="handleExchange(item)">
+              {{ !item.receiveSign ? Number(item.inventoryActual) === 0 ? '已兑完' : '积分兑换' : '已兑换' }}
             </view>
           </view>
         </view>

+ 2 - 3
src/store/user.ts

@@ -252,13 +252,12 @@ export const useUserStore = defineStore('user', {
      */
     handleCommonMiniProgram(orderNumber: string) {
       const query = {
-        orderNumber,
-        source: 'H5',
+        orderNo: orderNumber,
       }
       const queryString = Object.entries(query)
         .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
         .join('&')
-      window.location.href = `weixin://dl/business/?appid=wx43b5b906cc30ed0b&path=subPack-refueling/orderDetaile/index&query=${queryString}&env_version=release`
+      window.location.href = `weixin://dl/business/?appid=wx43b5b906cc30ed0b&path=subPack-refueling/orderDetaile/index&query=${queryString}&env_version=trial`
     },
     async handleCommonGoXiaoJuPay(orderNumber: string) {
       try {