| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- const _Http = getApp().globalData.http;
- Component({
- options: {
- addGlobalClass: true
- },
- properties: {
- list: {
- type: Array
- },
- changeTotal: {
- type: Function
- },
- disabled: {
- type: Boolean
- }
- },
- data: {
- range: [{
- show: getApp().globalData.Language.getMapText('高层'),
- value: '高层',
- }, {
- show: getApp().globalData.Language.getMapText('中层'),
- value: '中层',
- }, {
- show: getApp().globalData.Language.getMapText('项目负责人'),
- value: '项目负责人',
- }],
- range1: ['高层', '中层', '项目负责人'],
- },
- methods: {
- handleItem(e) {
- const {
- name,
- item
- } = e.target.dataset,
- that = this;
- switch (name) {
- case "call":
- if (!item.phonenumber) return getApp().globalData.Language.modeBoxPrompts('该用户联系方式为空')
- wx.makePhoneCall({
- phoneNumber: item.phonenumber,
- })
- break;
- case "delete":
- wx.showModal({
- title: getApp().globalData.Language.getMapText('提示'),
- content: getApp().globalData.Language.getMapText('是否确认删除') + `"${item.name}"`,
- cancelText: getApp().globalData.Language.getMapText('取消'),
- confirmText: getApp().globalData.Language.getMapText('确定'),
- complete: (res) => {
- if (res.confirm) _Http.basic({
- "id": "20221111130904",
- "content": {
- sa_project_contactsids: [item.sa_project_contactsid],
- }
- }).then(res => {
- console.log("删除联系人", res)
- if (res.code != '1') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- wx.showToast({
- title: getApp().globalData.Language.getMapText('删除成功') + `!`,
- 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/project/modules/contacts/add/index?data=${JSON.stringify(item)}`
- })
- break;
- }
- },
- bindPickerChange(e) {
- let item = e.currentTarget.dataset.item,
- tag = this.data.range1[e.detail.value];
- if (item.tag == tag) return;
- _Http.basic({
- "id": 20221119103902,
- "content": {
- "sa_project_contactsid": item.sa_project_contactsid,
- tag,
- },
- }).then(res => {
- console.log("修改关联客户类型", res)
- if (res.code != '1') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- this.setData({
- [`list[${this.data.list.findIndex(v=>v.sa_project_contactsid==item.sa_project_contactsid)}].tag[0]`]: tag
- });
- getApp().globalData.Language.modeBoxPrompts([{
- t: 1,
- v: '已更改',
- r: " "
- }, {
- v: item.name,
- r: " "
- }, {
- t: 1,
- v: '联系人类型为',
- r: " "
- }, {
- t: 1,
- v: tag
- }])
- })
- },
- }
- })
|