zhaoxiaohai 3 лет назад
Родитель
Сommit
62544c054a

+ 172 - 160
packageA/contract/add/type2/index.js

@@ -1,167 +1,179 @@
 const _Http = getApp().globalData.http,
-    getTime = require("../../../../utils/getTime");
+	getTime = require("../../../../utils/getTime");
 
 import {
-    handleRes
+	handleRes
 } from "../submit";
 
 Page({
-    data: {
-        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/agency/select",
-            radio: true,
-            value: "",
-            params: {
-                "id": 20220920083901,
-                "content": {
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    "where": {
-                        "condition": "",
-                        "type": 1
-                    }
-                }
-            },
-            placeholder: "选择经销商",
-            valueName: "sys_enterpriseid",
-            checking: "base",
-            required: true
-        }, {
-            label: "项目名称",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/packageA/select/project/select",
-            radio: true,
-            value: "",
-            params: {
-                "id": 20221201090802,
-                "content": {
-                    "type": 2, //1直销 2经销 3居间
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    "where": {
-                        "condition": "",
-                    }
-                }
-            },
-            placeholder: "选择项目",
-            valueName: "sa_projectid",
-            checking: "base",
-            required: true
-        }, {
-            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": "项目",
-            "typemx": '经销',
-            sys_enterpriseid: 0
-        },
-        disabled: true
-    },
-    onLoad(options) {
-        if (options.data) {
-            let data = JSON.parse(options.data);
-            this.setData({
-                disabled: false,
-                form: this.data.form.map(v => {
-                    if (v.valueName == "invaliddate") v.start = "";
-                    v.value = data[v.valueName];
-                    return v
-                }),
-                "content.sa_contractid": data.sa_contractid
-            })
-        }
-        if (options.project) {
-            this.setData({
-                "form[2].value": JSON.parse(options.project)
-            })
-        };
-    },
-    /* 打断处理form */
-    interrupt(e) {
-        let {
-            data,
-            form
-        } = e.detail;
-        console.log("处理", data, form)
-    },
-    submit() {
-        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][0] || '';
-        content.sa_projectid = content.sa_projectid[1][0] || '';
-        delete(content.invaliddate)
-        _Http.basic({
-            "id": 20221121185302,
-            content
-        }).then(res => {
-            console.log("添加经销项目合同", res)
-            handleRes(res);
-        })
-    },
-    // 是否显示全部
-    onChange({
-        detail
-    }) {
-        this.setData({
-            showAll: detail
-        })
-    },
-    /* 表单必填项是否完成 */
-    onConfirm({
-        detail
-    }) {
-        this.setData({
-            disabled: detail
-        })
-    }
+	data: {
+		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/agency/select",
+			radio: true,
+			value: "",
+			params: {
+				"id": 20220920083901,
+				"content": {
+					"pageNumber": 1,
+					"pageSize": 20,
+					"where": {
+						"condition": "",
+						"type": 1
+					}
+				}
+			},
+			placeholder: "选择经销商",
+			valueName: "sys_enterpriseid",
+			checking: "base",
+			required: true
+		}, {
+			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": "项目",
+			"typemx": '经销',
+			sys_enterpriseid: 0
+		},
+		disabled: true
+	},
+	onLoad(options) {
+		if (options.data) {
+			let data = JSON.parse(options.data);
+			this.setData({
+				disabled: false,
+				form: this.data.form.map(v => {
+					if (v.valueName == "invaliddate") v.start = "";
+					v.value = data[v.valueName];
+					return v
+				}),
+				"content.sa_contractid": data.sa_contractid
+			})
+		}
+		if (options.project) {
+			this.setData({
+				"form[2].value": JSON.parse(options.project)
+			})
+		};
+	},
+	/* 打断处理form */
+	interrupt(e) {
+		let {
+			data,
+			form
+		} = e.detail;
+		console.log("处理", data, form)
+		if (data.label == '经销商') {
+			if (form[2].label == '项目') {
+				form[2].params.content.sys_enterpriseid = data.value[1][0];
+				form[2].value = "";
+			} else {
+				form.splice(2, 0, {
+					label: "项目",
+					error: false,
+					errMsg: "",
+					type: "route",
+					url: "/packageA/select/project/select",
+					radio: true,
+					value: "",
+					params: {
+						"id": 20221201090802,
+						"content": {
+							sys_enterpriseid: data.value[1][0],
+							"type": 2, //1直销 2经销 3居间
+							"pageNumber": 1,
+							"pageSize": 20,
+							"where": {
+								"condition": "",
+							}
+						}
+					},
+					placeholder: "选择项目",
+					valueName: "sa_projectid",
+					checking: "base",
+					required: true
+				})
+			};
+			this.setData({
+				form
+			})
+		}
+	},
+	submit() {
+		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][0] || '';
+		content.sa_projectid = content.sa_projectid[1][0] || '';
+		delete(content.invaliddate)
+		_Http.basic({
+			"id": 20221121185302,
+			content
+		}).then(res => {
+			console.log("添加经销项目合同", res)
+			handleRes(res);
+		})
+	},
+	// 是否显示全部
+	onChange({
+		detail
+	}) {
+		this.setData({
+			showAll: detail
+		})
+	},
+	/* 表单必填项是否完成 */
+	onConfirm({
+		detail
+	}) {
+		this.setData({
+			disabled: detail
+		})
+	}
 })

+ 175 - 163
packageA/contract/add/type3/index.js

@@ -1,170 +1,182 @@
 const _Http = getApp().globalData.http,
-    getTime = require("../../../../utils/getTime");
+	getTime = require("../../../../utils/getTime");
 
 import {
-    handleRes
+	handleRes
 } from "../submit";
 
 Page({
-    data: {
-        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",
-            radio: true,
-            value: "",
-            params: {
-                id: 20221012164402,
-                content: {
-                    nocache: true,
-                    deleted: 0,
-                    type: 0,
-                    pageNumber: 1,
-                    pageSize: 20,
-                    isExport: 0,
-                    where: {
-                        condition: "",
-                    }
-                },
-            },
-            placeholder: "选择客户",
-            valueName: "sys_enterpriseid",
-            checking: "base",
-            required: true
-        }, {
-            label: "项目名称",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/packageA/select/project/select",
-            radio: true,
-            value: "",
-            params: {
-                "id": 20221201090802,
-                "content": {
-                    "type": 1, //1直销 2经销 3居间
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    "where": {
-                        "condition": "",
-                    }
-                }
-            },
-            placeholder: "选择项目",
-            valueName: "sa_projectid",
-            checking: "base",
-            required: true
-        }, {
-            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": "项目",
-            "typemx": '直销',
-            sys_enterpriseid: 0
-        },
-        disabled: true
-    },
-    onLoad(options) {
-        if (options.data) {
-            let data = JSON.parse(options.data);
-            this.setData({
-                disabled: false,
-                form: this.data.form.map(v => {
-                    if (v.valueName == "invaliddate") v.start = "";
-                    v.value = data[v.valueName];
-                    return v
-                }),
-                "content.sa_contractid": data.sa_contractid
-            })
-        }
-        if (options.project) {
-            this.setData({
-                "form[2].value": JSON.parse(options.project)
-            })
-        };
-    },
-    /* 打断处理form */
-    interrupt(e) {
-        let {
-            data,
-            form
-        } = e.detail;
-        console.log("处理", data, form)
-    },
-    submit() {
-        let content = {
-            ...this.data.content,
-            ...this.selectComponent("#Form").submit()
-        };
-        content.begdate = content.invaliddate[0];
-        content.enddate = content.invaliddate[1];
-        content.sa_projectid = content.sa_projectid[1][0] || '';
-        content.sys_enterpriseid = content.sys_enterpriseid[1][0] || '';
-        delete(content.invaliddate)
-        _Http.basic({
-            "id": 20221121185302,
-            content
-        }).then(res => {
-            console.log("添加经销项目合同", res)
-            handleRes(res);
-        })
-    },
-    // 是否显示全部
-    onChange({
-        detail
-    }) {
-        this.setData({
-            showAll: detail
-        })
-    },
-    /* 表单必填项是否完成 */
-    onConfirm({
-        detail
-    }) {
-        this.setData({
-            disabled: detail
-        })
-    }
+	data: {
+		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",
+			radio: true,
+			value: "",
+			params: {
+				id: 20221012164402,
+				content: {
+					nocache: true,
+					deleted: 0,
+					type: 0,
+					pageNumber: 1,
+					pageSize: 20,
+					isExport: 0,
+					where: {
+						condition: "",
+					}
+				},
+			},
+			placeholder: "选择客户",
+			valueName: "sys_enterpriseid",
+			checking: "base",
+			required: true
+		}, {
+			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": "项目",
+			"typemx": '直销',
+			sys_enterpriseid: 0
+		},
+		disabled: true
+	},
+	onLoad(options) {
+		if (options.data) {
+			let data = JSON.parse(options.data);
+			this.setData({
+				disabled: false,
+				form: this.data.form.map(v => {
+					if (v.valueName == "invaliddate") v.start = "";
+					v.value = data[v.valueName];
+					return v
+				}),
+				"content.sa_contractid": data.sa_contractid
+			})
+		}
+		if (options.project) {
+			this.setData({
+				"form[2].value": JSON.parse(options.project)
+			})
+		};
+	},
+	/* 打断处理form */
+	interrupt(e) {
+		let {
+			data,
+			form
+		} = e.detail;
+		console.log("处理", data, form)
+		if (data.label == '客户') {
+			if (form[2].label == '项目') {
+				form[2].params.content.sys_enterpriseid = data.value[1][0];
+				form[2].value = "";
+			} else {
+				form.splice(2, 0, {
+					label: "项目",
+					error: false,
+					errMsg: "",
+					type: "route",
+					url: "/packageA/select/project/select",
+					radio: true,
+					value: "",
+					params: {
+						"id": 20221201090802,
+						"content": {
+							sys_enterpriseid: data.value[1][0],
+							"type": 1, //1直销 2经销 3居间
+							"pageNumber": 1,
+							"pageSize": 20,
+							"where": {
+								"condition": "",
+							}
+						}
+					},
+					placeholder: "选择项目",
+					valueName: "sa_projectid",
+					checking: "base",
+					required: true
+				})
+			};
+			this.setData({
+				form
+			})
+		}
+	},
+	submit() {
+		let content = {
+			...this.data.content,
+			...this.selectComponent("#Form").submit()
+		};
+		content.begdate = content.invaliddate[0];
+		content.enddate = content.invaliddate[1];
+		content.sa_projectid = content.sa_projectid[1][0] || '';
+		content.sys_enterpriseid = content.sys_enterpriseid[1][0] || '';
+		delete(content.invaliddate)
+		_Http.basic({
+			"id": 20221121185302,
+			content
+		}).then(res => {
+			console.log("添加经销项目合同", res)
+			handleRes(res);
+		})
+	},
+	// 是否显示全部
+	onChange({
+		detail
+	}) {
+		this.setData({
+			showAll: detail
+		})
+	},
+	/* 表单必填项是否完成 */
+	onConfirm({
+		detail
+	}) {
+		this.setData({
+			disabled: detail
+		})
+	}
 })

+ 285 - 286
packageA/contract/add/type4/index.js

@@ -1,293 +1,292 @@
 const _Http = getApp().globalData.http,
-    getTime = require("../../../../utils/getTime");
+	getTime = require("../../../../utils/getTime");
 
 import {
-    handleRes
+	handleRes
 } from "../submit";
 
 Page({
-    data: {
-        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/agency/select",
-            radio: true,
-            value: "",
-            params: {
-                "id": 20220920083901,
-                "content": {
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    "where": {
-                        "condition": "",
-                        "type": 1
-                    }
-                }
-            },
-            placeholder: "选择居间服务商",
-            valueName: "sys_enterpriseid",
-            checking: "base",
-            required: true
-        }, {
-            label: "项目合同",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/packageA/select/contract/select",
-            radio: true,
-            value: "",
-            params: {
-                "id": 20221217145402,
-                "content": {
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    "where": {
-                        "condition": ""
-                    }
-                }
-            },
-            placeholder: "选择项目合同",
-            valueName: "ascription_contractid",
-            checking: "base",
-            required: true
-        }, {
-            label: "项目名称",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/packageA/select/project/select",
-            radio: true,
-            disabled: true,
-            value: "",
-            params: {
-                "id": 20221201090802,
-                "content": {
-                    "type": 3, //1直销 2经销 3居间
-                    nocache: true,
-                    "pageNumber": 1,
-                    "pageSize": 20,
-                    "where": {
-                        "condition": "",
-                    }
-                }
-            },
-            placeholder: "项目名称",
-            valueName: "sa_projectid",
-            checking: "base",
-            required: true
-        }, {
-            label: "计算方式",
-            error: false,
-            errMsg: "",
-            hint: "",
-            type: "radio",
-            value: "1",
-            interrupt: true,
-            radioList: [{
-                id: '1',
-                name: '按订单金额比例计算'
-            }, {
-                id: '2',
-                name: '按产品折扣计算'
-            }],
-            valueName: "radios", //绑定的字段名称
-            required: false, //必填
-            checking: `base`,
-        }, {
-            label: "订单金额比例",
-            error: false,
-            errMsg: "",
-            hint: "请输入0-100整数!",
-            type: "number",
-            value: "",
-            placeholder: "请填写订单金额比例(%)",
-            valueName: "orderratio", //绑定的字段名称
-            required: true, //必填
-            checking: `^([1-9]?\\d|100)$`, //0-100%
-            slot: "discountrate"
-        }, {
-            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": "居间",
-            sys_enterpriseid: 0
-        },
-        disabled: true
-    },
-    onLoad(options) {
-        if (options.data) {
-            let data = JSON.parse(options.data);
-            this.setData({
-                disabled: false,
-                form: this.data.form.map(v => {
-                    if (v.valueName == "invaliddate") v.start = "";
-                    v.value = data[v.valueName];
-                    return v
-                }),
-                "content.sa_contractid": data.sa_contractid
-            })
-        }
-        if (options.sa_projectid) {
-            this.setData({
-                "form[2]": {
-                    label: "项目合同",
-                    error: false,
-                    errMsg: "",
-                    type: "route",
-                    url: "/packageA/select/contract/select",
-                    radio: true,
-                    value: "",
-                    params: {
-                        "id": 20221217145402,
-                        "content": {
-                            nocache: true,
-                            "pageNumber": 1,
-                            "pageSize": 20,
-                            "where": {
-                                "condition": "",
-                                sa_projectid: options.sa_projectid
-                            }
-                        }
-                    },
-                    placeholder: "选择项目合同",
-                    valueName: "ascription_contractid",
-                    checking: "base",
-                    required: true
-                }
-            })
-        }
-        if (options.project) {
-            this.setData({
-                "form[3].value": JSON.parse(options.project)
-            })
-        };
-    },
-    /* 打断处理form */
-    interrupt(e) {
-        let {
-            data,
-            form,
-            list
-        } = e.detail;
-        if (data.label == '计算方式') {
-            this.selectComponent('#Form').query()
-            let obj = this.selectComponent('#Form').query();
-            let form1 = form.map(v => {
-                v.value = obj[v.valueName]
-                return v
-            })
-            let index = form.findIndex(item => item.valueName == 'radios')
-            let i = index + 1
-            if (form1[index].value == 1) {
-                form1[i].label = '订单金额比例'
-                form1[i].placeholder = '请填写订单金额比例'
-                form1[i].valueName = 'orderratio'
-            } else if (form[index].value == 2) {
-                form1[i].label = '产品折扣'
-                form1[i].placeholder = '请填写产品折扣'
-                form1[i].valueName = 'productdiscount'
-            }
-            console.log(form1);
-            this.setData({
-                form: form1
-            })
-        } else if (data.label == '项目合同') {
-            this.selectComponent('#Form').query()
-            let obj = this.selectComponent('#Form').query();
-            this.setData({
-                form: form.map(v => {
-                    console.log(v)
-                    if (v.label == '项目名称') {
-                        v.value = [list[0].projectname, [list[0].sa_projectid]]
-                    } else {
-                        v.value = obj[v.valueName]
-                    }
-                    return v
-                })
-            })
-        }
-    },
-    submit() {
-        let content = {
-            ...this.data.content,
-            ...this.selectComponent("#Form").submit()
-        };
-        content.calculatemodel = content.radios
-        if (content.calculatemodel == 1) {
-            content.orderratio = (content.orderratio / 100).toFixed(4)
-        } else {
-            content.productdiscount = (content.productdiscount / 100).toFixed(4)
-        }
-        content.begdate = content.invaliddate[0];
-        content.enddate = content.invaliddate[1];
-        content.ascription_contractid = content.ascription_contractid[1][0] || '';
-        content.sys_enterpriseid = content.sys_enterpriseid[1][0] || '';
-        content.sa_projectid = content.sa_projectid[1][0] || '';
-        delete(content.invaliddate)
-        _Http.basic({
-            "id": 20221121185302,
-            content
-        }).then(res => {
-            console.log("添加居间合同", res)
-            handleRes(res);
-        })
-    },
-    // 是否显示全部
-    onChange({
-        detail
-    }) {
-        this.setData({
-            showAll: detail
-        })
-    },
-    /* 表单必填项是否完成 */
-    onConfirm({
-        detail
-    }) {
-        this.setData({
-            disabled: detail
-        })
-    }
+	data: {
+		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/agency/select",
+			radio: true,
+			value: "",
+			params: {
+				"id": 20220920083901,
+				"content": {
+					"pageNumber": 1,
+					"pageSize": 20,
+					"where": {
+						"condition": "",
+						"type": 1
+					}
+				}
+			},
+			placeholder: "选择居间服务商",
+			valueName: "sys_enterpriseid",
+			checking: "base",
+			required: true
+		}, {
+			label: "项目合同",
+			error: false,
+			errMsg: "",
+			type: "route",
+			url: "/packageA/select/contract/select",
+			radio: true,
+			value: "",
+			params: {
+				"id": 20221217145402,
+				"content": {
+					"pageNumber": 1,
+					"pageSize": 20,
+					"where": {
+						"condition": ""
+					}
+				}
+			},
+			placeholder: "选择项目合同",
+			valueName: "ascription_contractid",
+			checking: "base",
+			required: true
+		}, {
+			label: "项目名称",
+			error: false,
+			errMsg: "",
+			type: "route",
+			url: "/packageA/select/project/select",
+			radio: true,
+			disabled: true,
+			value: "",
+			params: {
+				"id": 20221201090802,
+				"content": {
+					"type": 3, //1直销 2经销 3居间
+					nocache: true,
+					"pageNumber": 1,
+					"pageSize": 20,
+					"where": {
+						"condition": "",
+					}
+				}
+			},
+			placeholder: "项目名称",
+			valueName: "sa_projectid",
+			checking: "base",
+			required: true
+		}, {
+			label: "计算方式",
+			error: false,
+			errMsg: "",
+			hint: "",
+			type: "radio",
+			value: "1",
+			interrupt: true,
+			radioList: [{
+				id: '1',
+				name: '按订单金额比例计算'
+			}, {
+				id: '2',
+				name: '按产品折扣计算'
+			}],
+			valueName: "radios", //绑定的字段名称
+			required: false, //必填
+			checking: `base`,
+		}, {
+			label: "订单金额比例",
+			error: false,
+			errMsg: "",
+			hint: "请输入0-100整数!",
+			type: "number",
+			value: "",
+			placeholder: "请填写订单金额比例(%)",
+			valueName: "orderratio", //绑定的字段名称
+			required: true, //必填
+			checking: `^([1-9]?\\d|100)$`, //0-100%
+			slot: "discountrate"
+		}, {
+			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": "居间",
+			sys_enterpriseid: 0
+		},
+		disabled: true
+	},
+	onLoad(options) {
+		if (options.data) {
+			let data = JSON.parse(options.data);
+			this.setData({
+				disabled: false,
+				form: this.data.form.map(v => {
+					if (v.valueName == "invaliddate") v.start = "";
+					v.value = data[v.valueName];
+					return v
+				}),
+				"content.sa_contractid": data.sa_contractid
+			})
+		}
+		if (options.sa_projectid) {
+			this.setData({
+				"form[2]": {
+					label: "项目合同",
+					error: false,
+					errMsg: "",
+					type: "route",
+					url: "/packageA/select/contract/select",
+					radio: true,
+					value: "",
+					params: {
+						"id": 20221217145402,
+						"content": {
+							nocache: true,
+							"pageNumber": 1,
+							"pageSize": 20,
+							"where": {
+								"condition": "",
+								sa_projectid: options.sa_projectid
+							}
+						}
+					},
+					placeholder: "选择项目合同",
+					valueName: "ascription_contractid",
+					checking: "base",
+					required: true
+				}
+			})
+		}
+		if (options.project) {
+			this.setData({
+				"form[3].value": JSON.parse(options.project)
+			})
+		};
+	},
+	/* 打断处理form */
+	interrupt(e) {
+		let {
+			data,
+			form,
+			list
+		} = e.detail;
+		if (data.label == '计算方式') {
+			this.selectComponent('#Form').query()
+			let obj = this.selectComponent('#Form').query();
+			let form1 = form.map(v => {
+				v.value = obj[v.valueName]
+				return v
+			})
+			let index = form.findIndex(item => item.valueName == 'radios')
+			let i = index + 1
+			if (form1[index].value == 1) {
+				form1[i].label = '订单金额比例'
+				form1[i].placeholder = '请填写订单金额比例'
+				form1[i].valueName = 'orderratio'
+			} else if (form[index].value == 2) {
+				form1[i].label = '产品折扣'
+				form1[i].placeholder = '请填写产品折扣'
+				form1[i].valueName = 'productdiscount'
+			}
+			console.log(form1);
+			this.setData({
+				form: form1
+			})
+		} else if (data.label == '项目合同') {
+			this.selectComponent('#Form').query()
+			let obj = this.selectComponent('#Form').query();
+			this.setData({
+				form: form.map(v => {
+					if (v.label == '项目名称') {
+						v.value = [list[0].projectname, [list[0].sa_projectid]]
+					} else {
+						v.value = obj[v.valueName]
+					}
+					return v
+				})
+			})
+		}
+	},
+	submit() {
+		let content = {
+			...this.data.content,
+			...this.selectComponent("#Form").submit()
+		};
+		content.calculatemodel = content.radios
+		if (content.calculatemodel == 1) {
+			content.orderratio = (content.orderratio / 100).toFixed(4)
+		} else {
+			content.productdiscount = (content.productdiscount / 100).toFixed(4)
+		}
+		content.begdate = content.invaliddate[0];
+		content.enddate = content.invaliddate[1];
+		content.ascription_contractid = content.ascription_contractid[1][0] || '';
+		content.sys_enterpriseid = content.sys_enterpriseid[1][0] || '';
+		content.sa_projectid = content.sa_projectid[1][0] || '';
+		delete(content.invaliddate)
+		_Http.basic({
+			"id": 20221121185302,
+			content
+		}).then(res => {
+			console.log("添加居间合同", res)
+			handleRes(res);
+		})
+	},
+	// 是否显示全部
+	onChange({
+		detail
+	}) {
+		this.setData({
+			showAll: detail
+		})
+	},
+	/* 表单必填项是否完成 */
+	onConfirm({
+		detail
+	}) {
+		this.setData({
+			disabled: detail
+		})
+	}
 })

+ 4 - 4
packageA/contract/detail.js

@@ -221,11 +221,11 @@ Page({
                 value: data.signamount
             })
             briefs.splice(4, 0, {
-                label: "关联项目",
+                label: "项目",
                 value: data.projectname
             })
             list1.splice(4, 0, {
-                label: "关联项目",
+                label: "项目",
                 value: data.projectname
             })
             list1.splice(7, 0, {
@@ -240,7 +240,7 @@ Page({
                         value: data.enterprisename
                     })
                     briefs.splice(3, 0, {
-                        label: "关联项目",
+                        label: "项目",
                         value: data.projectname
                     })
                     briefs.splice(5, 0, {
@@ -248,7 +248,7 @@ Page({
                         value: data.calculatemodel == 1 ? data.orderratio * 100 + '%' : data.productdiscount * 100 + '%'
                     })
                     list1.splice(5, 0, {
-                        label: "关联项目",
+                        label: "项目",
                         value: data.projectname
                     })
                     briefs.splice(3, 0, {