<template>
  <div class="editIntegral">
    <div class="item">
      <div class="title"><span>*</span>学习强国</div>
      <div class="inp">
        <u-input v-model="learningIntegral" :type="number" />
      </div>
    </div>

    <div class="btn">
      <div class="submitBtn" @click="submit">提交</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'editIntegral',
  appName: '修改学习强国',
  data() {
    return {
      learningIntegral: '',
      partyMemberId: '',
      id: '',
      flag: false,
    }
  },
  onLoad(o) {
    this.partyMemberId = o.partyMemberId
    this.id = o.id
  },
  methods: {
    getIntegral() {
      this.$instance.post('/app/appparty/getPartyIntegralDetail',{
        params: {
          id: this.id,
        }
      }).then((res) => {
        if(res?.data) {
          this.learningIntegral = { ...res.data.learningIntegral }
        }
      })
    },
    submit() {
      if(this.flag) return
      if(!this.learningIntegral) {
        return this.$u.toast('请输入学习强国积分')
      }
      this.flag = true
      this.$instance.post('/app/appparty/editLearningIntegral',null,{
        params: {
          partyMemberId: this.partyMemberId,
          learningIntegral: this.learningIntegral,
        }
      }).then((res) => {
        if (res.code == 0) {
          this.$u.toast('修改成功')
          setTimeout(() => {
            uni.$emit('update')
            uni.navigateBack()
          },600)
        }
      })
    }
  },

}
</script>

<style lang="scss" scoped>
.editIntegral {
  padding: 0 30px;
  box-sizing: border-box;
  .item {
    display: flex;
    justify-content: space-between;
    padding: 30px 0;
    .title {
      width: 200px;
      span {
        color:#FF4466;
      }
    }

    .inp {
      width: calc(100% - 200px);
      ::v-deep .u-input .u-input__input {
        text-align: right;
      }
    }
  }
  .btn {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    padding: 16px 32px;
    box-sizing: border-box;
    display: flex;
    background: #F3F6F9;
    .submitBtn {
      flex: 1;
      height: 88px;
      line-height: 88px;
      text-align: center;
      color: #FFF;
      background: #4181FF;
      border-radius: 16px;
    }
  }
}
</style>