Browse Source

0312团组操作 团组类型是非团组的时候 除了出访人数、团组名称、出访国家外 其他都不是必填项 然后默认给一些值:客户名称:暂无 客户单位:暂无 城市下拉框:四川-成都 出访天数:1 成单人下拉框:张海麟 客户级别下拉框:普通团组 op提成等级:0元

liuhj 1 month ago
parent
commit
cebf1e7714
2 changed files with 143 additions and 34 deletions
  1. 75 21
      src/components/OP/EntryQuotation.vue
  2. 68 13
      src/components/OP/Groupedit.vue

+ 75 - 21
src/components/OP/EntryQuotation.vue

@@ -17,29 +17,35 @@
                         </div>
                         <div class="entryquotation-content-box">
                             <label>单价:</label>
-                            <el-input-number style="width:110px" size="small" :precision="2" :controls="false" v-model="items.unitPrice" @change="calculateTotal(items)"></el-input-number>
+                            <el-input-number style="width:110px" size="small" :precision="2" :controls="false"
+                                v-model="items.unitPrice" @change="calculateSubtotal(items,item)"></el-input-number>
                         </div>
                         <div class="entryquotation-content-box">
                             <label>币种:</label>
-                            <el-select style="width:110px" size="small" v-model="items.currency" filterable placeholder="请选择">
-                                <el-option v-for="opt in options" :key="opt.currencyCode" :label="opt.currencyCode" :value="opt.currencyCode"></el-option>
+                            <el-select style="width:110px" size="small" v-model="items.currency" filterable
+                                placeholder="请选择" @change="calculateSubtotal(items,item)">
+                                <el-option v-for="opt in options" :key="opt.currencyCode" :label="opt.currencyCode"
+                                    :value="opt.currencyCode"></el-option>
                             </el-select>
                         </div>
                         <div class="entryquotation-content-box">
                             <label>数量:</label>
-                            <el-input-number style="width:110px" size="small" :precision="2" :controls="false" v-model="items.quantity" @change="calculateTotal(items)"></el-input-number>
+                            <el-input-number style="width:110px" size="small" :precision="2" :controls="false"
+                                v-model="items.quantity" @change="calculateSubtotal(items,item)"></el-input-number>
                         </div>
                         <div class="entryquotation-content-box">
                             <label>小计:</label>
-                            <el-input-number style="width:110px" size="small" :precision="2" :controls="false" v-model="items.totalAmt" disabled></el-input-number>
+                            <el-input-number style="width:110px" size="small" :precision="2" :controls="false"
+                                v-model="items.totalAmt" disabled></el-input-number>
                         </div>
-                        <el-button size="small" type="danger" @click="removeItem(item.infos, subIndex)">移除</el-button>
+                        <el-button size="small" type="danger" @click="removeItem(item.infos, subIndex,item)">移除</el-button>
                     </div>
                 </div>
                 <div class="entryquotation-form-totalprice">
                     <div class="entryquotation-content-box">
                         <label>该项总计:</label>
-                        <el-input-number size="small" :precision="2" :controls="false" v-model="item.totalAmt" disabled></el-input-number>
+                        <el-input-number size="small" :precision="2" :controls="false" v-model="item.totalAmt"
+                            disabled></el-input-number>
                     </div>
                 </div>
             </div>
@@ -51,44 +57,82 @@
 export default {
     data() {
         return {
-            tabledata: [],
-            options: [],
+            tabledata: [], // 表格数据
+            options: [], // 币种汇率数据
         };
     },
     methods: {
+        // 获取初始数据
         EnterExitCostQuoteEntryExitCosts() {
             var url = "/api/Groups/EnterExitCostQuoteEntryExitCosts";
             var that = this;
             this.$axios({
-                method: 'post',
+                method: "post",
                 url: url,
-                headers: { Authorization: 'Bearer' },
-                data: { portType: 1, diId: 2477, currUserId: 330 }
+                headers: { Authorization: "Bearer" },
+                data: { portType: 1, diId: 2477, currUserId: 330 },
             }).then(function (res) {
                 if (res.data.code == 200) {
-                    that.options = res.data.data.rates;
-                    that.tabledata = res.data.data.feeItems;
+                    that.options = res.data.data.rates; // 存储币种汇率
+                    that.tabledata = res.data.data.feeItems; // 存储表格数据
                 } else {
                     that.$message.error(res.data.msg);
                 }
             });
         },
+
+        // 新增一行
         appenditems(item) {
-            item.infos.push({ feeName: '', unitPrice: 0, currency: '', quantity: 1, totalAmt: 0 });
+            console.log(item);
+            
+            item.infos.push({
+                currency:'',
+                id:0,
+                itemId:item.itemId,
+                feeName: "",
+                unitPrice: 0,
+                currency: "",
+                quantity: 1,
+                totalAmt: 0,
+                remark:'',
+            });
         },
-        removeItem(infos, index) {
+
+        // 移除一行
+        removeItem(infos, index,item) {
             infos.splice(index, 1);
+            this.calculateItemTotal(item); // 重新计算总价
+            this.calculateItemTotalAll(this.tabledata)
+        },
+
+        // 计算小计
+        calculateSubtotal(items,item) {
+            const rate = this.getCurrencyRate(items.currency); // 获取汇率
+            items.totalAmt = items.unitPrice * items.quantity * rate; // 计算小计
+            this.calculateItemTotal(item); // 更新总价
+            this.calculateItemTotalAll(this.tabledata)
         },
-        calculateTotal(items) {
-            items.totalAmt = items.unitPrice * items.quantity;
+
+        // 获取币种汇率
+        getCurrencyRate(currencyCode) {
+            const currency = this.options.find((opt) => opt.currencyCode === currencyCode);
+            return currency ? currency.rate : 1; // 如果未找到汇率,默认为 1
         },
+
+        // 计算项总价
         calculateItemTotal(item) {
             item.totalAmt = item.infos.reduce((sum, info) => sum + info.totalAmt, 0);
-        }
+        },
+        // 计算总价
+        calculateItemTotalAll(item) {
+            console.log(item);
+            
+            // item.totalAmt = item.infos.reduce((sum, info) => sum + info.totalAmt, 0);
+        },
     },
     mounted() {
-        this.EnterExitCostQuoteEntryExitCosts();
-    }
+        this.EnterExitCostQuoteEntryExitCosts(); // 初始化数据
+    },
 };
 </script>
 
@@ -100,18 +144,22 @@ export default {
     border-radius: 10px;
     min-height: 840px;
 }
+
 .entryquotation-title {
     text-align: center;
     font-size: 17px;
     font-weight: 600;
 }
+
 .entryquotation-form {
     border: 1px solid #ebeef5;
     margin-top: 10px;
 }
+
 .entryquotation-form-li {
     display: flex;
 }
+
 .entryquotation-form-title {
     padding: 10px;
     width: 15%;
@@ -120,12 +168,14 @@ export default {
     display: flex;
     align-items: center;
 }
+
 .entryquotation-form-content {
     width: 70%;
     border-bottom: 1px solid #ebeef5;
     border-right: 1px solid #ebeef5;
     padding: 10px;
 }
+
 .entryquotation-form-totalprice {
     width: 15%;
     border-bottom: 1px solid #ebeef5;
@@ -133,20 +183,24 @@ export default {
     display: flex;
     align-items: center;
 }
+
 .entryquotation-content {
     display: flex;
     align-items: center;
     margin: 5px 0;
 }
+
 .entryquotation-content-box {
     display: flex;
     align-items: center;
     margin-right: 15px;
     padding: 5px 0;
 }
+
 .entryquotation-content-box label {
     margin-right: 5px;
 }
+
 .entryquotation-form-addbtn {
     text-align: right;
 }

+ 68 - 13
src/components/OP/Groupedit.vue

@@ -6,25 +6,25 @@
                     <el-form-item label-width="120px" label="销售报价号:">
                         <el-input :readonly="true" el-input v-model="ruleForm.quotenum"></el-input>
                     </el-form-item>
-                    <el-form-item label-width="120px" label="本团成单人:" prop="person">
+                    <el-form-item label-width="120px" label="本团成单人:" :prop="nongroupty?'person':''">
                         <el-select v-model="ruleForm.person" placeholder="请选择本团成单人     ">
                             <el-option v-for="(item, index) in personarr" :key="index" :label="item.cnName"
                                 :value="item.id"></el-option>
                         </el-select>
                     </el-form-item>
-                    <el-form-item label-width="120px" label="客户级别:" prop="grades">
+                    <el-form-item label-width="120px" label="客户级别:" :prop="nongroupty?'grades':''">
                         <el-select @change="rankchange" v-model="ruleForm.grades" placeholder="请选择客户级别">
                             <el-option v-for="(item, index) in gradearr" :key="index" :label="item.name"
                                 :value="item.id"></el-option>
                         </el-select>
                     </el-form-item>
-                    <el-form-item label-width="120px" label="团组类型:" prop="OP">
+                    <el-form-item label-width="120px" label="团组类型:" :prop="nongroupty?'OP':''">
                         <el-select @change="optypechange" class="op-type" v-model="ruleForm.OP" placeholder="请选择团组类型">
                             <el-option v-for="(item, index) in OPtype" :key="index" :label="item.name"
                                 :value="item.id"></el-option>
                         </el-select>
                     </el-form-item>
-                    <el-form-item label-width="120px" label="客户名称:" prop="customername">
+                    <el-form-item label-width="120px" label="客户名称:" :prop="nongroupty?'customername':''">
                         <el-autocomplete
                         style="width: 100%;"
                         class="inline-input"
@@ -35,7 +35,7 @@
                         ></el-autocomplete>
                         <!-- <el-input el-input v-model="ruleForm.customername"></el-input> -->
                     </el-form-item>
-                    <el-form-item label-width="120px" label="客户单位:" prop="customerunits">
+                    <el-form-item label-width="120px" label="客户单位:" :prop="nongroupty?'customerunits':''">
                         <el-autocomplete
                         style="width: 100%;"
                         class="inline-input"
@@ -46,7 +46,7 @@
                         ></el-autocomplete>
                         <!-- <el-input el-input v-model="ruleForm.customerunits"></el-input> -->
                     </el-form-item>
-                    <el-form-item label-width="120px" label="城市:" prop="cityId">
+                    <el-form-item label-width="120px" label="城市:" :prop="nongroupty?'cityId':''">
                         <el-select filterable @change="optypechange" class="op-type" v-model="ruleForm.cityId" placeholder="请选择城市">
                             <el-option v-for="(item, index) in cityData" :key="index" :label="item.name"
                                 :value="item.id"></el-option>
@@ -55,11 +55,11 @@
                     <el-form-item label-width="120px" label="出访国家:" prop="countriesvisited">
                         <el-input @blur="splicingname" el-input v-model="ruleForm.countriesvisited" placeholder="按照“国家1、国家2、国家3”录入"></el-input>
                     </el-form-item>
-                    <el-form-item label-width="120px" label="出访时间:" prop="visitingtime">
+                    <el-form-item label-width="120px" label="出访时间:" :prop="nongroupty?'visitingtime':''">
                         <el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.visitingtime"
                             style="width: 100%;"></el-date-picker>
                     </el-form-item>
-                    <el-form-item label-width="120px" label="出访天数:" prop="numdays">
+                    <el-form-item label-width="120px" label="出访天数:" :prop="nongroupty?'numdays':''">
                         <el-input @blur="splicingname" el-input v-model="ruleForm.numdays"></el-input>
                     </el-form-item>
                     <el-form-item style="position: relative;" label-width="120px" label="出访人数:" prop="numperson">
@@ -138,7 +138,7 @@
                     </div>
                 </div>
                 <div style="display: flex;align-items: center;">
-                    <el-form-item style="width:16%" label-width="120px" label="OP提成等级" :prop="bidbr?'opRoyaltyLv':''">
+                    <el-form-item style="width:16%" label-width="120px" label="OP提成等级" :prop="bidbr&&nongroupty?'opRoyaltyLv':''">
                         <el-select @change="commissionlevel" v-model="ruleForm.opRoyaltyLv" placeholder="OP提成等级" clearable filterable
                             style="width: 100%;">
                             <el-option v-for="item in opRoyaltyLvList" :key="item.id" :label="item.name + '元'"
@@ -146,7 +146,7 @@
                             </el-option>
                         </el-select>
                     </el-form-item>
-                    <el-form-item style="width:50%" label-width="98px" label="等级说明:" :prop="bidbr?'opRoyaltyRemark':''">
+                    <el-form-item style="width:50%" label-width="98px" label="等级说明:" :prop="bidbr&&nongroupty?'opRoyaltyRemark':''">
                         <el-select style="width:100%" class="op-type" v-model="ruleForm.opRoyaltyRemark" placeholder="请选择团组类型">
                             <el-option v-for="(item, index) in commissionleve" :key="index" :label="item"
                                 :value="item"></el-option>
@@ -206,7 +206,7 @@
             :close-on-click-modal="false">
             <span>
                 1)普通团组:¥300/团;<br><br>
-
+ 
                 2)VIP团(地市州书记 市长 成都副市级别 副书记级别 成都正厅级干部):¥500/团;<br><br>
 
                 3)VVIP团(四川省副部级 副省级 省长 ):¥1000/团;<br><br>
@@ -308,7 +308,7 @@ export default {
                     { required: true, message: '请选择成团人', trigger: 'change' }
                 ],
                 cityId: [
-                    { required: true, message: 'asd', trigger: 'change' }
+                    { required: true, message: '请选择城市', trigger: 'change' }
                 ],
                 grades: [
                     { required: true, message: '请选择级别', trigger: 'change' }
@@ -352,7 +352,8 @@ export default {
             restaurantss:[],
             customerunitslist:[],
             bidbr:true,
-            rollcallarr:[]
+            rollcallarr:[],
+            nongroupty:true,
         };
     },
     methods: {
@@ -510,6 +511,24 @@ export default {
         },
         //agreeChange
         optypechange(val){
+            if(val==248){
+                this.nongroupty=false;
+                console.log(this.ruleForm);
+                this.ruleForm.OP=248;
+                this.ruleForm.cityId=3505;
+                this.ruleForm.customername="暂无";
+                this.ruleForm.customerunits="暂无";
+                this.ruleForm.grades=770;
+                this.ruleForm.numdays="1";
+                this.ruleForm.opRoyaltyLv=995;
+                this.ruleForm.opRoyaltyRemark="无";
+                this.ruleForm.person=21;
+                this.ruleForm.visitingtime=new Date();
+            }else{
+                this.nongroupty=true;
+                this.initializeinfo();
+            }
+
             if (val==1348) {
                 this.bidbr=false;
                 this.ruleForm.groupname='沟通中-'+this.ruleForm.groupname;
@@ -583,6 +602,9 @@ export default {
                         if(that.ruleForm.radioval==1){
                             that.bidbr=false;
                         }
+                        if (that.ruleForm.OP==248) {
+                            that.nongroupty=false;
+                        }
                     }
                 })
             }
@@ -694,6 +716,39 @@ export default {
                 this.commissionlevel( this.ruleForm.opRoyaltyLv)
             }
         },
+        //数据初始化
+        initializeinfo(){
+            this.ruleForm={
+                groupname: '',
+                customername: '',
+                customerunits: '',
+                countriesvisited: '',
+                visitingtime: '',
+                contracttime: '',
+                numdays: '',
+                cityId:'',
+                numperson: '',
+                occasion: '',
+                payments: '',
+                purposevisit: '',
+                specialneeds: '',
+                otherneeds: '',
+                Officialneeds:'',
+                approvalname: '',
+                approvalnumber1: '',
+                approvalnumber2: '',
+                censorshipdepartment: '',
+                remark: '',
+                phonenumber: '',
+                Wechat: '',
+                OP: '',
+                grades: '',
+                person: '',
+                opRoyaltyLv: '',
+                opRoyaltyRemark: '',
+                radioval:'0',
+            }
+        },
         //获取客户名单info
         PostTourClientListByDiId() {
             this.rollcallarr=[];