<template>
  <div>
    <el-form ref="ruleForm" :model="ruleForm" label-width="80px">
      <el-form-item label="物流状态" prop="tags">
        <el-select
          v-model="ruleForm.status"
          class="form_select"
          filterable
          clearable
          placeholder="请选择物流状态"
        >
          <el-option
            v-for="item in logisticsStatusList"
            :key="item.id"
            :label="item.text"
            :value="item.id"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm()">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { logisticsStatusOrderCustomerService } from "@/api/customerServiceManagement/orderListCustomerService";
export default {
  props: {
    rowid: {
      type: String,
      default: "",
    },
    layerid: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      ruleForm: {
        orderids: "", //订单编号
        status: "", //标签内容
      },
      logisticsStatusList: [
        {
          id: 1,
          text: '未签收',
        },{
          id: 2,
          text: '签收',
        },{
          id: 3,
          text: '改代收',
        },{
          id: 4,
          text: '拒收',
        }
      ], //物流状态
    };
  },
  created() {
    if (this.rowid) {
      this.ruleForm.orderids = this.rowid;
    }
  },
  methods: {
    submitForm() {
      // this.ruleForm.status = this.ruleForm.status.join(",");
      logisticsStatusOrderCustomerService(this.ruleForm)
        .then((response) => {
          if (response.state.toLowerCase() === "success") {
            this.$parent.$layer.close(this.layerid);
            this.$parent.getList(); // 重新加载父级数据
            this.$message.success("恭喜你，操作成功!");
          }
        })
        .catch(() => {
          this.loading = false;
        });
    },
  },
};
</script>
<style lang="scss" scoped>
.form_select {
  width: 100%;
}
</style>