<template>
  <div>
    <div class="bg-in">
      <div>
        <el-form
          :model="deliveryForms"
          :rules="rules"
          ref="ruleForm"
          label-width="120px"
        >
          <el-row>
            <el-col>
              <el-form-item label="预约类型:" prop="appointment_type">
                <el-select
                  v-model="deliveryForms.appointment_type"
                  :disabled="disabledType"
                >
                  <el-option
                    v-for="(item, index) in appointmentList"
                    :key="index"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item
                label="预约时间:"
                prop=""
                v-if="deliveryForms.appointment_type != 0"
              >
                <el-date-picker
                  v-model="deliveryForms.appointment_time"
                  type="datetime"
                  placeholder="选择日期时间"
                  :disabled="disabledType"
                  value-format="yyyy-MM-dd HH:mm:ss"
                ></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-divider></el-divider>
          <h3>发货人信息:</h3>
          <el-row>
            <el-col :span="12">
              <el-form-item label="发货人姓名:" prop="sender.name">
                <!-- <el-select v-model="deliveryForms.sender.name"> </el-select> -->
                <el-input
                  v-model="deliveryForms.sender.name"
                  :minlength="1"
                  :maxlength="20"
                  placeholder="请输入发货人姓名"
                  :disabled="disabledType"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="手机号:" prop="sender.phone">
                <el-input
                  v-model="deliveryForms.sender.phone"
                  :minlength="1"
                  :maxlength="20"
                  :disabled="disabledType"
                  placeholder="请输入手机号"
                ></el-input> </el-form-item
            ></el-col>
            <el-col :span="12">
              <el-form-item label="发货地址:" prop="sender.address">
                <el-cascader
                  size="large"
                  :options="options"
                  clearable
                  :disabled="disabledType"
                  v-model="selectedOptions"
                  @change="sendHandleChange"
                >
                </el-cascader>
                <el-input
                  :disabled="disabledType"
                  v-model="deliveryForms.sender.address"
                  placeholder="请输入"
                ></el-input> </el-form-item
            ></el-col>
            <!--    <el-col :span="12">
              <el-form-item label="配送仓库:" prop="freight_price">
                <el-select>

                </el-select>
              </el-form-item></el-col
            >
            <el-col :span="12">
              <el-form-item label="物流公司:" prop="logistics_company_id">
                <el-select v-model="deliveryForms.logistics_company_id">

                </el-select>
              </el-form-item></el-col
            >
            <el-col :span="12">
              <el-form-item label="配送地址" prop="address">
                <el-input
                  v-model="deliveryForms.address"
                  :minlength="1"
                  :maxlength="20"
                  clearable
                  placeholder="请输入提货人"
                ></el-input> </el-form-item
            ></el-col> -->
          </el-row>
          <el-divider></el-divider>
          <h3>收货人信息:</h3>
          <!-- --><el-row>
            <el-col :span="12">
              <el-form-item label="收货人姓名:" prop="receiver.name">
                <el-input
                  v-model="deliveryForms.receiver.name"
                  :minlength="1"
                  :maxlength="20"
                  :disabled="disabledType"
                  placeholder="请输入收货人姓名"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="手机号:" prop="receiver.phone">
                <el-input
                  v-model="deliveryForms.receiver.phone"
                  :minlength="1"
                  :maxlength="20"
                  :disabled="disabledType"
                  placeholder="请输入手机号"
                ></el-input> </el-form-item
            ></el-col>
            <el-col :span="12">
              <el-form-item label="配送地址:" prop="receiver.address">
                <el-cascader
                  size="large"
                  :options="options"
                  clearable
                  :disabled="disabledType"
                  v-model="receiverOptions"
                  @change="receiverChange"
                >
                </el-cascader>
                <el-input
                  v-model="deliveryForms.receiver.address"
                  size="medium"
                  :disabled="disabledType"
                  placeholder="请输入"
                ></el-input> </el-form-item
            ></el-col>
          </el-row>
          <el-divider></el-divider>
          <!--  <el-row  :gutter="20">
              <el-col :span="8" :offset="6">
              <el-form-item label="物流单号:" prop="tracking_number">
                <el-input
                  v-model="tracking_number"
                  :minlength="1"
                  :maxlength="20"
                  clearable
                  placeholder="请输入物流单号"
                ></el-input>
                <el-button>自动获取单号</el-button>
                </el-form-item
            ></el-col>
          </el-row> -->
          <h3>商品信息:</h3>
          <el-table
            :data="product_list"
            border
            :cell-style="{ textAlign: 'center' }"
            :header-cell-style="{ textAlign: 'center' }"
            style="width: 95%"
          >
            <el-table-column type="selection" width="40" align="center" />
            <el-table-column label="商品编号">
              <template slot-scope="scope">
                {{ scope.row.goods_vo.sn }}
              </template>
            </el-table-column>
            <el-table-column label="商品名称">
              <template slot-scope="scope">
                {{ scope.row.goods_vo.name }}
              </template>
            </el-table-column>
            <el-table-column label="条码">
              <template slot-scope="scope">
                {{ scope.row.product_vo.bar_code }}
              </template>
            </el-table-column>
            <el-table-column label="序列号">
              <template slot-scope="scope">
                {{ scope.row.product_vo.sn_code }}
              </template>
            </el-table-column>
            <el-table-column label="规格型号">
              <template slot-scope="scope">
                {{ scope.row.product_vo.spec_name.join("/") }}
              </template>
            </el-table-column>
            <el-table-column label="单位">
              <template slot-scope="scope">
                {{ scope.row.product_vo.unit }}
              </template>
            </el-table-column>
            <el-table-column label="订单数量">
              <template slot-scope="scope">
                {{ scope.row.num }}
              </template>
            </el-table-column>
            <el-table-column label="库存数量">
              <template slot-scope="scope">
                {{ scope.row.use_able_stock }}
              </template>
            </el-table-column>
          </el-table>
          <el-divider></el-divider>
          <h3></h3>

          <el-row>
            <el-col :span="8">
              <el-form-item label="物品总重量:" prop="total_weight">
                <el-input
                  v-model.number="deliveryForms.total_weight"
                  :minlength="1"
                  :maxlength="20"
                  type="number"
                  max="50"
                  clearable
                  :disabled="disabledType"
                  placeholder="请输入物品总重量"
                  ><template slot="append">KG</template></el-input
                >
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="物品总体积:" prop="total_volume">
                <el-input
                  v-model="deliveryForms.total_volume"
                  :minlength="1"
                  :maxlength="20"
                  clearable
                  :disabled="disabledType"
                  placeholder="请输入物品总体积"
                  ><template slot="append">m³</template></el-input
                >
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="物品价格:" prop="declared_value">
                <el-input
                  v-model="deliveryForms.declared_value"
                  :minlength="1"
                  :maxlength="20"
                  clearable
                  :disabled="disabledType"
                  placeholder="请输入物品价格"
                  ><template slot="append">元</template></el-input
                >
              </el-form-item>
            </el-col>
            <el-col :span="16">
              <el-form-item label="备注:" prop="remark">
                <el-input
                  v-model="deliveryForms.remark"
                  type="textarea"
                  clearable
                  :disabled="disabledType"
                  :autosize="{ minRows: 2, maxRows: 4 }"
                  placeholder="请输入备注"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-divider></el-divider>
          <el-row :gutter="20">
            <el-col :span="8" :offset="6">
              <el-form-item label="物流单号:" prop="tracking_number">
                <el-input
                  v-model="kdnCode"
                  :minlength="1"
                  :maxlength="20"
                  :disabled="true"
                  placeholder="请输入物流单号"
                ></el-input>
                <el-button
                  @click="obtainOrder"
                  v-if="kdnCode == '' || kdnCode == undefined"
                  :disabled="btnType"
                  >获取单号</el-button
                >
              </el-form-item></el-col
            >
          </el-row>
        </el-form>
      </div>
      <div
        v-if="
          outType !== undefined &&
          (JSON.stringify(deliveryForms.create_order_fail) !== '{}' ||
            JSON.stringify(deliveryForms.create_order_success) !== '{}')
        "
      >
        <h3>物流状态:</h3>
        <div
          class="steps-wrap"
          v-if="JSON.stringify(deliveryForms.create_order_fail) !== '{}'"
        >
          <el-steps class="steps" direction="vertical" process-status="finish">
            <el-step
              icon="el-icon-error"
              :title="
                deliveryForms.create_order_fail.orderStatus == 600
                  ? '下单失败'
                  : ''
              "
            >
              <div slot="description">
                <p class="row-remark">
                  {{ deliveryForms.create_order_fail.remark }}
                </p>
                <p class="row-time">
                  {{
                    (deliveryForms.create_order_fail.requestTime / 1000)
                      | unixToDate
                  }}
                </p>
              </div>
            </el-step>
          </el-steps>
        </div>
        <div class="steps-wrap" v-else>
          <el-steps
            class="steps"
            direction="vertical"
            process-status="finish"
            :active="0"
          >
            <el-step
              icon="el-icon-success"
              v-if="JSON.stringify(deliveryForms.sign_in) !== '{}'"
              :title="deliveryForms.sign_in.orderStatus == 402 ? '退回' : ''"
            >
              <div slot="description">
                <p class="row-remark">{{ deliveryForms.sign_in.remark }}</p>
                <p class="row-time">
                  {{ (deliveryForms.sign_in.requestTime / 1000) | unixToDate }}
                </p>
              </div>
            </el-step>
            <el-step
              icon="el-icon-success"
              v-if="JSON.stringify(deliveryForms.sign_in) !== '{}'"
              :title="deliveryForms.sign_in.orderStatus == 401 ? '签收' : ''"
            >
              <div slot="description">
                <p class="row-remark">{{ deliveryForms.sign_in.remark }}</p>
                <p class="row-time">
                  {{ (deliveryForms.sign_in.requestTime / 1000) | unixToDate }}
                </p>
              </div>
            </el-step>
            <el-step
              icon="el-icon-success"
              v-if="JSON.stringify(deliveryForms.user_sending) !== '{}'"
              :title="
                deliveryForms.user_sending.orderStatus == 300 ? '配送中' : ''
              "
            >
              <div slot="description">
                <p class="row-remark">
                  {{ deliveryForms.user_sending.remark }}
                </p>
                <p class="row-time">
                  {{
                    (deliveryForms.user_sending.requestTime / 1000) | unixToDate
                  }}
                </p>
              </div>
            </el-step>
            <el-step
              icon="el-icon-success"
              v-if="JSON.stringify(deliveryForms.user_arrives) !== '{}'"
              :title="
                deliveryForms.user_arrives.orderStatus == 202 ? '已取件' : ''
              "
            >
              <div slot="description">
                <p class="row-remark">
                  {{ deliveryForms.user_arrives.remark }}
                </p>
                <p class="row-time">
                  {{
                    (deliveryForms.user_arrives.requestTime / 1000) | unixToDate
                  }}
                </p>
              </div>
            </el-step>
            <el-step
              icon="el-icon-success"
              v-if="JSON.stringify(deliveryForms.user_take_order) !== '{}'"
              :title="
                deliveryForms.user_take_order.orderStatus == 201 ? '已接单' : ''
              "
            >
              <div slot="description">
                <p class="row-remark">
                  {{ deliveryForms.user_take_order.remark }}
                </p>
                <p class="row-time">
                  {{
                    (deliveryForms.user_take_order.requestTime / 1000)
                      | unixToDate
                  }}
                </p>
              </div>
            </el-step>
            <el-step
              icon="el-icon-success"
              v-if="JSON.stringify(deliveryForms.create_order_success) !== '{}'"
              :title="
                deliveryForms.create_order_success.orderStatus == 100
                  ? '待接单'
                  : ''
              "
            >
              <div slot="description">
                <p class="row-remark">
                  {{ deliveryForms.create_order_success.remark }}
                </p>
                <p class="row-time">
                  {{
                    (deliveryForms.create_order_success.requestTime / 1000)
                      | unixToDate
                  }}
                </p>
              </div>
            </el-step>
          </el-steps>
        </div>
      </div>
      <!--  <el-divider></el-divider>
      <el-form
        :model="deliveryForms"
        ref="deliveryForms"
        label-width="120px"
      >
        <el-row>
          <el-col :span="12">
            <el-form-item label="出库单号:" prop="name">
              <el-select v-model="deliveryForms.sn">

              </el-select>

            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="订单编号:" prop="sn">
              <el-select v-model="deliveryForms.order_sn_list">

              </el-select>
            </el-form-item></el-col
          >
          <el-col :span="12">
            <el-form-item label="配送方式:" prop="category_id">
              <el-select>

              </el-select>
            </el-form-item></el-col
          >
          <el-col :span="12">
            <el-form-item label="配送仓库:" prop="freight_price">
              <el-select>

              </el-select>
            </el-form-item></el-col
          >
          <el-col :span="12">
            <el-form-item label="物流公司:" prop="logistics_company_id">
              <el-select v-model="deliveryForms.logistics_company_id">

              </el-select>
            </el-form-item></el-col
          >
          <el-col :span="8" >
            <el-form-item label="配送地址" prop="address">
              <el-input
                v-model="deliveryForms.address"
                :minlength="1"
                :maxlength="20"
                clearable
                placeholder="请输入提货人"
              ></el-input>
              </el-form-item
          ></el-col>
        </el-row>
          <el-row  :gutter="20">
              <el-col :span="8" :offset="6">
              <el-form-item label="物流单号:" prop="tracking_number">
                <el-input
                  v-model="tracking_number"
                  :minlength="1"
                  :maxlength="20"
                  clearable
                  placeholder="请输入物流单号"
                ></el-input>
                <el-button>自动获取单号</el-button>
                </el-form-item
            ></el-col>
          </el-row>
      </el-form> -->
      <div class="footer">
        <!-- <el-button type="primary"> 获取全部单号 </el-button> -->
        <el-button
          type="primary"
          @click="saveErpWarehouseOut"
          :disabled="outType == 'check'"
          v-if="kdnCode !== ''"
          >发货
        </el-button>
        <el-button @click="roBack2()">返回</el-button>
      </div>
    </div>
  </div>
</template>
<script>
import * as API_BasicSetting from "@/api/basicSetting";
import * as API_order from "@/api/order";
import * as API_Setting from "@/api/setting";
import * as API_Auth from "@/api/auth";
import { RegExp } from "~/ui-utils";
import { Foundation } from "~/ui-utils";
import {
  provinceAndCityData,
  pcTextArr,
  regionData,
  pcaTextArr,
  codeToText,
} from "element-china-area-data";
import { mapGetters } from "vuex";

export default {
  name: "orderOutbound",
  data() {
    return {
      btnType: false,
      disabledType: false,
      // 列表loading状态
      loading: false,
      appointmentList: [
        {
          label: "立即单",
          value: 0,
        },
        {
          label: "预约上门",
          value: 1,
        },
      ],
      deptList: [],
      orderIds: "",
      orderOutboundInfo: {
        warehouse_consignee_id: "",
      },
      id: "",
      adminList: [],
      kdnCode: "",
      deliveryForms: {
        remark: "",
        declared_value: "",
        appointment_type: "",
        total_weight: "",
        //发货人
        sender: {
          name: "",
          phone: "",
          address: "",
        },
        //收货人
        receiver: {
          name: "",
          phone: "",
          address: "",
        },
        //商品信息列表
        goods_list: [],
      },
      product_list: [],
      options: regionData,
      selectedOptions: [],
      receiverOptions: [],
      rules: {
        appointment_type: [
          { required: true, message: "请选择预约类型", trigger: "change" },
        ],
        appointment_time: [
          { required: true, message: "请选择上门时间", trigger: "blur" },
        ],
        sender: {
          name: [
            { required: true, message: "请输入发货人姓名", trigger: "blur" },
          ],

          phone: [
            this.MixinRequired("请输入手机号码！"),
            {
              validator: (rule, value, callback) => {
                if (!RegExp.mobile.test(value)) {
                  callback(new Error("手机号码格式有误！"));
                } else {
                  callback();
                }
              },
              trigger: ["change", "blur"],
            },
          ],
        },
        receiver: {
          name: [
            { required: true, message: "请输入收货人姓名", trigger: "blur" },
          ],
          phone: [
            this.MixinRequired("请输入手机号码！"),
            {
              validator: (rule, value, callback) => {
                if (!RegExp.mobile.test(value)) {
                  callback(new Error("手机号码格式有误！"));
                } else {
                  callback();
                }
              },
              trigger: ["change", "blur"],
            },
          ],
        },
        total_weight: [
          { required: true, message: "请输入物品总重量", trigger: "blur" },
          /**/ {
            type: "number",
            min: 0,
            max: 50,
            message: "物品总重量不能超过50kg",
            trigger: "blur",
          },
        ],
        total_volume: [
          { required: true, message: "请输入物品总体积", trigger: "blur" },
        ],
        declared_value: [
          { required: true, message: "请输入物品价格", trigger: "blur" },
        ],
      },
      outType: "",
      send_address: "",
      receive_address: "",
      detailData: [], // 物流详情
      /* nameToCodeMap:{} */
    };
  },
  watch: {
    $route: {
      immediate: true,
      handler(newVal) {
        if (this.$route.name === "orderOutboundAdd") {
          /* this.id = this.$route.params.id;
          this.GET_WarehouseOutDetail(); */
        } else {
          this.orderIds = this.$route.params.orderIds;
          /* this.GET_WarehouseOutPreview(); */
        }
      },
    },
  },
  computed: {
    ...mapGetters(["user"]),
  },
  mounted() {
    /**/ this.id = this.$route.params.id;
    this.GET_WarehouseOutDetail();
    this.GET_AdministratorList();
    this.outType = this.$route.params.type;
    /* this.generateMap(regionData); */
  },
  methods: {
    /* 收获地址 */
    receiverChange(val) {
      this.deliveryForms.receiver.province_name =
        codeToText[this.receiverOptions[0]];
      this.deliveryForms.receiver.city_name =
        codeToText[this.receiverOptions[1]];
      this.deliveryForms.receiver.area_name =
        codeToText[this.receiverOptions[2]];
      this.receive_address = val.join(",");
    },
    /* 发货地址 */
    sendHandleChange(val) {
      this.deliveryForms.sender.province_name =
        codeToText[this.selectedOptions[0]];
      this.deliveryForms.sender.city_name = codeToText[this.selectedOptions[1]];
      this.deliveryForms.sender.area_name = codeToText[this.selectedOptions[2]];
      this.send_address = val.join(",");
    },

    obtainOrder() {
      this.$refs["ruleForm"].validate((valid) => {
        if (valid) {
          this.btnType = true;
          const params = this.MixinClone(this.deliveryForms);
          //发货详细地址
          params.receiver.province_city_area_address =
            params.receiver.province_name +
            params.receiver.city_name +
            params.receiver.area_name +
            params.receiver.address;
          //收货详细地址
          params.sender.province_city_area_address =
            params.sender.province_name +
            params.sender.city_name +
            params.sender.area_name +
            params.sender.address;
          //商品信息
          const item = {};
          this.product_list.map((el) => {
            item.goods_name = el.goods_vo.name;
            /* item.goods_price = el.product_vo.price; */
            item.quantity = el.num;
            item.unit = el.product_vo.unit;
            return params.goods_list.push(item);
          });
          params.goods_num = this.product_list.reduce(
            (sum, e) => sum + Number(e.num || 0),
            0
          );
          params.total_weight = Number(params.total_weight);
          params.total_volume = Number(params.total_volume);
          params.declared_value = Number(params.declared_value);
          //地址
          params.send_address = this.send_address;
          params.receive_address = this.receive_address;
          params.order_code = this.id;
          API_order.getKdShip(this.id, params).then((res) => {
            this.kdnCode = res;
            this.btnType = false;
          });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },

    //获取地址
    handleChange(value) {},
    /** 获取人员列表 */
    GET_AdministratorList() {
      API_Auth.getAdministratorList({
        page_no: 1,
        page_size: 9999,
        user_state: 0,
      }).then((response) => {
        this.adminList = response.data;
      });
    },
    saveErpWarehouseOut() {
      API_order.outOrderSend(this.id).then((res) => {
        this.$router.push({ name: "warehouseOut" });
      });
      return;
      /* {
        send_address: this.send_address,
        receive_address: this.receive_address,
      } */
      API_order.addErpWarehouseOut({
        order_list: this.orderOutboundInfo.order_list,
        warehouse_consignee_id: this.orderOutboundInfo.warehouse_consignee_id,
        out_time: this.orderOutboundInfo.out_time / 1000,
      }).then((response) => {
        this.$message.success("出库成功！");
        const { callback } = this.$route.params;
        if (typeof callback === "function") callback();
        this.$store.dispatch("delCurrentViews", {
          view: this.$route,
          $router: this.$router,
        });
        this.$router.push({ name: "order" });
      });
    },
    // 选择批次
    async handleSelectWarehouseEntryBatch(items) {
      const goodsData = await this.$EnwarehouseEntryBatch({
        goodsApi: "admin/erp/warehouseEntryBatch",
        selectedIds: items.batch_list
          ? items.batch_list.map((item) => item.id)
          : [],
        purchasePlanApiParams: {
          warehouse_id: this.orderOutboundInfo.warehouse_id,
          product_id: items.product_id,
        },
        showWarehouseSearch: false,
      });
      items.batch_list = goodsData.purchasePlans.map((item) => {
        item.batch_id = item.id;
        item.batch_sn = item.sn;
        return item;
      });
    },
    roBack2() {
      const { callback } = this.$route.params;
      if (typeof callback === "function") callback();
      this.$store.dispatch("delCurrentViews", {
        view: this.$route,
        $router: this.$router,
      });
      this.$router.push({ name: "warehouseOut" });
    },
    roBack() {
      const { callback } = this.$route.params;
      if (typeof callback === "function") callback();
      this.$store.dispatch("delCurrentViews", {
        view: this.$route,
        $router: this.$router,
      });
      this.$router.push({ name: "order" });
    },
    /** 获取发货单详情*/
    GET_WarehouseOutDetail() {
      API_order.getSendOrderDetail(this.id).then((res) => {
        res.product_list = res.order_item_vos;
        this.product_list = res.order_item_vos;
        console.log(res.kdn_order_code == undefined);

        if (this.outType !== undefined || res.kdn_order_code !== undefined) {
          this.disabledType = true;
          this.deliveryForms.appointment_type = res.appointment_type;
          this.deliveryForms.appointment_time = res.appointment_time;
          this.deliveryForms.sender.name = res.sender_name;
          this.deliveryForms.sender.phone = res.sender_phone;
          this.deliveryForms.sender.address = res.sender_address;
          this.deliveryForms.receiver.name = res.receiver_name;
          this.deliveryForms.receiver.phone = res.receiver_phone;
          this.deliveryForms.receiver.address = res.receiver_address;
          this.deliveryForms.total_volume = res.total_volume;
          this.deliveryForms.declared_value = res.order_vo.real_price;
          this.deliveryForms.remark = res.remark;
          this.kdnCode = res.kdn_order_code;
          if (
            JSON.stringify(res.create_order_fail) == "{}" ||
            JSON.stringify(res.create_order_success) == "{}" ||
            JSON.stringify(res.user_take_order) == "{}" ||
            JSON.stringify(res.user_arrives) == "{}" ||
            JSON.stringify(res.user_sending) == "{}" ||
            JSON.stringify(res.order_fee) == "{}" ||
            JSON.stringify(res.sign_in) == "{}"
          ) {
            /* let arr =[]
            arr.push(res.create_order_fail)
            arr.push(res.create_order_success)
            arr.push(res.user_take_order)
            arr.push(res.user_arrives)
            arr.push(res.user_sending)
            arr.push(res.order_fee)
            arr.push(res.sign_in)
            console.log(arr);*/
            this.deliveryForms.create_order_fail = res.create_order_fail;
            this.deliveryForms.create_order_success = res.create_order_success;
            this.deliveryForms.user_take_order = res.user_take_order;
            this.deliveryForms.user_arrives = res.user_arrives;
            this.deliveryForms.user_sending = res.user_sending;
            this.deliveryForms.order_fee = res.order_fee;
            this.deliveryForms.sign_in = res.sign_in;
          }
        }
        res.order_item_vos.map((el) => {
          this.deliveryForms.total_weight = Number(
            el.product_vo.weight * el.num
          );
        });
        this.deliveryForms.declared_value = Number(res.order_vo.real_price);
        if (res.send_address && res.receiver_address) {
          this.selectedOptions = res.send_address.split(",");
          this.receiverOptions = res.receive_address.split(",");
        }

        console.log(this.deliveryForms);
        /* this.deliveryForms.sender=res.sender_province_name */
      });
    },
    /** 出库前预览 */
    GET_WarehouseOutPreview() {
      API_order.getWarehouseOutPreview({ order_id_list: this.orderIds }).then(
        (response) => {
          this.dept_id = response.dept_id;
          this.orderOutboundInfo = response;
          this.orderOutboundInfo.out_time = new Date().getTime();
          this.$set(
            this.orderOutboundInfo,
            "warehouse_consignee_id",
            this.user.uid
          );
        }
      );
    },
  },
};
</script>
<style type="text/scss" lang="scss" scoped>
/deep/.el-card {
  margin-top: 30px;
}

.el-row {
  // border-bottom: 1px solid #ebeef5;
  position: relative;
}

.el-col {
  padding: 10px;
  position: relative;

  &:not(:first-child)::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    // width: 1px;
    height: 100%;
    background-color: #ebeef5;
  }
}

/deep/ .el-card__body {
  margin: 10px;
  padding: 0;
  border: 1px solid #ebeef5;
  border-bottom: 0;
  font-size: 12px;
}

.bg-in {
  background-color: #fff;
  margin: 10px;
  padding: 55px;
}

.flex {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;

  div {
    flex: 1;
    color: #909399;
    font-size: 15px;
  }
}

.font {
  color: #606266;
  padding: 0 12px 0 0;
}

.order-item {
  margin-top: 30px;
}

.footer {
  width: 100%;
  padding: 10px;
  bottom: 0px;
  text-align: center;
  z-index: 999;
  margin-top: 30px;
}
/deep/ .el-form-item__content {
  display: flex;
  align-items: center;
  .el-input {
    width: 300px;
  }
}
/* 覆盖步骤条的数字为圆点 */
/deep/.el-steps__icon {
  background-color: #409eff; /* 蓝色背景 */
  color: #409eff; /* 蓝色文字，与背景同色，使数字不可见 */
}

/* 调整圆点的大小 */
/deep/.el-steps__icon-inner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: white; /* 白色圆点 */
  transform: translate(-50%, -50%);
  position: absolute;
  top: 50%;
  left: 50%;
}
</style>

