소스 검색

Merge branch 'master-fixBug'

shish 11 달 전
부모
커밋
cd394b70c3
2개의 변경된 파일16개의 추가작업 그리고 16개의 파일을 삭제
  1. 10 10
      hdApp/src/admin/goods/add.vue
  2. 6 6
      hdApp/src/admin/goods/detail.vue

+ 10 - 10
hdApp/src/admin/goods/add.vue

@@ -1,12 +1,12 @@
 <template>
   <view class="app-content">
     <!-- 加载状态 -->
-    <view v-if="loading" class="loading-overlay">
+    <!-- <view v-if="loading" class="loading-overlay">
       <view class="loading-content">
         <view class="loading-spinner"></view>
         <text class="loading-text">加载中...</text>
       </view>
-    </view>
+    </view> -->
     
     <form @submit="commitForm">
       <view class="module-com input-line-wrap">
@@ -145,14 +145,14 @@ import TuiListCell from "@/components/plugin/list-cell";
 import AppUploader from "@/components/app-uploader";
 const form = require("@/utils/formValidation.js");
 import { getClass } from "@/api/category";
-import { addGoodsData, getGoodsDetail } from "@/api/goods"
+import { addGoodsData } from "@/api/goods"
 import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
-import productMins from "@/mixins/product";
+//import productMins from "@/mixins/product"; //复制页面代码时,没去掉
 import inputRestore from "@/mixins/inputRestore";
 export default {
   name: "add",
   components: { TuiListCell, AppUploader,htzImageUpload },
-	mixins: [productMins, inputRestore],
+	mixins: [inputRestore], //productMins, 
   data() {
     return {
       headers:{token:''},
@@ -186,7 +186,6 @@ export default {
   onLoad() {
     const token = uni.getStorageSync('token')
     this.headers.token = token
-    this.init()
   },
   computed: {
     // 根据上传的图片数量动态生成封面选项
@@ -197,8 +196,6 @@ export default {
       return this.form.shopImg;
     }
   },
-  watch:{
-  },
   methods: {
     changeKind(){
       this.pageTo({url:'/admin/goods/selectKind?style=2&flower=1'})
@@ -352,11 +349,13 @@ export default {
         } else {
           formData.cover = '';
         }
+        if(formData.stockSet === '0'){
+          formData.stock = 9999;
+        }
         
         addGoodsData({ status: this.status, ...formData }).then(res => {
           uni.hideLoading()
-          this.$msg("添加成功")
-          this.removeFromSaveDirect()
+          // this.removeFromSaveDirect()
           
           // 把新增的商品添加到商品列表页的商品数组的第一项
           if (res.code === 1 && res.data) {
@@ -379,6 +378,7 @@ export default {
                 prevPage.$vm.list.data.unshift(newGoodsItem);
                 prevPage.$vm.list.total = (prevPage.$vm.list.total || 0) + 1;
               }
+              this.$msg("添加成功")
             } catch (error) {
               console.log('更新列表页数据失败:', error);
             }

+ 6 - 6
hdApp/src/admin/goods/detail.vue

@@ -1,12 +1,12 @@
 <template>
   <view class="app-content">
     <!-- 加载状态 -->
-    <view v-if="loading" class="loading-overlay">
+    <!-- <view v-if="loading" class="loading-overlay">
       <view class="loading-content">
         <view class="loading-spinner"></view>
         <text class="loading-text">加载中...</text>
       </view>
-    </view>
+    </view> -->
     
     <form @submit="formSubmit">
       <view class="module-com input-line-wrap">
@@ -148,7 +148,7 @@ import { getClass } from "@/api/category";
 import { getGoodsDetail, addGoodsData, updateGoodsData } from "@/api/goods";
 //图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
 import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
-import productMins from "@/mixins/product";
+//import productMins from "@/mixins/product"; //复制页面代码时,没去掉,引入的话会导致页面崩溃
 import inputRestore from "@/mixins/inputRestore";
 export default {
   name: "add",
@@ -157,7 +157,7 @@ export default {
     AppUploader,
     htzImageUpload
   },
-	mixins: [productMins, inputRestore],
+	mixins: [inputRestore],//productMins, 
   data() {
     return {
 			selectJobType: "addGoodsSelectItem",
@@ -314,7 +314,7 @@ export default {
             return {name:ele.name,cover:ele.smallCover,itemId:ele.ptItemId,id:ele.itemId,ratio:ele.ratio,
             bigCount:bigCount,smallCount:smallCount,bigUnit:ele.bigName,smallUnit:ele.smallName,shortCover:ele.shortCover}
           })
-          this.pushToSave(newItem)
+          //this.pushToSave(newItem)
         }
 
         Object.keys(this.form).forEach((i) => {
@@ -495,7 +495,7 @@ export default {
       }
       
       updateGoodsData({ ...form}).then(res => {
-        this.removeFromSaveDirect()
+        //this.removeFromSaveDirect()
         this.$msg("操作成功")
         
         // 更新成功后,把更新的数据传递给前一页的列表页