index.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. skeletonShow: false,
  5. loading: false,
  6. sa_brandid: null,
  7. tradefield: null,
  8. brandList: [],
  9. domainList: []
  10. },
  11. onLoad(options) {
  12. console.log(options)
  13. _Http.basic({
  14. "id": 20230105144102,
  15. "content": {
  16. nocache: true,
  17. "sa_orderid": options.id
  18. }
  19. }).then(res => {
  20. console.log(res)
  21. this.setData({
  22. brandList: res.data.brands,
  23. domainList: res.data.tradefields,
  24. })
  25. })
  26. },
  27. /* 选择品牌 */
  28. onSelectBrand(e) {
  29. let {
  30. item
  31. } = e.currentTarget.dataset;
  32. if (this.data.sa_brandid == item.sa_brandid) return;
  33. this.setData({
  34. sa_brandid: item.sa_brandid
  35. })
  36. },
  37. /* 选择领域 */
  38. onSelect(e) {
  39. let {
  40. item
  41. } = e.currentTarget.dataset;
  42. if (this.data.tradefield == item.tradefield) return;
  43. this.setData({
  44. tradefield: item.tradefield
  45. })
  46. },
  47. submit() {
  48. if (this.data.loading) return;
  49. this.setData({
  50. loading: true
  51. })
  52. _Http.basic({
  53. "id": 20221108111402,
  54. content: {
  55. sa_orderid: 0,
  56. sa_accountclassid: 0,
  57. rec_contactsid: 0,
  58. pay_enterpriseid: 0,
  59. "sa_brandid": this.data.sa_brandid, //品牌ID
  60. "type": "标准订单", //订单类型
  61. "tradefield": this.data.tradefield, //必选
  62. }
  63. }).then(res => {
  64. this.setData({
  65. loading: false
  66. })
  67. console.log("创建标准订单", res);
  68. wx.showToast({
  69. title: res.msg != '成功' ? res.msg : '创建成功',
  70. icon: "none"
  71. });
  72. if (res.msg == '成功') setTimeout(() => {
  73. wx.redirectTo({
  74. url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
  75. });
  76. let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/index');
  77. if (page) page.getList(true);
  78. }, 500)
  79. })
  80. }
  81. })