pointDetailDialog.vue 7.88 KB
<template>
  <baseDialog
    :is-show.sync="dialogShow"
    :config="dialogConfig.setting"
    :dialog-config="dialogConfig.config"
    @closeDialog="handleDetailClose"
  >
    <div class="detail-content">
      <div class="form_div">
        <el-form class="edit-sub-block" label-width="110px" :inline="true">
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="积分类型:">
                {{ detailInfo.infoName ? detailInfo.infoName : "-" }}
              </el-form-item></el-col
            >

            <el-col :span="12">
              <el-form-item label="积分明细:" class="halfItem">
                {{
                  detailInfo.rewardScore
                    ? (detailInfo.type == 0 ? "+" : "-") +
                      detailInfo.rewardScore
                    : "--"
                }}
              </el-form-item></el-col
            >
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="客户名称:">
                {{ detailInfo.customerName ? detailInfo.customerName : "-" }}
              </el-form-item></el-col
            >

            <el-col :span="12">
              <el-form-item label="客户手机号:" class="halfItem">
                {{ detailInfo.customerPhone ? detailInfo.customerPhone : "-" }}
              </el-form-item></el-col
            >
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="订单编号:">
                {{ detailInfo.orderCode ? detailInfo.orderCode : "-" }}
              </el-form-item></el-col
            >

            <el-col :span="12">
              <el-form-item label="商品名称:" class="halfItem">
                {{ detailInfo.goodsName ? detailInfo.goodsName : "-" }}
              </el-form-item></el-col
            >
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="积分变化时间:">
                {{ detailInfo.updatedTime ? detailInfo.updatedTime : "-" }}
              </el-form-item></el-col
            >

            <el-col :span="12">
              <el-form-item label="员工名称:" class="halfItem">
                {{ detailInfo.staffName ? detailInfo.staffName : "-" }}
              </el-form-item></el-col
            >
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="员工手机号:" class="halfItem">
                {{ detailInfo.staffPhone ? detailInfo.staffPhone : "-" }}
              </el-form-item></el-col
            >

            <el-col :span="12">
              <el-form-item label="门店名称:" class="halfItem">
                {{ detailInfo.merchantName ? detailInfo.merchantName : "-" }}
              </el-form-item></el-col
            >
          </el-row>
          <el-row>
            <el-col :span="12">
              <template
                v-if="
                  detailInfo.infoName == '积分兑换' ||
                  detailInfo.infoName == '积分返还'
                "
              >
                <el-form-item label="兑换时间:" class="halfItem">
                  {{
                    detailInfo.withdrawalTime ? detailInfo.withdrawalTime : "-"
                  }}
                </el-form-item>
              </template>

              <template v-if="detailInfo.infoName == '退款抵扣'">
                <el-form-item label="退款时间:" class="halfItem">
                  {{ detailInfo.failTime ? detailInfo.failTime : "-" }}
                </el-form-item></template
              >
              <template v-if="detailInfo.infoName == '错单抵扣'">
                <el-form-item label="错单时间:" class="halfItem">
                  {{ detailInfo.failTime ? detailInfo.failTime : "-" }}
                </el-form-item>
              </template>
              <template v-if="detailInfo.infoName == '撤单抵扣'">
                <el-form-item label="撤单时间:" class="halfItem">
                  {{ detailInfo.failTime ? detailInfo.failTime : "-" }}
                </el-form-item>
              </template>
            </el-col>
            <template v-if="detailInfo.infoName =='撤销抵扣'">
              <el-col :span="12" v-if="detailInfo.relationRemark">
                <el-form-item label="备注:" class="halfItem">
                  {{
                    detailInfo.relationRemark ? detailInfo.relationRemark : "-"
                  }}
                </el-form-item>
            </el-col>
            </template>
            <template v-else-if="detailInfo.infoName =='手动抵扣'">
              <el-col :span="12" v-if="detailInfo.remark">
                <el-form-item label="备注:" class="halfItem">
                  {{
                    detailInfo.remark ? detailInfo.remark : "-"
                  }}
                </el-form-item>
            </el-col>
            </template>
            <template v-if="detailInfo.infoName =='撤销抵扣'">
            <el-col :span="12" v-if="detailInfo.remark">
              <el-form-item label="撤销原因:" class="halfItem">
                {{ detailInfo.remark ? detailInfo.remark : "-" }}
              </el-form-item></el-col
            >
            </template>
          </el-row>
        </el-form>
      </div>
    </div>
  </baseDialog>
</template>
  
  <script>
import { Util, deepClone } from "@/common/util"
import { getScoreDetail } from "@api/point"
export default {
  name: "DetailDialog",
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    id: {
      type: Number,
      default: ""
    }
  },
  computed: {
    dialogShow: {
      get() {
        return this.visible
      },
      set(val) {
        this.$emit("update:visible", val)
      }
    }
  },
  watch: {
    id(val) {
      if (val) this.getDetail()
    }
  },
  mounted() {
    this.getDetail()
  },
  data() {
    return {
      dialogConfig: {
        setting: {
          showClose: true,
          appendToBody: false,
          btnList: []
        },
        config: {
          title: "查看详情",
          width: "1080px"
        }
      },

      detailInfo: {}
    }
  },
  methods: {
    handleDetailClose() {
      this.dialogShow = false
    },
    getDetail() {
      getScoreDetail({ id: this.id }).then((res) => {
        if (res) {
          res.updatedTime = res.updatedTime
            ? Util.dateFormate(res.updatedTime, "YYYY-MM-DD HH:mm:ss")
            : "--"
          res.withdrawalTime = res.withdrawalTime
            ? Util.dateFormate(res.withdrawalTime, "YYYY-MM-DD HH:mm:ss")
            : "--"
          res.refundTime = res.refundTime
            ? Util.dateFormate(res.refundTime, "YYYY-MM-DD HH:mm:ss")
            : "--"
          res.failTime = res.failTime
            ? Util.dateFormate(res.failTime, "YYYY-MM-DD HH:mm:ss")
            : "--"
            res.revokeTime = res.revokeTime
            ? Util.dateFormate(res.revokeTime, "YYYY-MM-DD HH:mm:ss")
            : "--"
            	
          this.detailInfo = res
        }
      })
    }
  }
}
</script>
  
  <style lang="scss" scoped>
.form_div {
  color: #333333;
  padding: 20px 30px;
  // border-bottom: 1px solid #eee;

  // .edit-sub-title {
  //   font-weight: bold;
  //   margin-bottom: 10px;
  // }

  .edit-sub-block {
    // padding: 0 10px;

    .el-form-item {
      width: 100%;
      margin-bottom: 0px;
    }
    .itemDiv {
      display: flex;
      .halfItem {
        width: 50%;
      }
    }

    .detail-txt {
      display: inline-block;
      width: 200px;
      vertical-align: bottom;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    ::v-deep .el-form-item__content {
      max-width: calc(100% - 110px);
      word-break: break-all;
    }
  }

  .edit-sub-block-two {
    .el-form-item {
      // width: 300px;
      margin-bottom: 0px;
    }
  }
}
</style>