美文网首页
form-item检验格式控制

form-item检验格式控制

作者: royluck | 来源:发表于2021-08-24 14:01 被阅读0次
    image.png
    <!-- 阶梯出价 -->
          <div v-if="adGroupData.bid.bidMode === 1">
            <a-form-model-item label="目标转化出价" prop="bid">
              <a-form-model-item style="display:inline-block;margin-bottom:0;margin-right: 10px;">
                <a-select
                  v-model="adGroupData.bid.bidType"
                  style="width: 90px"
                  @focus="focusBidtype"
                  @change="changeBidType"
                  :disabled="isClickBid"
                  :loading="isClickBid"
                >
                  <a-select-option v-for="item in payList" :key="item.value" :value="item.value" :disabled="item.disabled">
                    {{ item.label }}
                  </a-select-option>
                </a-select>
              </a-form-model-item>
    
              <a-form-model-item style="display:inline-block;margin-bottom:0" ref="bid.bidAmountMin">
                <a-input
                  v-model="adGroupData.bid.bidAmountMin"
                  @blur="checkLineitemBid"
                  placeholder="最低出价"
                  style="width:200px"
                ></a-input>
              </a-form-model-item>
    
              <span style="padding:0 15px">至</span>
    
              <a-form-model-item style="display:inline-block;margin-bottom:0" ref="bid.bidAmountMax">
                <a-input
                  suffix="元"
                  v-model="adGroupData.bid.bidAmountMax"
                  @blur="checkLineitemBid"
                  placeholder="最高出价"
                  style="width:200px"
                ></a-input>
              </a-form-model-item>
              <!--<span style="margin-left:10px">元</span>-->
              <!-- <p style="font-size:12px">
                <a-icon
                  type="info-circle"
                  style="color:rgb(250, 173, 20);"
                />当您需要创建的广告为1条时,阶梯出价将会取最低出价与最高出价的中间值。
              </p> -->
            </a-form-model-item>
          </div>
    
    checkLineitemBid() {
          this.$refs.bidTencent.validateField('bid')
        },
    
    rules: {
    bid: [
              {
                required: true,
                validator: (rule, value, callback) => {
                  let { bidType, bidAmountMin, bidAmountMax, bidAmount } = this.adGroupData.bid
                  if (!value || !bidType) {
                    return callback(new Error('请选择出价方式'))
                  }
                  if (this.adGroupData.bid.bidMode == 1) {
                    if (!value || !bidAmountMin) {
                      return callback(new Error('请输入最低出价'))
                    } else if (!value || !bidAmountMax) {
                      return callback(new Error('请输入最高出价'))
                    }
                    if (bidAmountMin) {
                      this.validatorMinBids(rule, bidAmountMin, callback)
                    }
                    if (bidAmountMax) {
                      this.validatorMaxBids(rule, bidAmountMax, callback)
                    }
                    callback()
                  } else {
                    if (!value || !bidAmount) {
                      return callback(new Error('请输入出价'))
                    }
                    if (bidAmount) {
                      this.validatorbidAmount(rule, bidAmount, callback)
                    }
                    callback()
                  }
                },
                trigger: 'change'
              }
            ]
    }
    focusBidtype() {
          if (!this.accountId || this.adGroupData.siteSet.length <= 0) {
            this.$message.info('请先选择广告账户和版位')
          }
        },
    changeBidType(value, option) {
          // if(this.valid){
          //   return false
          // }
          // this.valid=true
          // setTimeout(()=>{
          //   this.valid=false
          // },2000)
          this.adGroupData.bid.optimizationGoal = null
          this.adGroupData.deepBid.deepGoal = ''
          this.adGroupData.bid.autoAcquisitionBudget = null
          this.adGroupData.deepBid.isOpenDeepConversion = 0
          this.adGroupData.bid.autoAcquisitionEnabled = 0
          if (value == 5 || value == 4) {
            this.$set(this.adGroupData.bid, 'bidStrategy', 1)
          }
          this.checkLineitemBid()
          // 清空已有的
          this.RESET_CREATIVES([])
        },
    

    相关文章

      网友评论

          本文标题:form-item检验格式控制

          本文链接:https://www.haomeiwen.com/subject/zaediltx.html