const _Http = getApp().globalData.http; Component({ options: { addGlobalClass: true }, properties: { list: Array, changeTotal: Function }, data: {}, methods: { handleItem(e) { const { name, item } = e.target.dataset, that = this; switch (name) { case "call": if (!item.phonenumber) return wx.showToast({ title: '该用户手机号为空', icon: "none" }) wx.makePhoneCall({ phoneNumber: item.phonenumber, }) break; case "delete": wx.showModal({ title: '提示', content: `是否确认删除"${item.name}"`, complete: (res) => { if (res.confirm) _Http.basic({ "id": "20221111130904", "content": { sa_project_contactsids: [item.sa_project_contactsid], } }).then(res => { console.log("删除联系人", res) if (res.msg != '成功') return wx.showToast({ title: res.data, icon: "none" }); wx.showToast({ title: `删除成功!`, icon: "none" }) getCurrentPages().forEach(v => { if (v.selectComponent("#Contacts")) { const page = v.selectComponent("#Contacts"); page.setData({ list: page.data.list.filter(v => v.contactsid != item.contactsid) }); page.changeTotal(); } else if (v.__route__ == "packageA/project/modules/contacts/search/index") { v.setData({ list: v.data.list.filter(v => v.contactsid != item.contactsid), 'content.total': v.data.content.total - 1 }); } else if (v.__route__ == "packageA/setclient/modules/contacts/detail/index") { wx.navigateBack() } }) }) } }) break; case "edit": wx.navigateTo({ url: `/packageA/setclient/modules/contacts/add/index?data=${JSON.stringify(item)}` }) break; } }, } })