瀏覽代碼

同步合作协议

xiaohaizhao 2 年之前
父節點
當前提交
a9eb330fe2

+ 2 - 2
packageA/contract/detail.wxml

@@ -14,8 +14,8 @@
     <Trace slot='跟进动态' id='Trace' ownertable='sa_contract' ownerid='{{detail.sa_contractid}}' />
     <Work slot='任务' id='Work' ownertable='sa_contract' ownerid='{{detail.sa_contractid}}' disabled="{{isAdmin||isLeader}}" />
     <PiscountProduct wx:if="{{detail.type=='经销商合作协议'||detail.type=='直销客户合作协议'}}" slot='产品明细折扣' id='PiscountProduct' disabled="{{(per.query(options,'app')||isAdmin||isLeader)&&detail.status!='新建'}}" />
-    <Product wx:else slot='{{detail.type=="工具使用(借用)协议"?  "工具清单": "产品明细折扣"}}' disabled="{{(per.query(options,'app')||isAdmin||isLeader)&&detail.status!='新建'}}" id='Product' />
-    <PiscountType slot='产品类别折扣' id='PiscountType' disabled="{{(per.query(options,'app')||isAdmin||isLeader)&&detail.status!='新建'}}" />
+    <Product wx:else slot='{{detail.type=="工具使用(借用)协议"?  "工具清单": "产品明细折扣"}}' synchronous='{{detail.type=="经销项目协议" && isLeader && detail.status=="新建"}}' disabled="{{(per.query(options,'app')||isAdmin||isLeader)&&detail.status!='新建'}}" id='Product' />
+    <PiscountType slot='产品类别折扣' id='PiscountType' synchronous='{{detail.type=="经销项目协议" && isLeader && detail.status=="新建"}}' disabled="{{(per.query(options,'app')||isAdmin||isLeader)&&detail.status!='新建'}}" />
     <Objective slot='业绩目标' id='Objective' />
     <Record slot="操作记录" id="Record" ownertable='sa_contract' ownerid='{{detail.sa_contractid}}' />
     <!-- <view slot='合同条款' /> -->

+ 49 - 8
packageA/contract/modules/discount/type/index.js

@@ -3,12 +3,20 @@ let queue = [],
     downCounter = null;
 
 Component({
+    options: {
+        addGlobalClass: true
+    },
     properties: {
-        disabled: {type:Boolean}, //禁用
+        disabled: {
+            type: Boolean
+        }, //禁用
         type: {
             type: String,
             value: "合同"
-        }
+        }, //禁用
+        synchronous: {
+            type: Boolean
+        },
     },
     data: {
         sa_contractid: 0,
@@ -28,6 +36,41 @@ Component({
         },
     },
     methods: {
+        openSynchronous() {
+            this.selectComponent("#synchronous").onOpen();
+        },
+        confirm({
+            detail
+        }) {
+            let params = this.data.type == "合同" ? {
+                "id": 20231208154904,
+                "content": {
+                    "sa_contractid": this.data.sa_contractid,
+                    "isadd": detail
+                }
+            } : {
+                "id": 20231208161304,
+                "content": {
+                    "sa_quotedpriceid": this.data.sa_quotedpriceid,
+                    "isadd": detail
+                }
+            }
+
+            _Http.basic(params).then(res => {
+                wx.showToast({
+                    title: res.msg == '成功' ? '设置成功' : res.msg,
+                    icon: "none"
+                })
+                if (res.msg == '成功') {
+                    this.selectComponent("#synchronous").onCancel();
+                    this.getList(this.data.type == "合同" ? this.data.sa_contractid : this.data.sa_quotedpriceid, true)
+                } else {
+                    this.selectComponent("#synchronous").setData({
+                        loading: false
+                    })
+                }
+            })
+        },
         addType() {
             let page = getCurrentPages()[getCurrentPages().length - 1];
             if (page.route == 'packageA/contract/detail') {
@@ -135,19 +178,17 @@ Component({
         }) {
             _Http.basic({
                 "id": this.data.type == "合同" ? 20221124111202 : 20230219161503,
-                "content": {
-                    "sa_contract_itemsaleclassids": detail,
-                    "sa_quotedprice_itemclassids": detail
-                }
+                "content": detail
             }).then(res => {
                 console.log("批量删除类别", res);
                 wx.showToast({
                     title: res.msg == '成功' ? '删除成功!' : res.msg,
                     icon: "none"
                 })
-                if (res.msg == '成功') this.setData({
+                if (res.msg == '成功') this.getList(this.data.type == "合同" ? this.data.sa_contractid : this.data.sa_quotedpriceid, true)
+                /* this.setData({
                     list: this.data.list.filter(v => detail.indexOf(v[this.data.idname]) == -1)
-                })
+                }) */
             })
         },
         /* 生成修改队列 */

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

@@ -1,5 +1,6 @@
 {
     "usingComponents": {
-        "List": "./list/index"
+        "List": "./list/index",
+        "synchronous": "../../product/synchronous/index"
     }
 }

+ 5 - 4
packageA/contract/modules/discount/type/index.wxml

@@ -1,12 +1,13 @@
 <view class="head">
     <view class="count">产品类型折扣</view>
     <view class="expand">
-        <!-- <navigator url="#" class="but">
-            <van-icon name="search" />
-        </navigator> -->
+        <navigator wx:if="{{synchronous}}" url="#" class="but" bindtap="openSynchronous">
+            <text class="iconfont icon-tongbuhezuoxieyi" />
+        </navigator>
         <navigator wx:if="{{!disabled}}" url="#" class="but" bindtap="addType">
             <van-icon name="plus" />
         </navigator>
     </view>
 </view>
-<List list='{{list}}' disabled='{{disabled}}' bind:deleteItem='deleteItems' bindchangeQueue='changeQueue' />
+<List list='{{list}}' disabled='{{disabled}}' bind:deleteItem='deleteItems' bindchangeQueue='changeQueue' />
+<synchronous id="synchronous" bind:confirm='confirm' />

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

@@ -1,9 +1,17 @@
 Component({
     properties: {
-        list: {type:Array},
-        deleteItem: {type:Function},
-        changeQueue: {type:Function}, //修改队列
-        disabled: {type:Boolean}
+        list: {
+            type: Array
+        },
+        deleteItem: {
+            type: Function
+        },
+        changeQueue: {
+            type: Function
+        }, //修改队列
+        disabled: {
+            type: Boolean
+        }
     },
     options: {
         addGlobalClass: true
@@ -44,6 +52,7 @@ Component({
         deleteProduct(e) {
             const {
                 sa_contract_itemsaleclassid,
+                sa_quotedprice_itemclassid,
                 itemclassname
             } = e.currentTarget.dataset.item,
                 that = this;
@@ -53,7 +62,10 @@ Component({
                 complete: ({
                     confirm
                 }) => {
-                    if (confirm) that.triggerEvent("deleteItem", [sa_contract_itemsaleclassid]);
+                    if (confirm) that.triggerEvent("deleteItem", {
+                        sa_contract_itemsaleclassids: sa_contract_itemsaleclassid ? [sa_contract_itemsaleclassid] : [],
+                        sa_quotedprice_itemclassids: sa_quotedprice_itemclassid ? [sa_quotedprice_itemclassid] : [],
+                    });
                 }
             })
         },

+ 36 - 1
packageA/contract/modules/product/index.js

@@ -9,8 +9,16 @@ let queue = [],
     downCounter = null;
 
 Component({
+    options: {
+        addGlobalClass: true
+    },
     properties: {
-        disabled: {type:Boolean}, //禁用
+        disabled: {
+            type: Boolean
+        }, //禁用
+        synchronous: {
+            type: Boolean
+        }, //是否同步按钮显示
     },
     data: {
         sa_contractid: 0,
@@ -30,6 +38,33 @@ Component({
         },
     },
     methods: {
+        openSynchronous() {
+            this.selectComponent("#synchronous").onOpen();
+        },
+        confirm({
+            detail
+        }) {
+            _Http.basic({
+                "id": 20231204153904,
+                "content": {
+                    "sa_contractid": this.data.sa_contractid,
+                    "isadd": detail
+                }
+            }).then(res => {
+                wx.showToast({
+                    title: res.msg == '成功' ? '设置成功' : res.msg,
+                    icon: "none"
+                })
+                if (res.msg == '成功') {
+                    this.selectComponent("#synchronous").onCancel();
+                    this.getList(this.data.sa_contractid, true)
+                } else {
+                    this.selectComponent("#synchronous").setData({
+                        loading: false
+                    })
+                }
+            })
+        },
         /* 获取产品列表 */
         getList(id, init) {
             let content = this.data.content;

+ 2 - 1
packageA/contract/modules/product/index.json

@@ -1,6 +1,7 @@
 {
     "component": true,
     "usingComponents": {
-        "List": "./list/index"
+        "List": "./list/index",
+        "synchronous": "./synchronous/index"
     }
 }

+ 6 - 4
packageA/contract/modules/product/index.wxml

@@ -1,12 +1,14 @@
 <view class="head">
     <view class="count">产品清单</view>
     <view class="expand">
-        <!-- <navigator url="#" class="but">
-            <van-icon name="search" />
-        </navigator> -->
+        <navigator wx:if="{{synchronous}}" url="#" class="but" bindtap="openSynchronous">
+            <text class="iconfont icon-tongbuhezuoxieyi" />
+        </navigator>
         <navigator wx:if="{{!disabled}}" url="#" class="but" bindtap="addProduct">
             <van-icon name="plus" />
         </navigator>
     </view>
 </view>
-<List list='{{list}}' disabled='{{disabled}}' bind:deleteItem='deleteItems' bindchangeQueue='changeQueue' />
+<List list='{{list}}' disabled='{{disabled}}' bind:deleteItem='deleteItems' bindchangeQueue='changeQueue' />
+
+<synchronous id="synchronous" bind:confirm='confirm' />

+ 40 - 0
packageA/contract/modules/product/synchronous/index.js

@@ -0,0 +1,40 @@
+Component({
+    properties: {
+        confirm: {
+            type: Function
+        }
+    },
+    data: {
+        radio: "",
+        show: false,
+        loading: false
+    },
+    methods: {
+        changeRadio(e) {
+            this.setData({
+                radio: e.currentTarget.dataset.name
+            })
+        },
+        onCancel() {
+            this.setData({
+                show: false,
+                loading: false
+            })
+        },
+        onOpen() {
+            this.setData({
+                show: true
+            })
+        },
+        onConfirm() {
+            if (!this.data.radio.length) return wx.showToast({
+                title: '还未选择同步方式',
+                icon: "none"
+            })
+            this.setData({
+                loading: true
+            })
+            this.triggerEvent("confirm", this.data.radio)
+        }
+    }
+})

+ 7 - 0
packageA/contract/modules/product/synchronous/index.json

@@ -0,0 +1,7 @@
+{
+    "component": true,
+    "usingComponents": {
+        "van-radio": "@vant/weapp/radio/index",
+        "van-radio-group": "@vant/weapp/radio-group/index"
+    }
+}

+ 67 - 0
packageA/contract/modules/product/synchronous/index.scss

@@ -0,0 +1,67 @@
+.title {
+    font-size: 28rpx;
+    font-family: PingFang SC, PingFang SC;
+    color: #333333;
+    text-align: center;
+    width: 100%;
+    font-weight: bold;
+    padding: 30rpx 0;
+}
+
+.explain {
+    width: 588rpx;
+    height: 34rpx;
+    font-size: 24rpx;
+    font-family: PingFang SC, PingFang SC;
+    color: #888888;
+    margin-left: 30rpx;
+}
+
+.item {
+    width: 100%;
+    box-sizing: border-box;
+    padding: 30rpx;
+
+    .label {
+        display: flex;
+        font-size: 28rpx;
+        font-family: PingFang SC, PingFang SC;
+        color: #333333;
+        font-weight: bold;
+    }
+
+    .value {
+        font-size: 24rpx;
+        font-family: PingFang SC, PingFang SC;
+        color: #888888;
+        margin-top: 10rpx;
+        margin-left: 50rpx;
+    }
+
+}
+
+.button-box {
+    display: flex;
+    justify-content: space-between;
+    width: 690rpx;
+    margin: 30rpx auto 30rpx;
+
+    .but {
+        width: 328rpx;
+        height: 90rpx;
+        border-radius: 8rpx;
+        font-size: 28rpx;
+    }
+
+    .cancel {
+        background: #FFFFFF;
+        border: 1rpx solid #CCCCCC;
+        color: #666666;
+    }
+
+    .confirm {
+        background: #3874F6;
+        color: #fff;
+        border: 0;
+    }
+}

+ 27 - 0
packageA/contract/modules/product/synchronous/index.wxml

@@ -0,0 +1,27 @@
+<van-popup show="{{ show }}" position="bottom" z-index='99999999'>
+    <view class="title">
+        同步合作协议
+    </view>
+    <view class="explain">
+        请选择同步更新经销商/直销客户合作协议产品的方式:
+    </view>
+    <van-radio-group value="{{ radio }}">
+        <view class="item" bindtap="changeRadio" data-name="1">
+            <view class="label">
+                <van-radio icon-size='16px' name="1" />同步添加合作协议产品
+            </view>
+            <view class="value">将协议中所有产品添加到表体,若表体已存在产品,则协议中相同产品的信息及其折扣价格覆盖更新到表体。</view>
+        </view>
+        <view class="item" bindtap="changeRadio" data-name="0">
+            <view class="label">
+                <van-radio icon-size='16px' name="0" />仅更新合作协议的产品折扣价格
+            </view>
+            <view class="value">将协议中与表体相同的产品信息及其折扣价格覆盖更新到表体,不添加协议产品。</view>
+        </view>
+
+        <view class="button-box">
+            <van-button custom-class='but cancel' disabled='{{loading}}' bindtap="onCancel">取消</van-button>
+            <van-button custom-class='but confirm' loading='{{loading}}' loading-text='保存中...' bindtap="onConfirm">确定</van-button>
+        </view>
+    </van-radio-group>
+</van-popup>

+ 3 - 3
packageA/offers/detail.wxml

@@ -1,4 +1,4 @@
-<import src="detail.skeleton.wxml"/>
+<import src="detail.skeleton.wxml" />
 <template is="skeleton" wx:if="{{loading}}" />
 
 <view class="header">
@@ -13,8 +13,8 @@
 <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=='新建'}}" />
-    <PiscountType slot='产品类别折扣' id='PiscountType' disabled="{{(isAdmin||isLeader)&&detail.status!='新建'}}" type="报价单" />
+    <Product slot='产品明细折扣' id='Product' synchronous='{{detail.quotedpricetype=="项目报价" && isLeader && detail.status=="新建"}}' sa_projectid="{{detail.sa_projectid}}" type="{{detail.quotedpricetype}}" disabled="{{(per.query(options,'product')||isAdmin||isLeader)&&detail.status=='新建'}}" />
+    <PiscountType slot='产品类别折扣' id='PiscountType' synchronous='{{detail.quotedpricetype=="项目报价" && isLeader && detail.status=="新建"}}' disabled="{{(isAdmin||isLeader)&&detail.status!='新建'}}" type="报价单" />
     <PettyExpense slot='其他费用' id='PettyExpense' quotedpricenotes='{{detail.quotedpricenotes}}' disabled="{{(isAdmin||isLeader)&&detail.status!='新建'}}" />
     <History slot='历史报价' id="History" isproject="{{detail.quotedpricetype=='项目报价'?1:0}}" />
     <Record slot='操作记录' id="Record" ownertable='sa_quotedprice' ownerid='{{detail.sa_quotedpriceid}}' />

+ 33 - 0
packageA/offers/modules/product/index.js

@@ -9,6 +9,9 @@ let queue = [],
     downCounter = null,
     sa_quotedpriceid = 0;
 Component({
+    options: {
+        addGlobalClass: true
+    },
     properties: {
         disabled: {
             type: Boolean
@@ -23,6 +26,9 @@ Component({
             type: Object,
             value: null
         }, //保存页面
+        synchronous: {
+            type: Boolean
+        }, //是否同步按钮显示
     },
     observers: {
         sumamount(newData) {
@@ -56,6 +62,33 @@ Component({
         },
     },
     methods: {
+        openSynchronous() {
+            this.selectComponent("#synchronous").onOpen();
+        },
+        confirm({
+            detail
+        }) {
+            _Http.basic({
+                "id": 20231206085404,
+                "content": {
+                    "sa_quotedpriceid": sa_quotedpriceid,
+                    "isadd": detail
+                }
+            }).then(res => {
+                wx.showToast({
+                    title: res.msg == '成功' ? '设置成功' : res.msg,
+                    icon: "none"
+                })
+                if (res.msg == '成功') {
+                    this.selectComponent("#synchronous").onCancel();
+                    this.getList(sa_quotedpriceid, true)
+                } else {
+                    this.selectComponent("#synchronous").setData({
+                        loading: false
+                    })
+                }
+            })
+        },
         /* 获取产品列表 */
         getList(id, init) {
             let content = this.data.content;

+ 2 - 1
packageA/offers/modules/product/index.json

@@ -1,6 +1,7 @@
 {
     "component": true,
     "usingComponents": {
-        "List": "./list/index"
+        "List": "./list/index",
+        "synchronous": "../../../contract/modules/product/synchronous/index"
     }
 }

+ 6 - 4
packageA/offers/modules/product/index.wxml

@@ -1,13 +1,15 @@
 <view class="head">
     <view class="count">产品清单 <text>总金额:{{sumamount}}元</text></view>
     <view class="expand">
-        <!-- <navigator url="#" class="but">
-            <van-icon name="search" />
-        </navigator> -->
+        <navigator wx:if="{{synchronous}}" url="#" class="but" bindtap="openSynchronous">
+            <text class="iconfont icon-tongbuhezuoxieyi" />
+        </navigator>
         <navigator wx:if="{{disabled}}" url="#" class="but" bindtap="addProduct">
             <van-icon name="plus" />
         </navigator>
     </view>
 </view>
 <List list='{{list}}' disabled='{{disabled}}' bind:deleteItem='deleteItems' bindchangeQueue='changeQueue' />
-<van-action-sheet show="{{ actionShow }}" actions="{{ actions }}" bind:select='selectorMode' bind:cancel='cancelSelector' bind:click-overlay='cancelSelector' z-index='999999999' cancel-text="取消" />
+<van-action-sheet show="{{ actionShow }}" actions="{{ actions }}" bind:select='selectorMode' bind:cancel='cancelSelector' bind:click-overlay='cancelSelector' z-index='999999999' cancel-text="取消" />
+
+<synchronous id="synchronous" bind:confirm='confirm' />

+ 7 - 0
project.private.config.json

@@ -13,6 +13,13 @@
                     "query": "",
                     "launchMode": "default",
                     "scene": null
+                },
+                {
+                    "name": "合同详情",
+                    "pathName": "packageA/contract/detail",
+                    "query": "id=4156",
+                    "launchMode": "default",
+                    "scene": null
                 }
             ]
         }

+ 24 - 0
static/font-icon.wxss

@@ -9,6 +9,30 @@
     -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-fuhe:before {
+    content: "\e6f3";
+}
+
+.icon-fanfuhe:before {
+    content: "\e6f2";
+}
+
+.icon-tejiabaojiashenpi:before {
+    content: "\e6f1";
+}
+
+.icon-tongbuhezuoxieyi:before {
+    content: "\e6f0";
+}
+
+.icon-quxiaoquanping_o:before {
+    content: "\e6ef";
+}
+
+.icon-xiangmuzhibiaofenleibili:before {
+    content: "\e6ee";
+}
+
 .icon-shenheshouquan:before {
     content: "\e6ea";
 }

文件差異過大導致無法顯示
+ 0 - 0
static/stylesheet.wxss


部分文件因文件數量過多而無法顯示