index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import api from '../../api/api'
  2. import data from './formData'
  3. Page({
  4. data: {
  5. data,
  6. form: {
  7. "sa_serviceorderid": 0, //sa_brandid<=0时 为新增
  8. "servicetype": "0",
  9. "sa_orderid": 0,
  10. "remarks": "",
  11. "class1": "",
  12. "class2": "",
  13. "reason": "",
  14. "province": "",
  15. "city": "",
  16. "county": "",
  17. "address": "",
  18. "scenecontact": "",
  19. "scenecontactrole": "",
  20. "scenecontactphonenumber": "",
  21. "billdate": "",
  22. "begdate": "",
  23. }
  24. },
  25. async onClick(data) {
  26. this.data.form = Object.assign({}, this.data.form, data.detail)
  27. const res = await api._post({
  28. "id": "20230206091403",
  29. "content": this.data.form
  30. })
  31. console.log("创建", res)
  32. wx.showToast({
  33. title: res.code == '1' ? getApp().globalData.Language.getMapText('创建成功') : res.msg,
  34. icon: "none",
  35. mask: true
  36. })
  37. if (res.code == '1') setTimeout(() => {
  38. wx.redirectTo({
  39. url: '/Eservice/agent/serviceBillDetail/index?id=' + res.data.sa_serviceorderid,
  40. })
  41. }, 300)
  42. const rs = await api._post({
  43. "classname": "system.attachment.Attachment",
  44. "method": "createFileLink",
  45. "content": {
  46. "ownertable": "sa_serviceorder",
  47. "ownerid": res.data.sa_serviceorderid,
  48. "usetype": "附件",
  49. "attachmentids": data.detail.attachmentids
  50. }
  51. })
  52. },
  53. onLoad(options) {
  54. getApp().globalData.Language.getLanguagePackage(this, 'E-订单');
  55. },
  56. onHide() {
  57. this.compData = this.selectComponent("#form")
  58. // this.compData.setObjectData(this.compData.data.formLayoutData.formInfo)
  59. },
  60. onUnload() {
  61. getApp().globalData.pageData = null
  62. },
  63. })