index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // pages/agent/addServiceBill/index.js
  2. import api from '../../api/api'
  3. import data from './formData'
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. data,
  10. form:{
  11. "sa_serviceorderid":0, //sa_brandid<=0时 为新增
  12. "servicetype":"0",
  13. "sa_orderid":0,
  14. "remarks":"",
  15. "class1":"",
  16. "class2":"",
  17. "reason":"",
  18. "province":"",
  19. "city":"",
  20. "county":"",
  21. "address":"",
  22. "scenecontact":"",
  23. "scenecontactrole":"",
  24. "scenecontactphonenumber":"",
  25. "billdate":"",
  26. "begdate":"",
  27. "enddate":""
  28. }
  29. },
  30. async onClick (data) {
  31. this.data.form = Object.assign({},this.data.form,data.detail)
  32. const res = await api._post({
  33. "id": "20230206091403",
  34. "version":1,
  35. "content": this.data.form
  36. })
  37. const rs = await api._post({
  38. "classname": "system.attachment.Attachment",
  39. "method": "createFileLink",
  40. "content": {
  41. "ownertable": "sa_serviceorder",
  42. "ownerid": res.data.sa_serviceorderid,
  43. "usetype": "附件",
  44. "attachmentids": data.detail.attachmentids
  45. }
  46. })
  47. wx.navigateBack({
  48. delta:0
  49. })
  50. },
  51. // setDefaultData () {
  52. // let that = this
  53. // this.data.data.formLayout.formInfo.forEach(e=>{
  54. // Object.keys(that.data.form).map((key,index)=>{
  55. // if (e.id === key) {
  56. // e.inputValue = that.data.form[key]
  57. // }
  58. // })
  59. // })
  60. // this.setData({
  61. // data:this.data.data
  62. // })
  63. // },
  64. /**
  65. * 生命周期函数--监听页面加载
  66. */
  67. onLoad(options) {
  68. getApp().globalData.Language.getLanguagePackage(this, 'E-订单');
  69. },
  70. /**
  71. * 生命周期函数--监听页面初次渲染完成
  72. */
  73. onReady() {
  74. },
  75. /**
  76. * 生命周期函数--监听页面显示
  77. */
  78. onShow() {
  79. },
  80. /**
  81. * 生命周期函数--监听页面隐藏
  82. */
  83. onHide() {
  84. this.compData = this.selectComponent("#form")
  85. // this.compData.setObjectData(this.compData.data.formLayoutData.formInfo)
  86. },
  87. /**
  88. * 生命周期函数--监听页面卸载
  89. */
  90. onUnload() {
  91. getApp().globalData.pageData = null
  92. },
  93. /**
  94. * 页面相关事件处理函数--监听用户下拉动作
  95. */
  96. onPullDownRefresh() {
  97. },
  98. /**
  99. * 页面上拉触底事件的处理函数
  100. */
  101. onReachBottom() {
  102. },
  103. /**
  104. * 用户点击右上角分享
  105. */
  106. onShareAppMessage() {
  107. }
  108. })