index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. const _Http = getApp().globalData.http;
  2. let sa_projectid = "";
  3. Page({
  4. data: {
  5. defeatreason: "",
  6. type: "其他",
  7. actions: [{
  8. name: "价格"
  9. }, {
  10. name: "品牌"
  11. }, {
  12. name: "商务"
  13. }, {
  14. name: "地域"
  15. }, {
  16. name: "其他"
  17. }],
  18. show: false
  19. },
  20. onLoad(options) {
  21. sa_projectid = options.id;
  22. },
  23. //开始选择跟进方式
  24. openSelect() {
  25. this.setData({
  26. show: true
  27. })
  28. },
  29. //取消选择
  30. onCancel() {
  31. this.setData({
  32. show: false
  33. })
  34. },
  35. //确定选择
  36. onSelect({
  37. detail
  38. }) {
  39. this.setData({
  40. type: detail.name
  41. })
  42. this.onCancel();
  43. },
  44. //文本域输入
  45. onInput(e) {
  46. this.setData({
  47. defeatreason: e.detail.value
  48. })
  49. },
  50. submit() {
  51. _Http.basic({
  52. "id": 20230706152904,
  53. "content": {
  54. sa_projectid,
  55. "defeatreason": this.data.defeatreason,
  56. defeattype: this.data.type
  57. }
  58. }).then(res => {
  59. console.log("失败", res)
  60. wx.showToast({
  61. title: res.msg == '成功' ? '已失败' : res.msg,
  62. icon: "none",
  63. mask: true
  64. });
  65. if (res.msg == '成功') {
  66. let page = getCurrentPages()[getCurrentPages().length - 2];
  67. page.getDetail()
  68. setTimeout(() => {
  69. wx.navigateBack()
  70. }, 500)
  71. }
  72. })
  73. }
  74. })