integralOrderPay.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. "use strict";
  2. var common_vendor = require("../common/vendor.js");
  3. var api_integral = require("../api/integral.js");
  4. require("../common/request.js");
  5. const _sfc_main = {
  6. data() {
  7. return {
  8. addressId: null,
  9. address: null,
  10. orderId: null,
  11. order: null,
  12. item: null
  13. };
  14. },
  15. onLoad(option) {
  16. this.goodsId = option.goodsId;
  17. var that = this;
  18. common_vendor.index.$on("updateAddress", (e) => {
  19. that.addressId = e.addressId;
  20. that.address = e;
  21. that.address.address = e.province + e.city + e.district + e.detail;
  22. });
  23. this.getIntegralGoodsById();
  24. },
  25. methods: {
  26. getIntegralGoodsById() {
  27. var data = { goodsId: this.goodsId };
  28. console.log(data);
  29. api_integral.getIntegralGoodsById(data).then((res) => {
  30. if (res.code == 200) {
  31. this.item = res.data;
  32. }
  33. }, (rej) => {
  34. });
  35. },
  36. openAddress() {
  37. common_vendor.index.navigateTo({
  38. url: "/pages_user/address"
  39. });
  40. },
  41. payOrder() {
  42. if (this.addressId == null) {
  43. common_vendor.index.showToast({
  44. icon: "none",
  45. title: "\u8BF7\u9009\u62E9\u6536\u8D27\u5730\u5740"
  46. });
  47. return;
  48. }
  49. var data = {
  50. goodsId: this.goodsId,
  51. addressId: this.addressId
  52. };
  53. common_vendor.index.showLoading();
  54. api_integral.createOrder(data).then((res) => {
  55. if (res.code == 200) {
  56. common_vendor.index.redirectTo({
  57. url: "./integralOrderPaySuccess?orderId=" + res.order.orderId
  58. });
  59. } else {
  60. common_vendor.index.showToast({
  61. icon: "none",
  62. title: res.msg
  63. });
  64. }
  65. }, (rej) => {
  66. });
  67. }
  68. }
  69. };
  70. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  71. return common_vendor.e({
  72. a: $data.address == null
  73. }, $data.address == null ? {
  74. b: common_vendor.o(($event) => $options.openAddress())
  75. } : {}, {
  76. c: $data.address != null
  77. }, $data.address != null ? common_vendor.e({
  78. d: common_vendor.t($data.address.realName),
  79. e: $data.address.phone != null
  80. }, $data.address.phone != null ? {
  81. f: common_vendor.t($data.address.phone)
  82. } : {}, {
  83. g: common_vendor.t($data.address.address),
  84. h: common_vendor.o(($event) => $options.openAddress())
  85. }) : {}, {
  86. i: $data.item.imgUrl == "" ? "/static/images/drug.svg" : $data.item.imgUrl,
  87. j: common_vendor.t($data.item.goodsName),
  88. k: common_vendor.t($data.item.integral),
  89. l: common_vendor.t($data.item.integral),
  90. m: $data.item != null
  91. }, $data.item != null ? {
  92. n: common_vendor.o(($event) => $options.payOrder())
  93. } : {});
  94. }
  95. var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_user/integralOrderPay.vue"]]);
  96. wx.createPage(MiniProgramPage);