zuozhengqing
2024-03-20 ea2b5a4a2779a2a94c4846b110c5507a248ffeb5
销售明细发货添加确认完成,格式化列表状态展示
3个文件已修改
204 ■■■■ 已修改文件
src/api/sales/salesDetails.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/salesDetails/index.vue 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/salesDetails/shipmentsDialog.vue 153 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/sales/salesDetails.js
@@ -88,4 +88,12 @@
    data
  })
}
// 确认发货完成
export function confirmOutputOver(data) {
  return request({
    url: "/api/salesDetails/confirmOutputOver",
    method: "post",
    data
  })
}
src/views/sales/salesDetails/index.vue
@@ -50,6 +50,9 @@
                  <template v-if="scope.row.status === 3||scope.row.status === 4">
                    <el-button @click.stop="shipmentsClick(scope.row)" type="text" size="small">发货</el-button>
                  </template>
                  <template v-if="scope.row.status === 3||scope.row.status === 4">
                    <el-button @click.stop="confirmClick(scope.row)" type="text" size="small">确认完成</el-button>
                  </template>
                </template>
              </el-table-column>
            </template>
@@ -176,7 +179,8 @@
  getProductOrderInfo,
  updateStatus,
  getProjectList,
  sendSalesDetailsToOtherSystem
  sendSalesDetailsToOtherSystem,
  confirmOutputOver
} from "@/api/sales/salesDetails"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import DetailSpecification from "@/views/sales/salesDetails/DetailSpecification"
@@ -241,7 +245,7 @@
      { label: "承运商", prop: "carrier" },
      { label: "运单号", prop: "waybill" },
      { label: "创建时间", prop: "warehouse" },
      { label: "状态", prop: "status" },
      { label: "状态", prop: "status",isCallMethod: true,getCallMethod: this.getStatusFive },
    ]
    // 制造信息
    const makeColumn = [
@@ -318,57 +322,47 @@
      {
        label: "委外订单",
        prop: "outsourcingId",
        default: true
      },
      {
        label: "产品编号",
        prop: "productId",
        default: true
      },
      {
        label: "产品名称",
        prop: "productName",
        default: true
      },
      {
        label: "产品规格",
        prop: "specs",
        default: true
      },
      {
        label: "产品单位",
        prop: "unit",
        default: true
      },
      {
        label: "委外数量",
        prop: "amount",
        default: true
      },
      {
        label: "完成数量",
        prop: "finishAmount",
        default: true
      },
      {
        label: "订单状态",
        prop: "status",
        default: true
        default: true, isCallMethod: true, getCallMethod: this.getStatus
      },
      {
        label: "委外供应商",
        prop: "supplierName",
        default: true
      },
      {
        label: "签约日期",
        prop: "startTime",
        default: true
      },
      {
        label: "交付日期",
        prop: "endTime",
        default: true
      },
    ]
    return {
@@ -736,6 +730,15 @@
      this.editShipmentsConfig.infomation.saleDetailNumber=row.number
      this.editShipmentsConfig.infomation.projectId=row.projectId
    },
    // 确认发货完成
    async confirmClick(row){
      await confirmOutputOver({saleDetailNumber:row.number}).then((res)=>{
        if(res&&res.code===200){
          this.$message.success("确认发货完成")
          this.getData()
        }
      })
    },
    // 关闭
    closeClick(row) {
      console.log(row, "关闭")
@@ -850,7 +853,7 @@
    },
    // 状态
    getStatus(val) {
      return val === 1 ? "待确认" : val === 2 ? "待出库" : val === 3 ? "备货中" : val === 4 ? "待出库" : val === 5 ? "出库完成" : val=== 6 ? "已关闭": "--"
      return val === 1 ? "待确认" : val === 2 ? "待分解" : val === 3 ? "备货中" : val === 4 ? "待出库" : val === 5 ? "出库完成" : val=== 6 ? "已关闭": "--"
    },
    // top 行点击
    tableRowClick(row) {
@@ -867,6 +870,9 @@
        this.getProductOrderInfo(this.selectRow.number)
      } else if (this.TabsIndex == 3) {
        // 采购信息
        this.getProductOrderInfo(this.selectRow.number)
      }else if(this.TabsIndex == 4){
        // 委外信息
        this.getProductOrderInfo(this.selectRow.number)
      }
    },
@@ -927,7 +933,14 @@
          })
        }
      })
    }
    },
    getStatusFive(val) {
      if (val) {
        return val==0?'就绪':'完成'
      } else {
        return "--";
      }
    },
  }
}
</script>
src/views/sales/salesDetails/shipmentsDialog.vue
@@ -85,9 +85,8 @@
              @clearupProduct="clearupProduct"
            ></CommonFormTableView>
          </div>
          <p class="tips" v-if="completely"><i class="el-icon-warning-outline">当前仓库能满足发货需求,直接发货吧</i></p>
          <p class="tips" v-if="satisfyPartly"><i class="el-icon-warning-outline"></i>当前仓库只能部分满足发货需求,是否确认发货</p>
          <p class="tips" v-if="dissatisfy"><i class="el-icon-warning-outline"></i>当前仓库库存不足,不能完成一次发货,请选择其他仓库吧</p>
          <p class="tips tips_success" v-if="completely"><i class="el-icon-warning-outline"></i>{{ shipmentsMsg }}</p>
          <p class="tips tips_insufficient" v-if="dissatisfy"><i class="el-icon-warning-outline"></i>{{shipmentsMsg}}</p>
        </div>
      </el-form>
@@ -205,9 +204,10 @@
        label: '仓库1--库存充足的情况'
      }],
      value:"",
      shipmentsList:[],
      shipmentsMsg:"",
      dissatisfy:false, // 一次发货-不足
      completely:false, // 多次发货,充足
      satisfyPartly:false, //多次发货,部分满足
    }
  },
  mounted(){
@@ -272,14 +272,41 @@
      this.$refs[formName].validate((valid) => {
        if (valid) {
          const params = this.saveParams()
          confirmOutput(params).then((res)=>{
            console.log(res,"res")
            if(res&&res.code===200){
              this.$message.success("发货成功!")
              this.$parent.getData()
              this.editConfig.visible=false
          console.log(params,"参数")
          let isShipments=false
          let shipmentsNum=false
          this.shipmentsList.map((item)=>{
            if(this.shipmentsType===1){
              if(item.leftAmount<item.availableAmount){
                isShipments=false
              }else{
                isShipments=true
              }
            }else{
              if(item.outputAmount>item.availableAmount||item.outputAmount>item.leftAmount){
                isShipments=true
              }else if(item.outputAmount===0){
                shipmentsNum=true
              }else if(!item.outputAmount){
                shipmentsNum=true
              }else{
                isShipments=false
              }
            }
          })
          if(isShipments){
            this.$message.warning("发货数量超出未发货数量或超出当前可用库存")
          }else if(shipmentsNum){
            this.$message.warning("发货数量不能为0")
          }else{
            confirmOutput(params).then((res)=>{
              if(res&&res.code===200){
                this.$message.success("发货成功!")
                this.$parent.getData()
                this.editConfig.visible=false
              }
            })
          }
        }
      })
    },
@@ -288,10 +315,10 @@
        products:[],
        saleDetailNumber:this.editCommonConfig.infomation.saleDetailNumber
      }
      this.productTableList.tableData.map((item)=>{
      this.shipmentsList.map((item)=>{
        let obj={
          number:item.number,
          outputAmount:item.outputAmount||''
          outputAmount:this.shipmentsType===1?item.leftAmount:item.outputAmount // 本次发货数量
        }
        params.products.push(obj)
      })
@@ -425,20 +452,20 @@
        tableColumn: [
          { label: "产品编号", prop: "number" },
          { label: "产品名称", prop: "name",   min: 110 },
          { label: "订单数量", prop: "specs" },
          { label: "订单完成数量", prop: "type" },
          { label: "订单数量", prop: "orderAmount" },
          { label: "订单完成数量", prop: "finishAmount" },
          // { label: "可用库存", prop: "unit" },
        ]
      }
    },
    // 产品列表输入
    inputContent(val, prop, row) {
      // this.productId = row.productId
      this.tableData.map((item) => {
        if (item.number === row.number) {
          item[prop] = val
        }
      })
      console.log(val,prop,row,)
      // this.productTableList.tableData.map((item) => {
      //   if (item.number === row.number) {
      //     item[prop] = val
      //   }
      // })
    },
    // 产品新增
    addProductClick() {
@@ -504,9 +531,10 @@
    },
    // 选择发货方式
    handleRadioChange(value) {  
      this.shipmentsList=[]
      this.dissatisfy=false
      this.completely=false
      if(value===1){
        this.completely=false
        this.satisfyPartly=false
        this.productTableList.tableColumn=[
          { label: "产品编号", prop: "number" },
          { label: "产品名称", prop: "name",   min: 110 },
@@ -517,20 +545,31 @@
        this.dissatisfy=false
        let portion=0
        this.productTableList.tableData.map((item)=>{
          if(item.availableAmount-item.leftAmount<0){
            this.dissatisfy=true
            return this.dissatisfy
          }else{
          if(item.availableAmount>=item.leftAmount&&item.availableAmount>0){
            portion++
            this.shipmentsList.push(item)
          }
          if(portion===0){// 没有产品满足发货条件
            this.completely=false
            this.dissatisfy=true
            this.shipmentsMsg="当前仓库库存不足,不能完成一次发货"
          }else if(portion>0&&portion<this.productTableList.tableData.length){// 部分产品满足发货条件
            this.dissatisfy=false
            this.completely=true
            this.shipmentsMsg="只能满足部分发货需求,是否确认发货"
          }else if(portion===this.productTableList.tableData.length){// 充分满足
            this.dissatisfy=false
            this.completely=true
            this.shipmentsMsg="能满足发货需求,直接发货吧"
          }
        })
        if(portion===this.productTableList.tableData.length){
        if(portion===this.productTableList.tableData.length){ // 全部满足发货条件
          this.dissatisfy=false
          this.completely=false
          this.completely=true
        }
      }else if(value===2){
        this.dissatisfy=false
        this.productTableList.tableColumn= [
          { label: "产品编号", prop: "number" },
          { label: "产品名称", prop: "name",  min: 110 },
@@ -538,37 +577,57 @@
          { label: "订单完成数量", prop: "finishAmount" },
          { label: "可用库存", prop: "availableAmount" },
          { label: "未发货数量", prop: "leftAmount",  },
          { label: "本次发货数量", prop: "outputAmount", inputFloat: true,isRequird: true  },
          { label: "本次发货数量", prop: "outputAmount", inputFloat: true,isRequird:true },
          { label: "剩余发货数量", prop: "availableAmount",},
        ]
        let portion=0
        this.productTableList.tableData.map((item)=>{
          if(item.availableAmount-item.leftAmount>=0){
          if(item.availableAmount>0){
            portion++
            this.shipmentsList.push(item)
          }
          if(portion===0){ // 没有一件产品能满足发货条件
            this.completely=false
            this.dissatisfy=true
            this.shipmentsMsg="当前仓库库存为0,无法发货"
          }else if(portion>0&&portion<this.productTableList.tableData.length){
            this.dissatisfy=false
            this.completely=true
            this.shipmentsMsg="只能满足部分发货需求,是否确认发货"
          }else if(portion===this.productTableList.tableData.length){
            this.dissatisfy=false
            this.completely=true
            this.shipmentsMsg="能满足发货需求,直接发货吧"
          }
        })
        if(0<portion<this.productTableList.tableData.length){
          this.satisfyPartly=true
        }else if(portion===this.productTableList.tableData.length){
          this.completely=true
          this.dissatisfy=fasle
        }else if(portion===0){
          this.dissatisfy=true
          this.completely=false
        }
      }
    },
    // 产品入库信息
    async getDeliveryPrepareInfo(params){
      await getDeliveryPrepareInfo(params).then((res)=>{
        this.shipmentsList=[]
        if(res&&res.code===200){
          this.productTableList.tableData=res.data||[]
          if(this.shipmentsType===1){
            let portion=0
            this.productTableList.tableData.map((item)=>{
              if(item.availableAmount-item.leftAmount<0){
              if(item.availableAmount>=item.leftAmount&&item.availableAmount>0){
                portion++
                this.shipmentsList.push(item)
              }
              if(portion===0){// 没有产品满足发货条件
                this.completely=false
                this.dissatisfy=true
                return this.dissatisfy
                this.shipmentsMsg="当前产品可用库存为0,无法发货"
              }else if(portion>0&&portion<this.productTableList.tableData.length){
                this.dissatisfy=false
                this.completely=true
                this.shipmentsMsg="只能满足部分发货需求,是否确认发货"
                // 部分产品满足发货条件
              }else if(portion===this.productTableList.tableData.length){
                this.dissatisfy=false
                this.completely=true
                this.shipmentsMsg="能满足发货需求,直接发货吧"
              }
            })
          }
@@ -623,7 +682,6 @@
      }
      .tips{
        font-size: 16px;
        color: #FF9C49;
        display: flex;
        margin-left: 20px;
        i{
@@ -631,6 +689,15 @@
          margin-right: 10px;
        }
      }
      .tips_success{
        color: #5299FF;
      }
      .tips_portion{
        color: #FF9C49;
      }
      .tips_insufficient{
        color: #FF9C49;
      }
    }
    .unflod-collapse {
      display: flex;