import ImageUpload from '@/components/file-upload'
export default {
  components: { ImageUpload },
  computed: {
    formItems() {
      return [
        {
          md: 24,
          isShow: true,
          name: 'slot-component',
          formItemAttributes: {
            label: '',
            prop: '',
            'label-width': '0px'
          },
          render: (h, { props, onInput }) => {
            var { formData } = props
            return (
              <div>
                <el-descriptions
                  border
                  title=""
                  column={4}
                  colon={false}
                  labelStyle={{ width: '8%' }}
                  contentStyle={{ width: '17%' }}
                >
                  <el-descriptions-item label="销售网点">{formData.websitName}</el-descriptions-item>
                  <el-descriptions-item label="订单单号">{formData.id}</el-descriptions-item>
                  <el-descriptions-item label="师傅姓名">{formData.workerName}</el-descriptions-item>
                  <el-descriptions-item label="师傅联系电话">{formData.workerMobile}</el-descriptions-item>
                  <el-descriptions-item label="师傅身份证号">{formData.workerIdcard}</el-descriptions-item>
                  <el-descriptions-item label="客户姓名">{formData.userName}</el-descriptions-item>
                  <el-descriptions-item label="客户电话">{formData.userMobile}</el-descriptions-item>
                  <el-descriptions-item label="详细地址">{formData.userAddress}</el-descriptions-item>
                  <el-descriptions-item label="内机条码">{formData.insideCode}</el-descriptions-item>
                  <el-descriptions-item label="服务单号">{formData.serviceNo}</el-descriptions-item>
                  <el-descriptions-item label="发票价格">{formData.invoiceAmount}</el-descriptions-item>
                  <el-descriptions-item label="发票时间">{formData.invoiceTime}</el-descriptions-item>
                  <el-descriptions-item label="服务截止时间">{formData.serviceEndTime}</el-descriptions-item>
                  <el-descriptions-item label="创建人">{formData.createBy}</el-descriptions-item>
                  <el-descriptions-item label="创建时间">{formData.createTime}</el-descriptions-item>
                  <el-descriptions-item label="支付状态">
                    {{ EXPIRE: '过期', CANCEL: '取消', PAID: '已支付', WAIT: '待支付', REFUND: '已退款' }[
                      formData.payStatus
                    ] || ''}
                  </el-descriptions-item>
                  <el-descriptions-item label="支付方式">
                    {{ 1: '微信支付', 2: '代客支付', 3: '现金支付' }[formData.payType] || ''}
                  </el-descriptions-item>
                  <el-descriptions-item label="支付订单号">{formData.payNo}</el-descriptions-item>
                  <el-descriptions-item label="支付时间">{formData.payTime}</el-descriptions-item>
                  <el-descriptions-item label="微信流水号">{formData.transcationId}</el-descriptions-item>
                  <el-descriptions-item label="师傅销售佣金">{formData.workerAmount}</el-descriptions-item>
                  <el-descriptions-item label="结算人员">{formData.updateBy}</el-descriptions-item>
                  <el-descriptions-item label="操作时间">{formData.updateTime}</el-descriptions-item>
                  {this.addFormData
                    ? [
                        <el-descriptions-item label="审批人">{formData.examineBy}</el-descriptions-item>,
                        <el-descriptions-item label="审批状态">
                          {{ WAIT: '待审核', OK: '通过', FAIL: '失败' }[formData.flag]}
                        </el-descriptions-item>,
                        <el-descriptions-item label="审批时间">{formData.examineTime}</el-descriptions-item>,
                        <el-descriptions-item label=""></el-descriptions-item>
                      ]
                    : null}
                </el-descriptions>
                <el-descriptions
                  border
                  title=""
                  column={1}
                  colon={false}
                  labelStyle={{ width: '8%' }}
                  contentStyle={{ width: '92%' }}
                >
                  <el-descriptions-item label="订单备注">{formData.remark}</el-descriptions-item>
                  <el-descriptions-item label="审批备注">{formData.examineRemark}</el-descriptions-item>
                </el-descriptions>
              </div>
            )
          }
        }
      ]
    },
    formItemsList() {
      return [
        {
          md: 24,
          isShow: true,
          name: 'slot-component',
          formItemAttributes: {
            label: '',
            prop: '',
            'label-width': '0px'
          },
          render: (h, { props, onInput }) => {
            var { formData } = props
            return (
              <zj-table
                columns={[
                  {
                    columnAttributes: {
                      label: '服务类型',
                      prop: 'type'
                    },
                    render: (h, { row, column, index }) => {
                      return <div style="padding: 0 10px">{{ 1: '延保', 2: '清洗' }[row.type] || ''}</div>
                    }
                  },
                  {
                    columnAttributes: {
                      label: '使用类型',
                      prop: 'usedType'
                    },
                    render: (h, { row, column, index }) => {
                      return (
                        <div style="padding: 0 10px">{{ COUNT: '使用次数', YEAR: '使用年限' }[row.usedType] || ''}</div>
                      )
                    }
                  },
                  {
                    columnAttributes: {
                      label: '品牌',
                      prop: 'brandName'
                    }
                  },
                  {
                    columnAttributes: {
                      label: '产品大类',
                      prop: 'mainName'
                    }
                  },
                  {
                    columnAttributes: {
                      label: '服务内容',
                      prop: 'content'
                    }
                  },
                  {
                    columnAttributes: {
                      label: '服务金额（元）',
                      prop: 'amount'
                    }
                  },
                  {
                    columnAttributes: {
                      label: '使用限值',
                      prop: 'limitNum'
                    }
                  },
                  {
                    columnAttributes: {
                      label: '总手续费',
                      prop: 'commissionAmount'
                    }
                  },
                  {
                    columnAttributes: {
                      label: '师傅分成金额',
                      prop: 'workerAmount'
                    }
                  },
                  {
                    columnAttributes: {
                      label: '网点分成金额',
                      prop: 'websitAmount'
                    }
                  }
                ]}
                tableData={[
                  {
                    ...(formData.increItem || {}),
                    ...(formData.incre || {}),
                    workerAmount: formData.workerAmount,
                    websitAmount: formData.websitAmount,
                    commissionAmount: formData.commissionAmount
                  }
                ]}
                tableAttributes={{
                  size: 'mini',
                  border: true
                }}
              />
            )
          }
        }
      ]
    },
    formItemsImgs() {
      return [
        {
          md: 24,
          name: 'slot-component',
          formItemAttributes: {
            label: '',
            prop: '',
            'label-width': '0px'
          },
          render: (h, { props, onInput }) => {
            var { formData } = props
            return (
              <ImageUpload
                fileList={[
                  { key: 'insideCodeImg', name: '内机条码' },
                  { key: 'machineImg', name: '机器铭牌图片' },
                  { key: 'buyCertImg', name: '购机凭证图片' }
                ].map(item => ({ url: formData[item.key], name: item.name }))}
                limit={1000}
                isEdit={false}
                viewOnline={false}
                download={false}
                showName={true}
              />
            )
          }
        }
      ]
    }
  }
}
