Browse Source

fix 加价分享 bug 修复

ylong 6 months ago
parent
commit
bda53f94ca

+ 3 - 2
App.vue

@@ -85,11 +85,12 @@ export default {
 						.post("/user/miniLogin", data)
 						.then((response) => {
 							if (response.code == 200) {
-								eventBus.emit('loginSuccess', { response: response.data, params: data })
-								that.globalData.isColdLaunch = false;
 								uni.setStorageSync("loginSuccess", response.data);
 								uni.setStorageSync("token", response.data.token);
 								console.log("登录成功返回参数", response.data, data);
+
+								eventBus.emit('loginSuccess', { response: response.data, params: data })
+								that.globalData.isColdLaunch = false;
 							}
 						});
 				},

+ 2 - 1
api/config.js

@@ -63,7 +63,7 @@ export const httpResponse = (res) => {
         return resolve(res.data);
       }
       if (res.data.code == 401) {
-        console.log("接口未登录>>>>401");
+        console.log("接口未登录>>>>4011",res.data.code);
         // 尝试静默登录
         silentLogin()
           .then((data) => {
@@ -82,6 +82,7 @@ export const httpResponse = (res) => {
       return resolve(res.data);
     }
     if (res.statusCode == 401) {
+      console.log("接口未登录>>>>401",res.statusCode);
       silentLogin()
         .then((data) => {
           // 登录成功,重新发起之前失败的请求

+ 3 - 0
components/pageScroll/index.vue

@@ -112,6 +112,9 @@ export default {
                 if (isRefresh) {
                     this.isRefreshing = false;
                 }
+                // #ifdef MP-ALIPAY
+                my.stopPullDownRefresh()
+                // #endif
             }
         },
 

+ 5 - 0
pages-home/pages/scaned-book.vue

@@ -47,6 +47,11 @@ export default {
             isAllSelected: false
         }
     },
+    // #ifdef MP-ALIPAY
+    onPullDownRefresh() {
+        this.$refs.pageRef?.loadData(true)
+    },
+    // #endif
     mounted() {
         this.$refs.pageRef?.loadData(true)
     },

+ 23 - 2
pages-mine/components/select-book-item.vue

@@ -43,7 +43,8 @@
                                 </view>
                             </view>
                             <view class="audit-price">
-                                <u-checkbox shape="circle" :name="book.id + '-' + index" v-model="audit.isSelected"
+                                <u-checkbox shape="circle" :name="book.isbn + '-' + index" 
+                                    v-model="checkboxValue[index]"
                                     @change="(e) => handleSelect(e, { index, isbn: book.isbn })"></u-checkbox>
                             </view>
                         </view>
@@ -74,9 +75,29 @@ export default {
             default: false
         }
     },
+    data() {
+        return {
+            checkboxValue: {}
+        }
+    },
+    watch: {
+        'book.auditCommentList': {
+            immediate: true,
+            handler(newVal) {
+                if (newVal) {
+                    newVal.forEach((audit, index) => {
+                        this.$set(this.checkboxValue, index, audit.isSelected || false);
+                    });
+                }
+            }
+        }
+    },
     methods: {
         handleSelect(e, { index, isbn }) {
-            this.$emit('select', { checked: e.value, index, isbn })
+            // 更新本地状态
+            this.$set(this.checkboxValue, index, e.value);
+            // 触发父组件更新
+            this.$emit('select', { checked: e.value, index, isbn });
         }
     }
 }

+ 14 - 1
pages-mine/pages/address/add-or-update.vue

@@ -68,6 +68,11 @@ export default {
                     message: '请输入正确的手机号',
                     trigger: ['change', 'blur'],
                 }],
+                detailAddress: [{
+                    required: true,
+                    message: '请输入详细地址',
+                    trigger: ['change', 'blur'],
+                }],
             },
             // 省市区
             selAddressCodes: [],
@@ -85,7 +90,7 @@ export default {
             this.title = '修改地址';
             this.getAddressDetail(ops.id);
         } else {
-            this.form.id = null;
+            this.form.id = '';
             this.form.type = 'add';
             this.title = '新建地址';
         }
@@ -118,6 +123,14 @@ export default {
 
         // 提交表单
         submit() {
+            if (!this.form.provinceId) {
+                uni.showToast({
+                    title: '请选择所在地区',
+                    icon: 'none'
+                })
+                return
+            }
+
             this.$refs.uForm.validate(valid => {
                 console.log(valid, 'valid')
                 if (valid) {

+ 5 - 1
pages-mine/pages/notice.vue

@@ -4,7 +4,7 @@
             url="/token/message/mymsg"
             :immediate="true"
             @updateList="handleUpdateList"
-            ref="pageScroll"
+            ref="pageRef"
             slotEmpty
             emptyText="暂无消息"
         >
@@ -46,6 +46,10 @@ export default {
             noticeList: [],
         };
     },
+    // #ifdef MP-ALIPAY
+    onPullDownRefresh() {
+        this.$refs.pageRef?.loadData(true)
+    },
     methods: {
         // 处理列表更新
         handleUpdateList(list = []) {

+ 6 - 0
pages-mine/pages/partner/income-detail.vue

@@ -31,6 +31,12 @@ export default {
             mockData: [],
         };
     },
+    // #ifdef MP-ALIPAY
+    onPullDownRefresh() {
+        this.$refs.pageRef?.loadData(true)
+    },
+    // #endif
+
     methods: {
         handleUpdateList(data) {
             this.mockData = data;

+ 6 - 0
pages-mine/pages/partner/order-detail.vue

@@ -55,6 +55,12 @@ export default {
             mockOrders: []
         }
     },
+    // #ifdef MP-ALIPAY
+    onPullDownRefresh() {
+        this.$refs.pageRef?.loadData(true)
+    },
+    // #endif
+
     onLoad(options) {
         // 如果有传入状态,切换到对应tab
         if (options.status) {

+ 6 - 0
pages-mine/pages/partner/partner-apply.vue

@@ -85,6 +85,8 @@ export default {
             counting: false,
             countdown: 60,
             rules: {
+                mobile: [{ required: true, message: "请输入手机号" }],
+                verifyCode: [{ required: true, message: "请输入验证码" }],
                 name: [{ required: true, message: "请输入真实姓名" }],
                 school: [{ required: true, message: "请输入学校" }],
                 faculties: [{ required: true, message: "请输入院系" }],
@@ -101,6 +103,10 @@ export default {
         // 获取省市区数据
         this.getDistrictData();
     },
+    // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
+	onReady() {
+		this.$refs.uForm?.setRules(this.rules);
+	},
     methods: {
         // 获取省市区数据
         async getDistrictData() {

+ 37 - 45
pages-mine/pages/return-select.vue

@@ -104,68 +104,60 @@ export default {
         getOrderInfo(orderId) {
             uni.$u.http.get('/token/order/getOrderDetail?orderId=' + orderId).then(res => {
                 if (res.code === 200) {
-                    this.orderInfo = res.data
-                    let selectedReturnBooks = uni.getStorageSync('selectedReturnBooks')
-                    let selectedBooks = selectedReturnBooks.selectedBooks || []
+                    this.orderInfo = res.data;
+                    let selectedReturnBooks = uni.getStorageSync('selectedReturnBooks') || {};
+                    let selectedBooks = selectedReturnBooks.selectedBooks || [];
 
                     this.bookList = res.data.detailVoList.filter(book => {
-                        let selectedBook = selectedBooks.find(selectedBook => selectedBook.isbn === book.isbn)
-
+                        let selectedBook = selectedBooks.find(selectedBook => selectedBook.isbn === book.isbn);
+                        
                         let list = book.auditCommentList.filter(audit => audit.sts === 3)
                             .sort((a, b) => {
                                 if (a.com === '无此书' && b.com !== '无此书') return 1;
                                 if (a.com !== '无此书' && b.com === '无此书') return -1;
                                 return 0;
                             });
-                        list.forEach((audit, index) => {
-                            audit.isSelected = selectedBook?.auditCommentList[index]?.isSelected || false
-                        })
-                        book.auditCommentList = list
-                        return list.length > 0
-                    })
-                    this.isAllSelected = this.bookList.every(book =>
-                        book.auditCommentList.every(audit => audit.isSelected)
-                    );
-                }
-            })
-        },
-        //选择书籍
-        handleSelectBook({ checked, index, isbn }) {
-            let found = false;
-            let updatedBook = null;
-
-            this.bookList = this.bookList.map(book => {
-                if (book.isbn === isbn) {
-                    const updatedAuditList = book.auditCommentList.map((audit, idx) => {
-                        if (idx === index) {
-                            found = true;
-                            return { ...audit, isSelected: checked };
+
+                        if (list.length > 0) {
+                            list.forEach((audit, index) => {
+                                audit.isSelected = selectedBook?.auditCommentList[index]?.isSelected || false;
+                            });
+                            book.auditCommentList = list;
+                            return true;
                         }
-                        return audit;
+                        return false;
+                    });
+
+                    this.$nextTick(() => {
+                        this.isAllSelected = this.bookList.every(book =>
+                            book.auditCommentList.every(audit => audit.isSelected)
+                        );
                     });
-                    updatedBook = { ...book, auditCommentList: updatedAuditList };
-                    return updatedBook;
                 }
-                return book;
             });
-
-            if (found) {
-                // 检查是否所有书籍都被选中
-                this.isAllSelected = this.bookList.every(book =>
-                    book.auditCommentList.every(audit => audit.isSelected)
-                );
+        },
+        //选择书籍
+        handleSelectBook({ checked, index, isbn }) {
+            const book = this.bookList.find(book => book.isbn === isbn);
+            if (book && book.auditCommentList[index]) {
+                book.auditCommentList[index].isSelected = checked;
+                
+                // 更新全选状态
+                this.$nextTick(() => {
+                    this.isAllSelected = this.bookList.every(book =>
+                        book.auditCommentList.every(audit => audit.isSelected)
+                    );
+                });
             }
         },
         //全选
         handleSelectAll({ value }) {
             this.isAllSelected = value;
-            this.bookList = this.bookList.map(book => ({
-                ...book,
-                auditCommentList: book.auditCommentList.map(audit => ({
-                    ...audit,
-                    isSelected: value
-                }))
-            }));
+            this.bookList.forEach(book => {
+                book.auditCommentList.forEach(audit => {
+                    audit.isSelected = value;
+                });
+            });
         },
         //确认选择
         handleConfirm() {

+ 6 - 0
pages-mine/pages/wallet.vue

@@ -81,6 +81,12 @@ export default {
             height: 'calc(100vh - 540rpx)'
         }
     },
+    // #ifdef MP-ALIPAY
+    onPullDownRefresh() {
+        this.$refs.pageRef?.loadData(true)
+    },
+    // #endif
+
     onLoad() {
         this.getWithdrawInfo()
         this.$nextTick(() => {

+ 9 - 2
pages-mine/pages/withdraw-detail.vue

@@ -29,6 +29,12 @@ export default {
             detailList: []
         }
     },
+    // #ifdef MP-ALIPAY
+    onPullDownRefresh() {
+        this.$refs.pageRef?.loadData(true)
+    },
+    // #endif
+
     onLoad(){
         this.$refs.pageRef?.loadData(true)
     },
@@ -90,8 +96,9 @@ export default {
     padding: 20rpx;
 
     .detail-list {
-        height: 100vh;
-
+        max-height: 100vh;
+        overflow-y: auto;
+        
         .detail-item {
             background: #FFFFFF;
             border-radius: 12rpx;

+ 18 - 5
pages.json

@@ -11,7 +11,8 @@
                 "navigationStyle": "custom",
                 "mp-alipay": {
                     "transparentTitle": "always",
-                    "titlePenetrate": "YES"
+                    "titlePenetrate": "YES",
+                    "pullRefresh": true
                 }
             }
         },
@@ -114,13 +115,19 @@
                 {
                     "path": "pages/wallet",
                     "style": {
-                        "navigationBarTitleText": "我的钱包"
+                        "navigationBarTitleText": "我的钱包",
+                        "mp-alipay":{
+                            "pullRefresh": true
+                        }
                     }
                 },
                 {
                     "path": "pages/withdraw-detail",
                     "style": {
-                        "navigationBarTitleText": "提现明细"
+                        "navigationBarTitleText": "提现明细",
+                        "mp-alipay":{
+                            "pullRefresh": true
+                        }
                     }
                 },
                 {
@@ -173,13 +180,19 @@
                 {
                     "path": "pages/partner/income-detail",
                     "style": {
-                        "navigationBarTitleText": "收入明细"
+                        "navigationBarTitleText": "收入明细",
+                        "mp-alipay":{
+                            "pullRefresh": true
+                        }
                     }
                 },
                 {
                     "path": "pages/partner/order-detail",
                     "style": {
-                        "navigationBarTitleText": "订单明细"
+                        "navigationBarTitleText": "订单明细",
+                        "mp-alipay":{
+                            "pullRefresh": true
+                        }
                     }
                 },
                 {

+ 156 - 153
pages/home/components/ScanBookList.vue

@@ -1,179 +1,182 @@
 <template>
-  <view class="wrapper">
-    <scroll-view
-      scroll-y
-      @scroll="onScroll"
-      :refresher-enabled="isAtTop"
-      :refresher-triggered="isRefreshing"
-      @refresherrefresh="onRefresh"
-      @scrolltoupper="scrollToUpper"
-      upper-threshold="5"
-      class="book-scroll"
-    >
-      <view class="scan-book-list">
-        <!-- 顶部提示 -->
-        <view class="tip-text">
-          套装书(相同ISBN相同的系列书籍)只需扫描其中一本,扫描价即套装价;需用户将整个套装全部寄出,缺册不予回收。
-        </view>
-
-        <!-- 书籍列表 -->
-        <view class="book-list">
-          <BookItem
-            v-for="book in bookList"
-            :key="book.isbn"
-            :book="book"
-            @delete="handleDeleteBook"
-            @quantity-change="handleQuantityChange"
-            @upsell="handleUpsell"
-          />
-        </view>
-
-        <view class="link-wrap flex-a">
-          <text class="link-btn flex-1" @click="goToScannedBooks"
-            >扫过的书 ></text
-          >
-          <text class="link-btn flex-1" @click="goToRules">卖书规则 ></text>
-        </view>
-      </view>
-    </scroll-view>
-  </view>
+    <view class="wrapper">
+        <scroll-view
+            scroll-y
+            @scroll="onScroll"
+            :refresher-enabled="isAtTop"
+            :refresher-triggered="isRefreshing"
+            @refresherrefresh="onRefresh"
+            @scrolltoupper="scrollToUpper"
+            upper-threshold="5"
+            class="book-scroll"
+        >
+            <view class="scan-book-list">
+                <!-- 顶部提示 -->
+                <view class="tip-text">
+                    套装书(相同ISBN相同的系列书籍)只需扫描其中一本,扫描价即套装价;需用户将整个套装全部寄出,缺册不予回收。
+                </view>
+
+                <!-- 书籍列表 -->
+                <view class="book-list">
+                    <BookItem
+                        v-for="book in bookList"
+                        :key="book.isbn"
+                        :book="book"
+                        @delete="handleDeleteBook"
+                        @quantity-change="handleQuantityChange"
+                        @upsell="handleUpsell"
+                    />
+                </view>
+
+                <view class="link-wrap flex-a">
+                    <text class="link-btn flex-1" @click="goToScannedBooks"
+                        >扫过的书 ></text
+                    >
+                    <text class="link-btn flex-1" @click="goToRules"
+                        >卖书规则 ></text
+                    >
+                </view>
+            </view>
+        </scroll-view>
+    </view>
 </template>
 
 <script>
 import BookItem from "./BookItem.vue";
 
 export default {
-  components: {
-    BookItem,
-  },
-  props: {
-    bookList: {
-      type: Array,
-      default: () => [],
+    components: {
+        BookItem,
     },
-  },
-  data() {
-    return {
-      books: [],
-      isRefreshing: false,
-      isAtTop: true, // 是否在顶部,默认为true
-      scrollTop: 0,
-    };
-  },
-  watch: {
-    bookList: {
-      handler(newVal) {
-        this.books = newVal;
-      },
-      deep: true,
-      immediate: true,
+    props: {
+        bookList: {
+            type: Array,
+            default: () => [],
+        },
     },
-  },
-  methods: {
-    // 滚动事件
-    onScroll(e) {
-      // 记录滚动位置
-      this.scrollTop = e.detail.scrollTop;
-
-      // 只有在最顶部时才能触发下拉刷新
-      this.isAtTop = this.scrollTop < 5;
+    data() {
+        return {
+            books: [],
+            isRefreshing: false,
+            isAtTop: true, // 是否在顶部,默认为true
+            scrollTop: 0,
+        };
     },
-
-    // 滚动到顶部事件
-    scrollToUpper() {
-      this.isAtTop = true;
-    },
-
-    // 下拉刷新
-    onRefresh() {
-      this.isRefreshing = true;
-
-      // 触发父组件的刷新事件
-      this.$emit("refresh");
-
-      // 模拟刷新完成
-      setTimeout(() => {
-        this.isRefreshing = false;
-      }, 600);
-    },
-
-    // 加价
-    handleUpsell(book) {
-      this.$emit("upsell", book);
-    },
-
-    handleDeleteBook(book) {
-      this.$emit("deleted", book);
+    watch: {
+        bookList: {
+            handler(newVal) {
+                this.books = newVal;
+            },
+            deep: true,
+            immediate: true,
+        },
     },
-
-    handleQuantityChange(data) {
-      const book = this.books.find((book) => book.isbn === data.isbn);
-      if (book) {
-        book.num = data.num;
-      }
-      this.$emit("updateBooks", this.books, book);
-    },
-
-    onNext() {
-      this.$emit("next");
-    },
-
-    goToScannedBooks() {
-      uni.navigateTo({
-        url: "/pages-home/pages/scaned-book",
-      });
+    methods: {
+        // 滚动事件
+        onScroll(e) {
+            // 记录滚动位置
+            this.scrollTop = e.detail.scrollTop;
+
+            // 只有在最顶部时才能触发下拉刷新
+            this.isAtTop = this.scrollTop < 5;
+        },
+
+        // 滚动到顶部事件
+        scrollToUpper() {
+            this.isAtTop = true;
+        },
+
+        // 下拉刷新
+        onRefresh() {
+            console.log("onRefresh");
+            this.isRefreshing = true;
+
+            // 触发父组件的刷新事件
+            this.$emit("refresh");
+
+            // 模拟刷新完成
+            setTimeout(() => {
+                this.isRefreshing = false;
+            }, 600);
+        },
+
+        // 加价
+        handleUpsell(book) {
+            this.$emit("upsell", book);
+        },
+
+        handleDeleteBook(book) {
+            this.$emit("deleted", book);
+        },
+
+        handleQuantityChange(data) {
+            const book = this.books.find((book) => book.isbn === data.isbn);
+            if (book) {
+                book.num = data.num;
+            }
+            this.$emit("updateBooks", this.books, book);
+        },
+
+        onNext() {
+            this.$emit("next");
+        },
+
+        goToScannedBooks() {
+            uni.navigateTo({
+                url: "/pages-home/pages/scaned-book",
+            });
+        },
+
+        goToRules() {
+            uni.navigateTo({
+                url: "/pages-mine/pages/rules-for-sellbooks",
+            });
+        },
     },
-
-    goToRules() {
-      uni.navigateTo({
-        url: "/pages-mine/pages/rules-for-sellbooks",
-      });
-    },
-  },
 };
 </script>
 
 <style lang="scss">
 .wrapper {
-  height: 100%;
-  width: 100%;
-  position: relative;
+    height: 100%;
+    width: 100%;
+    position: relative;
 }
 
 .book-scroll {
-  height: calc(100vh - 240px);
+    height: calc(100vh - 240px);
 }
 
 .scan-book-list {
-  padding: 20rpx;
-  display: flex;
-  flex-direction: column;
-
-  .tip-text {
-    font-family: Source Han Sans CN;
-    font-weight: 400;
-    font-size: 24rpx;
-    color: #ff8a4b;
-    line-height: 36rpx;
-  }
-
-  .link-wrap {
-    gap: 20rpx;
-    box-sizing: border-box;
-    margin-top: 20rpx;
-
-    .link-btn {
-      height: 80rpx;
-      background: #ffffff;
-      border-radius: 10rpx;
-      display: flex;
-      align-items: center;
-      justify-content: center;
-      font-family: PingFang SC;
-      font-weight: 500;
-      font-size: 32rpx;
-      color: #666666;
+    padding: 20rpx;
+    display: flex;
+    flex-direction: column;
+
+    .tip-text {
+        font-family: Source Han Sans CN;
+        font-weight: 400;
+        font-size: 24rpx;
+        color: #ff8a4b;
+        line-height: 36rpx;
+    }
+
+    .link-wrap {
+        gap: 20rpx;
+        box-sizing: border-box;
+        margin-top: 20rpx;
+
+        .link-btn {
+            height: 80rpx;
+            background: #ffffff;
+            border-radius: 10rpx;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            font-family: PingFang SC;
+            font-weight: 500;
+            font-size: 32rpx;
+            color: #666666;
+        }
     }
-  }
 }
 </style>

+ 29 - 137
pages/home/index.vue

@@ -88,11 +88,8 @@
         <!-- 温馨提示弹窗 -->
         <KindReminder ref="kindReminder" @start="handleStartSelling" @viewRules="handleViewRules" />
 
-        <view class="customer-service" :style="{
-            left: servicePosition.left + 'px',
-            right: servicePosition.right + 'px',
-            bottom: servicePosition.bottom + 'px',
-        }" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd">
+        <!-- 客服按钮 -->
+        <FloatingDrag :width="126" :height="140" :initial-position="servicePosition" @position-change="handlePositionChange">
             <!-- #ifdef MP-ALIPAY -->
             <button class="service-btn" @click="navigateToCustomerService">
                 <image src="/static/img/kf.png" mode="widthFix" style="width: 126rpx; height: 140rpx"></image>
@@ -103,7 +100,7 @@
                 <image src="/static/img/kf.png" mode="widthFix" style="width: 126rpx; height: 140rpx"></image>
             </button>
             <!-- #endif -->
-        </view>
+        </FloatingDrag>
 
         <ConfirmBooks ref="confirmBooks" @incomplete="handleIncomplete" />
         <!-- 首单免费弹窗 -->
@@ -135,6 +132,7 @@ import UpsellBook from "./components/upsell-book.vue";
 import UpsellRules from "./components/upsell-rules.vue";
 import UpsellShare from "./components/upsell-share.vue";
 import UpsellQrcode from "./components/upsell-qrcode.vue";
+import FloatingDrag from "@/components/floating-drag.vue";
 import { eventBus } from "@/utils/event-bus";
 
 const app = getApp();
@@ -153,6 +151,7 @@ export default {
         UpsellRules,
         UpsellShare,
         UpsellQrcode,
+        FloatingDrag,
     },
     data() {
         return {
@@ -171,17 +170,6 @@ export default {
                 right: 0,
                 bottom: "20%",
             },
-            // 触摸开始位置
-            startX: 0,
-            startY: 0,
-            // 屏幕宽度和高度
-            screenWidth: 0,
-            screenHeight: 0,
-            // 初始位置记录,用于计算拖动
-            initialLeft: 0,
-            initialBottom: 0,
-            // 是否正在更新位置,用于防止频繁更新
-            isUpdatingPosition: false,
             shareData: {},
             deleteBook: {},
         };
@@ -308,6 +296,11 @@ export default {
             this.getLastOrder();
         }
     },
+    // #ifdef MP-ALIPAY
+    onPullDownRefresh() {
+        this.getLastOrder()
+    },
+    // #endif
 
     //卸载loginSuccess事件
     onUnload() {
@@ -319,8 +312,8 @@ export default {
         // 登录成功之后
         loginSuccess() {
             let upsellCode = uni.getStorageSync("upsellCode");
-            console.log(upsellCode, "登录成功之后助力的 code值:", upsellCode);
             if (upsellCode) {
+                console.log(upsellCode, "登录成功之后助力的 code值:", upsellCode);
                 this.$refs.shareRef?.open(upsellCode);
             }
             this.getLastOrder();
@@ -362,110 +355,6 @@ export default {
             this.$refs.upsellRulesRef.open();
         },
 
-        // 触摸开始
-        touchStart(e) {
-            const touch = e.touches[0];
-            this.startX = touch.clientX;
-            this.startY = touch.clientY;
-
-            // 记录初始位置,用于计算移动距离
-            if (this.servicePosition.right !== "auto") {
-                // 如果是靠右定位,记录当前位置但不立即改变显示位置
-                // 只在内部计算中使用,避免视觉上的位置跳动
-                this.initialLeft = this.screenWidth - 126;
-            } else {
-                this.initialLeft = parseFloat(this.servicePosition.left);
-            }
-
-            // 如果bottom是百分比,转换为具体像素值,但不改变显示位置
-            if (
-                typeof this.servicePosition.bottom === "string" &&
-                this.servicePosition.bottom.includes("%")
-            ) {
-                const percentage = parseFloat(this.servicePosition.bottom) / 100;
-                this.initialBottom = this.screenHeight * percentage;
-            } else {
-                this.initialBottom = parseFloat(this.servicePosition.bottom);
-            }
-        },
-
-        // 触摸移动
-        touchMove(e) {
-            // 阻止默认行为,防止页面滚动
-            e.preventDefault && e.preventDefault();
-            e.stopPropagation && e.stopPropagation();
-
-            const touch = e.touches[0];
-
-            // 计算移动距离
-            const deltaX = touch.clientX - this.startX;
-            const deltaY = touch.clientY - this.startY;
-
-            // 使用初始位置计算新位置,避免累积误差
-            let newLeft = this.initialLeft + deltaX;
-            let newBottom = this.initialBottom - deltaY; // 注意:y轴方向是相反的
-
-            // 确保按钮不超出屏幕边界
-            if (newLeft < 0) {
-                newLeft = 0;
-            } else if (newLeft > this.screenWidth - 126) {
-                newLeft = this.screenWidth - 126;
-            }
-
-            // 确保按钮不超出屏幕垂直边界
-            if (newBottom < 20) {
-                newBottom = 20;
-            } else if (newBottom > this.screenHeight - 160) {
-                newBottom = this.screenHeight - 160;
-            }
-
-            // 使用节流方式更新位置,避免过于频繁的更新
-            if (!this.isUpdatingPosition) {
-                this.isUpdatingPosition = true;
-
-                // 更新位置 - 第一次移动时才真正改变right为auto
-                this.servicePosition = {
-                    left: newLeft,
-                    right: "auto",
-                    bottom: newBottom,
-                };
-
-                // 使用setTimeout代替requestAnimationFrame,在微信小程序中更兼容
-                setTimeout(() => {
-                    this.isUpdatingPosition = false;
-                }, 16); // 约等于60fps的刷新率
-            }
-
-            // 不更新起始点,保持相对于初始触摸点的位移计算
-            // 这样可以避免累积误差,使拖动更精确
-        },
-
-        // 触摸结束,实现吸附效果
-        touchEnd() {
-            // 确保不再有待处理的更新
-            this.isUpdatingPosition = false;
-
-            const buttonCenter = this.servicePosition.left + 63; // 按钮中心位置
-            const halfScreen = this.screenWidth / 2;
-
-            // 判断是吸附到左边还是右边
-            if (buttonCenter < halfScreen) {
-                // 吸附到左边
-                this.servicePosition = {
-                    left: 0,
-                    right: "auto",
-                    bottom: this.servicePosition.bottom,
-                };
-            } else {
-                // 吸附到右边
-                this.servicePosition = {
-                    left: "auto",
-                    right: 0,
-                    bottom: this.servicePosition.bottom,
-                };
-            }
-        },
-
         handleStart() {
             this.showPopup = true;
         },
@@ -615,8 +504,17 @@ export default {
                         })
                         : [];
                     this.serviceList = res.data.serviceList || [];
+                }else{
+                    uni.showToast({
+                        title: res.msg,
+                        icon: "none",
+                    });
                 }
-            });
+            }).finally(()=>{
+                // #ifdef MP-ALIPAY
+                my.stopPullDownRefresh()
+                // #endif
+            })
         },
 
         goToScannedBooks() {
@@ -631,25 +529,19 @@ export default {
             // 标记已显示过温馨提示
             uni.setStorageSync("kindReminderShown", true);
         },
+        // 处理位置变更
+        handlePositionChange(position) {
+            this.servicePosition = position;
+        },
     },
 };
 </script>
 
 <style lang="scss" scoped>
-.customer-service {
-    position: fixed;
-    width: 126rpx;
-    height: 140rpx;
-    bottom: 20%;
-    z-index: 999;
-    transition: all 0.3s ease;
-
-    /* 添加过渡效果使吸附更平滑 */
-    button {
-        height: max-content;
-        background-color: transparent;
-        padding: 0;
-    }
+.service-btn {
+    height: max-content;
+    background-color: transparent;
+    padding: 0;
 }
 
 .container {