index.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. sat_orderclueid: {
  5. type: String
  6. }
  7. },
  8. lifetimes: {
  9. attached: function () {
  10. this.querySite();
  11. getApp().globalData.Language.getLanguagePackage(this)
  12. },
  13. },
  14. data: {
  15. show: false
  16. },
  17. methods: {
  18. querySite() {
  19. return new Promise((resolve, reject) => {
  20. _Http.basic({
  21. "id": 20230814102104,
  22. "content": {}
  23. }).then(res => {
  24. console.log("查询可转站点", res)
  25. if (res.code != '1') return reject()
  26. this.setData({
  27. siteList: res.data.filter(v => v.siteid != wx.getStorageSync('siteP').siteid).map(v => {
  28. v.name = v.sitename;
  29. return v
  30. })
  31. });
  32. resolve(res.data.length)
  33. })
  34. })
  35. },
  36. showSite() {
  37. if (this.data.siteList.length) {
  38. this.setData({
  39. show: true
  40. })
  41. } else {
  42. that.querySite().then(count => {
  43. if (count == 0) return wx.showToast({
  44. title: getApp().globalData.Language.getMapText('未查询到可转移站点'),
  45. icon: "none",
  46. })
  47. this.setData({
  48. show: true
  49. })
  50. })
  51. }
  52. },
  53. onClose() {
  54. this.setData({
  55. show: false
  56. })
  57. },
  58. onSelect({
  59. detail
  60. }) {
  61. let that = this;
  62. wx.showModal({
  63. title: getApp().globalData.Language.getMapText('取消'),
  64. content: getApp().globalData.Language.getMapText('是否确定转移到') + `“${detail.sitename}”` + getApp().globalData.Language.getMapText('站点'),
  65. cancelText: getApp().globalData.Language.getMapText('取消'),
  66. confirmText: getApp().globalData.Language.getMapText('确定'),
  67. complete: ({
  68. confirm
  69. }) => {
  70. if (confirm) _Http.basic({
  71. "accesstoken": "5371fad42310bda53730d7e685f48c0c",
  72. "id": 20230809144804,
  73. "content": {
  74. "toSiteid": detail.siteid,
  75. "sat_orderclueid": [that.data.sat_orderclueid]
  76. }
  77. }).then(res => {
  78. wx.showToast({
  79. title: res.code == '1' ? getApp().globalData.Language.getMapText('成功转移到') + `“${detail.sitename}”` + getApp().globalData.Language.getMapText('站点') : res.msg,
  80. icon: "none"
  81. })
  82. })
  83. }
  84. })
  85. }
  86. }
  87. })