zuozhengqing
2023-11-22 72f6f5abb7d6a90c9edfb69db63907ef3e17ef03
销售明细单添加确认订单前确认是否选择项目
3个文件已修改
175 ■■■■ 已修改文件
src/views/sales/contractManage/index.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/salesDetails/AddSalesDetailsDialog.vue 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/salesDetails/index.vue 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/contractManage/index.vue
@@ -113,7 +113,8 @@
        { label: "合同状态", prop: "serviceContractStatus_name", min: 100 },
        { label: "创建时间", prop: "created_at" }
      ],
      showCol: ["单据编号", "负责人", "客户名称", "合同状态", "创建时间"]
      showCol: ["单据编号", "负责人", "客户名称", "合同状态", "创建时间"],
      keyword:''
    }
  },
  created() {
@@ -160,7 +161,7 @@
    async getData() {
      this.loading = true
      await getContractList({
        search_map: this.search_map,
        keyword:this.keyword,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
@@ -195,7 +196,7 @@
    },
    // 搜索
    onFilterSearch(searchText) {
      this.search_map.number = searchText ?? ""
      this.keyword=searchText
      this.pagerOptions.currPage = 1
      this.getData()
    },
src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -659,13 +659,6 @@
          } else {
            const params = this.saveParams()
            if (this.editConfig.title === "新建") {
              if(params.projectId!==0){
                sendSalesDetailsToApsProject({...params,member:this.thatMember}).then((res)=>{
                  if(res.code===200){
                    this.$message.success("成功推送至aps系统")
                  }
                })
              }
              getAddSalesDetails(params).then((res) => {
                console.log(res)
                this.editConfig.visible = false
@@ -721,7 +714,7 @@
        quotationId: this.quotationId,
        deliverType: data.deliverType || 0,
        status: 1,
        projectId:data.projectId||0
        projectId:data.projectId||''
      }
      let params = {}
      if (this.editConfig.title === "新建") {
src/views/sales/salesDetails/index.vue
@@ -102,6 +102,36 @@
        </div>
      </div>
    </div>
    <!-- 确认提交-选择项目 -->
    <el-dialog
      title="请选择项目"
      :visible.sync="projectListShow"
      width="40%"
      :before-close="handleClose">
      <el-form
        label-width="100px"
        class="demo-ruleForm"
        ref="form"
        :rules="rules"
        :model="projects"
      >
        <el-form-item  label="选择项目" prop="projectId">
          <el-select
            v-model="projects.projectId"
            placeholder="请选择"
            size="mini"
            style="width: 100%"
          >
            <el-option v-for="item in projectList" :key="item.projectId" :label="item.projectName" :value="item.projectId">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="projectListShow = false">取 消</el-button>
        <el-button type="primary" @click="affirmCommitBtn">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 新建/编辑 -->
    <AddSalesDetailsDialog
      v-if="editConfig.visible"
@@ -125,7 +155,10 @@
  getProductInventoryInfo,
  getProductOrderInfo,
  updateStatus,
  createOperation
  createOperation,
  getProjectList,
  getUpdateSalesDetails,
  sendSalesDetailsToApsProject
} from "@/api/sales/salesDetails"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import DetailSpecification from "@/views/sales/salesDetails/DetailSpecification"
@@ -257,7 +290,16 @@
      showInventoryCol: ["产品编号", "产品名称", "订单数量", "仓库", "在库数量", "可用库存", "单位"],
      makeColumn: makeColumn,
      showMakeCol: ["生产订单", "产品名称", "订单状态", "工单编号", "工单状态", "计划开始时间", "计划结束时间"],
      selectRow: {}
      selectRow: {},
      projectList:[],
      projectListShow:false,
      projects:{
        projectId:'',
      },
      thatRow:{},
      rules: {
        projectId: [{ required: true, message: "请选择项目", trigger: "change" }],
      },
    }
  },
  created() {
@@ -270,6 +312,7 @@
      this.keywordType = this.addConfig.keywordType
    }
    this.getData()
    this.getProjectList()
  },
  methods: {
    setTable() {
@@ -446,17 +489,28 @@
    },
    // 确认提交
    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()
      this.thatRow=row
      if(row.projectId==""){
        this.$message.error("请先填写项目信息")
        this.projectListShow=true
      }else{
        let params = {
          ...row,
          status: 2
        }
      })
        await createOperation(params).then((res) => {
          if (res.code == 200) {
            this.$message.success("确认提交成功")
            this.getData()
            this.thatRow.status=2
            sendSalesDetailsToApsProject(this.thatRow).then((res)=>{
              if(res.code===200){
                this.$message.success("成功推送至aps系统")
              }
            })
          }
        })
      }
    },
    // 关闭
    closeClick(row) {
@@ -578,6 +632,83 @@
      } else if (this.TabsIndex == 2) {
        this.getProductOrderInfo(this.selectRow.number)
      }
    },
    // 获取项目列表
    async getProjectList(){
      await getProjectList({
        page: 1,
        pageSize: 100,
      }).then((res) => {
        console.log(res.data,"项目列表信息")
        this.projectList=res.data
      })
    },
    handleClose(done) {
      done()
    },
    saveParams() {
      let params={
        address: this.thatRow.address || "",
        addressee: this.thatRow.addressee || "",
        clientId: this.thatRow.clientId || 0,
        conditions: this.thatRow.conditions || "",
        deliveryDate: this.thatRow.deliveryDate || "",
        memberId: this.thatRow.memberId || 0,
        number: this.thatRow.number || "",
        phone: this.thatRow.phone || "",
        products: this.thatRow.products,
        remark: this.thatRow.remark || "",
        saleChanceId: this.thatRow.saleChanceId || 0,
        saleType: this.thatRow.saleType || 0,
        signTime: this.thatRow.signTime || "",
        wechatOrderStatus: this.thatRow.wechatOrderStatus || 0,
        logisticCompany: this.thatRow.logisticCompany || "",
        logisticCost: this.thatRow.logisticCost || 0,
        logisticNumber: this.thatRow.logisticNumber || "",
        quotationId: this.thatRow.quotationId,
        deliverType: this.thatRow.deliverType || 0,
        status:  this.thatRow.deliverType,
        projectId:this.projects.projectId||0
      }
      return params
    },
    // 确认提交
    affirmCommitBtn(){
      let params=this.saveParams()
      this.$refs['form'].validate((valid) => {
        if(valid){
          console.log()
          this.projectListShow=false
          getUpdateSalesDetails({
            id:this.thatRow.id,
            salesDetails:params
          }).then((res) => {
            console.log(res)
            this.editConfig.visible = false
            if (res.code === 200) {
              let params2 = {
                ...this.thatRow,
                status: 2
              }
              createOperation(params2).then((res) => {
                if (res.code == 200) {
                  this.$message.success("提交成功")
                  this.getData()
                  this.thatRow.status=2
                  sendSalesDetailsToApsProject(this.thatRow).then((res)=>{
                    if(res.code===200){
                      this.$message.success("成功推送至aps系统")
                    }
                  })
                }
              })
            }
          }).catch((err)=>{
            this.$message.error(`编辑失败:${err}`)
          })
        }
      })
    }
  }
}
@@ -679,4 +810,8 @@
.bgcWhite {
  background: #fff !important;
}
.el-form-item{
  width: 80%;
  margin: 20px auto;
}
</style>