<template>
  <view class="container ask-container-message">
    <view class="advice-ipt-cont">
      <u-input v-model="advice_content" type="textarea" maxlength="100" :clearable="false" :placeholder="titlePlaceholder" height="300" class="ipt" />
      <text class="num-tag">{{ advice_content.length }}/100</text>
    </view>
    <view class="btn-cont" @click="submitHandle"> 提交 </view>
    <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
    <Loading />
  </view>
</template>

<script>
import { Reports } from "@/config/api.js";
import freeCharge from "@/components/freeCharge";
export default {
  data() {
    return {
      advice_content: "",
      id: "",
      type: "",
    };
  },
  components: {
    freeCharge,
  },
  computed: {
    titlePlaceholder() {
      return "请描述您的专题需求";
    },
  },
  methods: {
    async submitHandle() {
      if (!this.advice_content)
        return uni.showToast({
          title: "内容不能为空",
          icon: "none",
          duration: 2000,
        });
      const res = await Reports.collectionApplyAdd({
        Content: this.this.advice_content,
      });
      if (res.Ret === 200) {
        this.$util.toast("提交成功");
        this.advice_content = "";
        setTimeout(() => {
          uni.navigateBack();
        }, 500);
      }
    },
  },
  onLoad(option) {},
};
</script>

<style scoped lang="scss">
.ask-container-message {
  background-color: #fff;
  padding: 30rpx 34rpx;
  .advice-ipt-cont {
    height: 420rpx;
    border: 1rpx solid #d0cfd5;
    border-radius: 8rpx;
    padding: 30rpx;
    position: relative;
    font-size: 28rpx;
    color: #d0cfd5;
    .num-tag {
      position: absolute;
      bottom: 30rpx;
      right: 30rpx;
    }
  }
  .btn-cont {
    margin: 80rpx auto;
    width: 368rpx;
    height: 80rpx;
    font-size: 34rpx;
    line-height: 80rpx;
    text-align: center;
    color: #ffffff;
    background: linear-gradient(268deg, #2ddbff 0%, #1599ff 49%, #005eff 100%);
    opacity: 1;
    border-radius: 4rpx;
  }
}
</style>
