detail.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = {
  4. data() {
  5. return {
  6. statusBarHeight: 20,
  7. footerHeight: 80,
  8. // px
  9. headerHeight: 120,
  10. // px
  11. order: {
  12. orderNo: "-",
  13. status: 1,
  14. statusName: "加载中",
  15. statusType: "pending",
  16. models: [],
  17. erpNo: "",
  18. time: "-"
  19. }
  20. };
  21. },
  22. computed: {
  23. statusSubText() {
  24. const map = {
  25. pending: "您的订单已提交,正在排队等待审核...",
  26. process: "审核已完成,正在由相关主管签批...",
  27. making: "订单已入库排产,工厂正在全力生产中...",
  28. finish: "该订单生产已完成并正式入库。",
  29. expired: "该订单已由客户主动撤销。"
  30. };
  31. return map[this.order.statusType] || "订单状态更新中";
  32. },
  33. scrollHeight() {
  34. const info = common_vendor.index.getSystemInfoSync();
  35. const safeBottom = info.safeAreaInsets ? info.safeAreaInsets.bottom : 0;
  36. return `calc(100vh - ${this.statusBarHeight + 164}px - ${80 + safeBottom}px)`;
  37. }
  38. },
  39. onLoad(options) {
  40. const info = common_vendor.index.getSystemInfoSync();
  41. this.statusBarHeight = info.statusBarHeight;
  42. if (options.data) {
  43. try {
  44. this.order = JSON.parse(decodeURIComponent(options.data));
  45. } catch (e) {
  46. common_vendor.index.__f__("error", "at pages/order/detail.vue:124", "Data Error");
  47. }
  48. }
  49. },
  50. methods: {
  51. goBack() {
  52. common_vendor.index.navigateBack();
  53. },
  54. doCancel() {
  55. common_vendor.index.showModal({
  56. title: "确认撤销",
  57. content: "订单撤销后将流转至已撤销状态,确定吗?",
  58. confirmColor: "#ff3b30",
  59. success: (res) => {
  60. if (res.confirm) {
  61. this.order.status = 0;
  62. this.order.statusName = "已撤销";
  63. this.order.statusType = "expired";
  64. common_vendor.index.showToast({ title: "撤销成功" });
  65. }
  66. }
  67. });
  68. },
  69. callSales() {
  70. common_vendor.index.makePhoneCall({ phoneNumber: "13888888888" });
  71. },
  72. goHome() {
  73. common_vendor.index.reLaunch({ url: "/pages/order/order" });
  74. }
  75. }
  76. };
  77. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  78. return common_vendor.e({
  79. a: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
  80. b: $data.statusBarHeight + "px",
  81. c: common_vendor.t($data.order.statusName),
  82. d: common_vendor.t($options.statusSubText),
  83. e: common_vendor.n($data.order.statusType),
  84. f: common_vendor.f($data.order.models || [$data.order], (model, mIdx, i0) => {
  85. return {
  86. a: common_vendor.t(mIdx + 1),
  87. b: common_vendor.t(model.type),
  88. c: common_vendor.t(model.typeName || "铝型材主料"),
  89. d: common_vendor.t(model.material || "6063-T5"),
  90. e: common_vendor.t(model.surface),
  91. f: common_vendor.t(model.package || "普通包装"),
  92. g: common_vendor.t(model.length),
  93. h: common_vendor.t(model.wallThickness || "1.2"),
  94. i: common_vendor.t(model.count),
  95. j: mIdx === 0 ? 1 : "",
  96. k: mIdx
  97. };
  98. }),
  99. g: common_vendor.t($data.order.orderNo),
  100. h: [2, 3, 4].includes($data.order.status)
  101. }, [2, 3, 4].includes($data.order.status) ? {
  102. i: common_vendor.t($data.order.erpNo || "ERP" + $data.order.orderNo.slice(-8))
  103. } : {}, {
  104. j: common_vendor.t($data.order.time),
  105. k: $options.scrollHeight,
  106. l: $data.order.status === 1
  107. }, $data.order.status === 1 ? {
  108. m: common_vendor.o((...args) => $options.doCancel && $options.doCancel(...args)),
  109. n: common_vendor.o((...args) => $options.callSales && $options.callSales(...args))
  110. } : {
  111. o: common_vendor.o((...args) => $options.goHome && $options.goHome(...args))
  112. });
  113. }
  114. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-6b23c96c"]]);
  115. wx.createPage(MiniProgramPage);
  116. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/order/detail.js.map