index.js 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. data: {
  4. types: [{
  5. name: '标准订单'
  6. }, {
  7. name: '项目订单'
  8. }],
  9. actionShow: false,
  10. },
  11. methods: {
  12. /* 挑选新增订单类型 */
  13. onSelect() {
  14. this.setData({
  15. actionShow: true
  16. })
  17. },
  18. /* 选择订单类型 */
  19. selectType({
  20. detail
  21. }) {
  22. switch (detail.name) {
  23. case '标准订单':
  24. wx.navigateTo({
  25. url: '/packageA/orderForm/add/add?type=标准订单',
  26. })
  27. break;
  28. case '项目订单':
  29. /* 前去挑选合同 */
  30. wx.navigateTo({
  31. url: `/select/contract/index?params=${JSON.stringify({
  32. "id": 20230103150802,
  33. "content": {
  34. "pageNumber": 1,
  35. "pageTotal": 1,
  36. "total": null,
  37. "pageSize": 20,
  38. "where": {
  39. "condition": ""
  40. }
  41. }
  42. })}&radio=false`,
  43. })
  44. getApp().globalData.handleSelect = this.addProjectOrder.bind(this);
  45. break;
  46. }
  47. this.onCancel();
  48. },
  49. /* 取消选择订单类型 */
  50. onCancel() {
  51. this.setData({
  52. actionShow: false
  53. })
  54. },
  55. addProjectOrder(e) {
  56. wx.showModal({
  57. title: '提示',
  58. content: `是否确认创建“${e.item.billno}”相关“${e.item.projectname}”项目订单?`,
  59. complete: (res) => {
  60. if (res.confirm) {
  61. wx.navigateTo({
  62. url: `/packageA/orderForm/add/add?type=项目订单&sa_contractid=${e.item.sa_contractid}&sa_projectid=${ e.item.sa_projectid}`,
  63. })
  64. }
  65. /* _Http.basic({
  66. "id": 20230103141402,
  67. "content": {
  68. sa_orderid: 0,
  69. "sa_contractid": e.item.sa_contractid, //合同ID,
  70. "sa_projectid": e.item.sa_projectid, //工程项目表ID,
  71. }
  72. }).then(res => {
  73. console.log("创建商品订单", res)
  74. wx.showToast({
  75. title: res.msg != '成功' ? res.msg : '创建成功',
  76. icon: "none"
  77. });
  78. if (res.msg == '成功') setTimeout(() => {
  79. wx.redirectTo({
  80. url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
  81. });
  82. let page = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/index');
  83. if (page) page.getList(true);
  84. }, 500)
  85. }) */
  86. }
  87. })
  88. }
  89. }
  90. })