zuozhengqing
2023-12-06 84d9de8968ea6675ecb57fa7c59a7bf2fede8f4d
src/views/purchaseManage/purchase/index.vue
@@ -75,6 +75,7 @@
import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
import { getSupplierList } from "@/api/supplierManage/supplier"
import { getDataByType } from "@/api/data";
export default {
  name: "SupplierManage",
  props: {},
@@ -83,6 +84,7 @@
  computed: {},
  data() {
    return {
      purchaseStatusList:getDataByType('purchaseStatus'),
      tableLoading: false,
      tableList: {}, // 列表
      selValueList: [],
@@ -122,8 +124,24 @@
    console.log(this.$route.params,"路由参数")
    if(this.$route.params.supplierId){
      this.editConfig.visible = true
      this.editConfig.infomation.supplierId=this.$route.params.supplierId
      this.editConfig.infomation.supplierName=this.$route.params.supplierName
      this.editConfig.infomation = {
        productList: [],
        purchaseTypeId: "",
        supplierId: this.$route.params.supplierId||'',
        supplierName: this.$route.params.supplierName||'',
        orderSource: "手动创建",
        name: "",
        contact: "",
        phone: "",
        signingDate: "",
        deliveryDate: "",
        remark: "",
        wholeDiscountType: null,
        wholeDiscount: 0,
        priceAdjustmentType: null,
        priceAdjustment: 0,
        realTotalPrice: 0
      }
    }
    this.setTable()
    this.getData()
@@ -131,17 +149,10 @@
  },
  methods: {
    getpurchaseStatus(val) {
      let statusList=[
        {id:1,name:"待确认"},
        {id:2,name:"待入库"},
        {id:3,name:"已入库"},
        {id:4,name:"已完成"},
        {id:5,name:"已取消"}
      ]
      if (val) {
        for (let i in statusList) {
          if (statusList[i].id == val) {
            return statusList[i].name
        for (let i in this.purchaseStatusList) {
          if (this.purchaseStatusList[i].id == val) {
            return this.purchaseStatusList[i].name
          }
        }
      } else {
@@ -250,6 +261,9 @@
          this.tableLoading = false
          this.editConfig.visible = true
          this.editConfig.title = "编辑"
          res.data.productList.map((item,index)=>{
            item.productIndex=index
          })
          this.editConfig.infomation = {
            productList: res.data.productList,
            supplierName: res.data.purchase.supplier.name,
@@ -267,20 +281,29 @@
    },
    // 确认发货
    btnConfirm(row) {
      this.$confirm("是否提交?", "提示", {
      let string='是否提交?'
      if(!row.supplierName){
        string='您有必填字段未录入,请检查数据完整性。'
      }
      this.$confirm(string, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          submitPurchase({ id: row.ID,status:2 }).then((response) => {
            if (response.code === 200) {
              this.$message.success("提交成功")
              this.getData()
            } else {
              this.$message.warning("提交失败")
            }
          })
          if(!row.supplierName){
            this.btnEdit(row)
          }else{
            submitPurchase({ id: row.ID,status:2 }).then((response) => {
              if (response.code === 200) {
                this.$message.success("提交成功")
                this.getData()
              } else {
                this.$message.warning("提交失败")
              }
            })
          }
        },(e)=>{
          console.error(e)
        })