|
@@ -82,44 +82,61 @@ Page({
|
|
|
},
|
|
},
|
|
|
submit() {
|
|
submit() {
|
|
|
let formData = this.selectComponent("#Form").submit();
|
|
let formData = this.selectComponent("#Form").submit();
|
|
|
- let content = Object.assign({
|
|
|
|
|
- "contactsid": this.data.editContactsid || 0,
|
|
|
|
|
- sys_enterpriseid,
|
|
|
|
|
- sex: "男",
|
|
|
|
|
- "name": "",
|
|
|
|
|
- "depname": "",
|
|
|
|
|
- "position": "",
|
|
|
|
|
- "isleader": 1,
|
|
|
|
|
- "birthday": "",
|
|
|
|
|
- "phonenumber": "",
|
|
|
|
|
- "email": "",
|
|
|
|
|
- "address": "",
|
|
|
|
|
- "remarks": "",
|
|
|
|
|
- "workaddress": 1,
|
|
|
|
|
- "isdefault": 0
|
|
|
|
|
- }, formData);
|
|
|
|
|
- content.province = content.region[0] || "";
|
|
|
|
|
- content.city = content.region[1] || "";
|
|
|
|
|
- content.county = content.region[2] || "";
|
|
|
|
|
- delete (content.region);
|
|
|
|
|
- this.setData({
|
|
|
|
|
- loading: true
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ let isEdit = this.data.isEdit;
|
|
|
|
|
+ let apiId, content;
|
|
|
|
|
+
|
|
|
|
|
+ if (isEdit) {
|
|
|
|
|
+ // 编辑:与 Web 一致使用 20221018141802
|
|
|
|
|
+ content = {
|
|
|
|
|
+ contactsid: this.data.editContactsid,
|
|
|
|
|
+ name: formData.name || "",
|
|
|
|
|
+ phonenumber: formData.phonenumber || "",
|
|
|
|
|
+ province: formData.region ? formData.region[0] || "" : "",
|
|
|
|
|
+ city: formData.region ? formData.region[1] || "" : "",
|
|
|
|
|
+ county: formData.region ? formData.region[2] || "" : "",
|
|
|
|
|
+ address: formData.address || "",
|
|
|
|
|
+ isdefault: formData.isdefault != null ? formData.isdefault : 0
|
|
|
|
|
+ };
|
|
|
|
|
+ apiId = 20221018141802;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 新增:使用 20221009155703
|
|
|
|
|
+ content = Object.assign({
|
|
|
|
|
+ "contactsid": 0,
|
|
|
|
|
+ sys_enterpriseid,
|
|
|
|
|
+ sex: "男",
|
|
|
|
|
+ "name": "",
|
|
|
|
|
+ "depname": "",
|
|
|
|
|
+ "position": "",
|
|
|
|
|
+ "isleader": 1,
|
|
|
|
|
+ "birthday": "",
|
|
|
|
|
+ "phonenumber": "",
|
|
|
|
|
+ "email": "",
|
|
|
|
|
+ "address": "",
|
|
|
|
|
+ "remarks": "",
|
|
|
|
|
+ "workaddress": 1,
|
|
|
|
|
+ "isdefault": 0
|
|
|
|
|
+ }, formData);
|
|
|
|
|
+ content.province = content.region[0] || "";
|
|
|
|
|
+ content.city = content.region[1] || "";
|
|
|
|
|
+ content.county = content.region[2] || "";
|
|
|
|
|
+ delete (content.region);
|
|
|
|
|
+ apiId = 20221009155703;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.setData({ loading: true });
|
|
|
_Http.basic({
|
|
_Http.basic({
|
|
|
- id: 20221009155703,
|
|
|
|
|
|
|
+ id: apiId,
|
|
|
content
|
|
content
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
console.log("保存地址", res);
|
|
console.log("保存地址", res);
|
|
|
- this.setData({
|
|
|
|
|
- loading: false
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.setData({ loading: false });
|
|
|
if (res.code != '1') return wx.showToast({
|
|
if (res.code != '1') return wx.showToast({
|
|
|
title: res.msg,
|
|
title: res.msg,
|
|
|
icon: "none",
|
|
icon: "none",
|
|
|
mask: true
|
|
mask: true
|
|
|
});
|
|
});
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
- title: getApp().globalData.Language.getMapText(this.data.isEdit ? '修改成功' : '添加成功'),
|
|
|
|
|
|
|
+ title: getApp().globalData.Language.getMapText(isEdit ? '修改成功' : '添加成功'),
|
|
|
icon: "none",
|
|
icon: "none",
|
|
|
mask: true
|
|
mask: true
|
|
|
});
|
|
});
|