Browse Source

Merge remote-tracking branch 'remotes/origin/dev_v3_lqw' into dev_v3_zb

ext.zhangbin71 14 hours ago
parent
commit
38825bf706

+ 6 - 19
components/CategorySelector/index.vue

@@ -123,10 +123,6 @@ const toggleSecondLevel = (child) => {
 
 // 获取所有选中的分类ID(根据规则:全选父类才包含父类ID,否则只包含子类ID)
 const getSelectedIds = () => {
-  console.log('当前选中状态:', {
-    allCategories: props.categoryList,
-    selectedChildren: selectedSecondLevel.value
-  })
 
   const result = []
 
@@ -137,19 +133,16 @@ const getSelectedIds = () => {
     if (category.child && category.child.length > 0) {
       // 有子分类的情况
       const allChildIds = category.child.map(child => String(child.id))
-      const isAllSelected = allChildIds.every(id =>
+      const selectedChildIds = allChildIds.filter(id =>
           selectedSecondLevel.value.includes(id)
       )
 
-      if (isAllSelected) {
-        // 全选子类,只添加父类ID
+      if (selectedChildIds.length > 0) {
+        // 只要有选中的子分类,就添加父类ID
         result.push(parentId)
-      } else {
-        // 非全选,添加选中的子类
-        allChildIds.forEach(id => {
-          if (selectedSecondLevel.value.includes(id)) {
-            result.push(id)
-          }
+        // 添加选中的子类ID
+        selectedChildIds.forEach(id => {
+          result.push(id)
         })
       }
     } else {
@@ -159,7 +152,6 @@ const getSelectedIds = () => {
       }
     }
   }
-
   console.log('计算出的选中IDs:', result)
   return result
 }
@@ -177,9 +169,6 @@ const setSelectedState = (ids) => {
   selectedSecondLevel.value = []
   currentFirstLevel.value = null
 
-  console.log('设置选中IDs:', ids)
-  console.log('可用分类数据:', props.categoryList)
-
   if (!ids || !Array.isArray(ids) || ids.length === 0) {
     initDefaultView()
     return
@@ -280,12 +269,10 @@ const setSelectedIds = (ids) => {
 
 // 监听props变化
 watch(() => props.selectedIds, (newVal) => {
-  console.log('props.selectedIds 变化:', newVal)
   setSelectedState(newVal)
 }, {immediate: true})
 
 watch(() => props.categoryList, (newVal) => {
-  console.log('分类数据变化:', newVal)
   if (newVal && newVal.length > 0) {
     // 重新应用选中状态
     setSelectedState(props.selectedIds)

+ 11 - 5
components/OrderListCard/index.vue

@@ -2,10 +2,11 @@
   <view class="item">
     <view @click="goOrderDetails(order.orderId)">
       <view class="title acea-row row-between-wrapper">
-        <view class="acea-row row-middle" @click.stop="toMerchant(order.sbMerchant.id)">
-          <image class="merchantImg" :src="order.sbMerchant.merchantLogo"></image>
-          <view style="margin-left: 10rpx;">{{order.sbMerchant.merchantName}}</view>
-          <uni-icons style="margin-left: 10rpx;" type="right" size="16" color="#999999"></uni-icons>
+        <view class="acea-row row-middle" @click.stop="toMerchant(order.sbMerchant?.id)">
+          <image class="merchantImg" v-if="order.sbMerchant?.merchantLogo" :src="order.sbMerchant.merchantLogo" ></image>
+          <image class="merchantImg" v-else src="@/static/avator.png" ></image>
+          <view style="margin-left: 10rpx;">{{order.sbMerchant?.merchantName||'自营'}}</view>
+          <uni-icons v-if="order.sbMerchant?.id" style="margin-left: 10rpx;" type="right" size="16" color="#999999"></uni-icons>
 <!--          <view>{{ order.createTime }}</view>-->
         </view>
         <view class="font-color">
@@ -101,7 +102,12 @@ function delOrder() {
   emit("delOrder", props.order.id, props.index);
 }
 const toMerchant = (merchantId) => {
-  uni.navigateTo({ url:"/pages/merchantCenters/merchant?merchantId="+merchantId });
+  if(merchantId){
+    uni.navigateTo({ url:"/pages/merchantCenters/merchant?merchantId="+merchantId });
+  }else{
+    return
+  }
+
 }
 </script>
 

+ 2 - 2
components/goodList/index.vue

@@ -13,9 +13,9 @@
 						<view class='line1'>{{item.storeName}}</view>
 						<view class='money font-color'>¥<text class='num'>{{item.totalPrice}}</text></view>
 						<view class='vip-money acea-row row-middle' v-if="item.vip_price && item.vip_price > 0">¥{{item.vip_price || 0}}
-							<image src='/static/images/vip.png'></image><text class='num'>已售{{Number(item.sales) + Number(item.ficti) || 0}}{{item.unitName}}</text>
+							<image src='/static/images/vip.png'></image><text class='num'>已售{{Number(item.sales) + Number(item.ficti) || 0}}</text>
 						</view>
-						<view class='vip-money acea-row row-middle' v-else><text class='num'>已售{{Number(item.sales) + Number(item.ficti) || 0}}{{item.unitName}}</text></view>
+						<view class='vip-money acea-row row-middle' v-else><text class='num'>已售{{Number(item.sales) + Number(item.ficti) || 0}}</text></view>
 					</view>
 				</view>
 <!--				<view class='iconfont icon-gouwuche cart-color acea-row row-center-wrapper'></view>-->

+ 2 - 2
pages/goods/goods_details/index.vue

@@ -65,7 +65,7 @@
                   </view>
                   <view class="label acea-row">
                     <view>工费:{{ attr.productSelect.price || 0 }}元/g</view>
-<!--                    <view>重量:{{ attr.productSelect.weight }}g</view>-->
+                    <view>重量:{{ attr.productSelect.weight }}g</view>
                     <view>
                       附加费:{{ attr.productSelect.additionalAmount || "" }}
                     </view>
@@ -2127,7 +2127,7 @@ action-sheet-item {
 }
 .label{
   display: flex;
-  gap: 30rpx;
+  gap: 20rpx;
   color: #666;
 }
 </style>

+ 10 - 5
pages/goods/goods_search/index.vue

@@ -39,6 +39,9 @@ import recommend from '@/components/recommend'
 import { HTTP_REQUEST_URL_IMG } from "@/config/app";
 // 获取实时金价
 import useRealGoldPrice from "@/hooks/useRealGoldPrice";
+import { useAppStore } from "@/stores/app";
+
+const appStore = useAppStore();
 
 // 响应式数据
 const hostProduct = ref([])
@@ -55,6 +58,7 @@ const hotPage = ref(1)
 const isScroll = ref(true)
 const isbastList = ref(false)
 const query = ref({})
+const merchantId =  ref('')
 // 实时价格处理
 const {
   realGoldprice, // 黄金实时销售价(基础)
@@ -76,10 +80,8 @@ const calculatedProducts = computed(() => {
 
     const totalLaborCost = Number(product.totalLaborCost);
     const additionalAmount = Number(product.additionalAmount);
-    console.log(totalLaborCost)
-    console.log(additionalAmount)
     const totalPrice = (totalLaborCost+additionalAmount).toFixed(2);
-    console.log('totalPrice',totalPrice)
+
     return {
       ...product,
       calculatedTotal: formattedTotal, // 新增计算结果字段
@@ -104,7 +106,8 @@ function getProductList() {
     ...query.value,
     keyword: searchValue.value,
     page: page.value,
-    limit: limit.value
+    limit: limit.value,
+    merchantId:merchantId.value,
   }).then(res => {
     const list = res.data.list
     const isLoadend = list.length < limit.value
@@ -164,10 +167,12 @@ function searchBut() {
 // 生命周期
 onShow(() => {
   getRoutineHotSearch()
-  getHostProduct()
+  getHostProduct();
+
 })
 onLoad((options)=>{
   query.value = options || {};
+  merchantId.value = appStore.merchantId||appStore.userInfo?.merchant?.id||'';
   if(options && options.cid){
     getProductList()
   }

+ 12 - 5
pages/merchantCenters/releaseProduct.vue

@@ -918,10 +918,18 @@ const submitForm = async () => {
     const submitData = {
       ...formData.value
     };
-    submitData.cateId =formData.value.categoryIds.join(',');
-    submitData.image =previewImages.value[0].info.url;
-    const urlString = JSON.stringify(productImages.value.map(item => item.info.url));
+    let urlString = '';
+    if(isProductCenter){
+      submitData.image =previewImages.value[0].url;
+      urlString = JSON.stringify(productImages.value.map(item => item.url));
+    }else{
+      submitData.image =previewImages.value[0].info.url;
+      urlString = JSON.stringify(productImages.value.map(item => item.info.url));
+    }
     submitData.sliderImage =urlString;
+    submitData.cateId =formData.value.categoryIds.join(',');
+
+
     submitData.merchantId =parseInt(merchantInfo.id);
     submitData.specType = 0;
     submitData.isSub = false;
@@ -937,13 +945,12 @@ const submitForm = async () => {
         additionalAmount :formData.value.additionalFee,
         attrValue:"{\"规格\":\"默认\"}",
         barCode : formData.value.barCode,
-        image : productImagesGg.value[0].info.url,
+        image : isProductCenter ? productImagesGg.value[0].url : productImagesGg.value[0].info.url,
         price : formData.value.laborCost,
         stock : formData.value.stock,
         weight :formData.value.weight
       }
     ];
-    console.log('提交数据:', submitData);
 
     if(productId.value && !isProductCenter.value){
       const {data} = await productUpdate(submitData);

BIN
static/images/orderTime.png