Bladeren bron

1.修改个人中心跳转浏览记录没反应问题
2.修改各个页面价格显示问题

ext.liuqiwen3 1 maand geleden
bovenliggende
commit
788a5bea40
3 gewijzigde bestanden met toevoegingen van 13 en 10 verwijderingen
  1. 5 1
      components/productWindow/index.vue
  2. 7 8
      pages/goods/goods_details/index.vue
  3. 1 1
      pages/user/index.vue

+ 5 - 1
components/productWindow/index.vue

@@ -221,11 +221,15 @@ const calcNumPrice = computed(() => {
   const total =
     (Number(price) * Number(weight) + Number(additionalAmount || 0)) *
     Number(cart_num);
-  return total.toFixed(2);
+
+  // 向上取整到小数点后一位
+  const roundedTotal = Math.ceil(total * 10) / 10;
+  return roundedTotal.toFixed(2);
 });
 
 // 监听 calcNumPrice 变化并传递给父组件
 watch(calcNumPrice, (newPrice) => {
+  console.log('newPrice',newPrice)
   emit("updatePrice", newPrice);
 }, { immediate: true });
 function goCat() {

+ 7 - 8
pages/goods/goods_details/index.vue

@@ -754,15 +754,14 @@ const getGoodsDetails = async () => {
 };
 const DefaultSelect = () => {
   let value = [];
-  // 或者使用 for...in 循环(会按对象属性顺序)
-  const allKeys = Object.keys(productValue.value);
 
+  const allKeys = Object.keys(productValue.value);
   // 手动排序:按数字部分从小到大排序
-  const keys = allKeys.sort((a, b) => {
-    // 提取数字:5g -> 5, 100g -> 100
-    const numA = parseInt(a.match(/\d+/)[0]);
-    const numB = parseInt(b.match(/\d+/)[0]);
-    return numA - numB;
+  const keys = [...allKeys].sort((a, b) => {
+    // 提取完整的数字(包括小数)
+    const numA = parseFloat(a.match(/\d+(\.\d+)?/)[0]);
+    const numB = parseFloat(b.match(/\d+(\.\d+)?/)[0]);
+    return numA - numB;  // 从小到大排序
   });
 
   for (let i = 0; i < keys.length; i++) {
@@ -780,7 +779,7 @@ const DefaultSelect = () => {
   });
 
   const productSelect = productValue.value[value.join(",")];
-  console.log('productSelect',productSelect)
+
   if (productSelect && attr.value.productAttr.length) {
     attr.value.productSelect = {
       ...attr.value.productSelect,

+ 1 - 1
pages/user/index.vue

@@ -137,7 +137,7 @@
     <view class="recent-visit" v-if="recentStores.length > 0">
       <view class="section-header">
         <text class="section-title">最近访问</text>
-        <view class="more"  @click="handleFunctionClick('/pages/users/browsing_history/index')">更多商家<uni-icons style="margin-left: 10rpx;" type="right" size="16" color="#666666"></uni-icons></view>
+        <view class="more"  @click="handleFunctionClick({pageUrl:'/pages/users/browsing_history/index'})">查看更多<uni-icons style="margin-left: 10rpx;" type="right" size="16" color="#666666"></uni-icons></view>
       </view>
 
       <view class="store-list">