Bladeren bron

新增直销客户协议,经销合作协议配合修改

xiaohaizhao 2 jaren geleden
bovenliggende
commit
f87df4dbf6

+ 2 - 1
app.json

@@ -152,7 +152,8 @@
                 "select/linkman/select",
                 "saleAdmin/index",
                 "saleAdmin/detail",
-                "saleAdmin/insert"
+                "saleAdmin/insert",
+                "contract/add/type6/index"
             ]
         }
     ],

+ 23 - 4
packageA/contract/add/type1/index.js

@@ -74,7 +74,7 @@ Page({
             query: "&radio=true",
             value: "",
             placeholder: "请选择付款条件",
-            valueName: "sa_receivableruleid",
+            valueName: "paytype",
             checking: "base",
             required: true
         }, {
@@ -123,9 +123,28 @@ Page({
         },
         disabled: true
     },
-    onLoad(options) {
+    async onLoad(options) {
         if (options.data) {
+            let res = await _Http.basic({
+                "id": "20230110100103",
+                "version": 1,
+                "content": {
+                    nocache: true,
+                    "where": {
+                        "condition": ""
+                    }
+                }
+            });
             let data = JSON.parse(options.data);
+            try {
+                if (res.msg == '成功') {
+                    let pay = res.data.find(v => v.ruleno == data.paytype.split("-")[0])
+                    data.paytype = [`${pay.ruleno}-${pay.remarks}`, pay.sa_receivableruleid]
+                }
+            } catch (error) {
+
+            }
+
             data.discountrate = data.discountrate == 1 ? 100 : (data.discountrate * 100).toFixed(2);
             let form = this.data.form.map(v => {
                 if (v.valueName == "invaliddate") v.start = "";
@@ -207,10 +226,10 @@ Page({
         content.begdate = content.invaliddate[0];
         content.enddate = content.invaliddate[1];
         content.sys_enterpriseid = content.sys_enterpriseid[1] ? content.sys_enterpriseid[1][0] : 0;
-        content.sa_receivableruleid = content.sa_receivableruleid[1] ? content.sa_receivableruleid[1][0] : 0;
+        content.sa_receivableruleid = content.paytype[1] ? content.paytype[1][0] : 0;
+        content.paytype = content.paytype[1] ? content.paytype[0] : "";
         content.saler_hrid = content.saler_hrid[1] ? content.saler_hrid[1][0] : 0;
         content.discountrate = (content.discountrate / 100).toFixed(4);
-        content.paytype = ""
         delete(content.invaliddate)
         _Http.basic({
             "id": 20221121185302,

+ 244 - 0
packageA/contract/add/type6/index.js

@@ -0,0 +1,244 @@
+const _Http = getApp().globalData.http,
+    getTime = require("../../../../utils/getTime");
+
+import {
+    handleRes
+} from "../submit";
+
+Page({
+    data: {
+        loading: false,
+        showAll: false,
+        form: [{
+            label: "合同标题",
+            error: false,
+            errMsg: "",
+            type: "text",
+            value: "",
+            placeholder: "",
+            valueName: "title",
+            checking: "base",
+            required: true
+        }, {
+            label: "客户",
+            error: false,
+            errMsg: "",
+            type: "route",
+            url: "/packageA/select/setclient/select",
+            value: "",
+            params: {
+                "id": 20220920083901,
+                "content": {
+                    nocache: true,
+                    "where": {
+                        "condition": "",
+                        "type": 18
+                    }
+                }
+            },
+            interrupt: true,
+            query: "&radio=true&title=选择客户&idname=sys_enterpriseid",
+            placeholder: "选择客户",
+            valueName: "sys_enterpriseid",
+            checking: "base",
+            required: true
+        }, {
+            label: "业务员",
+            error: false,
+            errMsg: "",
+            type: "route",
+            value: "",
+            placeholder: "选择业务员",
+            disabled: true,
+            valueName: "saler_hrid",
+            checking: "base",
+            required: true
+        }, {
+            label: "折扣(%)",
+            error: false,
+            errMsg: "",
+            hint: "请输入0-100%",
+            type: "digit",
+            value: "",
+            placeholder: "请填写折扣(%)",
+            valueName: "discountrate", //绑定的字段名称
+            required: false, //必填
+            checking: `^(100|\\d{0,2})(\\.\\d{1,2})?$`, //0-100%
+            slot: "discountrate"
+        }, {
+            label: "付款条件",
+            error: false,
+            errMsg: "",
+            type: "route",
+            url: "/packageA/select/paytype/select",
+            params: {
+                "id": "20230110100103",
+                "version": 1,
+                "content": {
+                    nocache: true,
+                    "where": {
+                        "condition": ""
+                    }
+                }
+            },
+            query: "&radio=true",
+            value: "",
+            placeholder: "请选择付款条件",
+            valueName: "paytype",
+            checking: "base",
+            required: true
+        }, {
+            label: "发货日期提醒(天)",
+            error: false,
+            errMsg: "",
+            type: "number",
+            value: "",
+            placeholder: "发货日期提醒(天)",
+            valueName: "reminddays", //绑定的字段名称
+            required: false //必填
+        }, {
+            label: "有效期",
+            error: false,
+            errMsg: "",
+            type: "dateRange",
+            start: getTime.formatTime(new Date(), '-').split(' ')[0],
+            value: [getTime.formatTime(new Date(), '-').split(' ')[0], ""],
+            placeholder: ['生效日期', '截止日期'],
+            valueName: "invaliddate",
+            checking: "base",
+            required: true
+        }, {
+            label: "签约时间",
+            error: false,
+            errMsg: "",
+            type: "date",
+            value: getTime.formatTime(new Date(), '-').split(' ')[0],
+            placeholder: "报价日期",
+            valueName: "signdate",
+            checking: "base",
+            required: true
+        }, {
+            label: "合同描述",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: "",
+            placeholder: "请填写",
+            valueName: "remarks",
+            required: false, //必填
+        }],
+        "content": {
+            "sa_contractid": 0,
+            "type": "直销"
+        },
+        disabled: true
+    },
+    async onLoad(options) {
+        if (options.data) {
+            let res = await _Http.basic({
+                "id": "20230110100103",
+                "version": 1,
+                "content": {
+                    nocache: true,
+                    "where": {
+                        "condition": ""
+                    }
+                }
+            });
+            let data = JSON.parse(options.data);
+            console.log(res)
+            console.log(data)
+            try {
+                if (res.msg == '成功') {
+                    let pay = res.data.find(v => v.ruleno == data.paytype.split("-")[0])
+                    data.paytype = [`${pay.ruleno}-${pay.remarks}`, pay.sa_receivableruleid]
+                }
+            } catch (error) {
+
+            }
+            data.discountrate = data.discountrate == 1 ? 100 : (data.discountrate * 100).toFixed(2);
+            let form = this.data.form.map(v => {
+                if (v.valueName == "invaliddate") v.start = "";
+                v.value = data[v.valueName] || "";
+                return v
+            })
+            this.setData({
+                disabled: false,
+                form,
+                "content.sa_contractid": data.sa_contractid
+            })
+        }
+    },
+    /* 打断 */
+    interrupt(e) {
+        let {
+            data,
+            form,
+            temporary
+        } = e.detail;
+        form[temporary.index].value = data.value;
+        if (temporary.item.label == '客户') {
+            _Http.basic({
+                "id": 20221012164302,
+                "content": {
+                    "sa_customersid": data.item.sa_customersid
+                }
+            }).then(res => {
+                console.log("业务员", res)
+                try {
+                    let leader = res.data.leader[0];
+                    form[2].value = [leader.name, [leader.hr.hrid]]
+                } catch (error) {
+                    form[2].value = ''
+                }
+                this.setData({
+                    form
+                })
+                wx.navigateBack()
+            })
+        }
+    },
+    submit() {
+        this.setData({
+            loading: true
+        })
+        let content = {
+            ...this.data.content,
+            ...this.selectComponent("#Form").submit()
+        };
+        content.begdate = content.invaliddate[0];
+        content.enddate = content.invaliddate[1];
+        content.sys_enterpriseid = content.sys_enterpriseid[1] ? content.sys_enterpriseid[1][0] : 0;
+        content.sa_receivableruleid = content.paytype[1] ? content.paytype[1][0] : 0;
+        content.paytype = content.paytype[1] ? content.paytype[0] : "";
+        content.saler_hrid = content.saler_hrid[1] ? content.saler_hrid[1][0] : 0;
+        content.discountrate = (content.discountrate / 100).toFixed(4);
+        delete(content.invaliddate)
+        _Http.basic({
+            "id": 20221121185302,
+            content
+        }).then(res => {
+            this.setData({
+                loading: false
+            })
+            console.log("添加直销客户合作协议", res)
+            handleRes(res);
+        })
+    },
+    // 是否显示全部
+    onChange({
+        detail
+    }) {
+        this.setData({
+            showAll: detail
+        })
+    },
+    /* 表单必填项是否完成 */
+    onConfirm({
+        detail
+    }) {
+        this.setData({
+            disabled: detail
+        })
+    }
+})

+ 4 - 0
packageA/contract/add/type6/index.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "直销客户合作协议"
+}

+ 23 - 0
packageA/contract/add/type6/index.scss

@@ -0,0 +1,23 @@
+.new-footer {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    position: fixed;
+    width: 100vw;
+    height: 130rpx;
+    background: #FFFFFF;
+    box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    bottom: 0;
+
+    .new-submit {
+        width: 156rpx;
+        height: 90rpx;
+        background: #3874F6;
+        border-radius: 8rpx;
+        font-size: 28rpx;
+        font-family: PingFang SC-Bold, PingFang SC;
+        font-weight: bold;
+        color: #FFFFFF;
+        margin-right: 30rpx;
+    }
+}

+ 8 - 0
packageA/contract/add/type6/index.wxml

@@ -0,0 +1,8 @@
+<Yl_Headline title='基本信息' type='switch' switchLabel='仅显示必填信息' switch='{{showAll}}' bind:callBack='onChange' />
+<Yl_field id='Form' form='{{form}}' showAll='{{!showAll}}' bind:onConfirm='onConfirm' bind:interrupt="interrupt">
+    <view slot='discountrate' style="margin-right: 36rpx;">%</view>
+</Yl_field>
+<view style="height: 100rpx;" />
+<view class="new-footer">
+    <van-button custom-class='new-submit' disabled='{{disabled || loading}}' loading='{{loading}}' bindclick='submit'>提交</van-button>
+</view>

+ 63 - 4
packageA/contract/detail.js

@@ -70,6 +70,27 @@ Page({
                     }]);
                     tabsActive = 1;
                     break;
+                case "直销":
+                    data.type = '直销客户合作协议'
+                    tabsList = tabsList.concat([{
+                        label: "产品明细折扣",
+                        icon: "icon-tabchanpin",
+                        model: '#PiscountProduct'
+                    }, {
+                        label: "产品类别折扣",
+                        icon: "icon-tabchanpinleibie",
+                        model: '#PiscountType'
+                    }, {
+                        label: "业绩目标",
+                        icon: "icon-tabrenwu",
+                        model: '#Objective'
+                    }, {
+                        label: "跟进动态",
+                        icon: "icon-tabgenjindongtai1",
+                        model: '#Trace'
+                    }]);
+                    tabsActive = 1;
+                    break;
                 case "工具借用":
                     data.type = '工具使用(借用)协议'
                     tabsList = tabsList.concat([{
@@ -87,10 +108,6 @@ Page({
                     data.type = '居间协议'
                     break;
                 case "项目":
-                    /*  {
-                        label: "合同条款",
-                        num: 132
-                    }, */
                     data.type = data.typemx + '项目协议'
                     tabsList = tabsList.concat([{
                         label: "产品明细折扣",
@@ -439,6 +456,43 @@ Page({
                         value: data.tradefields
                     })
                     break;
+                case "直销客户合作协议":
+                    briefs[3].label = '折扣(%)';
+                    briefs[2].label = '客户';
+                    /* briefs.splice(3, 0, {
+                        label: "签约金额(元)",
+                        value: CNY(data.signamount)
+                    }) */
+
+                    briefs.splice(4, 0, {
+                        label: "合同有效期",
+                        value: data.begdate + ' 至 ' + data.enddate
+                    })
+                    briefs.splice(6, 0, {
+                        label: "业务员",
+                        value: data.salername
+                    })
+                    list1.splice(3, 0, {
+                        label: "客户",
+                        value: data.enterprisename
+                    })
+                    list1.splice(4, 0, {
+                        label: "签约金额(元)",
+                        value: CNY(data.signamount)
+                    })
+                    list1.splice(5, 0, {
+                        label: "折扣(%)",
+                        value: data.discountrate * 100 + "%"
+                    })
+                    list1.splice(6, 0, {
+                        label: "品牌",
+                        value: data.brandname
+                    })
+                    list1.splice(7, 0, {
+                        label: "领域",
+                        value: data.tradefields
+                    })
+                    break;
             }
         }
         this.setData({
@@ -706,6 +760,7 @@ Page({
             case "直销项目协议":
                 type = "type3"
                 break;
+
             case "居间协议":
                 data.ascription_contractid = [data.ascription_title, [data.ascription_contractid]];
                 data.radios = data.calculatemodel + "";
@@ -714,6 +769,10 @@ Page({
             case "工具使用(借用)协议":
                 type = "type5"
                 break;
+            case "直销客户合作协议":
+                data.saler_hrid = [data.salername, [data.saler_hrid]];
+                type = "type6"
+                break;
         };
         if (type) wx.navigateTo({
             url: `/packageA/contract/add/${type}/index?data=${JSON.stringify(data)}`,

+ 2 - 3
packageA/contract/detail.wxml

@@ -1,5 +1,4 @@
-
-<import src="detail.skeleton.wxml"/>
+<import src="detail.skeleton.wxml" />
 <template is="skeleton" wx:if="{{loading}}" />
 <view class="header">
     <view class="title">{{detail.title}}</view>
@@ -14,7 +13,7 @@
     <Preview slot='详细信息' list1='{{list1}}' list2='{{list2}}' />
     <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=='经销商合作协议'}}" slot='产品明细折扣' id='PiscountProduct' disabled="{{(per.query(options,'app')||isAdmin||isLeader)&&detail.status!='新建'}}" />
+    <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!='新建'}}" />
     <Objective slot='业绩目标' id='Objective' />

+ 4 - 1
packageA/contract/index.js

@@ -9,6 +9,9 @@ Page({
         typeList: [{
             name: '经销商合作协议',
             route: 'type1'
+        }, {
+            name: '直销客户合作协议',
+            route: 'type6'
         }, {
             name: '经销项目协议',
             route: 'type2'
@@ -59,7 +62,7 @@ Page({
         },
         filter: {
             show: false,
-            type: ['项目', '居间', '工具借用', '框架'], //状态项
+            type: ['项目', '居间', '工具借用', '框架', '直销'], //状态项
             typeActive: "",
             status: ['新建', '已提交', '审核', '已终止', '已过期'], //状态项
             statusActive: "",

+ 3 - 3
packageA/contract/index.wxml

@@ -1,4 +1,4 @@
-<import src="index.skeleton.wxml"/>
+<import src="index.skeleton.wxml" />
 <template is="skeleton" wx:if="{{loading}}" />
 
 <Yl_nav search list='{{navList}}' sort='{{content.sort}}' bind:onClick='navClick' bindonSearch="onSearch" />
@@ -17,7 +17,7 @@
             合同类型
         </view>
         <view class="content">
-            <van-button custom-class='but {{filter.typeActive==item?"active":""}}' wx:for="{{filter.type}}" style="white-space: pre-wrap;" wx:key="item" bindtap="typeStatus" data-item="{{item}}">{{item=='框架'?'经销商\n合作':item}}协议</van-button>
+            <van-button custom-class='but {{filter.typeActive==item?"active":""}}' wx:for="{{filter.type}}" style="white-space: pre-wrap;" wx:key="item" bindtap="typeStatus" data-item="{{item}}">{{item=='框架'?'经销商\n合作':item=='直销'?'直销客户\n合作':item}}协议</van-button>
         </view>
     </view>
     <view class="groud">
@@ -45,4 +45,4 @@
 </Yl_filtrate>
 <!-- 浮动按钮 -->
 <Yl_FloatingButton wx:if="{{insert}}" bindtap="openType" />
-<van-action-sheet show="{{ typeShow }}" actions="{{ typeList }}" cancel-text="取消" bind:cancel='typeCancel' bind:select='typeSelect' />
+<van-action-sheet show="{{ typeShow }}" actions="{{ typeList }}" cancel-text="取消" bind:cancel='typeCancel' bind:select='typeSelect' bind:click-overlay='typeCancel' />

+ 3 - 0
packageA/contract/modules/type.wxs

@@ -20,6 +20,9 @@ module.exports = {
             case "框架":
                 result = '经销商合作协议'
                 break;
+            case "直销":
+                result = '直销客户合作协议'
+                break;
             case "工具借用":
                 result = '工具使用(借用)协议'
                 break;

+ 2 - 1
packageA/select/paytype/select.js

@@ -81,8 +81,9 @@ Page({
             obj = {
                 id: result,
                 item,
-                value: [`${item.ruleno}\n${item.point}\n立账余额比例:${item.amountrate*100}\n后置天数${item.days}`, result]
+                value: [`${item.ruleno}-${item.remarks}`, result]
             }
+            //[`${item.ruleno}\n${item.point}\n立账余额比例:${item.amountrate*100}\n后置天数${item.days}`, result]
         } else {
             obj = {
                 result,

+ 1 - 0
packageA/select/paytype/select.wxml

@@ -10,6 +10,7 @@
             <view class="exp line-1"><text>{{item.point||" --"}}</text></view>
             <view class="exp line-1">立账余额比例:<text>{{item.amountrate*100}}%</text></view>
             <view class="exp line-1">后置天数:<text>{{item.days}}</text></view>
+            <view class="exp line-1"><text>{{item.remarks||" --"}}</text></view>
         </view>
     </navigator>
     <view style="height: 230rpx;" />

+ 21 - 0
project.private.config.json

@@ -49,6 +49,27 @@
                     "query": "id=690",
                     "launchMode": "default",
                     "scene": null
+                },
+                {
+                    "name": "合同",
+                    "pathName": "packageA/contract/index",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "直销客户",
+                    "pathName": "packageA/contract/add/type6/index",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "直销客户详情",
+                    "pathName": "packageA/contract/detail",
+                    "query": "id=3823",
+                    "launchMode": "default",
+                    "scene": null
                 }
             ]
         }