Ver código fonte

Merge branch 'requirements_031'

hbchen 10 meses atrás
pai
commit
fe5a28e9b3

+ 19 - 0
src/api/modules/businessCustom.js

@@ -51,6 +51,25 @@ export const businessCustomInterence = {
     addNewContract:(params)=>{
         return http.post('/eta_business/signing',params)
     },
+    /** 
+     * 编辑续约
+     * @param EtaBusinessId Integer 商家ID
+     * @param EtaBusinessContractId Integer 商家合约ID
+     * @param SigningTime String 签约时间
+     * @param ExpiredTime String 到期时间
+     * @returns 
+    */
+    editContract:(params)=>{
+        return http.post('/eta_business/edit_sign',params)
+    },
+    /**
+     * 删除续约信息
+     * @param EtaBusinessContractId Integer 商家合约ID
+     * @returns 
+     */
+    removeContract:(params)=>{
+        return http.post('/eta_business/remove_sign',params)
+    },
     /**
      * 修改销售
      * @param EtaBusinessId Integer 商家ID

+ 53 - 9
src/views/business_ETA_manage/businessEdit.vue

@@ -105,6 +105,7 @@
                 </el-form>
             </div>
             <div class="second-step-form-wrap" v-show="step===2">
+                <el-button type="primary" @click="addRenewalHandle" style="margin-top: 15px;">添加续约</el-button>
                 <el-table :data="recordData" border>
                     <el-table-column
                         v-for="item in tableColOpts"
@@ -114,8 +115,14 @@
                         align="center"
                     >
                     </el-table-column>
+                    <el-table-column label="操作" align="center">
+                        <template slot-scope="scope">
+                            <span class="editsty" @click="editRenewal(scope.row)" style="padding: 0 3px;">编辑</span>
+                            <span class="deletesty" @click="deleteRenewal(scope.row)" style="padding: 0 3px;">删除</span>
+                        </template>
+                    </el-table-column>
                 </el-table>
-                <el-button type="text" @click="showRenewal=true">添加续约</el-button>
+                <!-- <el-button type="text" @click="showRenewal=true">添加续约</el-button> -->
             </div>
         </div>
         <div class="business-other">
@@ -143,7 +150,7 @@
 
         <!-- 添加续约 -->
         <el-dialog
-            title="添加续约"
+            :title="renewalDiaTitle"
             :visible.sync="showRenewal"
             :modal-append-to-body="false"
             :close-on-click-modal="false"
@@ -152,7 +159,8 @@
         >
             <AddRenewal 
                 @addRenewal="handleAddRenewal"
-                @close="showRenewal=false"/>
+                @close="showRenewal=false"
+                :renewalForm="renewalForm"/>
         </el-dialog>
     </div>
 </template>
@@ -218,7 +226,7 @@ export default {
             recordData:[],
             tableColOpts:[
                 {
-                    label:'签约时间',
+                    label:'运维时间',
                     key:'SigningTime'
                 },{
                     label:'到期时间',
@@ -230,6 +238,8 @@ export default {
             ],
             activities:[],
             showRenewal:false,
+            renewalDiaTitle:"添加续约",
+            renewalForm:{}
         }
     },
     created() {
@@ -308,15 +318,49 @@ export default {
                 this.getBusinessDetail()
             })
         },
-        //添加续约
-        handleAddRenewal({signDate,expirationDate}){
-            businessCustomInterence.addNewContract({
+        // 添加续约
+        addRenewalHandle(){
+            this.renewalForm={}
+            this.renewalDiaTitle="添加续约"
+            this.showRenewal=true
+        },
+        // 编辑续约
+        editRenewal(row){
+            this.renewalDiaTitle="编辑续约"
+            this.renewalForm={
+                id:row.EtaBusinessContractId,
+                signDate:row.SigningTime,
+                expirationDate:row.ExpiredTime
+            }
+            this.showRenewal=true
+        },
+        deleteRenewal(row){
+            this.$confirm("是否确认删除该签约信息?", "提示", {
+                type: "warning"
+            }).then(() => {
+                businessCustomInterence.
+                removeContract({EtaBusinessContractId:row.EtaBusinessContractId})
+                .then(res=>{
+                    if(res.Ret == 200){
+                        this.$message.success("删除成功")
+                        this.getTableData(Number(this.$route.query.id))
+                        this.getTimeLineData(Number(this.$route.query.id))
+                    }
+                })
+            }).catch(() => {});
+        },
+        //添加续约-保存
+        handleAddRenewal({signDate,expirationDate,id}){
+            // id-商家合约ID
+            let api = Number(id) ? 'editContract' : 'addNewContract'
+            businessCustomInterence[api]({
                 EtaBusinessId:Number(this.$route.query.id),
+                EtaBusinessContractId:Number(id),
                 SigningTime:signDate,
                 ExpiredTime:expirationDate
             }).then(res=>{
                 if(res.Ret!==200) return 
-                this.$message.success('添加续约成功')
+                this.$message.success(this.renewalDiaTitle+'成功')
                 this.showRenewal=false
                 this.getTableData(Number(this.$route.query.id))
                 this.getTimeLineData(Number(this.$route.query.id))
@@ -359,7 +403,7 @@ export default {
             }
         }
         .el-table{
-            margin-top: 30px;
+            margin-top: 15px;
         }
     }
     .business-other{

+ 1 - 1
src/views/business_ETA_manage/businessList.vue

@@ -260,7 +260,7 @@ export default {
                     key:'SigningStatus'
                 },
                 {
-                    label:'最新签约时间',
+                    label:'运维开始时间',
                     key:'SigningTime',
                     sort:true
                 },

+ 30 - 10
src/views/business_ETA_manage/components/AddRenewal.vue

@@ -7,7 +7,7 @@
             label-width="100px" 
             class="demo-ruleForm"
         >
-            <el-form-item label="签约时间" prop="signDate">
+            <el-form-item label="运维时间" prop="signDate">
                 <el-date-picker
                     v-model="ruleForm.signDate"
                     type="date"
@@ -33,13 +33,34 @@
 
 <script>
 export default {
+    props:{
+        renewalForm:{
+            type:Object,
+            default:()=>{
+                return {}
+            }
+        }
+    },
+    watch:{
+        renewalForm:{
+            handler:function(value){
+                if(value.id){
+                    this.ruleForm.id = value.id || 0
+                    this.ruleForm.signDate = value.signDate || ''
+                    this.ruleForm.expirationDate = value.expirationDate || ''
+                }
+            },
+            immediate:true
+        }
+    },
     data() {
         return {
             rules:{
-                signDate:[{required: true, message: '请选择签署日期', trigger: 'change' },],
-                expirationDate:[{required: true, message: '请选择签署日期', trigger: 'change' },],
+                signDate:[{required: true, message: '请选择运维时间', trigger: 'change' },],
+                expirationDate:[{required: true, message: '请选择到期时间', trigger: 'change' },],
             },
             ruleForm:{
+                id:0,
                 signDate:'',
                 expirationDate:''
             }
@@ -51,7 +72,7 @@ export default {
                 if(valid){
                     const flag=this.$moment(this.ruleForm.signDate).isBefore(this.ruleForm.expirationDate);
                     if(!flag){
-                        this.$message.warning('到期时间不得早于签约时间')
+                        this.$message.warning('到期时间不得早于运维时间')
                         return
                     }
                     this.$emit('addRenewal',this.ruleForm)
@@ -60,9 +81,12 @@ export default {
             })
         },
         initForm(){
+            this.ruleForm.id = 0
             this.ruleForm.signDate = ''
             this.ruleForm.expirationDate = ''
-            this.$refs.ruleForm.resetFields();
+            this.$nextTick(()=>{
+                this.$refs.ruleForm.clearValidate();
+            })
         },
         handleClose(){
             this.initForm()
@@ -70,8 +94,4 @@ export default {
         }
     },
 }
-</script>
-
-<style>
-
-</style>
+</script>