index.js 2.1 KB

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