<!--
 * @Descripttion: (订单/tb_order 详情弹窗)
 * @version: (1.0)
 * @Author: (lwh)
 * @Date: (2023-08-29)
 * @LastEditors: (lwh)
 * @LastEditTime: (2023-08-29)
-->
 <template>
  <el-dialog v-model="props.modelValue" title="订单信息详情" width="900px" @closed="closeDialog" @open="openDialog">
    <el-form ref="formRef" :model="formData" :disabled="true">

      <el-row :gutter="20">
	  

    
    
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="商品guid" >
              <el-input v-model="formData.goodsGuid"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="订单流水guid" >
              <el-input v-model="formData.paymentGuid"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="客户guid" >
              <el-input v-model="formData.customerGuid"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="店铺guid" >
              <el-input v-model="formData.shopGuid"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="订单号" >
              <el-input v-model="formData.orderNumber"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="商品总金额" >
              <el-input v-model="formData.goodsTotalAmoun"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="订单金额" >
              <el-input v-model="formData.orderAmount"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="优惠券guid" >
              <el-input v-model="formData.couponGuid"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="优惠券抵扣金额" >
              <el-input v-model="formData.couponMoney"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="积分抵扣金额" >
              <el-input v-model="formData.pointsMoney"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="积分抵扣数量" >
              <el-input v-model="formData.pointsNum"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="实际付款金额(包含运费)" >
              <el-input v-model="formData.payPrice"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="后台修改的订单金额（差价）" >
              <el-input v-model="formData.updatePrice"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="买家留言" >
              <el-input v-model="formData.orderRemark"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="支付方式(1微信支付 2余额支付)" >
              <el-select v-model="formData.payType" >
                <el-option v-for="item in  pay_type " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="付款状态(1未付款 2已付款)" >
              <el-select v-model="formData.payStatus" >
                <el-option v-for="item in  pay_status " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="付款时间" >
              <el-date-picker v-model="formData.payTime" type="datetime" :teleported="false" isabledStr}></el-date-picker>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="配送方式(1快递配送)" >
              <el-select v-model="formData.deliveryType" >
                <el-option v-for="item in  delivery_type " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="运费金额" >
              <el-input v-model="formData.expressPrice"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="物流公司guid" >
              <el-input v-model="formData.logisticsCompanyGuid"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="物流公司" >
              <el-input v-model="formData.logisticsCompany"  />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="物流单号" >
              <el-input v-model="formData.logisticsTrackingNumber"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="发货状态(1未发货 2已发货)" >
              <el-select v-model="formData.deliveryStatus" >
                <el-option v-for="item in  delivery_status " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="发货时间" >
              <el-date-picker v-model="formData.deliveryTime" type="datetime" :teleported="false" isabledStr}></el-date-picker>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="收货状态(1未收货 2已收货)" >
              <el-select v-model="formData.receiptStatus" >
                <el-option v-for="item in  receipt_status " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="收货时间" >
              <el-date-picker v-model="formData.receiptTime" type="datetime" :teleported="false" isabledStr}></el-date-picker>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="订单状态(1进行中 2取消 3待取消 4已完成)" >
              <el-select v-model="formData.orderStatus" >
                <el-option v-for="item in  order_status " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="赠送的积分数量" >
              <el-input v-model="formData.pointsBonus"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="订单是否已结算(1未结算 2已结算)" >
              <el-select v-model="formData.isSettled" >
                <el-option v-for="item in  is_settled " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="微信支付交易号" >
              <el-input v-model="formData.transactionId"  />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="是否已评价(1否 2是)" >
              <el-select v-model="formData.isComment" >
                <el-option v-for="item in  is_comment " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="订单来源(1普通订单)" >
              <el-input v-model="formData.orderSource"  />
            </el-form-item>
          </el-col>






      </el-row>
    </el-form>
  </el-dialog>
</template>

<script setup>
import { ElMessage } from 'element-plus'
import { reactive, ref, watch } from "vue";


// 打开弹窗时回调
const openDialog = async () => {
   await getpay_type()
   await getpay_status()
   await getdelivery_type()
   await getdelivery_status()
   await getreceipt_status()
   await getorder_status()
   await getis_settled()
   await getis_comment()

}

const formData = ref({
  ...props.data,
});
watch(props, async (v) => {
  formData.value = v.data;
});

// -业务参数
// 支付方式(1微信支付 2余额支付)字典选项列表
const pay_type = ref([]);
// 付款状态(1未付款 2已付款)字典选项列表
const pay_status = ref([]);
// 配送方式(1快递配送)字典选项列表
const delivery_type = ref([]);
// 发货状态(1未发货 2已发货)字典选项列表
const delivery_status = ref([]);
// 收货状态(1未收货 2已收货)字典选项列表
const receipt_status = ref([]);
// 订单状态(1进行中 2取消 3待取消 4已完成)字典选项列表
const order_status = ref([]);
// 订单是否已结算(1未结算 2已结算)字典选项列表
const is_settled = ref([]);
// 是否已评价(1否 2是)字典选项列表
const is_comment = ref([]);

// -业务方法
// 字典获取
async function getpay_type() {
  await proxy.getDicts('pay_type').then((res) => {
    pay_type.value = res.data
  })
}
// 字典获取
async function getpay_status() {
  await proxy.getDicts('pay_status').then((res) => {
    pay_status.value = res.data
  })
}
// 字典获取
async function getdelivery_type() {
  await proxy.getDicts('delivery_type').then((res) => {
    delivery_type.value = res.data
  })
}
// 字典获取
async function getdelivery_status() {
  await proxy.getDicts('delivery_status').then((res) => {
    delivery_status.value = res.data
  })
}
// 字典获取
async function getreceipt_status() {
  await proxy.getDicts('receipt_status').then((res) => {
    receipt_status.value = res.data
  })
}
// 字典获取
async function getorder_status() {
  await proxy.getDicts('order_status').then((res) => {
    order_status.value = res.data
  })
}
// 字典获取
async function getis_settled() {
  await proxy.getDicts('is_settled').then((res) => {
    is_settled.value = res.data
  })
}
// 字典获取
async function getis_comment() {
  await proxy.getDicts('is_comment').then((res) => {
    is_comment.value = res.data
  })
}



// 基础参数
const formRef = ref();
const labelWidth = 100;
const { proxy } = getCurrentInstance()
const props = defineProps({
  modelValue: Boolean,
  data: Object,
  done: Function,
});
const emits = defineEmits(["update:modelValue"]);


// -基础方法
const closeDialog = () => {
  emits("update:modelValue", false);
};

</script>
