Kaynağa Gözat

报价单添加产品类别折扣

zhaoxiaohai 2 yıl önce
ebeveyn
işleme
b535d85b4f

+ 2 - 1
packageA/contract/modules/discount/type/add/index.js

@@ -50,10 +50,11 @@ Page({
         })
     },
     submit() {
-        let page = getCurrentPages().find(v => v.__route__ == 'packageA/contract/detail');
+        let page = getCurrentPages().find(v => v.__route__ == 'packageA/contract/detail' || v.__route__ == 'packageA/offers/detail');
         if (page) page.selectComponent("#PiscountType").handleAdd(this.data.result.map(v => {
             return {
                 "sa_contract_itemsaleclassid": 0,
+                "sa_quotedprice_itemclassid": 0,
                 "itemclassid": v,
                 "discountrate": 1
             }

+ 20 - 10
packageA/contract/modules/discount/type/index.js

@@ -5,6 +5,10 @@ let queue = [],
 Component({
     properties: {
         disabled: Boolean, //禁用
+        type: {
+            type: String,
+            value: "合同"
+        }
     },
     data: {
         sa_contractid: 0,
@@ -28,9 +32,10 @@ Component({
         getList(id, init) {
             let content = this.data.content;
             content.sa_contractid = id;
+            content.sa_quotedpriceid = id;
             if (init) content.pageNumber = 1;
             _Http.basic({
-                "id": "20221124135602",
+                "id": this.data.type == "合同" ? 20221124135602 : 20230219161403,
                 content
             }).then(res => {
                 console.log("类别折扣明细列表", res)
@@ -48,7 +53,9 @@ Component({
                     "content.pageSize": res.pageSize,
                     "content.pageTotal": res.pageTotal,
                     "content.total": res.total,
-                    sa_contractid: id
+                    sa_contractid: id,
+                    sa_quotedpriceid: id,
+                    idname: this.data.type == "合同" ? "sa_contract_itemsaleclassids" : "sa_quotedprice_itemclassids"
                 })
             })
         },
@@ -62,9 +69,10 @@ Component({
                     confirm
                 }) => {
                     if (confirm) _Http.basic({
-                        "id": 20221124110202,
+                        "id": this.data.type == "合同" ? 20221124110202 : 20230219161303,
                         "content": {
-                            "sa_contractid": that.data.sa_contractid,
+                            sa_contractid: that.data.sa_contractid,
+                            sa_quotedpriceid: that.data.sa_contractid,
                             items
                         }
                     }).then(res => {
@@ -90,9 +98,10 @@ Component({
             detail
         }) {
             _Http.basic({
-                "id": 20221124111202,
+                "id": this.data.type == "合同" ? 20221124111202 : 20230219161503,
                 "content": {
-                    "sa_contract_itemsaleclassids": detail
+                    "sa_contract_itemsaleclassids": detail,
+                    "sa_quotedprice_itemclassids": detail
                 }
             }).then(res => {
                 console.log("批量删除类别", res);
@@ -101,7 +110,7 @@ Component({
                     icon: "none"
                 })
                 if (res.msg == '成功') this.setData({
-                    list: this.data.list.filter(v => detail.indexOf(v.sa_contract_itemsaleclassid) == -1)
+                    list: this.data.list.filter(v => detail.indexOf(v[this.data.idname]) == -1)
                 })
             })
         },
@@ -109,7 +118,7 @@ Component({
         changeQueue({
             detail
         }) {
-            let i = queue.findIndex(v => v.sa_contract_itemsaleclassid == detail.sa_contract_itemsaleclassid);
+            let i = queue.findIndex(v => v[this.data.idname] == detail[this.data.idname]);
             i == -1 ? queue.push(detail) : queue[i] = detail;
             clearTimeout(downCounter)
             downCounter = setTimeout(() => {
@@ -118,10 +127,11 @@ Component({
         },
         changeItem(items) {
             _Http.basic({
-                "id": 20221124110202,
+                "id": this.data.type == "合同" ? 20221124110202 : 20230219161303,
                 "version": 1,
                 "content": {
                     "sa_contractid": this.data.sa_contractid,
+                    sa_quotedpriceid: this.data.sa_contractid,
                     items
                 }
             }, false).then(res => {
@@ -140,7 +150,7 @@ Component({
                 }
                 items.forEach(v => {
                     v.discountrate = (v.discountrate * 100).toFixed(2);
-                    let i = list.findIndex(value => v.sa_contract_itemsaleclassid == value.sa_contract_itemsaleclassid);
+                    let i = list.findIndex(value => v[this.data.idname] == value[this.data.idname]);
                     if (i != -1) this.data.list[i] = {
                         ...list[i],
                         ...v

+ 1 - 1
packageA/contract/modules/discount/type/list/index.js

@@ -28,7 +28,7 @@ Component({
                 [`list[${index}]`]: item
             })
             let obj = {};
-            ["itemclassid", "sa_contract_itemsaleclassid", "discountrate"].forEach(v => obj[v] = item[v]);
+            ["itemclassid", "sa_contract_itemsaleclassid", "discountrate", "sa_quotedprice_itemclassid"].forEach(v => obj[v] = item[v]);
             obj.discountrate = (obj.discountrate / 100).toFixed(4);
             this.triggerEvent("changeQueue", obj)
         },

+ 1 - 0
packageA/offers/addProjectOffer.js

@@ -208,6 +208,7 @@ Page({
         content.projectname = content.sa_projectid[0] || "";
         content.sa_projectid = content.sa_projectid[1] ? content.sa_projectid[1][0] : 0;
         content.contactsid = content.contactsid ? content.contactsid[1][0] : 0;
+        content.discountrate = (content.discountrate / 100).toFixed(4) || 1;
         content.begdate = content.invaliddate[0];
         content.enddate = content.invaliddate[1];
         content.address = this.data.address;

+ 1 - 1
packageA/offers/addSetclientOffer.js

@@ -172,12 +172,12 @@ Page({
             ...this.selectComponent("#Form").submit(),
             "sa_quotedpriceid": 0, //报价单id
             "sa_projectid": 0, //项目id
-            discountrate: "",
             projectname: "",
             address: "",
         };
         content.sys_enterpriseid = content.sys_enterpriseid[1] ? content.sys_enterpriseid[1][0] : 0;
         content.contactsid = content.contactsid[1] ? content.contactsid[1][0] : 0;
+        content.discountrate = (content.discountrate / 100).toFixed(4) || 1;
         content.begdate = content.invaliddate[0];
         content.enddate = content.invaliddate[1];
         delete(content.invaliddate)

+ 6 - 2
packageA/offers/detail.js

@@ -8,9 +8,13 @@ Page({
             label: "详细信息",
             icon: "icon-tabxiangxixinxi1"
         }, {
-            label: "产品清单",
+            label: "产品明细折扣",
             icon: "icon-tabchanpin",
             model: "#Product"
+        }, {
+            label: "产品类别折扣",
+            icon: "icon-tabchanpinleibie",
+            model: "#PiscountType"
         }, {
             label: "其他费用",
             icon: "icon-tabkaipiaoxinxi",
@@ -176,7 +180,7 @@ Page({
             value: res.data.begdate + ' - ' + res.data.enddate
         }, {
             label: "折扣(%)",
-            value: res.data.discountrate + '%'
+            value: (res.data.discountrate * 100).toFixed(2) + '%'
         }, {
             label: "总金额",
             value: res.data.sumamount

+ 2 - 1
packageA/offers/detail.json

@@ -7,7 +7,8 @@
         "Files": "/packageA/public/files/index",
         "History": "./modules/history/index",
         "Work": "/packageA/public/work/index",
-        "PettyExpense":"./modules/pettyExpense/index"
+        "PettyExpense": "./modules/pettyExpense/index",
+        "PiscountType": "../contract/modules/discount/type/index"
     },
     "navigationBarTitleText": "报价单详情"
 }

+ 3 - 2
packageA/offers/detail.wxml

@@ -10,9 +10,10 @@
 <Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
     <Preview slot='详细信息' list1='{{list1}}' list2='{{list2}}' />
     <Trace slot='跟进动态' id='Trace' ownertable='sa_quotedprice' ownerid='{{detail.sa_quotedpriceid}}' />
-    <Product slot='产品清单' id='Product' sa_projectid="{{detail.sa_projectid}}" type="{{detail.quotedpricetype}}" disabled="{{(per.query(options,'product')||isAdmin||isLeader)&&detail.status=='新建'}}" />
+    <Product slot='产品明细折扣' id='Product' sa_projectid="{{detail.sa_projectid}}" type="{{detail.quotedpricetype}}" disabled="{{(per.query(options,'product')||isAdmin||isLeader)&&detail.status=='新建'}}" />
+    <PiscountType slot='产品类别折扣' id='PiscountType' disabled="{{(isAdmin||isLeader)&&detail.status!='新建'}}" type="报价单" />
     <PettyExpense slot='其他费用' id='PettyExpense' quotedpricenotes='{{detail.quotedpricenotes}}' />
-    <History slot='历史报价' id="History" isproject="{{detail.quotedpricetype=='项目报价'?1:0}}"  />
+    <History slot='历史报价' id="History" isproject="{{detail.quotedpricetype=='项目报价'?1:0}}" />
     <Record slot='操作记录' id="Record" ownertable='sa_quotedprice' ownerid='{{detail.sa_quotedpriceid}}' />
     <Files slot='附件' id="Files" ownertable='sa_quotedprice' ownerid='{{detail.sa_quotedpriceid}}' />
     <Work slot='任务' id='Work' ownertable='sa_quotedprice' ownerid='{{detail.sa_quotedpriceid}}' disabled="{{isAdmin||isLeader}}" />