123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- const _Http = getApp().globalData.http;
- Component({
- options: {
- addGlobalClass: true
- },
- properties: {
- list: Array,
- changeTotal: Function
- },
- data: {
- radio: 0
- },
- methods: {
- //打开详情
- onClick(e) {
- const {
- item
- } = e.currentTarget.dataset;
- wx.navigateTo({
- url: '/packageA/setclient/modules/financing/detail/index?sys_enterprise_financeid=' + item.sys_enterprise_financeid,
- })
- },
- /* 处理快捷小按钮 */
- 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.msg,
- icon: "none"
- });
- that.triggerEvent("changeTotal");
- getCurrentPages().forEach(v => {
- switch (v.__route__) {
- //退出详情界面
- case 'packageA/setclient/modules/financing/detail/index':
- wx.navigateBack()
- break;
- //列表页更新数据
- case 'packageA/setclient/detail':
- that.setData({
- list: that.data.list.filter(v => v.sys_enterprise_financeid != item.sys_enterprise_financeid)
- });
- break;
- }
- });
- wx.showToast({
- title: '作废成功',
- icon: "none"
- });
- });
- }
- }
- })
- break;
- case "edit":
- wx.navigateTo({
- url: '/packageA/setclient/modules/financing/add/index?data=' + JSON.stringify(item),
- });
- 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
- })
- })
- },
- }
- })
|