yangfeng
2023-11-10 bad9393dc3c437248697963f44eaa3ef39800a77
src/views/sales/salesDetails/index.vue
@@ -40,12 +40,12 @@
            <template slot="tableButton">
              <el-table-column label="操作" width="180">
                <template slot-scope="scope">
                  <el-button @click="handleClick(scope.row, '查看')" type="text" size="small">查看</el-button>
                  <el-button @click.stop="handleClick(scope.row, '查看')" type="text" size="small">查看</el-button>
                  <template v-if="scope.row.status === 1">
                    <el-button @click="handleClick(scope.row, '编辑')" type="text" size="small">编辑</el-button>
                    <el-button @click="submitClick(scope.row)" type="text" size="small">确认提交</el-button>
                    <el-button @click.stop="handleClick(scope.row, '编辑')" type="text" size="small">编辑</el-button>
                    <el-button @click.stop="submitClick(scope.row)" type="text" size="small">确认提交</el-button>
                    <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button> -->
                    <el-button @click="closeClick(scope.row.id)" type="text" size="small">关闭</el-button>
                    <el-button @click.stop="closeClick(scope.row)" type="text" size="small">关闭</el-button>
                  </template>
                </template>
              </el-table-column>
@@ -119,7 +119,14 @@
<script>
import AddSalesDetailsDialog from "@/views/sales/salesDetails/AddSalesDetailsDialog"
import { getSalesDetailsList, getDelSalesDetails } from "@/api/sales/salesDetails"
import {
  getSalesDetailsList,
  getDelSalesDetails,
  getProductInventoryInfo,
  getProductOrderInfo,
  updateStatus,
  createOperation
} from "@/api/sales/salesDetails"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import DetailSpecification from "@/views/sales/salesDetails/DetailSpecification"
import AddCollectionPlan from "@/views/other/payment/collectionPlan/AddCollectionPlan"
@@ -153,35 +160,35 @@
  data() {
    // 产品信息
    const productColumn = [
      { label: "产品编号", prop: "number", default: true },
      { label: "产品名称", prop: "client_name" },
      { label: "数量", prop: "signTime" },
      { label: "单位", prop: "member_name" },
      { label: "发货单", prop: "outboundStatus" },
      { label: "承运商", prop: "receiveTotalAmount", price: true },
      { label: "运单号", prop: "total", price: true },
      { label: "销售单价", prop: "taxUnitPrice", isProductPrice: true },
      { label: "价税合计", prop: "priceTax", isProductTotal: true }
      { label: "产品编号", prop: "Id", default: true },
      { label: "产品名称", prop: "Name" },
      { label: "数量", prop: "Amount" },
      { label: "单位", prop: "Unit" },
      { label: "发货单", prop: "shipOrder" },
      { label: "承运商", prop: "carrier" },
      { label: "运单号", prop: "waybillNumber" },
      { label: "销售单价", prop: "SalePrice", price: true },
      { label: "价税合计", prop: "Valorem", price: true }
    ]
    // 库存信息
    const inventoryColumn = [
      { label: "产品编号", prop: "number", default: true },
      { label: "产品名称", prop: "client_name" },
      { label: "订单数量", prop: "signTime" },
      { label: "仓库", prop: "member_name" },
      { label: "在库数量", prop: "outboundStatus" },
      { label: "可用库存", prop: "receiveTotalAmount", price: true },
      { label: "单位", prop: "total", price: true }
      { label: "产品编号", prop: "Id", default: true },
      { label: "产品名称", prop: "Name" },
      { label: "订单数量", prop: "OrderAmount" },
      { label: "仓库", prop: "Warehouse" },
      { label: "在库数量", prop: "Amount" },
      { label: "可用库存", prop: "AvailableNumber" },
      { label: "单位", prop: "Unit" }
    ]
    // 制造信息
    const makeColumn = [
      { label: "生产订单", prop: "number", default: true },
      { label: "产品名称", prop: "client_name" },
      { label: "订单状态", prop: "signTime" },
      { label: "工单编号", prop: "member_name" },
      { label: "工单状态", prop: "outboundStatus" },
      { label: "计划开始时间", prop: "receiveTotalAmount", price: true },
      { label: "计划结束时间", prop: "total", price: true }
      { label: "生产订单", prop: "OrderId", default: true },
      { label: "产品名称", prop: "ProductName" },
      { label: "订单状态", prop: "OrderStatus" },
      { label: "工单编号", prop: "WorkOrderId" },
      { label: "工单状态", prop: "WorkOrderStatus" },
      { label: "计划开始时间", prop: "StartTime" },
      { label: "计划结束时间", prop: "EndTime" }
    ]
    return {
      tableList: {},
@@ -360,16 +367,15 @@
                  ...item,
                  client_name: item.client.name,
                  member_name: item.Member.username,
                  source: "CRM同步",
                  status: 2
                  source: "CRM同步"
                }
              })
              this.tableList.tableInfomation = list || []
              this.pagerOptions.totalCount = res.data.count
              if (res.data.count > 0) {
                this.selectRow = this.tableList.tableInfomation.length > 0 ? this.tableList.tableInfomation[0] : {}
                // let row = this.tableList.tableInfomation[0];
                // this.getPointinspectionRecord(row.id);
                let row = this.tableList.tableInfomation[0]
                this.getProductInventoryInfo(row.number)
              }
            } else {
              this.tableList.tableInfomation = []
@@ -384,6 +390,20 @@
          this.tableList.tableInfomation = []
          this.loading = false
        })
    },
    // 获取产品/库存信息
    async getProductInventoryInfo(number) {
      await getProductInventoryInfo(number).then((res) => {
        console.log(res)
        this.productTableList.tableInfomation = res.data
      })
    },
    // 获取制造信息
    async getProductOrderInfo(number) {
      await getProductOrderInfo(number).then((res) => {
        console.log(res)
        this.productTableList.tableInfomation = res.data
      })
    },
    // 搜索
    onFilterSearch(searchText) {
@@ -420,12 +440,36 @@
      }
    },
    // 确认提交
    submitClick(row) {
    async submitClick(row) {
      console.log(row, "确认提交")
      let params = {
        ...row,
        status: 2
      }
      await createOperation(params).then((res) => {
        if (res.code == 200) {
          this.$message.success("确认提交成功")
          this.getData()
        }
      })
    },
    // 关闭
    closeClick(row) {
      console.log(row, "关闭")
      this.updateStatus(row.id, 4)
    },
    // 修改状态
    async updateStatus(id, status) {
      await updateStatus({
        id: id,
        status: status
      }).then((res) => {
        console.log(res)
        if (res.code == 200) {
          this.$message.success("关闭成功")
          this.getData()
        }
      })
    },
    // 删除
    delClick(rowID) {
@@ -493,6 +537,7 @@
        this.tableBottomColumn = this.productColumn
        this.showBottomCol = this.showProductCol
        this.setBottomList()
        this.getProductInventoryInfo(this.selectRow.number)
      } else if (this.TabsIndex == 1) {
        this.isClickProduct = false
        this.isClickInventory = true
@@ -501,6 +546,7 @@
        this.tableBottomColumn = this.inventoryColumn
        this.showBottomCol = this.showInventoryCol
        this.setBottomList()
        this.getProductInventoryInfo(this.selectRow.number)
      } else if (this.TabsIndex == 2) {
        this.isClickProduct = false
        this.isClickInventory = false
@@ -509,6 +555,7 @@
        this.tableBottomColumn = this.makeColumn
        this.showBottomCol = this.showMakeCol
        this.setBottomList()
        this.getProductOrderInfo(this.selectRow.number)
      }
    },
    // 状态
@@ -519,7 +566,13 @@
    tableRowClick(row, column, event) {
      console.log(row, column, event)
      this.selectRow = row
      // this.getPointinspectionRecord(row.id);
      if (this.TabsIndex == 0) {
        this.getProductInventoryInfo(this.selectRow.number)
      } else if (this.TabsIndex == 1) {
        this.getProductInventoryInfo(this.selectRow.number)
      } else if (this.TabsIndex == 2) {
        this.getProductOrderInfo(this.selectRow.number)
      }
    }
  }
}