qymljy 3 лет назад
Родитель
Сommit
922352ad61

+ 34 - 10
src/Form/QuotedPrice/edit.vue

@@ -63,7 +63,7 @@
               </el-form-item>
             </el-col>
             <el-col :offset="2" :span="11">
-              <el-form-item label="联系人:" label-width="90px" prop="name">
+              <el-form-item label="联系人:" label-width="90px" prop="contactsname">
                 <el-input  v-model="form.contactsname" autocomplete="off" placeholder="联系人" @focus="contacts" @contactsList="contactsList"></el-input>
               </el-form-item>
             </el-col>
@@ -82,8 +82,8 @@
         <quoted_price_product :id="form.sa_projectid" ref="quoterPrice" @checkForm="onSubmit"></quoted_price_product>
       </div>
       <div class="fixed__btn__panel">
-        <el-button size="small" @click="drawer = false" class="normal-btn-width">取 消</el-button>
-        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
+        <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
+        <el-button size="small" type="warning" @click="getSubmit" class="normal-btn-width">保 存</el-button>
       </div>
     </el-drawer>
     <project_table v-if="projectDrawer" :projectDrawer="projectDrawer" @projectData="projectData" @projectList="projectList"></project_table>
@@ -141,7 +141,7 @@ export default {
         enterprisename:[
           { required: true, message: '请选择客户', trigger: 'change'},
         ],
-        name:[
+        contactsname:[
           { required: true, message: '请选择联系人', trigger: 'change'},
         ]
       },
@@ -167,7 +167,7 @@ export default {
     },
     onClose(){
       this.drawer = false
-      this.$emit('addSuccess')
+      this.$emit('onSuccess')
     },
     onSubmit(){
       console.log(this.data,"点击添加商品")
@@ -191,13 +191,34 @@ export default {
       })
     },
     getSubmit(){
-      this.drawer = false
-      this.$emit('addSuccess')
+      console.log(this.data)
+      if (this.date === '' && this.date === 'undefined'){
+        this.form.begdate = ''
+        this.form.enddate = ''
+      }else {
+        this.form.begdate = this.date[0]
+        this.form.enddate = this.date[1]
+      }
+      console.log(this.form,"表单")
+      this.$refs.form.validate(async (valid) => {
+        if (!valid) return false
+        const res = await this.$api.requested({
+          "id": 20221020164803,
+          "version":1,
+          "content": this.form
+        })
+        this.tool.showMessage(res,() => {
+          this.drawer = false
+          this.$emit('onSuccess')
+        })
+      })
     },
     project(){
       this.projectDrawer = true
     },
     customer(){
+      console.log("客户弹出")
+      console.log(this.customerDrawer)
       this.customerDrawer = true
     },
     contacts(){
@@ -221,16 +242,19 @@ export default {
     },
     /*客户选择信息*/
     customerData(val){
-      this.contactsDrawer = false
+      this.customerDrawer = false
       this.form.sys_enterpriseid = val.sys_enterpriseid
       this.form.enterprisename = val.enterprisename
+      this.form.contactsid = ''
+      this.form.contactsname = ''
+      this.form.contactsphonenumber = ''
     },
     /*联系人选择信息*/
     contactsData(val){
       this.contactsDrawer = false
       this.form.contactsid = val.contactsid
-      this.form.name = val.name
-      this.form.phonenumber = val.phonenumber
+      this.form.contactsname = val.name
+      this.form.contactsphonenumber = val.phonenumber
     },
   },
   mounted() {

+ 6 - 7
src/SDrpManagement/QuotedPrice/components/productTable.vue

@@ -196,7 +196,6 @@ export default {
       this.dialogProductVisible = true
       this.params.content.sa_projectid = this.id
       console.log(id,"报价单id五")
-
       this.type = type
       console.log(this.type)
       this.productData(id)
@@ -252,10 +251,10 @@ export default {
           return {
             sa_quotedprice_itemsid:'0',
             itemid:e.itemid,
-            oldprice:0,
+            oldprice:e.marketprice,
             /*price:(e.marketprice * 100)/100,*/
-            price:e.price,
-            discountrate:100,
+            price:0,
+            discountrate:0,
             qty:e.qty
           }
         })
@@ -266,10 +265,10 @@ export default {
           return {
             sa_quotedprice_itemsid:'0',
             itemid:e.itemid,
-            oldprice:0,
+            oldprice:e.marketprice,
             /*price:(e.marketprice * 100)/100,*/
-            price:e.price,
-            discountrate:100,
+            price:0,
+            discountrate:0,
             qty:1
           }
         })

+ 73 - 12
src/SDrpManagement/QuotedPrice/components/quotedPriceProduct.vue

@@ -11,7 +11,7 @@
           @clear="productData(param.content.pageNumber = 1)"
           clearable>
       </el-input>&nbsp;
-      <product_table style="float: right" :id="id" @checkForm="checkForm" ref="quoterPrice" @productAdd="productData"></product_table>
+      <product_table style="float: right" :id="id" @checkForm="checkForm" ref="quoterPrice" @productAdd="productInitialization"></product_table>
     </div>
     <div class="produtMag-panel">
       <el-table
@@ -211,13 +211,40 @@ export default {
     }
   },
   methods:{
+    /*产品配置信息新增初始化*/
+    async productInitialization(id){
+      this.param.content.sa_quotedpriceid = id
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      for (var i=0 ;i<this.list.length;i++){
+
+          this.list[i].discountrate = this.list[i].discountrate * 100
+
+      }
+      console.log(this.list,'产品配置信息')
+    },
     /*产品配置信息*/
     async productData(id){
       this.param.content.sa_quotedpriceid = id
       const res = await this.$api.requested(this.param)
       this.list = res.data
       this.total = res.total
-      console.log(res,'产品配置信息')
+      for (var i=0 ;i<this.list.length;i++){
+        this.list[i].discountrate = this.list[i].discountrate * 100
+      }
+      console.log(this.list,'产品配置信息')
+    },
+    /*修改折扣或单价的时候刷新*/
+    async productDiscountrateData(id){
+      this.param.content.sa_quotedpriceid = id
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      for (var i=0 ;i<this.list.length;i++){
+        this.list[i].discountrate = this.list[i].discountrate * 100
+      }
+      console.log(this.list,'产品配置信息')
     },
     handleSizeChange(val) {
       // console.log(`每页 ${val} 条`);
@@ -252,23 +279,43 @@ export default {
     },
     onChangeNum (val,data,index) {
       console.log(val,data,index)
-      data.amount = data.qty * data.price
+     /* data.amount = data.qty * data.price*/
       this.$set(this.list,index,data)
       this.$nextTick(()=>{
-        this.objSet(this.list)
+        let obj = this.list.map(e=>{
+          return {
+            sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
+            itemid:e.itemid,
+            oldprice:e.marketprice,
+            price:e.price,
+            discountrate:e.discountrate,
+            qty:e.qty
+          }
+        })
+        this.changeData(obj)
       })
     },
     onChangeDiscountrate(val,data,index) {
-      data.price = data.marketprice * (data.discountrate / 100)
-      data.amount = data.qty * data.price
+     /* data.price = data.marketprice * (data.discountrate / 100)
+      data.amount = (data.qty * data.price).toFixed(2)*/
       this.$set(this.list,index,data)
       this.$nextTick(()=>{
-        this.objSet(this.list)
+        let obj = this.list.map(e=>{
+          return {
+            sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
+            itemid:e.itemid,
+            oldprice:e.marketprice,
+            price:0,
+            discountrate:e.discountrate/100,
+            qty:e.qty
+          }
+        })
+        this.changeDiscountrateData(obj)
       })
     },
     onChangePrice(val,data,index){
-      data.discountrate = ((data.price / data.marketprice) * 100).toFixed(2)
-      data.amount = data.qty * data.price
+      /*data.discountrate = ((data.price / data.marketprice) * 100).toFixed(2)
+      data.amount = data.qty * data.price*/
       this.$set(this.list,index,data)
       this.$nextTick(()=>{
         this.objSet(this.list)
@@ -279,13 +326,13 @@ export default {
         return {
           sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
           itemid:e.itemid,
-          oldprice:0,
+          oldprice:e.marketprice,
           price:e.price,
-          discountrate:e.discountrate,
+          discountrate:0,
           qty:e.qty
         }
       })
-      this.changeData(obj)
+      this.changeDiscountrateData(obj)
     },
     async changeData(obj){
       console.log(this.list,"数据")
@@ -298,6 +345,20 @@ export default {
         }
       })
       console.log(res)
+      this.productData(res.data[0].sa_quotedpriceid)
+    },
+    async changeDiscountrateData(obj){
+      console.log(this.list,"数据")
+      const res = await this.$api.requested({
+        "id": 20221021095403,
+        "version":1,
+        "content": {
+          "sa_quotedpriceid":this.list[0].sa_quotedpriceid,     //sat_notice_classid<=0时 为新增
+          "items":obj
+        }
+      })
+      console.log(res)
+      this.productDiscountrateData(res.data[0].sa_quotedpriceid)
     },
     async deleteProduct(val){
       console.log(val)

+ 1 - 1
src/SDrpManagement/QuotedPrice/detail/index.vue

@@ -98,7 +98,7 @@ export default {
         },
         {
           label:'报价日期',
-          value:this.mainData.createdate
+          value:this.mainData.billdate
         },
         {
           label:'有效期',

+ 5 - 1
src/SDrpManagement/QuotedPrice/modules/ProjectQuotationAdd.vue

@@ -78,7 +78,7 @@
         <el-divider></el-divider>
       </div>
       <div style="margin:30px 20px 20px 20px">
-        <quoted_price_product :id="form.sa_projectid" ref="quoterPrice" @checkForm="onSubmit"></quoted_price_product>
+        <quoted_price_product :id="form.sa_projectid" ref="quoterPrice" @checkForm="onSubmit" ></quoted_price_product>
       </div>
       <div class="fixed__btn__panel">
         <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
@@ -234,6 +234,10 @@ export default {
       this.form.name = val.name
       this.form.phonenumber = val.phonenumber
     },
+    /*isSpecial(val){
+      console.log("获取")
+      console.log(val,'是否特价')
+    }*/
 
 
   },