zuozhengqing
2023-10-16 2c84ad381bef4907658b5feb5f6590299695e236
src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -13,7 +13,7 @@
        :model="editConfig.infomation"
        :rules="rules"
        label-position="right"
        label-width="308px"
        label-width="30%"
        size="mini"
        style="height: 60vh; overflow-x: hidden"
      >
@@ -24,9 +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%"
                      v-model="editConfig.infomation.client_name"
                      :fetch-suggestions="
                        (queryString, callback) => {
@@ -35,29 +52,31 @@
                      "
                      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')"
                    >
                      <i class="el-icon-edit-outline" title="清除"></i>
                      <i class="el-icon-remove-outline" title="清除"></i>
                    </div>
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="订单编号" prop="number">
                  <el-input v-model="editConfig.infomation.number"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="销售机会" prop="saleChanceId">
                  <div class="custom-name">
                    <el-autocomplete
                      style="width: 100%"
                      v-model="editConfig.infomation.sale_chance_name"
                      :fetch-suggestions="
                        (queryString, callback) => {
@@ -66,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-edit-outline"></i>
                      <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>
@@ -100,6 +156,7 @@
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期"
                    style="width: 100%"
                  >
                  </el-date-picker>
                </el-form-item>
@@ -110,7 +167,7 @@
                    v-model="editConfig.infomation.memberId"
                    placeholder="请选择"
                    size="mini"
                    style="width: 63%"
                    style="width: 100%"
                  >
                    <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
                    </el-option>
@@ -124,6 +181,7 @@
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期"
                    style="width: 100%"
                  >
                  </el-date-picker>
                </el-form-item>
@@ -167,9 +225,10 @@
                  <el-input v-model="editConfig.infomation.phone"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
              <el-col :span="12">
                <el-form-item label="收货地址" prop="address">
                  <el-input
                    style="width: 100%"
                    type="textarea"
                    :autosize="{ minRows: 2 }"
                    v-model="editConfig.infomation.address"
@@ -205,8 +264,9 @@
          <div class="basic-info-view">
            <el-row>
              <el-col :span="24">
                <el-form-item label="条款与条件" prop="conditions">
                <el-form-item label="条款与条件" prop="conditions" label-width="15%">
                  <el-input
                    style="width: 100%"
                    type="textarea"
                    :autosize="{ minRows: 4 }"
                    v-model="editConfig.infomation.conditions"
@@ -220,7 +280,7 @@
          <div class="basic-info-view">
            <el-row>
              <el-col :span="24">
                <el-form-item label="备注" prop="remark">
                <el-form-item label="备注" prop="remark" label-width="15%">
                  <el-input
                    type="textarea"
                    :autosize="{ minRows: 2 }"
@@ -356,8 +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 { getSaleChanceList} from "@/api/sales/salesOpportunity"
import { getSubOrderList } from "@/api/sales/subOrder"
import {mapActions} from "vuex"
export default {
  name: "AddSalesDetailsDialog",
  mixins: [codeMixin],
  props: {
    editCommonConfig: {
      type: Object,
@@ -377,14 +444,18 @@
    },
    saleChancelist() {
      return this.$store.state.getClientName.saleChancelist
    },
    subOrderList(){
      return this.$store.state.getClientName.subOrderList
    }
  },
  data() {
    return {
      dialogWidth: "80%",
      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" }]
@@ -414,6 +485,7 @@
      },
      clientId: this.editCommonConfig.infomation.client_id,
      saleChanceId: this.editCommonConfig.infomation.saleChanceId,
      subbillId:this.editCommonConfig.infomation.subbillId,
      productId: 1,
      isNoProduct: true,
      addCollectionConfig: {
@@ -421,16 +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()
    // if (this.editConfig.title === "新建" && this.editConfig.infomation.client_name.length > 0) {
    //   this.isNameChanceEdit = true
    // }
    // else {
    // }
  },
  watch: {
    "editClientManageConfig.visible"(val) {
      if (val) {
        this.formInfo()
      }
    },
    "editClientManageConfig.infomation.codeStandID"() {
      this.formInfo()
    }
  },
  methods: {
    ...mapActions(["getChanceFilter","getSubunitFliter"]),
    formInfo() {
      this.objCode.type = "销售明细编码"
      this.objCode.codeStandID = ""
      if (this.editConfig.infomation.codeStandID) {
        this.objCode.codeStandID = this.editConfig.infomation.codeStandID
      }
      this.getRCodeStandardList()
    },
    getCommonData() {
      getAllData()
        .then((res) => {
@@ -517,7 +617,8 @@
        wechatOrderStatus: data.wechatOrderStatus || 0,
        logisticCompany: data.logisticCompany || "",
        logisticCost: data.logisticCost || 0,
        logisticNumber: data.logisticNumber || ""
        logisticNumber: data.logisticNumber || "",
        codeRule: this.codeRule
      }
      let params = {}
      if (this.editConfig.title === "新建") {
@@ -541,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)
@@ -552,17 +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
      }
    },
@@ -573,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
      }
    },
    // 清除已选择用户
@@ -583,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
      }
    },
    // 添加附件
@@ -676,6 +813,11 @@
<style lang="scss" scoped>
::v-deep {
  .iframe-dialog .el-dialog__body {
    .el-form {
      .el-form-item {
        width: 100%;
      }
    }
    .basic-info {
      .basic-info-title {
        background-color: #f4f8fe;