<template>
  <div class="add">
    <div class="form-group">
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>工资性收入(元)</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income3" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>生产经营收入(元)</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income4" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>计划生育金(元)</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income5" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>资产收益扶贫分红收入</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income6" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>养老保险金（元）</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income9" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>低保金（元）</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income7" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>特困供养金（元）</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income8" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>生态补偿金（元）</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income10" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>财产性收入（元）</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income13" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>其他财产性收入</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income14" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>转移性收入（元）</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income11" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>其他转移性收入（元）</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income12" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>生产经营性支出（元）</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income15" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>纳入监测对象的收入参考范围</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income1" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
      <div class="form-item">
        <div class="form-item__wrapper">
          <div class="left">
            <span>纳入监测对象的人均收入参考范围</span>
          </div>
          <div class="right">
            <input placeholder="请输入" v-model="form.income2" type="number"
                   placeholder-style="color: #999; font-size: 30rpx;"/>
          </div>
        </div>
      </div>
    </div>
    <!-- <p class="tips">*不填时默认为0元</p> -->

    <div class="btn" hover-class="text" @click="submit">保存</div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        income1: '',
        income2: '',
        income3: '',
        income4: '',
        income5: '',
        income6: '',
        income8: '',
        income9: '',
        income10: '',
        income11: '',
        income12: '',
        income13: '',
        income14: '',
        income15: '',
      },
      id: '',
      girdId: '',
      girdName: '',
    }
  },

  onLoad(query) {
    this.id = query.id
    this.girdId = query.girdId
    this.girdName = query.girdName
    this.getInfo(query.id)
  },

  onShow() {
    document.title = '家庭收支情况'
  },

  methods: {
    getInfo(id) {
      this.$http.post(`/app/apppreventionreturntopoverty/queryDetailById?id=${id}`).then(res => {
        if (res.code === 0) {
          this.form = {
            ...this.form,
            ...res.data
          }
        }
      })
    },

    submit() {
      this.form.girdId = this.girdId
      this.form.girdName = this.girdName
      this.$http.post('/app/apppreventionreturntopoverty/addByEwechat', {
        ...this.form,
        id: this.id
      }).then(res => {
        if (res.code === 0) {
          this.$u.toast('保存成功')
          uni.$emit('reload')
          uni.navigateBack({
            delta: 1
          })
        }
      })
    }
  }
}
</script>

<style lang="scss">
.add {
  padding-bottom: 120px;

  .tips {
    margin: 32px 0 0 32px;
    color: #999999;
    font-size: 26px;
  }

  & > div {
    margin-bottom: 16px;
    background: #fff;
  }

  .form-group {
    .form-item {
      padding-left: 32px;

      .form-item__wrapper {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 112px;
        border-bottom: 1px solid #E4E5E6;
      }

      .right {
        height: 112px;
        line-height: 112px;
        padding-right: 32px;

        span {
          font-size: 30px;
          color: #999999;
        }
      }

      input {
        height: 100%;
        text-align: right;
      }

      .left {
        display: flex;
        align-items: center;

        span {
          color: #333333;
          font-size: 32px;
        }

        i {
          margin-right: 4px;
          font-style: normal;
          color: #FF4466;
          font-size: 32px;
        }
      }

      &:last-child {
        .form-item__wrapper {
          border: none;
        }
      }
    }
  }

  .form-item__imgs {
    padding: 32px;

    .form-item__title {
      display: flex;
      align-items: center;
      margin-bottom: 34px;

      h2 {
        color: #333333;
        font-weight: normal;
        font-size: 32px;
      }

      i {
        color: #999999;
        font-size: 28px;
        font-style: normal;
      }
    }

    textarea {
      width: 100%;
    }
  }

  .form-type {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 112px;
    padding: 0 32px;

    h2 {
      font-weight: normal;
      color: #333333;
      font-size: 32px;
    }

    span {
      color: #999999;
      font-size: 28px;
    }
  }

  .btn {
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 11;
    width: 100%;
    height: 112px;
    line-height: 112px;
    margin: 0;
    text-align: center;
    color: #FFFFFF;
    font-size: 32px;
    background: #3192F4;
  }
}
</style>
