123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- 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":
- wx.makePhoneCall({
- phoneNumber: item.phonenumber,
- })
- break;
- case "delete":
- wx.showModal({
- title: '提示',
- content: `是否确认删除"${item.name}"`,
- complete: (res) => {
- if (res.confirm) _Http.basic({
- "id": "20221018145502",
- "content": {
- "contactsid": item.contactsid,
- "sys_enterpriseid": item.sys_enterpriseid
- }
- }).then(res => {
- console.log("删除联系人", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- that.triggerEvent("changeTotal")
- wx.showToast({
- title: `删除成功!`,
- icon: "none"
- })
- getCurrentPages().forEach(v => {
- switch (v.__route__) {
- case "packageA/setclient/detail":
- that.setData({
- list: this.data.list.filter(v => v.contactsid != item.contactsid)
- });
- break;
- case "packageA/setclient/modules/contacts/detail/index":
- wx.navigateBack()
- break;
- }
- })
- })
- }
- })
- break;
- case "edit":
- wx.navigateTo({
- url: `/packageA/setclient/modules/contacts/add/index?data=${JSON.stringify(item)}`
- })
- break;
- }
- },
- toDetail(e) {
- const {
- item
- } = e.currentTarget.dataset;
- wx.navigateTo({
- url: '/packageA/setclient/modules/contacts/detail/index?contactsid=' + item.contactsid
- })
- },
- }
- })
|