index.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. list: Array,
  5. fastCallBack: Function,
  6. disabled: Boolean
  7. },
  8. options: {
  9. addGlobalClass: true
  10. },
  11. data: {
  12. range: ['业主', '设计院', '总包', '分包', '监理', '其他']
  13. },
  14. methods: {
  15. handleFast(e) {
  16. const {
  17. name,
  18. item
  19. } = e.currentTarget.dataset;
  20. this.triggerEvent("fastCallBack", {
  21. name,
  22. item
  23. })
  24. },
  25. bindPickerChange(e) {
  26. let item = e.currentTarget.dataset.item,
  27. type = this.data.range[e.detail.value];
  28. if (item.type == type) return;
  29. _Http.basic({
  30. "id": 20221116142502,
  31. "content": {
  32. "sa_project_partiesid": item.sa_project_partiesid,
  33. sa_projectid: item.sa_projectid,
  34. type
  35. },
  36. }).then(res => {
  37. console.log("修改关联客户类型", res)
  38. if (res.msg != '成功') return wx.showToast({
  39. title: res.data,
  40. icon: "none"
  41. });
  42. this.setData({
  43. [`list[${this.data.list.findIndex(v=>v.sa_project_partiesid==item.sa_project_partiesid)}].type`]: type
  44. });
  45. wx.showToast({
  46. title: `已更改“${item.enterprisename}”客户类型为“${type}”`,
  47. icon: "none"
  48. })
  49. })
  50. },
  51. }
  52. })