|
|
@@ -1,4 +1,5 @@
|
|
|
-const _Http = getApp().globalData.http;
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ getTime = require("../../utils/getTime");
|
|
|
|
|
|
Page({
|
|
|
data: {
|
|
|
@@ -7,97 +8,62 @@ Page({
|
|
|
label: "选择客户",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
- type: "option",
|
|
|
+ type: "route",
|
|
|
+ url: "/packageA/select/setclient/select",
|
|
|
+ radio: true,
|
|
|
value: "",
|
|
|
- placeholder: "项目名称",
|
|
|
- valueName: "projectname",
|
|
|
- checking: "base",
|
|
|
- required: true
|
|
|
- }, {
|
|
|
- label: "项目类型",
|
|
|
- error: false,
|
|
|
- errMsg: "",
|
|
|
- type: "option",
|
|
|
- optionNmae: "projecttype",
|
|
|
- optionType: "radio", //复选 radio 单选
|
|
|
- value: "",
|
|
|
- placeholder: "选择类型",
|
|
|
- valueName: "projecttype",
|
|
|
+ params: {
|
|
|
+ id: 20221012164402,
|
|
|
+ content: {
|
|
|
+ nocache: true,
|
|
|
+ type: 0,
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ isExport: 0,
|
|
|
+ where: {
|
|
|
+ condition: "",
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ placeholder: "选择客户",
|
|
|
+ valueName: "sys_enterpriseid",
|
|
|
checking: "base",
|
|
|
required: true
|
|
|
}, {
|
|
|
- label: "项目等级",
|
|
|
- error: false,
|
|
|
- errMsg: "",
|
|
|
- type: "option",
|
|
|
- optionNmae: "projectgrade",
|
|
|
- optionType: "radio", //复选 radio 单选
|
|
|
- value: "",
|
|
|
- placeholder: "选择项目等级",
|
|
|
- valueName: "grade",
|
|
|
- checking: "base",
|
|
|
- required: false
|
|
|
- }, {
|
|
|
- label: "地区",
|
|
|
- error: false,
|
|
|
- errMsg: "",
|
|
|
- type: "region",
|
|
|
- value: [],
|
|
|
- placeholder: "所属地区 省/市/区",
|
|
|
- valueName: "region",
|
|
|
- required: false
|
|
|
- }, {
|
|
|
- label: "详细地址",
|
|
|
- error: false,
|
|
|
- errMsg: "",
|
|
|
- type: "textarea",
|
|
|
- value: "",
|
|
|
- placeholder: "详细地址",
|
|
|
- valueName: "address",
|
|
|
- checking: "base",
|
|
|
- required: false
|
|
|
- }, {
|
|
|
- label: "项目规模",
|
|
|
+ label: "报价日期",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
- type: "textarea",
|
|
|
- value: "",
|
|
|
- placeholder: "项目规模",
|
|
|
- valueName: "scale",
|
|
|
- checking: "base",
|
|
|
- required: false
|
|
|
- }, {
|
|
|
- label: "项目预算",
|
|
|
- error: false,
|
|
|
- errMsg: "",
|
|
|
- type: "number",
|
|
|
- value: "",
|
|
|
- placeholder: "项目预算",
|
|
|
- valueName: "budgetary",
|
|
|
- checking: "base",
|
|
|
- required: false
|
|
|
- }, {
|
|
|
- label: "预计签约金额",
|
|
|
- error: false,
|
|
|
- errMsg: "",
|
|
|
- type: "number",
|
|
|
+ type: "date",
|
|
|
+ start: getTime.formatTime(new Date(), '-').split(' ')[0],
|
|
|
value: "",
|
|
|
- placeholder: "预计签约金额",
|
|
|
- valueName: "signamount_due",
|
|
|
+ placeholder: "报价日期",
|
|
|
+ valueName: "billdate",
|
|
|
checking: "base",
|
|
|
required: false
|
|
|
}, {
|
|
|
- label: "预计签约月份",
|
|
|
+ label: "有效截止期",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
type: "date",
|
|
|
- fields: "month",
|
|
|
+ start: getTime.formatTime(new Date(), '-').split(' ')[0],
|
|
|
value: "",
|
|
|
- placeholder: "预计签约月份",
|
|
|
- valueName: "signdate_due",
|
|
|
+ placeholder: "报价有效截止日期",
|
|
|
+ valueName: "invaliddate",
|
|
|
checking: "base",
|
|
|
required: false
|
|
|
}],
|
|
|
+ "content": {
|
|
|
+ "sa_quotedpriceid": 0, //报价单id
|
|
|
+ "sa_projectid": 0, //项目id
|
|
|
+ "contactsid": 0, //联系人id
|
|
|
+ "sys_enterpriseid": 0, //合作客户ID
|
|
|
+ "invaliddate": "", //有效截止日期
|
|
|
+ "billdate": "", //报价日期
|
|
|
+ discountrate: "",
|
|
|
+ remarks: "",
|
|
|
+ projectname: "",
|
|
|
+ address: ""
|
|
|
+ },
|
|
|
disabled: true
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
@@ -116,15 +82,77 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ /* 打断处理form */
|
|
|
+ interrupt(e) {
|
|
|
+ let {
|
|
|
+ data,
|
|
|
+ form
|
|
|
+ } = e.detail,
|
|
|
+ obj = {
|
|
|
+ label: "联系人",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "route",
|
|
|
+ url: "/packageA/select/contacts/select",
|
|
|
+ model: "#Form",
|
|
|
+ value: "",
|
|
|
+ radio: true,
|
|
|
+ params: {
|
|
|
+ "id": "20221022165503",
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "sys_enterpriseid": data.value[1][0],
|
|
|
+ "where": {
|
|
|
+ "condition": "",
|
|
|
+ "workaddress": 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ placeholder: "选择客户联系人",
|
|
|
+ valueName: "contactsid",
|
|
|
+ checking: "base",
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+ console.log("处理", data, form)
|
|
|
+ //选择客户
|
|
|
+ if (data.valueName == "sys_enterpriseid") {
|
|
|
+ if (form[1].label == "联系人") {
|
|
|
+ form[1] = obj
|
|
|
+ } else {
|
|
|
+ form.splice(1, 0, obj)
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+ /* */
|
|
|
+ },
|
|
|
submit() {
|
|
|
- let data = this.selectComponent("#Form").submit();
|
|
|
- if (data.region.length != 0) {
|
|
|
- data.province = data.region[0]
|
|
|
- data.city = data.region[1]
|
|
|
- data.county = data.region[2]
|
|
|
+ let content = {
|
|
|
+ ...this.data.content,
|
|
|
+ ...this.selectComponent("#Form").submit()
|
|
|
};
|
|
|
- delete(data.region);
|
|
|
+ content.sys_enterpriseid = content.sys_enterpriseid[1][0] || '';
|
|
|
+ content.contactsid = content.contactsid[1][0] || '';
|
|
|
+ console.log(content)
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20221020164803,
|
|
|
+ "version": 1,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("添加普通报价单", res)
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg != '成功' ? res.msg : '保存成功',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ if (res.msg != '成功') return;
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.navigateBack();
|
|
|
+ getCurrentPages().forEach(v => {
|
|
|
+ if (v.getList) v.getList(true);
|
|
|
+ })
|
|
|
+ }, 300)
|
|
|
+ })
|
|
|
},
|
|
|
// 是否显示全部
|
|
|
onChange({
|
|
|
@@ -141,5 +169,5 @@ Page({
|
|
|
this.setData({
|
|
|
disabled: detail
|
|
|
})
|
|
|
- },
|
|
|
+ }
|
|
|
})
|