MrShi
10 天以前 59bfd0b8bbbf0ee94ec68e4a3a1a6e536d0ad8fd
admin/src/components/business/OperaShopApprovalWindow.vue
@@ -182,7 +182,7 @@
    </div>
    <div class="approval-form" v-if="storeInfo && storeInfo.auditStatus === 0">
      <el-form ref="approvalForm" :model="approvalForm" :rules="approvalForm.auditStatus ==1?approvalRules:approvalRules1">
      <el-form ref="approvalForm" :model="approvalForm" :rules="approvalForm.auditStatus === 1 ? approvalRules : approvalRules1">
        <el-form-item label="审批结果" prop="auditStatus">
          <el-radio-group v-model="approvalForm.auditStatus" @change="handleAuditStatusChange">
            <el-radio :label="0">通过</el-radio>
@@ -198,6 +198,31 @@
            style="width: 300px"
          ></el-input>
        </el-form-item>
        <div class="profit-section" v-if="approvalForm.auditStatus === 0">
          <h4 class="section-title">就地寄存模式</h4>
          <el-form-item label="在订单中作为寄件点时,分成比例为" prop="localDeposit">
            <div class="profit-input">
              <el-input v-model="approvalForm.localDeposit" placeholder="请输入分成比例" style="width: 150px;"></el-input>
              <span class="unit">%</span>
            </div>
          </el-form-item>
        </div>
        <div class="profit-section" v-if="approvalForm.auditStatus === 0">
          <h4 class="section-title">同城寄送模式</h4>
          <el-form-item label="在订单中作为寄件点时,分成比例为" prop="remoteTake">
            <div class="profit-input">
              <el-input v-model="approvalForm.remoteTake" placeholder="请输入分成比例" style="width: 150px;"></el-input>
              <span class="unit">%</span>
            </div>
          </el-form-item>
          <el-form-item label="在订单中作为收件点时,分成比例为" prop="remoteDeposit">
            <div class="profit-input">
              <el-input v-model="approvalForm.remoteDeposit" placeholder="请输入分成比例" style="width: 150px;"></el-input>
              <span class="unit">%</span>
            </div>
          </el-form-item>
        </div>
        <section class="approval-buttons">
          <el-button type="primary" @click="handleSubmit" :loading="isWorking.submit">提交</el-button>
          <el-button @click="handleCancel">取消</el-button>
@@ -222,14 +247,30 @@
      approvalForm: {
        id: null,
        auditStatus: 0,
        auditRemark: ''
        auditRemark: '',
        localDeposit: '',
        remoteTake: '',
        remoteDeposit: ''
      },
      approvalRules: {
        auditRemark: [
          { required: true, message: '请输入拒绝原因', trigger: 'blur' }
        ]
      },
      approvalRules1: { },
      approvalRules1: {
        localDeposit: [
          { required: true, message: '请输入分成比例', trigger: 'blur' },
          { validator: this.validateDepositRate, trigger: 'blur' }
        ],
        remoteTake: [
          { required: true, message: '请输入分成比例', trigger: 'blur' },
          { validator: this.validateDepositRate, trigger: 'blur' }
        ],
        remoteDeposit: [
          { required: true, message: '请输入分成比例', trigger: 'blur' },
          { validator: this.validateDepositRate, trigger: 'blur' }
        ]
      },
      isWorking: {
        submit: false
      }
@@ -242,6 +283,30 @@
    })
  },
  methods: {
    validateDepositRate (rule, value, callback) {
      if (value !== null && value !== '' && value !== undefined) {
        const num = Number(value)
        if (isNaN(num)) {
          callback(new Error('请输入有效数字'))
        } else if (num < 1) {
          callback(new Error('必须大于等于1'))
        } else {
          const str = String(num)
          if (str.includes('.')) {
            const decimal = str.split('.')[1]
            if (decimal.length > 1) {
              callback(new Error('最多支持一位小数'))
            } else {
              callback()
            }
          } else {
            callback()
          }
        }
      } else {
        callback()
      }
    },
    changeRadio(){
      this.$refs.approvalForm.clearValidate()
    },
@@ -262,12 +327,9 @@
        })
    },
    handleAuditStatusChange (val) {
      this.$refs.approvalForm.clearValidate()
      // if (val === 1) {
      //   this.approvalRules.auditRemark = []
      // } else {
      //   this.approvalRules.auditRemark = [{ required: true, message: '请输入拒绝原因', trigger: 'blur' }]
      // }
      this.$nextTick(() => {
        this.$refs.approvalForm.clearValidate()
      })
    },
    handleSubmit () {
      this.$refs.approvalForm.validate(valid => {
@@ -295,6 +357,30 @@
</script>
<style scoped>
.profit-section {
  margin-bottom: 30px;
  background: #f5f7fa;
  border-radius: 4px;
}
.profit-section .section-title {
  font-size: 16px;
  font-weight: bold;
  color: #303133;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e4e7ed;
}
.profit-input {
  display: flex;
  align-items: center;
  gap: 10px;
}
.inline-form /deep/ .el-form-item {
  display: block;
  margin-right: 0;
}
.store-header {
  display: flex;
  background: #f5f7fa;