<template>
  <section class="submitEvaluation">
    <AiGroup>
      <AiItem label="评价分数" top-label required>
        <u-rate v-model="form.score" :size="64" active-color="#F8B425" :min-count="1" inactive-icon="star-fill"/>
      </AiItem>
    </AiGroup>
    <u-gap height="24"/>
    <AiGroup>
      <AiItem label="评价详情" top-label required>
        <u-input type="textarea" v-model="form.content" placeholder="请简要描述..."/>
      </AiItem>
    </AiGroup>
    <u-gap height="24"/>
    <AiGroup>
      <AiItem label="附件" top-label>
        <AiUploader v-model="form.files" :limit="9" multiple/>
      </AiItem>
    </AiGroup>
    <div class="fixed-bottom">
      <div class="bottomBtn" @click="submit">提交</div>
    </div>
  </section>
</template>

<script>
export default {
  name: "submitEvaluation",
  appName: "提交评价",
  data() {
    return {
      form: {
        files: []
      }
    }
  },
  methods: {
    submit() {
      if (!this.form.score) {
        return this.$u.toast("请选择评价分数!")
      }
      if (!this.form.content) {
        return this.$u.toast("请填写评价详情!")
      }
      this.$instance.post("/app/appbusinesscompletionevaluation/addOrUpdate", this.form).then(res => {
        if (res?.code == 0) {
          this.$u.toast("提交成功!")
          setTimeout(() => uni.navigateBack({}), 1500)
        }
      })
    }
  },
  onLoad(params) {
    this.form.bizId = params.bid
  }
}
</script>

<style lang="scss" scoped>
.submitEvaluation {
}
</style>
