sunshibo преди 2 месеца
родител
ревизия
3fb766066c

+ 10 - 1
api/dining.js

@@ -1,4 +1,13 @@
 import { api } from '@/utils/request.js';
 
 // 微信登录
-export const DiningUserWechatLogin = (params) => api.post({ url: '/dining/user/wechatLogin', params });
+export const DiningUserWechatLogin = (params) => api.post({ url: '/dining/user/wechatLogin', params });
+
+// 点餐页数据(入参 dinerCount 就餐人数、tableId 桌号)
+export const DiningOrderFood = (params) => api.get({ url: '/store/dining/page-info', params });
+
+// 菜品种类(入参 storeId,GET /store/info/categories?storeId=)
+export const GetStoreCategories = (params) => api.get({ url: '/store/info/categories', params });
+
+// 根据菜品种类获取菜品(入参 categoryId,GET /store/info/cuisines?categoryId=)
+export const GetStoreCuisines = (params) => api.get({ url: '/store/info/cuisines', params });

+ 13 - 2
manifest.json

@@ -15,7 +15,10 @@
             "autoclose" : true,
             "delay" : 0
         },
-        "modules" : {},
+        "modules" : {
+            "Barcode" : {},
+            "OAuth" : {}
+        },
         "distribute" : {
             "android" : {
                 "permissions" : [
@@ -38,7 +41,15 @@
                 ]
             },
             "ios" : {},
-            "sdkConfigs" : {}
+            "sdkConfigs" : {
+                "oauth" : {
+                    "univerify" : {},
+                    "weixin" : {
+                        "appid" : "wxc9598c736783dfa9",
+                        "UniversalLinks" : ""
+                    }
+                }
+            }
         }
     },
     "quickapp" : {},

+ 1 - 2
pages/components/LoginModal.vue

@@ -96,8 +96,7 @@ const handleGetPhoneNumber = async (e) => {
         try {
           // 调用快速登录接口
           const res = await DiningUserWechatLogin({
-            code: loginRes.code,
-            phoneCode: e.detail.code
+            code: loginRes.code
           });
 
           if (res && res.token) {

+ 35 - 3
pages/numberOfDiners/index.vue

@@ -14,6 +14,9 @@
     <view class="more-number" @click="addDiners" v-if="diners < 16">查看更多</view>
 
     <view class="confirm-button" @click="toOrderFood" hover-class="hover-active">确定</view>
+
+    <!-- 未登录时弹出:手机号授权一键登录 -->
+    <LoginModal v-model:open="showLoginModal" @success="handleLoginSuccess" @cancel="handleLoginCancel" />
   </view>
 </template>
 
@@ -21,9 +24,15 @@
 import { onLoad } from "@dcloudio/uni-app";
 import { ref } from "vue";
 import { go } from "@/utils/utils.js";
+import { useUserStore } from "@/store/user.js";
+import LoginModal from "@/pages/components/LoginModal.vue";
 
+const userStore = useUserStore();
 const diners = ref(12);
 const currentDiners = ref(2);
+const showLoginModal = ref(false);
+// 登录成功后要跳转的点餐页参数(手机号授权完成后再跳转)
+const pendingNavigate = ref(null);
 
 const addDiners = () => {
   diners.value = 16
@@ -33,14 +42,37 @@ const selectDiners = (item) => {
   currentDiners.value = item;
 };
 
+// 手机号授权登录成功:再跳转点餐页
+const handleLoginSuccess = () => {
+  if (pendingNavigate.value) {
+    const { tableid, dinersVal } = pendingNavigate.value;
+    pendingNavigate.value = null;
+    go(`/pages/orderFood/index?tableid=${tableid}&diners=${dinersVal}`);
+  }
+};
+
+const handleLoginCancel = () => {
+  pendingNavigate.value = null;
+};
+
 const toOrderFood = () => {
   uni.setStorageSync('currentDiners', currentDiners.value);
-  go('/pages/orderFood/index');
+  const tableid = 1;
+  const dinersVal = currentDiners.value;
+
+  if (!userStore.getToken) {
+    // 未登录:弹出手机号授权一键登录弹窗,登录成功后再跳转
+    pendingNavigate.value = { tableid, dinersVal };
+    showLoginModal.value = true;
+    return;
+  }
+
+  go(`/pages/orderFood/index?tableid=${tableid}&diners=${dinersVal}`);
 };
 
 onLoad((e) => {
-  let currentDiners = uni.getStorageSync('currentDiners');
-  if (currentDiners) currentDiners.value = currentDiners;
+  // let currentDiners = uni.getStorageSync('currentDiners');
+  // if (currentDiners) currentDiners.value = currentDiners;
 });
 </script>
 

+ 15 - 10
pages/orderFood/components/BottomActionBar.vue

@@ -41,25 +41,30 @@ const props = defineProps({
 
 const emit = defineEmits(['coupon-click', 'cart-click', 'order-click']);
 
-// 计算总数量
+// 取单品金额(与 FoodCard 第 10 行显示的菜品金额一致:优先 totalPrice,再兼容 price 等)
+const getItemPrice = (item) => {
+  const p = item?.totalPrice ?? item?.price ?? item?.salePrice ?? item?.currentPrice ?? item?.unitPrice ?? 0;
+  return Number(p) || 0;
+};
+
+// 计算总数量(与 FoodCard 第 32 行当前菜品数量一致)
 const totalQuantity = computed(() => {
-  return props.cartList.reduce((sum, item) => {
-    return sum + (item.quantity || 0);
-  }, 0);
+  return props.cartList.reduce((sum, item) => sum + (Number(item?.quantity) || 0), 0);
 });
 
-// 计算总价格
+// 总金额 = 菜品金额×当前菜品数量 + 其他选中项(菜品金额×当前数量)… 即 Σ(菜品金额 × 当前菜品数量)
 const totalPrice = computed(() => {
   return props.cartList.reduce((sum, item) => {
-    const quantity = item.quantity || 0;
-    const price = item.price || 0;
-    return sum + (quantity * price);
+    const quantity = Number(item?.quantity) || 0;
+    const price = getItemPrice(item);
+    return sum + quantity * price;
   }, 0);
 });
 
-// 格式化价格(显示为整数)
+// 格式化总金额
 const formatPrice = (price) => {
-  return Math.round(price).toFixed(0);
+  const num = Number(price);
+  return Number.isNaN(num) ? '0.00' : num.toFixed(2);
 };
 
 // 优惠券点击

+ 7 - 1
pages/orderFood/components/CartModal.vue

@@ -13,7 +13,7 @@
             <scroll-view class="cart-modal__list" scroll-y>
                 <view v-for="(item, index) in cartList" :key="item.id || index" class="cart-item">
                     <!-- 菜品图片 -->
-                    <image :src="item.image" mode="aspectFill" class="cart-item__image"></image>
+                    <image :src="getItemImageSrc(item)" mode="aspectFill" class="cart-item__image"></image>
 
                     <!-- 菜品信息 -->
                     <view class="cart-item__info">
@@ -116,6 +116,12 @@ const formatPrice = (price) => {
     return Math.round(price).toFixed(0);
 };
 
+// 菜品图片地址:兼容接口字段 image/imageUrl/pic/cover,相对路径经 getFileUrl 补全 CDN
+const getItemImageSrc = (item) => {
+    const url = item?.image ?? item?.imageUrl ?? item?.pic ?? item?.cover ?? '';
+    return url ? getFileUrl(url) : '';
+};
+
 // 处理关闭
 const handleClose = () => {
     getOpen.value = false;

+ 47 - 6
pages/orderFood/components/FoodCard.vue

@@ -1,19 +1,19 @@
 <template>
   <view class="food-card">
     <view class="food-item">
-      <image class="food-image" :src="food.image" mode="aspectFill" @click="handleFoodClick" />
+      <image class="food-image" :src="food.images" mode="aspectFill" @click="handleFoodClick" />
       <view class="food-info">
         <view class="food-header">
           <view class="food-title">{{ food.name }}</view>
           <view class="food-price">
             <text class="price-symbol">¥</text>
-            <text class="price-main">{{ getPriceMain(food.price) }}</text>
-            <text class="price-decimal" v-if="getPriceDecimal(food.price)">.{{ getPriceDecimal(food.price) }}</text>
+            <text class="price-main">{{ getPriceMain(food.totalPrice) }}</text>
+            <text class="price-decimal" v-if="getPriceDecimal(food.totalPrice)">.{{ getPriceDecimal(food.totalPrice) }}</text>
           </view>
         </view>
-        <view class="food-desc">{{ food.desc }}</view>
-        <view class="food-tags">
-          <view v-for="(tag, tagIndex) in food.tags" :key="tagIndex" class="food-tag" :class="tag.type">
+        <view class="food-desc">{{ food.description }}</view>
+        <view class="food-tags" v-if="normalizedTags.length">
+          <view v-for="(tag, tagIndex) in normalizedTags" :key="tagIndex" class="food-tag" :class="tag.type">
             {{ tag.text }}
           </view>
         </view>
@@ -41,6 +41,7 @@
 </template>
 
 <script setup>
+import { computed } from "vue";
 import { getFileUrl } from "@/utils/file.js";
 import { go } from "@/utils/utils.js";
 
@@ -63,6 +64,44 @@ const props = defineProps({
 
 const emit = defineEmits(['increase', 'decrease']);
 
+// 后端返回的 tags 统一为 [{ text, type }] 便于绑定(兼容多种字段名与格式)
+const normalizedTags = computed(() => {
+  const food = props.food;
+  let raw = food?.tags ?? food?.tagList ?? food?.tagNames ?? food?.labels ?? food?.tag;
+  if (raw == null) return [];
+
+  // 第一步:先把各种类型统一转为数组
+  let arr = [];
+  if (Array.isArray(raw)) {
+    arr = raw;
+  } else if (typeof raw === 'string') {
+    const trimmed = raw.trim();
+    if (trimmed.startsWith('[')) {
+      try {
+        arr = JSON.parse(trimmed);
+        if (!Array.isArray(arr)) arr = [];
+      } catch {
+        arr = trimmed ? [trimmed] : [];
+      }
+    } else {
+      arr = trimmed ? trimmed.split(/[,,、\s]+/).map(s => s.trim()).filter(Boolean) : [];
+    }
+  } else if (raw && typeof raw === 'object') {
+    arr = Array.isArray(raw.list) ? raw.list : Array.isArray(raw.items) ? raw.items : [];
+  }
+
+  // 第二步:将数组每一项转为 { text, type }
+  return arr.map(item => {
+    if (item == null) return { text: '', type: '' };
+    if (typeof item === 'string') return { text: item, type: '' };
+    if (typeof item === 'number') return { text: String(item), type: '' };
+    return {
+      text: item.text ?? item.tagName ?? item.name ?? item.label ?? item.title ?? '',
+      type: item.type ?? item.tagType ?? ''
+    };
+  }).filter(t => t.text !== '' && t.text != null);
+});
+
 const handleFoodClick = () => {
   go('/pages/foodDetail/index');
 };
@@ -179,6 +218,8 @@ const getPriceDecimal = (price) => {
   padding: 4rpx 12rpx;
   border-radius: 4rpx;
   font-size: 20rpx;
+  color: #333;
+  background-color: #f0f0f0;
 
   &.signature {
     background: linear-gradient(90deg, #FCB13F 0%, #FC793D 100%);

+ 121 - 89
pages/orderFood/index.vue

@@ -1,7 +1,7 @@
 <template>
   <!-- 点餐页 -->
   <view class="content">
-    <view class="top-info">桌号:A08 &nbsp;&nbsp;就餐人数:{{ currentDiners }}人</view>
+    <view class="top-info">桌号:{{ tableId || '—' }} &nbsp;&nbsp;就餐人数:{{ currentDiners }}人</view>
     <!-- 搜索 -->
     <input type="text" placeholder="请输入菜品名称" class="search-input" />
 
@@ -11,7 +11,7 @@
       <scroll-view class="category-list" scroll-y>
         <view v-for="(category, index) in categories" :key="index" class="category-item"
           :class="{ active: currentCategoryIndex === index }" @click="selectCategory(index)">
-          {{ category.name }}
+          {{ category.categoryName }}
         </view>
       </scroll-view>
 
@@ -50,8 +50,10 @@ import CouponModal from "./components/CouponModal.vue";
 import CartModal from "./components/CartModal.vue";
 import SelectCouponModal from "./components/SelectCouponModal.vue";
 import { go } from "@/utils/utils.js";
+import { DiningOrderFood, GetStoreCategories, GetStoreCuisines } from "@/api/dining.js";
 
-const currentDiners = ref(uni.getStorageSync('currentDiners'));
+const tableId = ref(''); // 桌号,来自上一页 url 参数 tableid
+const currentDiners = ref(uni.getStorageSync('currentDiners') || '');
 const currentCategoryIndex = ref(0);
 const couponModalOpen = ref(false);
 const cartModalOpen = ref(false);
@@ -59,86 +61,30 @@ const selectCouponModalOpen = ref(false);
 const discountAmount = ref(12); // 优惠金额,示例数据
 const selectedCouponId = ref(null); // 选中的优惠券ID
 
-// 分类列表
-const categories = ref([
-  { name: '推荐菜品', id: 'recommend' },
-  { name: '招牌川菜', id: 'signature' },
-  { name: '凉菜', id: 'cold' },
-  { name: '热菜', id: 'hot' },
-  { name: '汤品', id: 'soup' },
-  { name: '主食', id: 'staple' },
-  { name: '饮品', id: 'drink' }
-]);
+// 分类列表(由接口 /store/info/categories 返回后赋值)
+const categories = ref([]);
 
-// 菜品列表数据(示例数据)
-const foodList = ref([
-  {
-    id: 1,
-    name: '炭烤牛排',
-    price: 26,
-    desc: '正宗川味, 麻辣鲜香, 豆腐滑嫩',
-    image: '/static/demo.png',
-    tags: [
-      { text: '招牌', type: 'signature' },
-      { text: '中辣', type: 'spicy' }
-    ],
-    monthlySales: 160,
-    quantity: 0,
-    categoryId: 'recommend'
-  },
-  {
-    id: 2,
-    name: '炭烤牛排',
-    price: 26,
-    desc: '正宗川味, 麻辣鲜香, 豆腐滑嫩',
-    image: '/static/demo.png',
-    tags: [
-      { text: '招牌', type: 'signature' },
-      { text: '中辣', type: 'spicy' }
-    ],
-    monthlySales: 160,
-    quantity: 99,
-    categoryId: 'recommend'
-  },
-  {
-    id: 3,
-    name: '炭烤牛排',
-    price: 26,
-    desc: '正宗川味, 麻辣鲜香, 豆腐滑嫩',
-    image: '/static/demo.png',
-    tags: [
-      { text: '招牌', type: 'signature' },
-      { text: '中辣', type: 'spicy' }
-    ],
-    monthlySales: 160,
-    quantity: 23,
-    categoryId: 'cold'
-  },
-  {
-    id: 4,
-    name: '炭烤牛排',
-    price: 26,
-    desc: '正宗川味, 麻辣鲜香, 豆腐滑嫩',
-    image: '/static/demo.png',
-    tags: [
-      { text: '招牌', type: 'signature' },
-      { text: '中辣', type: 'spicy' }
-    ],
-    monthlySales: 160,
-    quantity: 0,
-    categoryId: 'cold'
-  }
-]);
+// 菜品列表(由接口 /store/info/cuisines 按分类拉取并合并,每项含 quantity、categoryId)
+const foodList = ref([]);
 
-// 当前分类的菜品列表
+// 当前分类的菜品列表(按当前选中的分类 id 过滤)
 const currentFoodList = computed(() => {
-  const categoryId = categories.value[currentCategoryIndex.value].id;
-  return foodList.value.filter(food => food.categoryId === categoryId);
+  const cat = categories.value[currentCategoryIndex.value];
+  if (!cat) return [];
+  const categoryId = cat.id ?? cat.categoryId;
+  return foodList.value.filter((food) => String(food?.categoryId ?? '') === String(categoryId ?? ''));
 });
 
-// 购物车列表(只包含数量大于0的菜品
+// 购物车列表:只包含数量>0 的菜品,并按菜品 id 去重(同一菜品只算一条,避免金额叠加)
 const cartList = computed(() => {
-  return foodList.value.filter(food => food.quantity > 0);
+  const withQty = foodList.value.filter((food) => (food.quantity || 0) > 0);
+  const seen = new Set();
+  return withQty.filter((f) => {
+    const id = String(f?.id ?? '');
+    if (seen.has(id)) return false;
+    seen.add(id);
+    return true;
+  });
 });
 
 // 优惠券列表(示例数据)
@@ -182,23 +128,65 @@ const availableCoupons = computed(() => {
   return couponList.value.filter(coupon => coupon.isReceived);
 });
 
-// 选择分类
-const selectCategory = (index) => {
+// 分类 id 统一转字符串,避免 number/string 比较导致误判
+const sameCategory = (a, b) => String(a ?? '') === String(b ?? '');
+
+// 根据分类 id 拉取菜品并合并到 foodList,切换分类时保留其他分类已选菜品及本分类已选数量
+const fetchCuisinesByCategoryId = async (categoryId) => {
+  if (!categoryId) return;
+  try {
+    const res = await GetStoreCuisines({ categoryId });
+    const list = res?.list ?? res?.data ?? (Array.isArray(res) ? res : []);
+    const normalized = (Array.isArray(list) ? list : []).map(item => ({
+      ...item,
+      quantity: item.quantity ?? 0,
+      categoryId: item.categoryId ?? categoryId
+    }));
+    // 其他分类的菜品原样保留(含已选数量)
+    const rest = foodList.value.filter(f => !sameCategory(f.categoryId, categoryId));
+    // 本分类:按菜品 id 从整份列表里取已选数量,id 一致则自动带上数量
+    const merged = normalized.map((newItem) => {
+      const existing = foodList.value.find(
+        (e) => String(e?.id ?? '') === String(newItem?.id ?? '')
+      );
+      const quantity = existing ? existing.quantity : (newItem.quantity ?? 0);
+      return { ...newItem, quantity };
+    });
+    foodList.value = [...rest, ...merged];
+  } catch (err) {
+    console.error('获取菜品失败:', err);
+  }
+};
+
+// 选择分类:切换高亮并拉取该分类菜品
+const selectCategory = async (index) => {
   currentCategoryIndex.value = index;
+  const cat = categories.value[index];
+  if (!cat) return;
+  const categoryId = cat.id ?? cat.categoryId;
+  await fetchCuisinesByCategoryId(categoryId);
+};
+
+// 更新菜品数量:菜品 id 一致则全部同步为同一数量,触发响应式使底部金额重新计算
+const updateFoodQuantity = (food, delta) => {
+  if (!food) return;
+  const id = food.id;
+  const nextQty = Math.max(0, (food.quantity || 0) + delta);
+  const sameId = (item) =>
+    String(item?.id ?? '') === String(id ?? '');
+  foodList.value = foodList.value.map((item) =>
+    sameId(item) ? { ...item, quantity: nextQty } : item
+  );
 };
 
 // 增加数量
 const handleIncrease = (food) => {
-  if (food) {
-    food.quantity = (food.quantity || 0) + 1;
-  }
+  updateFoodQuantity(food, 1);
 };
 
 // 减少数量
 const handleDecrease = (food) => {
-  if (food && food.quantity > 0) {
-    food.quantity -= 1;
-  }
+  updateFoodQuantity(food, -1);
 };
 
 // 优惠券点击(领取优惠券弹窗)
@@ -306,10 +294,54 @@ const handleOrderClick = (data) => {
   go('/pages/placeOrder/index');
 };
 
-onLoad((e) => {
-  uni.setNavigationBarTitle({
-    title: '店铺名称'
-  });
+onLoad(async (options) => {
+  // 获取上一页(选择就餐人数页)传来的桌号和就餐人数
+  const tableid = options.tableid || '';
+  const diners = options.diners || '';
+  tableId.value = tableid;
+  currentDiners.value = diners;
+  console.log('点餐页接收参数 - 桌号(tableid):', tableid, '就餐人数(diners):', diners);
+
+  // 调用点餐页接口,入参 dinerCount、tableId
+  if (tableid || diners) {
+    try {
+      const res = await DiningOrderFood({
+        tableId: tableid,
+        dinerCount: diners
+      });
+      console.log('点餐页接口返回:', res);
+
+      // 成功后调接口获取菜品种类(storeId 取自点餐页接口返回,若无则需从别处获取)
+      const storeId = res?.storeId ?? res?.data?.storeId ?? '';
+      if (storeId) {
+        try {
+          const categoriesRes = await GetStoreCategories({ storeId });
+          const list = categoriesRes?.list ?? categoriesRes?.data ?? categoriesRes;
+          if (Array.isArray(list) && list.length) {
+            categories.value = list;
+            // 默认用第一项的分类 id 拉取菜品
+            const firstCat = list[0];
+            const firstCategoryId = firstCat.id ?? firstCat.categoryId;
+            if (firstCategoryId) {
+              const cuisinesRes = await GetStoreCuisines({ categoryId: firstCategoryId });
+              const cuisinesList = cuisinesRes?.list ?? cuisinesRes?.data ?? (Array.isArray(cuisinesRes) ? cuisinesRes : []);
+              foodList.value = (Array.isArray(cuisinesList) ? cuisinesList : []).map(item => ({
+                ...item,
+                quantity: item.quantity ?? 0,
+                categoryId: item.categoryId ?? firstCategoryId
+              }));
+              console.log('默认分类菜品:', cuisinesRes);
+            }
+          }
+          console.log('菜品种类:', categoriesRes);
+        } catch (err) {
+          console.error('获取菜品种类失败:', err);
+        }
+      }
+    } catch (e) {
+      console.error('点餐页接口失败:', e);
+    }
+  }
 });
 </script>
 

+ 46 - 36
pages/personal/userInfo.vue

@@ -6,6 +6,18 @@
 			<view class="user-item">
 				<view class="user-item-label">头像</view>
 				<view class="user-item-value">
+					<!-- #ifdef MP-WEIXIN -->
+					<button class="avatar-btn" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
+						<view class="avatar-container">
+							<image 
+								:src="formData.avatar || getFileUrl('img/personal/userDemo.png')" 
+								:mode="formData.avatar ? 'aspectFill' : 'widthFix'" 
+								class="avatar-img"
+							/>
+						</view>
+					</button>
+					<!-- #endif -->
+					<!-- #ifndef MP-WEIXIN -->
 					<view class="avatar-container" @click="handleAvatarClick">
 						<image 
 							:src="formData.avatar || getFileUrl('img/personal/userDemo.png')" 
@@ -13,15 +25,21 @@
 							class="avatar-img"
 						/>
 					</view>
+					<!-- #endif -->
 				</view>
 			</view>
 
-			<!-- 昵称 -->
+			<!-- 昵称:微信端 type="nickname" 可一键填入微信昵称 -->
 			<view class="user-item">
 				<view class="user-item-label">昵称</view>
 				<view class="user-item-value">
-					<input v-model="formData.nickname" class="user-input" placeholder="请输入"
-						placeholder-style="color: #999;" />
+					<input
+						v-model="formData.nickname"
+						type="nickname"
+						class="user-input"
+						placeholder="请输入昵称,可点击使用微信昵称"
+						placeholder-style="color: #999;"
+					/>
 				</view>
 			</view>
 
@@ -138,44 +156,25 @@ const handleAvatarClick = () => {
 	});
 };
 
-// 获取微信头像
+// 微信小程序:通过「头像昵称填写」能力选择头像(button open-type="chooseAvatar" 触发)
+// 注意:e.detail.avatarUrl 为临时路径,需上传到服务器后保存永久链接
+const onChooseAvatar = (e) => {
+	if (e.detail && e.detail.avatarUrl) {
+		formData.value.avatar = e.detail.avatarUrl;
+		uni.showToast({ title: '头像已选择', icon: 'success' });
+	}
+};
+
+// 获取微信头像(仅非 MP-WEIXIN 时从 actionSheet 进入;MP-WEIXIN 已改用模板内 button chooseAvatar)
 const handleWechatAvatar = () => {
 	// #ifdef MP-WEIXIN
-	// 先尝试从已登录的用户信息中获取头像
-	const userInfo = userStore.getUserInfo;
-	if (userInfo && userInfo.avatar) {
-		formData.value.avatar = userInfo.avatar;
-		uni.showToast({
-			title: '已使用微信头像',
-			icon: 'success'
-		});
-		return;
-	}
-	
-	// 如果用户信息中没有头像,则调用微信API获取
-	wx.getUserProfile({
-		desc: '用于完善个人资料',
-		success: (res) => {
-			if (res.userInfo && res.userInfo.avatarUrl) {
-				formData.value.avatar = res.userInfo.avatarUrl;
-				uni.showToast({
-					title: '获取成功',
-					icon: 'success'
-				});
-			}
-		},
-		fail: (err) => {
-			console.log('获取微信头像失败', err);
-			uni.showToast({
-				title: '获取头像失败',
-				icon: 'none'
-			});
-		}
+	// 微信已废弃 getUserProfile,请直接点击页面头像区域,使用「选择头像」按钮
+	uni.showToast({
+		title: '请点击上方头像区域选择',
+		icon: 'none'
 	});
 	// #endif
-	
 	// #ifndef MP-WEIXIN
-	// 非微信小程序环境,提示用户
 	uni.showToast({
 		title: '当前环境不支持',
 		icon: 'none'
@@ -273,6 +272,17 @@ const handleChangePhone = () => {
 }
 
 // 头像样式
+.avatar-btn {
+	padding: 0;
+	margin: 0;
+	background: transparent;
+	border: none;
+	line-height: 1;
+	&::after {
+		border: none;
+	}
+}
+
 .avatar-container {
 	width: 76rpx;
 	height: 76rpx;