Browse Source

设备列表表单修改编辑

zhengjinyi 2 years ago
parent
commit
167441c081

+ 1 - 1
apis/index.js

@@ -117,7 +117,7 @@ export default ($axios) => {
   const getProductDetails = (params = {}) =>
     $axios.get('/wx/auth/product/form/data', { params })
   // 编辑保存授权商品
-  const authProducSave = (params = {}) =>
+  const authProducSave = (data = {}) =>
     $axios.post('/wx/auth/product/save', data)
   // 高德地图api : 将坐标转化为高德地图坐标
   const assistant = (params = {}) =>

+ 16 - 10
pages/_template/app/form/components/form-club-device.vue

@@ -170,7 +170,6 @@ export default {
     this.fetchBrandList()
     this.fetchDeviceList()
     this.initFormList()
-    this.init()
   },
 
   methods: {
@@ -182,14 +181,18 @@ export default {
     async init(formData) {
       console.log('formData',formData)
       const obj = {}
-      const productImageList = {
-        name:'',
-        url:formData.productImage
-      }
-      const invoiceImageList = {
-        name:'',
-        url:formData.invoiceImage
-      }
+      const productImageList = [
+        {
+          name:'',
+          url:formData?.productImage
+        }
+      ]
+      const invoiceImageList = [
+        {
+          name:'',
+          url:formData.invoiceImage
+        }
+      ]
       obj.uuid = ++this.uuid
       obj.productImageList = productImageList
       obj.invoiceImageList = invoiceImageList
@@ -197,11 +200,12 @@ export default {
       obj.productName = formData.productName
       obj.snCode = formData.snCode
       obj.brandId = formData.brandId
+      obj.productId = formData.productId
       obj.productTypeId = formData.productTypeId
       obj.purchaseWay = formData.purchaseWay
       obj.invoiceImage = formData.invoiceImage
       obj.paramList = formData.paramList
-      this.formList.push(obj)
+      this.formList.splice(0,1,obj)
       console.log('formList',this.formList)
     },
     formatFormList() {
@@ -212,6 +216,8 @@ export default {
         obj.productName = formItem.productName
         obj.snCode = formItem.snCode
         obj.brandId = formItem.brandId
+        obj.productId = formItem.productId
+        obj.source = 2
         obj.productTypeId = formItem.productTypeId
         obj.purchaseWay = formItem.purchaseWay
         obj.invoiceImage = formItem.invoiceImage

+ 13 - 4
pages/_template/app/record/device/detail.vue

@@ -44,10 +44,10 @@
           <div class="params-list">
             <div class="param"
               v-for="param in productInfo.paramList"
-              :key="param.authId"
+              :key="param.productName"
             >
-              <div class="param-name">{{ param.productName }}</div>
-              <div class="param-content">{{ param.productName }}</div>
+              <div class="param-name">{{ param.paramName }}</div>
+              <div class="param-content">{{ param.paramContent }}</div>
             </div>
           </div>
         </div>
@@ -62,7 +62,7 @@
         <div class="col">{{ productInfo.invalidReason ? productInfo.invalidReason : '暂无' }}</div>
       </div>
 
-      <div class="control flex flex-col items-center">
+      <div class="control flex flex-col items-center"v-if="productInfo.auditStatus === 0">
         <div class="button edit flex justify-center items-center"  @click="onEdit">编辑</div>
       </div>
     </div>
@@ -170,6 +170,9 @@ export default {
         justify-content: flex-start;
         align-items: flex-start;
         margin-bottom: 8px;
+        .param-name{
+          margin-right: 20px;
+        }
       }
     }
 
@@ -204,6 +207,8 @@ export default {
         width: 120px;
         height: 120px;
         margin-right: 12px;
+        box-sizing: border-box;
+        border-radius: 4px;
       }
     }
 
@@ -268,6 +273,9 @@ export default {
         justify-content: flex-start;
         align-items: flex-start;
         margin-bottom: 8px;
+        .param-name{
+          margin-right: 10px;
+        }
       }
     }
 
@@ -293,6 +301,7 @@ export default {
       .el-image {
         width: 26vw;
         height: 26vw;
+        border-radius: 1vw;
       }
     }
 

+ 8 - 7
pages/_template/app/record/device/edit.vue

@@ -8,7 +8,7 @@
       <div class="page-title">设备认证</div>
       <FormClubDevice ref="formClubDevice" :formType="formType" @step="onClubDeviceFormStep" />
       <div class="control flex flex-col items-center">
-        <div class="button submit flex justify-center items-center">提交</div>
+        <div class="button submit flex justify-center items-center" @click="onSubmit">提交</div>
       </div>
     </div>
   </div>
@@ -27,11 +27,11 @@ export default {
       productInfo: {},
       formData: {},
       productId:0,
-      formType:''
+      formType:'',
     }
   },
   computed: {
-    ...mapGetters(['supplierInfo', 'authUserId', 'routePrefix']),
+    ...mapGetters(['supplierInfo', 'authUserId', 'routePrefix','authId']),
   },
   mounted() {
     this.formType = this.$route.query.type
@@ -40,9 +40,10 @@ export default {
   methods: {
     async onSubmit() {
       try {
-        await this.$refs.formClubInfo.validate()
-        this.formData.authUserId = this.authUserId
-        this.formData.source = 2
+        await this.$refs.formClubDevice.validate()
+        if(this.formType === 'edit'){
+          this.formData.authId = this.authId
+        }
         await this.$http.api.authProducSave(this.formData)
         this.$toast('保存成功')
         this.$router.push(`${this.routePrefix}/record/device/detail?id=${this.productId}`)
@@ -64,7 +65,7 @@ export default {
     },
     onClubDeviceFormStep(data) {
       console.log(data)
-      this.formData = data
+       this.formData = data[0]
     }
   }  
 }

+ 1 - 2
pages/_template/app/record/device/index.vue

@@ -17,7 +17,7 @@
           <div class="page-title">设备认证</div>
           <div class="device-list"
             v-for="item in list"
-            :key="item.authId"
+            :key="item.productId"
             @click="toEdit(item)"
           >
             <div class="device">
@@ -114,7 +114,6 @@ export default {
     },
     // 加载更多
     onLoadMore() {
-      console.log('111111111')
       this.authProductList()
     },
   },