update.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. const _Http = getApp().globalData.http;
  2. let sa_quotedpriceid = null;
  3. Page({
  4. data: {
  5. form: [{
  6. label: "类型",
  7. error: false,
  8. errMsg: "",
  9. type: "option",
  10. optionNmae: "quotedpriceitemtype",
  11. optionType: "radio", //复选 radio 单选
  12. value: "",
  13. placeholder: "请选择",
  14. valueName: "itemtype",
  15. required: false
  16. }, {
  17. label: "费用明细",
  18. error: false,
  19. errMsg: "",
  20. type: "textarea",
  21. value: "",
  22. placeholder: "费用明细",
  23. valueName: "itemname",
  24. required: false, //必填
  25. }, {
  26. label: "单位",
  27. error: false,
  28. errMsg: "",
  29. type: "selector",
  30. range: [{
  31. "unitid": 2,
  32. "rowindex": "1",
  33. "unitname": "个"
  34. },
  35. {
  36. "unitid": 3,
  37. "rowindex": "2",
  38. "unitname": "米"
  39. },
  40. {
  41. "unitid": 4,
  42. "rowindex": "3",
  43. "unitname": "千克"
  44. },
  45. {
  46. "unitid": 5,
  47. "rowindex": "4",
  48. "unitname": "克"
  49. }
  50. ],
  51. rangeKey: "unitname",
  52. rangeIndex: "",
  53. value: "",
  54. placeholder: "计量单位",
  55. valueName: "unitname",
  56. required: false, //必填
  57. }, {
  58. label: "单价(元)",
  59. error: false,
  60. errMsg: "",
  61. type: "digit",
  62. value: "",
  63. placeholder: "单价(元)",
  64. valueName: "price",
  65. required: false, //必填
  66. }, {
  67. label: "数量",
  68. error: false,
  69. errMsg: "",
  70. type: "digit",
  71. value: "",
  72. placeholder: "数量",
  73. valueName: "qty",
  74. required: false, //必填
  75. }],
  76. },
  77. onLoad(options) {
  78. sa_quotedpriceid = options.id;
  79. },
  80. submit() {
  81. let content = this.selectComponent("#Form").submit();
  82. for (const key in content) {
  83. if (content[key]) {
  84. content.sa_quotedprice_specialitemsid = 0;
  85. wx.showModal({
  86. title: '提示',
  87. content: '是否确认添加本条费用明细',
  88. complete: (res) => {
  89. if (res.confirm) _Http.basic({
  90. "id": 20230211155503,
  91. "version": 1,
  92. "content": {
  93. "sa_quotedpriceid": sa_quotedpriceid,
  94. "items": [content]
  95. }
  96. }).then(res => {
  97. wx.showToast({
  98. title: res.msg == '成功' ? '添加成功' : res.msg,
  99. icon: "none",
  100. mask: true
  101. });
  102. if (res.msg == '成功') setTimeout(() => {
  103. getApp().globalData.saveFun(sa_quotedpriceid, true);
  104. getApp().globalData.saveFun = null;
  105. wx.navigateBack();
  106. }, 500);
  107. })
  108. }
  109. })
  110. break;
  111. }
  112. }
  113. },
  114. })