sunshibo il y a 10 heures
Parent
commit
f0ff6efe9c

+ 4 - 3
api/dining.js

@@ -237,9 +237,10 @@ export const PostOrderPay = (params) => {
   if (params.payAmount != null && params.payAmount !== '') {
     query.payAmount = params.payAmount;
   }
-  if (params.serviceFee != null && params.serviceFee !== '') {
-    query.serviceFee = params.serviceFee;
-  }
+  // 本版本不参与服务费(恢复 prePay 传 serviceFee 时取消下方注释)
+  // if (params.serviceFee != null && params.serviceFee !== '') {
+  //   query.serviceFee = params.serviceFee;
+  // }
   return api.get({
     url: '/payment/prePay',
     params: query

+ 4 - 3
api/genericDining.js

@@ -247,9 +247,10 @@ export const PostOrderPay = (params) => {
   if (params.payAmount != null && params.payAmount !== '') {
     query.payAmount = params.payAmount;
   }
-  if (params.serviceFee != null && params.serviceFee !== '') {
-    query.serviceFee = params.serviceFee;
-  }
+  // 本版本不参与服务费(恢复时取消注释)
+  // if (params.serviceFee != null && params.serviceFee !== '') {
+  //   query.serviceFee = params.serviceFee;
+  // }
   return api.get({
     url: '/payment/prePay',
     params: query

+ 21 - 11
pages/checkout/index.vue

@@ -82,10 +82,12 @@
           <view class="info-item-label">菜品总价</view>
           <view class="info-item-value">¥{{ formatPrice(foodSubtotalForDisplay) }}</view>
         </view>
+        <!-- 本版本不参与服务费
         <view class="info-item">
           <view class="info-item-label">服务费</view>
           <view class="info-item-value">¥{{ formatPrice(orderInfo.serviceFee ?? 0) }}</view>
         </view>
+        -->
         <view class="info-item info-item--coupon info-item--clickable" @click="onCouponRowClick">
           <view class="info-item-label">优惠券</view>
           <view class="info-item-value coupon-value">
@@ -189,10 +191,10 @@ function adjustDiners(delta) {
   if (next < MIN_DINERS || next > MAX_DINERS) return;
   orderInfo.value.diners = String(next);
   uni.setStorageSync('currentDiners', String(next));
-  // 仅当接口判定为「按人数计费」(feeType === 1) 时,改人数才重新估算服务费
-  if (Number(estimateFeeType.value) === 1) {
-    fetchServiceFeeEstimate().catch((err) => console.warn('按人数重算服务费失败:', err));
-  }
+  // 本版本不参与服务费(恢复按人数重算时取消注释)
+  // if (Number(estimateFeeType.value) === 1) {
+  //   fetchServiceFeeEstimate().catch((err) => console.warn('按人数重算服务费失败:', err));
+  // }
 }
 
 // 展示用菜品小计:有明细时与行成交价一致;否则用接口 dishTotal 或 totalAmount − 服务费
@@ -350,9 +352,14 @@ function parseEstimateFeeType(res) {
 }
 
 /**
- * 调用 /store/dining/service-fee/estimate,更新服务费与 estimateFeeType
+ * 服务费估算(本版本关闭:不参与服务费)
  */
 async function fetchServiceFeeEstimate() {
+  orderInfo.value.serviceFee = 0;
+  estimateFeeType.value = null;
+  recalcDiscountAfterServiceFeeChange();
+  updateCheckoutPayAmount();
+  /* 原 /store/dining/service-fee/estimate 逻辑(恢复时整段移出注释)
   const storeId = orderInfo.value.storeId || uni.getStorageSync('currentStoreId') || '';
   const tableId = getTableIdForServiceFeeEstimate();
   if (!storeId || !tableId) return;
@@ -380,6 +387,7 @@ async function fetchServiceFeeEstimate() {
   } catch (e) {
     console.warn('结算页服务费估算失败:', e);
   }
+  */
 }
 
 function formatPrice(price) {
@@ -497,13 +505,15 @@ const fetchOrderDetail = async () => {
     orderInfo.value.nominalValue = raw?.nominalValue ?? null;
     orderInfo.value.discountAmount = Number(raw?.discountAmount ?? raw?.couponAmount ?? raw?.couponDiscount ?? 0) || 0;
     orderInfo.value.payAmount = Number(raw?.payAmount ?? raw?.totalAmount ?? raw?.totalPrice ?? 0) || 0;
-    orderInfo.value.serviceFee =
-      Number(raw?.serviceFee ?? raw?.serviceCharge ?? raw?.tablewareFee ?? 0) || 0;
+    // 本版本不参与服务费:不从订单拉取服务费
+    // orderInfo.value.serviceFee =
+    //   Number(raw?.serviceFee ?? raw?.serviceCharge ?? raw?.tablewareFee ?? 0) || 0;
+    orderInfo.value.serviceFee = 0;
     const list = raw?.orderItemList ?? raw?.orderItems ?? raw?.items ?? raw?.detailList ?? [];
     foodList.value = (Array.isArray(list) ? list : []).map(normalizeOrderItem);
     selectedCouponId.value = orderInfo.value.couponId != null && orderInfo.value.couponId !== '' ? String(orderInfo.value.couponId) : null;
     updateCheckoutPayAmount();
-    await fetchServiceFeeEstimate();
+    await fetchServiceFeeEstimate(); // 本版为 no-op(不参与服务费)
   } catch (err) {
     console.error('获取订单详情失败:', err);
     uni.showToast({ title: '加载失败', icon: 'none' });
@@ -545,7 +555,7 @@ const handleConfirmPay = async () => {
           ? String(selectedCouponId.value)
           : '';
     const discountAmountVal = Number(orderInfo.value.discountAmount) || 0;
-    const serviceFeeVal = Math.round((Number(orderInfo.value.serviceFee ?? 0) || 0) * 100) / 100;
+    // const serviceFeeVal = Math.round((Number(orderInfo.value.serviceFee ?? 0) || 0) * 100) / 100;
     const res = await diningApi.PostOrderPay({
       orderNo,
       payer: openid,
@@ -555,8 +565,8 @@ const handleConfirmPay = async () => {
       couponId: couponIdVal || undefined,
       payerId: payerId ? String(payerId) : undefined,
       discountAmount: discountAmountVal,
-      payAmount: payAmountVal,
-      serviceFee: serviceFeeVal
+      payAmount: payAmountVal
+      // serviceFee: serviceFeeVal // 本版本不参与服务费
     });
     uni.hideLoading();
     uni.requestPayment({

+ 22 - 11
pages/numberOfDiners/index.vue

@@ -25,7 +25,6 @@
 <script setup>
 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";
 import { TOKEN } from "@/settings/enums.js";
@@ -34,7 +33,7 @@ const userStore = useUserStore();
 const diners = ref(12);
 const currentDiners = ref(1);
 const showLoginModal = ref(false);
-// 登录成功后要跳转的点餐页参数(手机号授权完成后再跳转
+// 登录成功后进入点餐页所需参数(手机号授权完成后再 navigate
 const pendingNavigate = ref(null);
 
 const addDiners = () => {
@@ -45,12 +44,24 @@ const selectDiners = (item) => {
   currentDiners.value = item;
 };
 
-// 手机号授权登录成功:先进入就餐信息页,再在该页确认后进入点餐
+/** 本版本不上预约:选完人数直接进入点餐页 */
+function navigateToOrderFood(tableid, dinersVal) {
+  const q = [];
+  if (tableid) q.push(`tableid=${encodeURIComponent(String(tableid))}`);
+  q.push(`diners=${encodeURIComponent(String(dinersVal ?? currentDiners.value))}`);
+  uni.navigateTo({
+    url: `/pages/orderFood/index?${q.join('&')}`
+  });
+}
+
+// 手机号授权登录成功:本版本不上预约,原「就餐信息页 diningInfo」流程已注释
 const handleLoginSuccess = () => {
-  if (pendingNavigate.value) {
-    pendingNavigate.value = null;
-    go('/pages/diningInfo/index');
-  }
+  const pending = pendingNavigate.value;
+  pendingNavigate.value = null;
+  if (!pending) return;
+  const { tableid, dinersVal } = pending;
+  navigateToOrderFood(tableid, dinersVal);
+  // go('/pages/diningInfo/index');
 };
 
 const handleLoginCancel = () => {
@@ -66,14 +77,14 @@ const toOrderFood = () => {
 
   const token = userStore.getToken || uni.getStorageSync(TOKEN) || '';
   if (!token) {
-    // 未登录:弹出手机号授权一键登录弹窗,登录成功后再跳转就餐信息页
+    // 未登录:授权成功后与已登录一致,直接进入点餐页(不上预约 / diningInfo)
     pendingNavigate.value = { tableid, dinersVal };
     showLoginModal.value = true;
     return;
   }
-  uni.navigateTo({
-    url: '/pages/diningInfo/index'
-  });
+  // 本版本不上预约:不到 diningInfo,选毕人数直接去点餐
+  // uni.navigateTo({ url: '/pages/diningInfo/index' });
+  navigateToOrderFood(tableid, dinersVal);
 }
 
 // 页面加载时仅同步参数到 storage,不自动弹出登录框;未登录时只能在点击「确定」时弹出登录框

+ 5 - 6
pages/orderFood/index.vue

@@ -364,7 +364,8 @@ const fetchAndMergeCart = async (tableid) => {
       items: list,
       totalAmount: Number(cartRes?.totalAmount) || 0,
       totalQuantity: Number(cartRes?.totalQuantity) || 0,
-      serviceFee: Number(cartRes?.serviceFee ?? cartRes?.serviceCharge ?? 0) || 0
+      // 本版不参与服务费:不采用接口返回的 serviceFee
+      serviceFee: 0
     };
     mergeCartIntoFoodList();
     console.log('购物车接口返回(data 层):', cartRes, '解析条数:', list.length);
@@ -830,7 +831,7 @@ const handleCartClear = () => {
     pendingCartData = list;
     const totalAmount = Number(res?.totalAmount) || 0;
     const totalQuantity = Number(res?.totalQuantity) || 0;
-    const serviceFee = Number(res?.serviceFee ?? res?.serviceCharge ?? 0) || 0;
+    const serviceFee = 0; // 本版不参与服务费
     cartData.value = { items: list, totalAmount, totalQuantity, serviceFee };
     mergeCartIntoFoodList();
     cartModalOpen.value = false;
@@ -862,7 +863,7 @@ const handleOrderClick = () => {
     return;
   }
   const totalAmount = displayTotalAmount.value;
-  const serviceFeeVal = Number(cartData.value?.serviceFee) || 0;
+  const serviceFeeVal = 0; // 本版不参与服务费
   const cartPayload = {
     list: displayCartListWithTags.value,
     totalAmount,
@@ -912,9 +913,7 @@ onLoad(async (options) => {
               items: Array.isArray(items) ? items : [],
               totalAmount: Number(payload?.totalAmount) || 0,
               totalQuantity: Number(payload?.totalQuantity) || 0,
-              serviceFee:
-                Number(payload?.serviceFee ?? payload?.serviceCharge ?? 0) ||
-                (cartData.value?.serviceFee ?? 0)
+              serviceFee: 0 // 本版不参与服务费
             };
             pendingCartData = null;
             mergeCartIntoFoodList();

+ 2 - 0
pages/orderInfo/orderDetail.vue

@@ -45,10 +45,12 @@
           <view class="info-item-label">菜品总价</view>
           <view class="info-item-value">¥{{ priceDetail.dishTotal }}</view>
         </view>
+        <!-- 本版本不参与服务费
         <view class="info-item">
           <view class="info-item-label">服务费</view>
           <view class="info-item-value">¥{{ priceDetail.serviceFee }}</view>
         </view>
+        -->
         <!-- 已完成订单:优惠金额(满减用 nominalValue;折扣按菜品总价与折扣率计算,与结算页选券逻辑一致) -->
         <view
           v-if="orderDetail.orderStatus === 3 && completedOrderDiscountDisplay > 0"

+ 16 - 8
pages/placeOrder/index.vue

@@ -78,10 +78,12 @@
           <view class="info-item-label">菜品总价</view>
           <view class="info-item-value">¥{{ formatPrice(dishTotal) }}</view>
         </view>
+        <!-- 本版本不参与服务费
         <view class="info-item">
           <view class="info-item-label">服务费</view>
           <view class="info-item-value">¥{{ formatPrice(orderInfo.serviceFee ?? 0) }}</view>
         </view>
+        -->
 
         <view class="price-line">
           <view class="price-line-label">应付金额</view>
@@ -162,10 +164,11 @@ function formatPrice(price) {
   return Number.isNaN(num) ? '0.00' : num.toFixed(2);
 }
 
-// 应付金额 = 菜品总价 + 服务费(优惠券在结算页选择)
+// 应付金额 = 菜品总价(本版不含服务费;优惠券在结算页选择)
 const updatePayAmount = () => {
   const dish = dishTotal.value;
-  const fee = Number(orderInfo.value.serviceFee) || 0;
+  // const fee = Number(orderInfo.value.serviceFee) || 0;
+  const fee = 0;
   orderInfo.value.payAmount = Math.max(0, dish + fee);
   orderInfo.value.totalAmount = orderInfo.value.payAmount;
 };
@@ -189,8 +192,11 @@ function parseServiceFeeFromEstimate(res) {
   return 0;
 }
 
-/** 加载时按门店/桌台/人数/菜品小计拉取服务端服务费估算 */
+/** 服务费估算(本版本关闭) */
 async function fetchServiceFeeEstimate(storeIdFromCart) {
+  orderInfo.value.serviceFee = 0;
+  updatePayAmount();
+  /* 原 GetServiceFeeEstimate 逻辑(恢复时取消注释)
   const storeId =
     (storeIdFromCart != null && String(storeIdFromCart).trim() !== '' ? String(storeIdFromCart).trim() : '') ||
     uni.getStorageSync('currentStoreId') ||
@@ -216,6 +222,7 @@ async function fetchServiceFeeEstimate(storeIdFromCart) {
   } catch (e) {
     console.warn('服务费估算失败:', e);
   }
+  */
 }
 
 // 将 tags 统一为 [{ text, type }] 格式
@@ -273,7 +280,8 @@ const handleConfirmOrder = async () => {
   const remark = (orderInfo.value.remark ?? '').trim().slice(0, 30);
   uni.showLoading({ title: '提交中...' });
   try {
-    const serviceFeeVal = Number(orderInfo.value.serviceFee) || 0;
+    // const serviceFeeVal = Number(orderInfo.value.serviceFee) || 0;
+    const serviceFeeVal = 0; // 本版本不参与服务费
     const payAmount = Number((Number(orderInfo.value.payAmount) ?? 0).toFixed(2));
     const totalAmount = Number((Number(dishTotal.value) ?? 0).toFixed(2));
     const createParams = {
@@ -337,9 +345,9 @@ onLoad((options) => {
       const total = Number(data.totalAmount) || 0;
       orderInfo.value.totalAmount = total;
       if (data.dishTotal != null && data.dishTotal !== '') orderInfo.value.dishTotal = Number(data.dishTotal) || 0;
-      orderInfo.value.serviceFee =
-        Number(data.serviceFee ?? data.serviceCharge ?? data.utensilFee ?? data.tablewareFee ?? 0) ||
-        0;
+      // orderInfo.value.serviceFee =
+      //   Number(data.serviceFee ?? data.serviceCharge ?? data.utensilFee ?? data.tablewareFee ?? 0) || 0;
+      orderInfo.value.serviceFee = 0;
       updatePayAmount();
     } catch (e) {
       console.error('解析购物车数据失败:', e);
@@ -349,7 +357,7 @@ onLoad((options) => {
     orderInfo.value.serviceFee = 0;
   }
   if (orderInfo.value.tableId) uni.setStorageSync('currentTableId', String(orderInfo.value.tableId));
-  fetchServiceFeeEstimate(cartStoreId);
+  fetchServiceFeeEstimate(cartStoreId); // 本版 no-op,不参与服务费
   // 不再主动调用 userOwnedByStore,优惠券在点击「优惠券」行打开弹窗时再拉取
 });
 

+ 2 - 2
settings/siteSetting.js

@@ -8,11 +8,11 @@ export const UPLOAD = 'https://alien-volume.oss-cn-beijing.aliyuncs.com/';
 // export const BASE_API_URL = 'https://uat.ailien.shop/alienDining';
 
 // 测试环境
-// export const BASE_API_URL = 'https://test.ailien.shop/alienDining';
+export const BASE_API_URL = 'https://test.ailien.shop/alienDining';
 
 
 // 测试环境
-export const BASE_API_URL = 'http://192.168.10.84:8000/alienDining';
+// export const BASE_API_URL = 'http://192.168.10.84:8000/alienDining';
 
 /** 文件上传 请求地址 */
 export const UPLOAD_URL = 'https://api.xxxxxx.cn/File/UploadImg';