yangfeng
2023-10-16 393ddcd51f0d588d13c6f5adc20e866aad259775
src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -24,10 +24,26 @@
          <div class="basic-info-view">
            <el-row>
              <el-col :span="12">
                <el-form-item label="订单编号" prop="number">
                  <WordInput
                    v-if="codenumer && (explain != '' || isIdDisabled) && method == 0"
                    :codenumer="codenumer"
                    :sum="sum"
                    :disabled="editConfig.title !== '新建' || isIdDisabled"
                    :inputValue="inputValue"
                    @codeList="codeList"
                  />
                  <span v-else-if="method == 0" style="color: #f56c6c"
                    >请优先配置编码规范 <el-button type="text" @click="numberClick"> 配置规范 </el-button></span
                  >
                  <span v-else>{{ editConfig.title === "新建" ? "自动生成" : editConfig.infomation.number }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="客户名称" prop="client_name">
                  <div class="custom-name">
                    <el-autocomplete
                      style="width:100%;"
                      style="width: 100%"
                      v-model="editConfig.infomation.client_name"
                      :fetch-suggestions="
                        (queryString, callback) => {
@@ -36,12 +52,17 @@
                      "
                      value-key="name"
                      @select="handleSelectClient('client', $event)"
                      :disabled="isNameChanceEdit"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick('client')">
                    <div v-if="!isNameChanceEdit" class="common-select-btn" @click="selClientClick('client')">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <div
                      v-if="editConfig.infomation.client_name && editConfig.infomation.client_name.length > 0"
                      v-if="
                        editConfig.infomation.client_name &&
                        editConfig.infomation.client_name.length > 0 &&
                        !isNameChanceEdit
                      "
                      class="common-select-btn"
                      @click="clearupClient('client')"
                    >
@@ -50,31 +71,12 @@
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="订单编号" prop="number">
                  <WordInput
                    v-if="codenumer && (explain != '' || isIdDisabled)&&method == 0"
                    :codenumer="codenumer"
                    :sum="sum"
                    :disabled="editConfig.infomation.id || isIdDisabled"
                    :inputValue="inputValue"
                    @codeList="codeList"
                  />
                  <span v-else-if="method == 0" style="color: #f56c6c"
                    >请优先配置编码规范
                    <el-button type="text"  @click="numberClick">
                        配置规范
                      </el-button
                    ></span
                  >
                  <span v-else>{{editConfig.title==='新建'? '自动生成': editConfig.infomation.number}}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="销售机会" prop="saleChanceId">
                  <div class="custom-name">
                    <el-autocomplete
                      style="width:100%"
                      style="width: 100%"
                      v-model="editConfig.infomation.sale_chance_name"
                      :fetch-suggestions="
                        (queryString, callback) => {
@@ -83,16 +85,53 @@
                      "
                      value-key="name"
                      @select="handleSelectClient('chance', $event)"
                      :disabled="isNameChanceEdit"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick('chance')">
                    <div v-if="!isNameChanceEdit" class="common-select-btn" @click="selClientClick('chance')">
                      <i class="el-icon-circle-plus-outline"></i>
                    </div>
                    <div
                      v-if="editConfig.infomation.sale_chance_name && editConfig.infomation.sale_chance_name.length > 0"
                      v-if="
                        editConfig.infomation.sale_chance_name &&
                        editConfig.infomation.sale_chance_name.length > 0 &&
                        !isNameChanceEdit
                      "
                      class="common-select-btn"
                      @click="clearupClient('chance')"
                    >
                      <i class="el-icon-remove-outline"></i>
                    </div>
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="销售子单" prop="subbill_name">
                  <div class="custom-name">
                    <el-autocomplete
                      style="width: 100%"
                      v-model="editConfig.infomation.subbill_name"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'subbill')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient('subbill', $event)"
                      :disabled="isNameChanceEdit"
                    ></el-autocomplete>
                    <div v-if="!isNameChanceEdit" class="common-select-btn" @click="selClientClick('client')">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <div
                      v-if="
                        editConfig.infomation.subbill_name &&
                        editConfig.infomation.subbill_name.length > 0 &&
                        !isNameChanceEdit
                      "
                      class="common-select-btn"
                      @click="clearupClient('subbill')"
                    >
                      <i class="el-icon-remove-outline" title="清除"></i>
                    </div>
                  </div>
                </el-form-item>
@@ -117,7 +156,7 @@
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期"
                    style="width:100%"
                    style="width: 100%"
                  >
                  </el-date-picker>
                </el-form-item>
@@ -125,7 +164,6 @@
              <el-col :span="12">
                <el-form-item label="销售负责人" prop="memberId">
                  <el-select
                    v-model="editConfig.infomation.memberId"
                    placeholder="请选择"
                    size="mini"
@@ -143,7 +181,7 @@
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期"
                    style="width:100%"
                    style="width: 100%"
                  >
                  </el-date-picker>
                </el-form-item>
@@ -190,7 +228,7 @@
              <el-col :span="12">
                <el-form-item label="收货地址" prop="address">
                  <el-input
                    style="width:100%"
                    style="width: 100%"
                    type="textarea"
                    :autosize="{ minRows: 2 }"
                    v-model="editConfig.infomation.address"
@@ -228,7 +266,7 @@
              <el-col :span="24">
                <el-form-item label="条款与条件" prop="conditions" label-width="15%">
                  <el-input
                    style="width:100%;"
                    style="width: 100%"
                    type="textarea"
                    :autosize="{ minRows: 4 }"
                    v-model="editConfig.infomation.conditions"
@@ -378,10 +416,15 @@
import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
import SelectChanceDialog from "@/views/other/commonDialog/SelectChanceDialog"
import AddCollectionPlan from "@/views/other/payment/collectionPlan/AddCollectionPlan"
import codeMixin from "@/views/client/followupRecords/mixin/codeMixin";
import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"
import { getSaleChanceList} from "@/api/sales/salesOpportunity"
import { getSubOrderList } from "@/api/sales/subOrder"
import {mapActions} from "vuex"
export default {
  name: "AddSalesDetailsDialog",
  mixins:[codeMixin],
  mixins: [codeMixin],
  props: {
    editCommonConfig: {
      type: Object,
@@ -401,14 +444,18 @@
    },
    saleChancelist() {
      return this.$store.state.getClientName.saleChancelist
    },
    subOrderList(){
      return this.$store.state.getClientName.subOrderList
    }
  },
  data() {
    return {
      dialogWidth: "60%",
      dialogWidth: "50%",
      editConfig: this.editCommonConfig,
      rules: {
        client_name: [{ required: true, message: "请选择客户名称", trigger: "change" }],
        // subbill_name: [{ required: true, message: "请选择销售子单", trigger: "change" }],
        number: [{ required: true, message: "请输入订单编号", trigger: "blur" }],
        signTime: [{ required: true, message: "请选择签约日期", trigger: "change" }],
        memberId: [{ required: true, message: "请选择销售负责人", trigger: "change" }]
@@ -438,6 +485,7 @@
      },
      clientId: this.editCommonConfig.infomation.client_id,
      saleChanceId: this.editCommonConfig.infomation.saleChanceId,
      subbillId:this.editCommonConfig.infomation.subbillId,
      productId: 1,
      isNoProduct: true,
      addCollectionConfig: {
@@ -445,35 +493,44 @@
        title: "新建",
        infomation: {}
      },
      amountTotal: 0
      amountTotal: 0,
      isNameChanceEdit: false
    }
  },
  created() {
    this.$store.dispatch("geClient")
    this.$store.dispatch("geChance")
    this.$store.dispatch("getSubunit")
    this.setTableForm()
    this.getCommonData()
    this.formInfo();
    this.formInfo()
    // if (this.editConfig.title === "新建" && this.editConfig.infomation.client_name.length > 0) {
    //   this.isNameChanceEdit = true
    // }
    // else {
    // }
  },
  watch:{
    'editClientManageConfig.visible'(val){
      if(val){
  watch: {
    "editClientManageConfig.visible"(val) {
      if (val) {
        this.formInfo()
      }
    },
    'editClientManageConfig.infomation.codeStandID'(){
    "editClientManageConfig.infomation.codeStandID"() {
      this.formInfo()
    }
  },
  methods: {
    formInfo(){
      this.objCode.type='销售明细编码'
      this.objCode.codeStandID = ''
      if(this.editConfig.infomation.codeStandID){
        this.objCode.codeStandID = this.editConfig.infomation.codeStandID;
    ...mapActions(["getChanceFilter","getSubunitFliter"]),
    formInfo() {
      this.objCode.type = "销售明细编码"
      this.objCode.codeStandID = ""
      if (this.editConfig.infomation.codeStandID) {
        this.objCode.codeStandID = this.editConfig.infomation.codeStandID
      }
      this.getRCodeStandardList();
    },
      this.getRCodeStandardList()
    },
    getCommonData() {
      getAllData()
        .then((res) => {
@@ -561,7 +618,7 @@
        logisticCompany: data.logisticCompany || "",
        logisticCost: data.logisticCost || 0,
        logisticNumber: data.logisticNumber || "",
        codeRule:this.codeRule,
        codeRule: this.codeRule
      }
      let params = {}
      if (this.editConfig.title === "新建") {
@@ -585,8 +642,16 @@
      var restaurants = []
      if (value === "client") {
        restaurants = this.clientList
        console.log(restaurants,"客户单")
      } else if (value === "chance") {
        restaurants = this.saleChancelist
      }else if(value==="subbill"){
        let arr=[]
         this.subOrderList.map((item)=>{
          arr.push(item.client)
         })
         restaurants=arr
        console.log("子丹",restaurants,arr)
      }
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
@@ -596,19 +661,39 @@
        return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
      }
    },
    handleSelectClient(value, item) {
    async handleSelectClient(value, item) {
      if (value === "client") {
        this.clientId = item.id
        this.editConfig.infomation.client_name = item.name
        // 需要修改
        await getSaleChanceList({
          client_id:this.clientId
        }).then((res)=>{
        })
        await getSubOrderList({
          page:1,
          pageSize:15,
          search_map:{
            client_id:item.id
          }
        }).then((res)=>{
          this.getSubunitFliter(res.data.list)
        })
      } else if (value === "chance") {
        this.saleChanceId = item.id
        this.editConfig.infomation.client_name = item.name
      }else if(value==="subbill"){
        console.log("下拉框点击",item)
        this.subbillId = item.id
        this.editConfig.infomation.subbill_name = item.name
      }
    },
    selClientClick(value) {
      if (value === "client") {
        this.editSelectClientConfig.editVisible = true
      } else if (value === "chance") {
        this.editSelectChanceConfig.editVisible = true
      }else if(value==="subbill"){
        this.editSelectChanceConfig.editVisible = true
      }
    },
@@ -619,6 +704,9 @@
      } else if (value === "chance") {
        this.editConfig.infomation.sale_chance_name = row.name
        this.saleChanceId = row.id
      }else if(value==="subbill"){
        this.editConfig.infomation.subbill_name = row.name
        this.subbillId=row.id
      }
    },
    // 清除已选择用户
@@ -629,6 +717,9 @@
      } else if (value === "chance") {
        this.editConfig.infomation.sale_chance_name = ""
        this.saleChanceId = 0
      }else if(value==="subbill"){
        this.editConfig.infomation.subbill_name = ""
        this.subbillId=0
      }
    },
    // 添加附件
@@ -662,7 +753,7 @@
          { label: "产品名称", prop: "name", productName: true, isRequird: true },
          { label: "产品编号", prop: "number" },
          { label: "数量", prop: "amount", inputNumber: true, isRequird: true },
          { label: "销售单价", prop: "price",inputFloat: true  },
          { label: "销售单价", prop: "price", inputFloat: true },
          { label: "价税合计", prop: "total", inputFloat: true }
        ]
      }
@@ -722,8 +813,8 @@
<style lang="scss" scoped>
::v-deep {
  .iframe-dialog .el-dialog__body {
    .el-form{
      .el-form-item{
    .el-form {
      .el-form-item {
        width: 100%;
      }
    }