Ver código fonte

Merge branch 'dev_v3_lqw' into dev_v3

# Conflicts:
#	pages/user/index.vue
ext.liuqiwen3 1 mês atrás
pai
commit
4dd036e1ed

+ 1 - 2
components/goodList/index.vue

@@ -26,7 +26,7 @@
 
 <script setup>
 import { useAppStore } from '@/stores/app.js';
-import { goShopDetail } from '@/libs/order.js';
+// import { goShopDetail } from '@/libs/order.js';
 
 const appStore = useAppStore();
 const uid = appStore.uidComputed;
@@ -46,7 +46,6 @@ const props = defineProps({
 // Navigation to detail page
 const goDetail = async (item) => {
   try {
-    await goShopDetail(item, uid.value);
     uni.navigateTo({
       url: `/pages/goods/goods_details/index?id=${item.id}`,
     });

+ 1 - 1
pages/goods/goods_search/index.vue

@@ -172,7 +172,7 @@ onShow(() => {
 })
 onLoad((options)=>{
   query.value = options || {};
-  merchantId.value = appStore.merchantId||appStore.userInfo?.merchant?.id||'';
+  merchantId.value =query.value.merchantId || appStore.merchantId||appStore.userInfo?.merchant?.id||'';
   if(options && options.cid){
     getProductList()
   }

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
pages/index/index.vue


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
pages/merchantCenter/index.vue


+ 22 - 76
pages/user/index.vue

@@ -21,13 +21,7 @@
           <view class="user-detail">
             <view class="name-vip" v-if="appStore.isLogin">
               <text class="name">{{ appStore.$userInfo?.nickname }}</text>
-              <image
-                class="vip-tag"
-                v-if="appStore.$userInfo?.svip"
-                mode="widthFix"
-                :src="HTTP_REQUEST_URL_IMG + 'setting/vip.png'"
-                >VIP</image
-              >
+              <image class="vip-tag" v-if="appStore.$userInfo?.svip" mode="widthFix" :src="HTTP_REQUEST_URL_IMG+'sviplogo.png'"></image>
             </view>
             <view
               class="name-vip"
@@ -53,37 +47,15 @@
       </view>
 
       <!-- 会员开通提示 v-if="!userInfo.isVip"-->
-      <view
-        class="vip-promote"
-        v-if="useList && useList.length > 0 && showIcons"
-      >
-        <image
-          class="vipBG"
-          :src="HTTP_REQUEST_URL_IMG + 'vipBG.png'"
-          mode="scaleToFill"
-        ></image>
+      <view class="vip-promote" v-if="useList&&useList.length>0&&showIcons">
+        <image class="vipBG" :src="HTTP_REQUEST_URL_IMG+'vipBG.png'" mode="scaleToFill"></image>
         <view class="vip-text">
           <view class="title">
-            <image
-              class="vipIcon"
-              :src="HTTP_REQUEST_URL_IMG + 'setting/vipIcon.png'"
-              mode="widthFix"
-            ></image>
-            <text
-              >开通<text class="bigText">会员</text>享受更多<text
-                class="bigText"
-                >权益</text
-              ></text
-            >
+            <image class="vipIcon" :src="HTTP_REQUEST_URL_IMG+'setting/vipIcon.png'" mode="widthFix"></image>
+            <text v-if="!appStore.$userInfo?.svip">开通<text class="bigText">会员</text>享受更多<text class="bigText">权益</text></text>
+            <text v-else>前往查看<text class="bigText">权益</text></text>
           </view>
-          <button class="open-vip" @click="goVIP">
-            {{ appStore.$userInfo?.svip ? "去查看" : "去开通"
-            }}<image
-              class="bofang"
-              :src="HTTP_REQUEST_URL_IMG + 'setting/bofang.png'"
-              mode="widthFix"
-            ></image>
-          </button>
+          <button class="open-vip" @click="goVIP">{{appStore.$userInfo?.svip ? '去查看':'去开通'}}<image class="bofang" :src="HTTP_REQUEST_URL_IMG+'setting/bofang.png'" mode="widthFix"></image></button>
         </view>
       </view>
     </view>
@@ -147,13 +119,8 @@
         >
       </view>
 
-      <view class="functions" v-if="useList && useList.length > 0 && showIcons">
-        <view
-          class="function-item"
-          v-for="item in useList"
-          :key="item.iconName"
-          @click="goDetail(item.jumpUrl)"
-        >
+      <view class="functions" v-if="useList&&useList.length>0&&showIcons">
+        <view class="function-item" v-for="item in useList" :key="item.iconName" @click="goDetail(item.jumpUrl)">
           <view class="function-icon">
             <image class="img" :src="item.src" mode="widthFix"></image>
           </view>
@@ -162,42 +129,25 @@
       </view>
     </view>
 
+
     <!-- 最近访问 -->
     <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('/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">
-        <template v-for="(store, storeIndex) in recentStores" :key="store.id">
-          <view
-            class="store-item"
-            v-if="storeIndex == 0"
-            @click="viewStore(store)"
-          >
-            <view class="store-logo">
-              <image class="img" :src="store.merchantLogo"></image>
-            </view>
-            <view class="store-info">
-              <text class="store-name">{{ store.merchantName }}</text>
-              <text class="store-desc">{{ store.merchantDescribe }}</text>
-            </view>
-            <uni-icons
-              style="margin-left: auto"
-              type="right"
-              size="16"
-              color="#666666"
-            ></uni-icons>
+        <template v-for="(store,storeIndex) in recentStores" :key="store.id">
+          <view class="store-item" v-if="storeIndex == 0" @click="viewStore(store)">
+              <view class="store-logo">
+                <image class="img" :src="store.merchantLogo"></image>
+              </view>
+              <view class="store-info">
+                <text class="store-name">{{ store.merchantName }}</text>
+                <text class="store-desc">{{ store.merchantDescribe }}</text>
+              </view>
+              <uni-icons style="margin-left: auto;" type="right" size="16" color="#666666"></uni-icons>
           </view>
         </template>
       </view>
@@ -240,11 +190,7 @@
 
       <view class="functions">
         <template v-for="func in commonFunctions" :key="func.name">
-          <view
-            class="function-item"
-            @click="handleFunctionClick(func)"
-            v-if="func.show"
-          >
+          <view class="function-item" @click="handleFunctionClick(func.pageUrl)" v-if="func.show">
             <view class="function-icon">
               <image class="img" :src="func.src" mode="widthFix"></image>
             </view>

+ 42 - 13
pages/users/user_goods_collection/index.vue

@@ -21,7 +21,7 @@
               </view>
               <view>
                 <view class='name line1'>{{item.storeName}}</view>
-                <view class='money font-color'>¥{{item.price}}</view>
+                <view class='money font-color'>¥{{item.totalPrice}}</view>
               </view>
             </navigator>
           </view>
@@ -51,7 +51,7 @@
 <!--      <recommend :hostProduct="hostProduct"></recommend>-->
     </view>
 
-    <home></home>
+<!--    <home></home>-->
   </view>
 </template>
 
@@ -64,7 +64,13 @@ import { HTTP_REQUEST_URL_IMG } from "@/config/app";
 import { getCollectUserList, getProductHot, collectDelete } from '@/api/store.js';
 import { toLogin } from "@/libs/login.js";
 import recommend from '@/components/recommend';
-
+// 获取实时金价
+import useRealGoldPrice from "@/hooks/useRealGoldPrice";
+const {
+  realGoldprice, // 黄金实时销售价(基础)
+  realPtprice, // 铂金实时销售价(基础)
+  realAgprice, // 白银实时销售价(基础)
+} = useRealGoldPrice({});
 import home from '@/components/home';
 import Util from '@/utils/util';
 
@@ -78,7 +84,7 @@ const hostProduct = ref([]);
 const loadTitle = ref('加载更多');
 const loading = ref(false);
 const loadend = ref(false);
-const collectProductList = ref([]);
+const collectList = ref([]);
 const limit = 8;
 const page = ref(1);
 const isAuto = ref(false);
@@ -92,6 +98,30 @@ const delBtnWidth = 80;
 const totals = ref(0);
 const startX = ref(0);
 
+
+const collectProductList = computed(() => {
+  // 计算逻辑与原代码一致,但基于响应式数据 products
+  return collectList.value.map((product) => {
+    // 1. 将price字符串转为数字
+    const price = Number(product.price);
+    // 2. 计算乘积
+    const total = (price + product.sales) * realGoldprice.value;
+    // 3. 向上取整到两位小数(先放大100倍取整,再缩小100倍)
+    const roundedTotal = Math.ceil(total * 100) / 100;
+    // 4. 格式化保留两位小数
+    const formattedTotal = roundedTotal.toFixed(2);
+
+    const totalLaborCost = Number(product.totalLaborCost);
+    const additionalAmount = Number(product.additionalAmount);
+    const totalPrice = (totalLaborCost+additionalAmount).toFixed(2);
+    console.log('totalPrice',totalPrice)
+    return {
+      ...product,
+      calculatedTotal: formattedTotal, // 新增计算结果字段
+      totalPrice
+    };
+  });
+});
 // #ifdef MP
 // 触摸开始
 const drawStart = (e) => {
@@ -143,7 +173,7 @@ const checkboxChange = (event) => {
   });
 
   selectValue.value = values.toString();
-  isAllSelect.value = collectProductList.value.length === values.length;
+  isAllSelect.value = calculatedProducts.value.length === values.length;
 };
 
 // 全选变化
@@ -205,9 +235,9 @@ const get_user_collect_product = async () => {
     const collectProductListData = res.data.list;
     const isLoadend = collectProductListData.length < limit;
 
-    collectProductList.value = Util.SplitArray(collectProductListData, collectProductList.value);
+    collectList.value = Util.SplitArray(collectProductListData, collectProductList.value);
 
-    if (collectProductList.value.length === 0) {
+    if (collectList.value.length === 0) {
       // get_host_product();
     }
 
@@ -329,7 +359,6 @@ onReachBottom(() => {
 
 .collectionGoods {
   .nav {
-    width: 92%;
     height: 90rpx;
     background-color: #fff;
     padding: 0 24rpx;
@@ -338,16 +367,16 @@ onReachBottom(() => {
     font-size: 28rpx;
     color: #282828;
     position: fixed;
-    left: 30rpx;
+    left: 20rpx;
     z-index: 5;
-    top: 30rpx;
+    top: 20rpx;
+    right: 20rpx;
     border-bottom: 1px solid #EEEEEE;
-    border-top-left-radius: 14rpx;
-    border-top-right-radius: 14rpx;
+    border-radius: 16rpx;
   }
 
   .list {
-    padding: 30rpx;
+    padding: 20rpx;
     margin-top: 110rpx;
 
     .name {