Преглед на файлове

fix: 1、修复手动发布商品图片路径不正确问题;2、修复首页商品重复渲染问题;3、修复商品管理批量管理上下架后列表未及时更新问题;

ext.zhangbin71 преди 1 месец
родител
ревизия
7a984e295e
променени са 4 файла, в които са добавени 16 реда и са изтрити 9 реда
  1. 9 3
      pages/index/index.vue
  2. 1 1
      pages/merchantCenters/productCenter.vue
  3. 4 3
      pages/merchantCenters/productManagement.vue
  4. 2 2
      pages/merchantCenters/releaseProduct.vue

+ 9 - 3
pages/index/index.vue

@@ -547,9 +547,15 @@ const getGroomList = async () => {
   try {
     loading.value = true;
     merchantId.value!='' ?  params.value.merchantId = merchantId.value:'';
-    const { data } = await getGroomListApi(goodType.value, params.value);
-
-    goodsList.value = [...goodsList.value, ...data.productList.list] || [];
+	console.log(goodType.value, params.value)
+	const param = {...params.value}
+    const { data } = await getGroomListApi(goodType.value, param);
+	if(param.page == 1){
+		goodsList.value = [...data.productList.list] || [];
+	}else{
+		goodsList.value = [...goodsList.value, ...data.productList.list] || [];
+	}
+    
     goodScroll.value = data.productList.list.length >= params.value.limit;
     params.value.page++;
   } catch (err) {

+ 1 - 1
pages/merchantCenters/productCenter.vue

@@ -26,7 +26,7 @@
     <view class="product-list">
       <view class="product-card" v-for="(item, index) in goodsList" :key="index">
         <view class="product-header">
-          <image class="product-image" :src="item.image" mode="aspectFit" />
+          <image class="product-image" :src="item.image" mode="aspectFill" />
           <view class="product-info">
             <view class="nameweight">
               <text class="product-name">{{ item.storeName }}</text>

+ 4 - 3
pages/merchantCenters/productManagement.vue

@@ -51,7 +51,7 @@
     <!-- 商品列表 -->
     <view class="product-list">
       <up-checkbox-group shape="circle" @change="checkboxChange" class="centent" activeColor="#F8C008">
-        <view class="product-card" v-for="(item, index) in goodsList" :key="index">
+        <view class="product-card" v-for="(item, index) in goodsList" :key="item.id">
           <view class="product-header">
             <!-- 多选框 -->
             <up-checkbox
@@ -62,7 +62,7 @@
                 activeColor="#F8C008"
             />
 
-            <image class="product-image" :src="item.image" mode="aspectFit" />
+            <image class="product-image" :src="item.image" mode="aspectFill" />
             <view class="product-info">
               <view class="nameweight">
                 <text class="product-name">{{ item.storeName }}</text>
@@ -213,7 +213,7 @@ const setAllSelectValue = (status) => {
   goodsList.value.forEach(item => {
     if (status) {
       item.checked = true;
-      selectValues.push(item.id);
+      selectValues.push(String(item.id));
       isAllSelect.value = true;
     } else {
       item.checked = false;
@@ -275,6 +275,7 @@ const batchPutOnShell = async () => {
           if (code === 200) {
             uni.showToast({ title: '批量上架成功', icon: 'success' });
             // 从列表中移除上架的商品
+			console.log(selectValue.value)
             goodsList.value = goodsList.value.filter(item => !selectValue.value.includes(item.id.toString()));
             resetSelection();
             footerswitch.value = true; // 退出管理模式

+ 2 - 2
pages/merchantCenters/releaseProduct.vue

@@ -919,7 +919,7 @@ const submitForm = async () => {
       ...formData.value
     };
     let urlString = '';
-    if(isProductCenter){
+    if(isProductCenter.value){
       submitData.image =previewImages.value[0].url;
       urlString = JSON.stringify(productImages.value.map(item => item.url));
     }else{
@@ -945,7 +945,7 @@ const submitForm = async () => {
         additionalAmount :formData.value.additionalFee,
         attrValue:"{\"规格\":\"默认\"}",
         barCode : formData.value.barCode,
-        image : isProductCenter ? productImagesGg.value[0].url : productImagesGg.value[0].info.url,
+        image : isProductCenter.value ? productImagesGg.value[0].url : productImagesGg.value[0].info.url,
         price : formData.value.laborCost,
         stock : formData.value.stock,
         weight :formData.value.weight