Procházet zdrojové kódy

feat:调整积分商城的接口对接(新格式对接)

xyh před 5 měsíci
rodič
revize
36cb76e457

+ 0 - 98
src/api/points.js

@@ -52,102 +52,4 @@ export function getPointTaskList(data) {
         url: '/user/point/activity/page',
         data
     });
-}
-
-
-
-
-
-// 积分商品列表
-export function getPointShopList(data) {
-    // 模拟数据返回
-    return new Promise((resolve, reject) => {
-        setTimeout(() => {
-            const mockData = {
-                code: 200,
-                message: 'success',
-                data: {
-                    list: [
-                        {
-                            id: 1,
-                            name: '广誉源会员定制玻璃杯',
-                            price: '10元+1000积分',
-                            value: '100',
-                            sales: 10,
-                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
-                        },
-                        {
-                            id: 2,
-                            name: '广誉源会员定制保温杯',
-                            price: '20元+2000积分',
-                            value: '200',
-                            sales: 20,
-                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
-                        },
-                        {
-                            id: 3,
-                            name: '广誉源会员定制雨伞',
-                            price: '15元+1500积分',
-                            value: '150',
-                            sales: 15,
-                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
-                        },
-                        {
-                            id: 4,
-                            name: '广誉源会员定制笔记本',
-                            price: '5元+500积分',
-                            value: '50',
-                            sales: 5,
-                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
-                        },
-                        {
-                            id: 6,
-                            name: '广誉源会员定制玻璃杯',
-                            price: '10元+1000积分',
-                            value: '100',
-                            sales: 10,
-                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
-                        },
-                        {
-                            id: 7,
-                            name: '广誉源会员定制保温杯',
-                            price: '20元+2000积分',
-                            value: '200',
-                            sales: 20,
-                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
-                        },
-                        {
-                            id: 8,
-                            name: '广誉源会员定制雨伞',
-                            price: '15元+1500积分',
-                            value: '150',
-                            sales: 15,
-                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
-                        },
-                        {
-                            id: 9,
-                            name: '广誉源会员定制笔记本',
-                            price: '5元+500积分',
-                            value: '50',
-                            sales: 5,
-                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
-                        }
-                    ],
-                    total: 9,
-                    page: data.page || 1,
-                    pageSize: data.pageSize || 10
-                }
-            };
-            resolve(mockData);
-        }, 800);
-    });
-    
-    // 真实API调用
-    /*
-    return request({
-        method: 'get',
-        url: '/api/order/v1/wx/getOrder',
-        data
-    });
-    */
 }

+ 134 - 0
src/api/shop.js

@@ -0,0 +1,134 @@
+import request from "@/utils/request.js";
+
+//积分商品分类
+export function getShopType(data) {
+    return request({
+        method: 'get',
+        url: '/product/category/list',
+        data
+    });
+
+    let res = {
+        "code": 200,
+        "msg": "操作成功",
+        "data": [
+            {
+                "parentId": 1,
+                "parentName": "商品",
+                "childId": 2,
+                "childCode": "1001",
+                "childName": "休闲",
+                "childSort": 1
+            },
+            {
+                "parentId": 1,
+                "parentName": "商品",
+                "childId": 3,
+                "childCode": "1002",
+                "childName": "日用",
+                "childSort": 2
+            },
+            {
+                "parentId": 1,
+                "parentName": "商品",
+                "childId": 4,
+                "childCode": "1003",
+                "childName": "娱乐",
+                "childSort": 3
+            }
+        ]
+    }
+}
+// 积分商品列表
+export function getPointShopList(data) {
+    // 模拟数据返回
+    return new Promise((resolve, reject) => {
+        setTimeout(() => {
+            const mockData = {
+                code: 200,
+                message: 'success',
+                data: {
+                    list: [
+                        {
+                            id: 1,
+                            name: '广誉源会员定制玻璃杯',
+                            price: '10元+1000积分',
+                            value: '100',
+                            sales: 10,
+                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
+                        },
+                        {
+                            id: 2,
+                            name: '广誉源会员定制保温杯',
+                            price: '20元+2000积分',
+                            value: '200',
+                            sales: 20,
+                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
+                        },
+                        {
+                            id: 3,
+                            name: '广誉源会员定制雨伞',
+                            price: '15元+1500积分',
+                            value: '150',
+                            sales: 15,
+                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
+                        },
+                        {
+                            id: 4,
+                            name: '广誉源会员定制笔记本',
+                            price: '5元+500积分',
+                            value: '50',
+                            sales: 5,
+                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
+                        },
+                        {
+                            id: 6,
+                            name: '广誉源会员定制玻璃杯',
+                            price: '10元+1000积分',
+                            value: '100',
+                            sales: 10,
+                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
+                        },
+                        {
+                            id: 7,
+                            name: '广誉源会员定制保温杯',
+                            price: '20元+2000积分',
+                            value: '200',
+                            sales: 20,
+                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
+                        },
+                        {
+                            id: 8,
+                            name: '广誉源会员定制雨伞',
+                            price: '15元+1500积分',
+                            value: '150',
+                            sales: 15,
+                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
+                        },
+                        {
+                            id: 9,
+                            name: '广誉源会员定制笔记本',
+                            price: '5元+500积分',
+                            value: '50',
+                            sales: 5,
+                            image: 'https://test.baoxianzhanggui.com/nightFragrance/profile/upload/2025/01/03/b43f6087c815cdab8828eb68529d96bc73203b941ab71e-xrpfmn_fw1200webp_20250103175413A002.png'
+                        }
+                    ],
+                    total: 9,
+                    page: data.page || 1,
+                    pageSize: data.pageSize || 10
+                }
+            };
+            resolve(mockData);
+        }, 800);
+    });
+
+    // 真实API调用
+    /*
+    return request({
+        method: 'get',
+        url: '/api/order/v1/wx/getOrder',
+        data
+    });
+    */
+}

+ 1 - 1
src/common/config.js

@@ -8,7 +8,7 @@ let baseUrl = 'https://test.baoxianzhanggui.com/nightFragrance';
 
 if (process.env.NODE_ENV == 'development') {
     // baseUrl = 'https://test.baoxianzhanggui.com/locallive-java' // 测试环境
-    // baseUrl = 'http://192.168.0.9:8082/jeecg-boot' // 靳
+    //baseUrl = 'http://192.168.1.190:8087' // 靳
 }
 
 // 同时导出所有变量(命名导出)

+ 8 - 1
src/points/components/product-list/product-list.vue

@@ -78,7 +78,7 @@
 
 <script>
 import ImageItem from "@/components/swiper/components/image.vue";
-import {getPointShopList} from '@/api/points'
+import {getShopType,getPointShopList} from "@/api/shop";
 export default {
   components: {ImageItem},
   props: {
@@ -124,6 +124,7 @@ export default {
     }
   },
   mounted() {
+    this.getTypeShop();
     this.loadData()
     // 延迟获取吸顶元素的初始位置,确保DOM已经渲染完成
     this.$nextTick(() => {
@@ -138,6 +139,10 @@ export default {
     }
   },
   methods: {
+    //获取分类
+    getTypeShop(){
+      const res = getShopType();
+    },
     // 获取吸顶元素的初始位置
     getStickyTop() {
       const query = uni.createSelectorQuery().in(this)
@@ -249,6 +254,8 @@ export default {
   background: #FFFFFF;
   border-radius: 20rpx 20rpx 0 0;
   padding-bottom: 32rpx;
+  margin-top: -20rpx;
+  overflow: hidden;
   .product-header {
     display: flex;
     justify-content: space-between;

+ 4 - 4
src/points/components/sign-in/sign-in.vue

@@ -20,7 +20,7 @@
           <ImageItem src="/static/points/notSigned.png" v-else/>
           <text class="sign-day-number" v-if="[0,2].includes(day.status)">+{{ day.points }}</text>
         </view>
-        <text :class="day.status === '1' ? 'sign-day-text' : 'day-text'">{{ getSignText(day) }}</text>
+        <text :class="day.status == '1' ? 'sign-day-text' : 'day-text'">{{ getSignText(day) }}</text>
       </view>
     </view>
     <!-- 空状态 -->
@@ -95,7 +95,7 @@ export default {
     display: flex;
     justify-content: center;
     align-items: center;
-    min-height: 200rpx;
+    height: 146rpx;
   }
   
   .sign-in-days {
@@ -142,7 +142,7 @@ export default {
         font-family: PingFang SC, PingFang SC;
         font-weight: 500;
         font-size: 24rpx;
-        color:  #999999;
+        color:#999999;
       }
 
       .day-text {
@@ -158,7 +158,7 @@ export default {
     display: flex;
     justify-content: center;
     align-items: center;
-    min-height: 145rpx;
+    height: 146rpx;
     color: #8f9ca2;
     font-size: 28rpx;
   }

+ 4 - 3
src/points/components/task-list/task-list.vue

@@ -165,6 +165,7 @@ export default {
   background-color: #fff;
   border-radius: 20rpx;
   padding: 24rpx;
+  height: 360rpx;
   box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
   
   .task-list-header {
@@ -181,7 +182,7 @@ export default {
     display: flex;
     justify-content: center;
     align-items: center;
-    min-height: 200rpx;
+    min-height: 230rpx;
   }
   
   .task-list {
@@ -189,7 +190,7 @@ export default {
       display: flex;
       justify-content: space-between;
       align-items: center;
-      margin-bottom: 32rpx;
+      margin-bottom: 20rpx;
       
       .task-item-left {
         display: flex;
@@ -278,7 +279,7 @@ export default {
     display: flex;
     justify-content: center;
     align-items: center;
-    min-height: 266rpx;
+    min-height: 230rpx;
     color: #8f9ca2;
     font-size: 28rpx;
   }

+ 10 - 9
src/points/home/index.vue

@@ -66,6 +66,7 @@ export default {
     ...mapActions([
       'getPointsInfo'
     ]),
+    // 跳转到积分规则界面
     goPointRule(){
       uni.navigateTo({
         url:'/points/home/pointRule'
@@ -102,8 +103,8 @@ export default {
         const res = await getSignPoint({
           cityCode: uni.getStorageSync('selectCitycode')
         });
-        if (res.code === 200) {
-          this.signData = res.data;
+        if (res.data.code === 200) {
+          this.signData = res.data.data;
         }
       } catch (error) {
         console.error('获取签到数据失败:', error);
@@ -118,8 +119,8 @@ export default {
         const res = await getHomeTask({
           cityCode: uni.getStorageSync('selectCitycode'),
         });
-        if (res.code === 200) {
-          this.taskData = res.data;
+        if (res.data.code === 200) {
+          this.taskData = res.data.data;
         }
       } catch (error) {
         console.error('获取任务数据失败:', error);
@@ -198,7 +199,7 @@ export default {
       signPoint({
         cityCode: uni.getStorageSync('selectCitycode'),
       }).then(res => {
-        if (res.code === 200) {
+        if (res.data.code === 200) {
           this.signData[index].status = 1;
         }
       }).catch(error => {
@@ -229,7 +230,7 @@ export default {
         if (taskArea) {
           // 获取元素的实际高度
           const rect = taskArea.getBoundingClientRect();
-          scrollDistance = rect.height;
+          scrollDistance = rect.height - 10;
         }
       } catch (error) {
         console.error('获取任务区域高度失败:', error);
@@ -271,9 +272,9 @@ export default {
       <!-- 规则按钮 -->
       <view class="rule-btn" @click="goPointRule">规则</view>
       <!-- 签到组件 -->
-      <SignIn @sign="handleSign" :signData="signData"/>
+      <SignIn @sign="handleSign" :signData="signData" :loading="loading.sign"/>
       <!-- 任务组件 -->
-      <TaskList :taskData="taskData" @scrollToSearch="scrollToSearch"/>
+      <TaskList :taskData="taskData" @scrollToSearch="scrollToSearch"  :loading="loading.task"/>
     </view>
     <!-- 商品列表组件 -->
     <ProductList ref="productRef" :scrollTop="scrollTop" />
@@ -295,7 +296,7 @@ export default {
     height: 80rpx;
     position: fixed;
     right: 6rpx;
-    bottom: 164rpx;
+    bottom: calc(8vh + 10rpx);
     z-index: 99;
   }
 }