packageForm.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. "use strict";
  2. var common_vendor = require("../common/vendor.js");
  3. var api_packageOrder = require("../api/packageOrder.js");
  4. require("../common/request.js");
  5. const _sfc_main = {
  6. data() {
  7. return {
  8. content: null,
  9. show: false,
  10. scrollTop: 0,
  11. patient: null,
  12. items: [
  13. {
  14. title: "\u60A8\u662F\u5426\u5DF2\u5728\u7EBF\u4E0B\u5C31\u8BCA\uFF0C\u4E14\u5BF9\u6240\u8D2D\u4E70\u7684\u836F\u54C1\u65E0\u8FC7\u654F\u6216\u4E0D\u826F\u53CD\u5E94\uFF1F",
  15. options: [
  16. { name: "\u662F\uFF0C\u6211\u7EBF\u4E0B\u5C31\u8BCA\u8FC7", value: 1, color: "green" },
  17. { name: "\u65E0\uFF0C\u4ECE\u672A\u5C31\u8BCA", value: 0, color: "red" }
  18. ]
  19. },
  20. {
  21. title: "\u60A8\u662F\u5426\u5DF2\u8BE6\u7EC6\u9605\u8BFB\u836F\u7269\u8BF4\u660E\uFF0C\u786E\u8BA4\u81EA\u5DF1\u7B26\u5408\u836F\u7269\u9002\u7528\u4EBA\u7FA4\uFF0C\u5E76\u4E86\u89E3\u7528\u836F\u65B9\u6CD5\u3001\u7528\u836F\u7981\u5FCC\u7B49\u4FE1\u606F?",
  22. options: [
  23. { name: "\u662F\uFF0C\u6211\u5DF2\u5145\u5206\u4E86\u89E3", value: 1, color: "green" },
  24. { name: "\u5426\uFF0C\u672A\u9605\u8BFB", value: 0, color: "red" }
  25. ]
  26. }
  27. ],
  28. msgs: [],
  29. index: 0,
  30. item: null,
  31. notice: [
  32. { title: "\u597D\u7684\u3002\u6211\u5C06\u6839\u636E\u60A8\u63D0\u4EA4\u7684\u590D\u8BCA\u4FE1\u606F\u5F00\u5177\u5904\u65B9\uFF0C\u8BF7\u8BE6\u7EC6\u9605\u8BFB\u836F\u54C1\u8BF4\u660E\u4E66\uFF0C\u9075\u533B\u5631\u7528\u836F\u3002" },
  33. { title: "\u60A8\u5B58\u5728\u7528\u836F\u7981\u5FCC\u8BC1\uFF0C\u76EE\u524D\u4E0D\u63A8\u8350\u8D2D\u4E70\u6B64\u5957\u9910\u5305\u3002\u5EFA\u8BAE\u60A8\u5C3D\u65E9\u5C31\u533B\uFF0C\u5728\u533B\u751F\u6307\u5BFC\u4E0B\u91C7\u53D6\u9488\u5BF9\u6027\u7684\u6CBB\u7597\u63AA\u65BD!\u5728\u6539\u5584\u76F8\u5173\u7981\u5FCC\u8BC1\u540E\uFF0C\u4E5F\u53EF\u4EE5\u518D\u6B21\u54A8\u8BE2\uFF0C\u91CD\u65B0\u8BC4\u4F30\u662F\u5426\u53EF\u4EE5\u4F7F\u7528\u8BE5\u5957\u9910\u5305\u3002" }
  34. ],
  35. packageId: null,
  36. doctorId: null,
  37. isComplete: 0,
  38. companyUserId: null,
  39. companyId: null
  40. };
  41. },
  42. onLoad(option) {
  43. this.packageId = option.packageId;
  44. this.doctorId = option.doctorId;
  45. if (!this.$isEmpty(option.companyId)) {
  46. this.companyId = option.companyId;
  47. }
  48. if (!this.$isEmpty(option.companyUserId)) {
  49. this.companyUserId = option.companyUserId;
  50. }
  51. var that = this;
  52. common_vendor.index.$on("refreshOrderPatient", (res) => {
  53. that.patient = res;
  54. });
  55. this.item = this.items[0];
  56. this.addMsg(1, this.item.title);
  57. },
  58. onShow() {
  59. },
  60. methods: {
  61. close() {
  62. this.show = false;
  63. },
  64. confirm() {
  65. if (this.isComplete == 1) {
  66. this.submit();
  67. } else {
  68. common_vendor.index.navigateBack();
  69. }
  70. },
  71. addMsg(type, content) {
  72. var msg = { type, content };
  73. this.msgs.push(msg);
  74. var that = this;
  75. common_vendor.index.createSelectorQuery().select(".msgs").boundingClientRect((res) => {
  76. const scrollH = res.height;
  77. that.scrollTop = scrollH;
  78. console.log(that.scrollTop);
  79. }).exec();
  80. },
  81. optionClick(item, option) {
  82. if (this.patient == null) {
  83. common_vendor.index.showToast({
  84. icon: "none",
  85. title: "\u8BF7\u9009\u62E9\u5C31\u8BCA\u4EBA"
  86. });
  87. return;
  88. }
  89. if (option.value == 0) {
  90. this.content = this.notice[1].title;
  91. this.show = true;
  92. this.isComplete = 0;
  93. return;
  94. }
  95. item.option = option.name;
  96. console.log(item.option);
  97. this.addMsg(2, option.name);
  98. this.index++;
  99. if (this.index <= this.items.length - 1) {
  100. this.item = this.items[this.index];
  101. this.addMsg(1, this.item.title);
  102. } else {
  103. this.content = this.notice[0].title;
  104. this.show = true;
  105. this.isComplete = 1;
  106. return;
  107. }
  108. },
  109. addPatient() {
  110. common_vendor.index.navigateTo({
  111. url: "/pages_user/patient"
  112. });
  113. },
  114. submit() {
  115. common_vendor.index.showLoading({
  116. title: "\u5904\u7406\u4E2D..."
  117. });
  118. var data = {
  119. companyId: this.companyId,
  120. companyUserId: this.companyUserId,
  121. patientId: this.patient.patientId,
  122. patientJson: JSON.stringify(this.patient),
  123. packageId: this.packageId,
  124. doctorId: this.doctorId,
  125. formJson: JSON.stringify(this.items)
  126. };
  127. api_packageOrder.create(data).then((res) => {
  128. common_vendor.index.hideLoading();
  129. if (res.code == 200) {
  130. var temps = ["jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU"];
  131. common_vendor.index.requestSubscribeMessage({
  132. tmplIds: temps,
  133. success(e) {
  134. setTimeout(function() {
  135. common_vendor.index.navigateTo({
  136. url: "/pages_order/packageOrderPay?orderId=" + res.order.orderId
  137. });
  138. }, 200);
  139. },
  140. fail(e) {
  141. setTimeout(function() {
  142. common_vendor.index.navigateTo({
  143. url: "/pages_order/packageOrderPay?orderId=" + res.order.orderId
  144. });
  145. }, 200);
  146. }
  147. });
  148. } else {
  149. common_vendor.index.showToast({
  150. icon: "none",
  151. title: res.msg
  152. });
  153. }
  154. });
  155. }
  156. }
  157. };
  158. if (!Array) {
  159. const _easycom_u_modal2 = common_vendor.resolveComponent("u-modal");
  160. _easycom_u_modal2();
  161. }
  162. const _easycom_u_modal = () => "../uni_modules/uview-plus/components/u-modal/u-modal.js";
  163. if (!Math) {
  164. _easycom_u_modal();
  165. }
  166. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  167. return common_vendor.e({
  168. a: $data.patient == null
  169. }, $data.patient == null ? {
  170. b: common_vendor.o(($event) => $options.addPatient())
  171. } : {}, {
  172. c: $data.patient != null
  173. }, $data.patient != null ? common_vendor.e({
  174. d: common_vendor.t($data.patient.patientName),
  175. e: $data.patient.sex == 1
  176. }, $data.patient.sex == 1 ? {} : {}, {
  177. f: $data.patient.sex == 2
  178. }, $data.patient.sex == 2 ? {} : {}, {
  179. g: common_vendor.t(_ctx.$getAge($data.patient.birthday)),
  180. h: common_vendor.t(_ctx.$parseIdCard($data.patient.idCard)),
  181. i: common_vendor.o(($event) => $options.addPatient())
  182. }) : {}, {
  183. j: common_vendor.f($data.msgs, (item, index, i0) => {
  184. return common_vendor.e({
  185. a: item.type == 1
  186. }, item.type == 1 ? {
  187. b: common_vendor.t(item.content)
  188. } : {}, {
  189. c: item.type == 2
  190. }, item.type == 2 ? {
  191. d: common_vendor.t(item.content)
  192. } : {});
  193. }),
  194. k: $data.scrollTop,
  195. l: $data.item != null
  196. }, $data.item != null ? {
  197. m: common_vendor.t($data.item.title),
  198. n: common_vendor.f($data.item.options, (option, opIndex, i0) => {
  199. return {
  200. a: common_vendor.t(option.name),
  201. b: common_vendor.n(option.color == "red" ? "option-item red" : "option-item green"),
  202. c: common_vendor.o(($event) => $options.optionClick($data.item, option))
  203. };
  204. })
  205. } : {}, {
  206. o: common_vendor.o(($event) => $options.close()),
  207. p: common_vendor.o(($event) => $options.confirm()),
  208. q: common_vendor.p({
  209. show: $data.show,
  210. title: "\u6E29\u99A8\u63D0\u793A",
  211. content: $data.content
  212. })
  213. });
  214. }
  215. var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_index/packageForm.vue"]]);
  216. wx.createPage(MiniProgramPage);