inquiryPay.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. "use strict";
  2. var common_vendor = require("../common/vendor.js");
  3. var api_user = require("../api/user.js");
  4. var api_common = require("../api/common.js");
  5. var api_inquiryOrder = require("../api/inquiryOrder.js");
  6. require("../common/request.js");
  7. const _sfc_main = {
  8. data() {
  9. return {
  10. order: null,
  11. orderId: null,
  12. orderTypeOptions: [],
  13. inquiryTypeOptions: [],
  14. couponText: "\u8BF7\u9009\u62E9\u4F18\u60E0\u5238",
  15. userCouponId: 0,
  16. coupons: [],
  17. couponShow: false,
  18. payMoney: 0,
  19. discountMoney: 0
  20. };
  21. },
  22. onLoad(options) {
  23. this.orderId = options.orderId;
  24. },
  25. onShow() {
  26. this.getDictByKey("sys_inquiry_order_type");
  27. this.getDictByKey("sys_inquiry_type");
  28. this.getInquiryOrderById();
  29. this.getMyEnableCouponList();
  30. },
  31. methods: {
  32. couponSelect(item) {
  33. this.couponShow = false;
  34. this.userCouponId = item.id;
  35. console.log(item);
  36. this.couponText = item.price + "\u5143\u4F18\u60E0\u5238";
  37. this.compute();
  38. },
  39. open() {
  40. },
  41. close() {
  42. this.couponShow = false;
  43. },
  44. openCoupon() {
  45. this.couponShow = true;
  46. },
  47. delCoupon() {
  48. this.userCouponId = 0;
  49. this.couponText = "\u8BF7\u9009\u62E9\u4F18\u60E0\u5238";
  50. this.compute();
  51. },
  52. compute() {
  53. var data = {
  54. orderId: this.orderId,
  55. userCouponId: this.userCouponId
  56. };
  57. console.log(data);
  58. api_inquiryOrder.compute(data).then((res) => {
  59. if (res.code == 200) {
  60. this.payMoney = res.data.payMoney;
  61. this.discountMoney = res.data.discountMoney;
  62. } else {
  63. this.userCouponId = 0;
  64. this.couponText = "\u8BF7\u9009\u62E9\u4F18\u60E0\u5238";
  65. common_vendor.index.showToast({
  66. icon: "none",
  67. title: res.msg
  68. });
  69. }
  70. }, (err) => {
  71. });
  72. },
  73. getMyEnableCouponList() {
  74. var data = { couponType: 3 };
  75. api_user.getMyEnableCouponList(data).then((res) => {
  76. if (res.code == 200) {
  77. this.coupons = res.data;
  78. }
  79. }, (err) => {
  80. });
  81. },
  82. getDictByKey(key) {
  83. var data = { key };
  84. api_common.getDictByKey(data).then((res) => {
  85. if (res.code == 200) {
  86. if (key == "sys_inquiry_order_type") {
  87. this.orderTypeOptions = res.data;
  88. }
  89. if (key == "sys_inquiry_type") {
  90. this.inquiryTypeOptions = res.data;
  91. }
  92. }
  93. }, (err) => {
  94. });
  95. },
  96. getInquiryOrderById() {
  97. var data = { orderId: this.orderId };
  98. var that = this;
  99. common_vendor.index.showLoading();
  100. api_inquiryOrder.getInquiryOrderById(data).then((res) => {
  101. if (res.code == 200) {
  102. common_vendor.index.hideLoading();
  103. that.order = res.data;
  104. this.compute();
  105. } else {
  106. common_vendor.index.showToast({
  107. icon: "none",
  108. title: res.msg
  109. });
  110. }
  111. }, (rej) => {
  112. });
  113. },
  114. payOrder() {
  115. var data = {
  116. orderId: this.order.orderId,
  117. userCouponId: this.userCouponId
  118. };
  119. common_vendor.index.showLoading();
  120. api_inquiryOrder.pay(data).then((res) => {
  121. if (res.code == 200) {
  122. common_vendor.index.redirectTo({
  123. url: "./inquiryPayment?orderId=" + this.orderId
  124. });
  125. } else {
  126. common_vendor.index.showToast({
  127. icon: "none",
  128. title: res.msg
  129. });
  130. }
  131. }, (rej) => {
  132. });
  133. }
  134. }
  135. };
  136. if (!Array) {
  137. const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
  138. _easycom_u_popup2();
  139. }
  140. const _easycom_u_popup = () => "../uni_modules/uview-plus/components/u-popup/u-popup.js";
  141. if (!Math) {
  142. _easycom_u_popup();
  143. }
  144. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  145. return common_vendor.e({
  146. a: $data.order != null
  147. }, $data.order != null ? {
  148. b: common_vendor.t($data.order.orderSn)
  149. } : {}, {
  150. c: common_vendor.t(_ctx.$getDictLabelName($data.inquiryTypeOptions, $data.order.inquiryType)),
  151. d: common_vendor.t(_ctx.$getDictLabelName($data.orderTypeOptions, $data.order.orderType)),
  152. e: common_vendor.t($data.order.money.toFixed(2)),
  153. f: $data.order != null && ($data.order.userCouponId == null || $data.order.userCouponId == 0)
  154. }, $data.order != null && ($data.order.userCouponId == null || $data.order.userCouponId == 0) ? common_vendor.e({
  155. g: common_vendor.t($data.couponText),
  156. h: $data.userCouponId != 0
  157. }, $data.userCouponId != 0 ? {
  158. i: common_vendor.o(($event) => $options.delCoupon())
  159. } : {}, {
  160. j: common_vendor.o(($event) => $options.openCoupon())
  161. }) : {}, {
  162. k: $data.order.userCouponId == null || $data.order.userCouponId == 0
  163. }, $data.order.userCouponId == null || $data.order.userCouponId == 0 ? {
  164. l: common_vendor.t($data.discountMoney.toFixed(2))
  165. } : {}, {
  166. m: common_vendor.t($data.payMoney.toFixed(2)),
  167. n: $data.coupons.length > 0
  168. }, $data.coupons.length > 0 ? {
  169. o: common_vendor.f($data.coupons, (item, k0, i0) => {
  170. return common_vendor.e({
  171. a: item.status == 0
  172. }, item.status == 0 ? {} : {}, {
  173. b: item.status != 0
  174. }, item.status != 0 ? {} : {}, {
  175. c: common_vendor.t(item.price.toFixed(2)),
  176. d: common_vendor.t(item.minPrice.toFixed(2)),
  177. e: common_vendor.t(item.title),
  178. f: item.status == 0 || item.status == 2
  179. }, item.status == 0 || item.status == 2 ? {
  180. g: common_vendor.t(item.limitTime)
  181. } : {}, {
  182. h: item.status == 1
  183. }, item.status == 1 ? {
  184. i: common_vendor.t(item.useTime)
  185. } : {}, {
  186. j: item.status == 1
  187. }, item.status == 1 ? {} : {}, {
  188. k: item.status == 2
  189. }, item.status == 2 ? {} : {}, {
  190. l: item.status == 0
  191. }, item.status == 0 ? {} : {}, {
  192. m: common_vendor.o(($event) => $options.couponSelect(item))
  193. });
  194. })
  195. } : {}, {
  196. p: $data.coupons.length == 0
  197. }, $data.coupons.length == 0 ? {} : {}, {
  198. q: common_vendor.o($options.close),
  199. r: common_vendor.o($options.open),
  200. s: common_vendor.p({
  201. closeable: true,
  202. show: $data.couponShow,
  203. round: 10,
  204. mode: "bottom"
  205. }),
  206. t: common_vendor.t($data.payMoney.toFixed(2)),
  207. v: common_vendor.o(($event) => $options.payOrder())
  208. });
  209. }
  210. var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-464ba66b"], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_order/inquiryPay.vue"]]);
  211. _sfc_main.__runtimeHooks = 2;
  212. wx.createPage(MiniProgramPage);