<template>
  <view class="page-content complaintsdetails">
    <view class="complaintsdetails-content">
      <view class="complaintsdetails-item complaintsdetails-plauser">
        <view class="item-content">
          <view class="item-text">
            <view class="item-textlable">
              <text class="item-lable">真实姓名：</text>
            </view>
            <view class="item-textvalue">
              <text class="item-value">{{ complaintsDetailsObj.plaUser }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="complaintsdetails-item complaintsdetails-plaphone">
        <view class="item-content">
          <view class="item-text">
            <view class="item-textlable">
              <text class="item-lable">手机号码：</text>
            </view>
            <view class="item-textvalue">
              <text
                class="item-value"
              >{{ complaintsDetailsObj.plaPhone ? complaintsDetailsObj.plaPhone.toString().replace(/^(.{3})(.*)(.{4})$/, '$1-$2-$3') : '' }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="complaintsdetails-item complaintsdetails-planame">
        <view class="item-content">
          <view class="item-text">
            <view class="item-textlable">
              <text class="item-lable">投诉标题：</text>
            </view>
            <view class="item-textvalue">
              <text class="item-value">{{ complaintsDetailsObj.plaName }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="complaintsdetails-placontent">
        <view class="placontent-text">
          <view class="placontent-textlable">
            <text class="placontent-lable">投诉内容：</text>
          </view>
          <view class="placontent-textvalue">
            <text class="placontent-textarea">{{ complaintsDetailsObj.plaContent }}</text>
          </view>
        </view>
      </view>
      <template v-if="complaintsDetailsObj.plaRes != null && complaintsDetailsObj.plaRes != ''">
        <view class="complaintsdetails-plares">
          <view class="plares-text">
            <view class="plares-textlable">
              <text class="plares-lable">反馈内容：</text>
            </view>
            <view class="plares-textvalue">
              <text class="plares-textarea">{{ complaintsDetailsObj.plaRes }}</text>
            </view>
          </view>
        </view>
      </template>
      <template v-else>
        <view class="complaintsdetails-plares">
          <view class="plares-text">
            <view class="plares-textlable">
              <text class="plares-lable">反馈内容：</text>
            </view>
            <view class="plares-textnovalue">
              <text class="plares-value">暂无</text>
            </view>
          </view>
        </view>
      </template>
    </view>
  </view>
</template>

<script>
import {
  complaintsViewData
} from '@/agrcloud-api/complaints';

export default {
  name: 'complaintsdetails',
  data() {
    return {
      complaintsDetailsObj: {
        plaUser: '',
        plaPhone: null,
        plaName: '',
        plaContent: '',
        plaRes: ''
      },
      custLabelStyle: {
        'height': '42rpx',
        'font-size': '30rpx',
        'font-family': 'PingFangSC-Regular, PingFang SC',
        'font-weight': '400',
        'color': '#666666',
        'line-height': '42rpx'
      },
      custPlaceholderStyle: 'font-size: 34rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;'
    };
  },
  onLoad() {
    this.initData();
  },
  methods: {
    /** 初始化数据 */
    initData() {
      const currComplaintsDetailsItem = (this.$store.getters || {}).complaintsDetailsObj || {};
      complaintsViewData({
        id: currComplaintsDetailsItem.plaId
      }).then(res => {
        this.complaintsDetailsObj = res.data || {};
      }).catch(() => {
        this.complaintsDetailsObj = {};
      });
    }
  }
}
</script>

<style lang="scss" scoped>
.complaintsdetails {
  padding: 0;

  .complaintsdetails-content {
    width: 100%;
    padding-top: 24rpx;

    .complaintsdetails-item {
      height: 138rpx;
      padding-left: 24rpx;
      background-color: #ffffff;

      .item-content {
        height: 138rpx;
        border-bottom: 1px solid #eeeeee;

        .item-text {
          padding: 24rpx 24rpx 24rpx 0;

          .item-textlable {
            height: 42rpx;
            line-height: 42rpx;

            .item-lable {
              height: 42rpx;
              font-size: 30rpx;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #666666;
              line-height: 42rpx;
            }
          }

          .item-textvalue {
            height: 48rpx;
            line-height: 48rpx;

            .item-value {
              height: 48rpx;
              font-size: 34rpx;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #333333;
              line-height: 48rpx;
            }
          }
        }
      }
    }

    .complaintsdetails-placontent {
      margin-top: 24rpx;
      background-color: #ffffff;
      min-height: 154rpx;

      .placontent-text {
        padding: 24rpx;

        .placontent-textlable {
          height: 42rpx;
          line-height: 42rpx;

          .placontent-lable {
            height: 42rpx;
            font-size: 30rpx;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #666666;
            line-height: 42rpx;
          }
        }

        .placontent-textvalue {
          .placontent-textarea {
            min-height: 48rpx;
            font-size: 34rpx;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #333333;
          }
        }
      }
    }

    .complaintsdetails-plares {
      margin-top: 24rpx;
      background-color: #ffffff;
      min-height: 154rpx;

      .plares-text {
        padding: 24rpx;

        .plares-textlable {
          height: 42rpx;
          line-height: 42rpx;

          .plares-lable {
            height: 42rpx;
            font-size: 30rpx;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #666666;
            line-height: 42rpx;
          }
        }

        .plares-textvalue {
          .plares-textarea {
            min-height: 48rpx;
            font-size: 34rpx;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #333333;
          }
        }

        .plares-textnovalue {
          height: 48rpx;
          line-height: 48rpx;

          .plares-value {
            height: 48rpx;
            font-size: 34rpx;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #333333;
            line-height: 48rpx;
          }
        }
      }
    }
  }
}
</style>
