const _Http = getApp().globalData.http; Component({ options: { addGlobalClass: true }, properties: { list: Array, changeTotal: Function }, data: { radio: 0, detailItem: {}, }, methods: { //打开详情 onClick(e) { const { item } = e.currentTarget.dataset; this.setData({ "detailItem": item }) wx.navigateTo({ url: '/packageA/setclient/modules/financing/detail/index?data=' + JSON.stringify(item), }) }, /* 处理快捷小按钮 */ handleItem(e) { const { name, item } = e.target.dataset, that = this; if (!name) return; switch (name) { case "call": wx.makePhoneCall({ phoneNumber: item.phonenumber, }) break; case "copy": wx.setClipboardData({ data: `名称:${item.enterprisename}\n纳税人识别号:${item.taxno}\n地址:${item.address}\n开户行:${item.bank}\n账号:${item.bankcardno}`, }) break; case "delete": wx.showModal({ title: '提示', content: '是否确认删除', complete: (res) => { if (res.confirm) { _Http.basic({ "id": 20221013160502, "content": { "sys_enterprise_financeids": [item.sys_enterprise_financeid] }, }).then(res => { if (res.msg != '成功') return wx.showToast({ title: res.data, icon: "none" }); that.setData({ list: that.data.list.filter(v => v.sys_enterprise_financeid != item.sys_enterprise_financeid) }); that.triggerEvent("changeTotal"); that.setData({ detailItem: {} }) let pages = getCurrentPages(); if (pages[pages.length - 1].__route__ == 'packageA/setclient/modules/financing/detail/index') wx.navigateBack() wx.showToast({ title: '删除成功', icon: "none" }); }); } } }) break; case "edit": wx.navigateTo({ url: '/packageA/setclient/modules/financing/add/index?data=' + JSON.stringify(item), }); that.setData({ detailItem: {} }) break; } }, /* 查询默认项目 */ queryDefault() { const item = this.data.list.find(v => v.isdefault == 1); if (!item) return; this.setData({ radio: item.sys_enterprise_financeid }) }, /* 修改默认项 */ onChange({ detail }) { _Http.basic({ "id": 20221013160702, "content": { "sys_enterprise_financeid": detail }, }).then(res => { if (res.msg != '成功') return wx.showToast({ title: res.data, icon: "none" }); this.setData({ list: this.data.list.map(v => { v.isdefault = v.sys_enterprise_financeid == detail ? 1 : 0 return v }), radio: detail }) }) }, } })