Selaa lähdekoodia

fix(api): 修正开发环境接口地址和兑换数量显示

- 注释了原有本地开发接口地址,启用正式环境API地址
- 修正积分兑换弹窗和活动列表中已兑换数量的计算错误
- 活动列表新增积分兑换弹窗展示及兑换操作绑定
- 兑换成功页使用路由替代原有uni API,并同步Tabbar状态
- 代金券页去除“未生效”标签及状态显示
- 固定用户位置获取逻辑,改为动态获取经纬度数据
zhangtao 2 päivää sitten
vanhempi
commit
f786bb5b6a

+ 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
 

+ 1 - 1
src/components/integralPopup.vue

@@ -37,7 +37,7 @@ watch(show, () => {
           </view>
           <view class="text-#aaa">
             <view class="mt10rpx">
-              已兑换:{{ couponInfo.inventoryActual }}/{{ couponInfo.inventoryTotal }}
+              已兑换:{{ Number(couponInfo.inventoryTotal) - Number(couponInfo.inventoryActual) }}/{{ couponInfo.inventoryTotal }}
             </view>
             <view class="mt10rpx">
               兑换期截至: {{ couponInfo.couponEndTime }}

+ 10 - 3
src/pages/activityList/index.vue

@@ -1,4 +1,5 @@
 <script setup lang="ts">
+import type { CouponInfoAppVo } from '@/api/globals'
 import router from '@/router'
 
 definePage({
@@ -11,7 +12,8 @@ definePage({
 })
 
 const staticUrl = import.meta.env.VITE_STATIC_BASE_URL
-
+const showModel = ref(false)
+const clickItem = ref<CouponInfoAppVo>()
 const { data, isLastPage, page, send } = usePagination((pageNum, pageSize) => Apis.app.get_smqjh_system_app_api_coupon_page({ params: {
   pageNum,
   pageSize,
@@ -41,6 +43,10 @@ onReachBottom(() => {
     page.value++
   }
 })
+function handleExchange(item: CouponInfoAppVo) {
+  showModel.value = true
+  clickItem.value = item
+}
 </script>
 
 <template>
@@ -67,7 +73,7 @@ onReachBottom(() => {
           </view>
           <!-- 已领取数量 -->
           <view class="mt12rpx text-26rpx text-#666">
-            已领取:{{ item.inventoryActual }} / {{ item.inventoryTotal }}
+            已领取:{{ Number(item.inventoryTotal) - Number(item.inventoryActual) }} / {{ item.inventoryTotal }}
           </view>
           <!-- 状态 -->
           <view v-if="item.receiveSign" class="mt12rpx text-26rpx text-#666">
@@ -88,7 +94,7 @@ onReachBottom(() => {
           v-if="!item.receiveSign"
           size="small"
           custom-class="exchange-btn"
-          @click="useUserStore().handleExchange(item)"
+          @click="handleExchange(item)"
         >
           积分兑换
         </wd-button>
@@ -104,6 +110,7 @@ onReachBottom(() => {
       </view>
     </view>
     <StatusTip v-if="!data.length" tip="暂无活动" />
+    <IntegralPopup v-model="showModel" :coupon-id="String(clickItem?.id)" />
   </view>
 </template>
 

+ 6 - 2
src/pages/exchangeSuccess/index.vue

@@ -1,4 +1,6 @@
 <script setup lang="ts">
+import router from '@/router'
+
 definePage({
   name: 'exchangeSuccess',
   islogin: true,
@@ -26,13 +28,15 @@ onLoad((options: any) => {
 
 // 查看抵扣券
 function handleViewVoucher() {
-  uni.switchTab({ url: '/pages/voucher/index' })
+  router.pushTab({ name: 'voucher' })
+  useTabbar().setTabbarItemActive('voucher')
 }
 
 // 立即使用
 function handleUseNow() {
   // TODO: 跳转到使用页面
-  uni.navigateBack()
+  router.pushTab({ name: 'home' })
+  useTabbar().setTabbarItemActive('home')
 }
 </script>
 

+ 0 - 2
src/pages/voucher/index.vue

@@ -19,7 +19,6 @@ const tabList = ref([
   { label: '可用', value: 2 },
   { label: '已使用', value: 1 },
   { label: '已过期', value: 5 },
-  { label: '未生效', value: 7 },
 ])
 const currentTab = ref(2)
 
@@ -28,7 +27,6 @@ const statusMap = new Map([
   [2, '可用'],
   [1, '已使用'],
   [5, '已过期'],
-  [7, '未生效'],
 ])
 
 // 分页请求

+ 4 - 4
src/store/user.ts

@@ -79,10 +79,10 @@ export const useUserStore = defineStore('user', {
           success: (res) => {
             uni.hideLoading()
             console.log('H5位置获取成功', res)
-            // this.lat = Number(res.latitude.toFixed(6))
-            // this.lng = Number(res.longitude.toFixed(6))
-            this.lat = 26.6643
-            this.lng = 106.625
+            this.lat = Number(res.latitude.toFixed(6))
+            this.lng = Number(res.longitude.toFixed(6))
+            // this.lat = 26.6643
+            // this.lng = 106.625
             resolve(true)
           },
           fail: (err) => {