Bläddra i källkod

fix: 编辑类字段选取

Sun 3 år sedan
förälder
incheckning
193346beea
2 ändrade filer med 8 tillägg och 6 borttagningar
  1. 6 5
      src/views/business/coupon/add.vue
  2. 2 1
      src/views/business/goods/add.vue

+ 6 - 5
src/views/business/coupon/add.vue

@@ -9,8 +9,8 @@
           </el-form-item>
           <el-form-item label="使用场景:" prop="type">
             <el-radio-group v-model="addData.type" :disabled="readonly">
-              <el-radio :label="1">门店消费</el-radio>
-              <el-radio :label="2">盲票购买</el-radio>
+              <el-radio :label="2">门店消费</el-radio>
+              <el-radio :label="1">盲票购买</el-radio>
             </el-radio-group>
           </el-form-item>
           <el-form-item label="面值:" prop="discount">
@@ -141,7 +141,7 @@ export default {
           { required: true, message: '请输入有效期', trigger: 'blur' },
           { pattern: /^([1-9]\d*)$/, message: "请输入正确的数字", trigger: ["blur", "change"] }
         ],
-        description: [{ required: true, message: '请输入使用说明', trigger: 'blur' }],
+        description: [{ required: false, message: '请输入使用说明', trigger: 'blur' }],
         useArea: [{ required: true, message: '请选择使用范围', trigger: 'blur' }]
       }
     }
@@ -149,7 +149,8 @@ export default {
   created() {
     if (this.id) {
       getCouponDetail(this.id).then(res => {
-        this.addData = res.data
+        const { couponId, title, quantity, discount, channelSharedRate, minOrderAmt, dueDays, description, ticketBoxList } = res.data
+        this.addData = { couponId, title, quantity, discount, channelSharedRate, minOrderAmt, dueDays, description, ticketBoxList }
         this.addData.type = JSON.parse(res.data.type).value
         this.addData.useArea = JSON.parse(res.data.useArea).value
       })
@@ -167,7 +168,7 @@ export default {
             this.addIng = false
             if (res.code === 0) {
               this.$message({
-                message: this.addData.id ? '修改成功!' : '添加成功!',
+                message: this.addData.couponId ? '修改成功!' : '添加成功!',
                 type: 'success'
               })
               this.$router.go(-1)

+ 2 - 1
src/views/business/goods/add.vue

@@ -157,7 +157,8 @@ export default {
   created() {
     if (this.id) {
       getGoodsDetail(this.id).then(res => {
-        this.addData = res.data
+        const { goodsId, title, picUrl, exchangeShow, multiSku, value, exchangePrice, cost, quantity, description } = res.data
+        this.addData = { goodsId, title, picUrl, exchangeShow, multiSku, value, exchangePrice, cost, quantity, description }
       })
     }
   },