index.js 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const utils_file = require("../../utils/file.js");
  4. const utils_utils = require("../../utils/utils.js");
  5. const _sfc_main = {
  6. __name: "index",
  7. setup(__props) {
  8. const activeTab = common_vendor.ref("current");
  9. const searchKeyword = common_vendor.ref("");
  10. const currentOrders = common_vendor.ref([
  11. {
  12. id: 1,
  13. orderNo: "1929065620709298441",
  14. storeName: "正旗手选海鲜烧烤(东港店)",
  15. createTime: "2025-06-01 14:40:58",
  16. totalPrice: 19.9,
  17. goodsCount: 2,
  18. statusText: "进行中",
  19. statusClass: "status-active",
  20. goodsImages: ["/static/demo.png", "/static/demo.png"]
  21. }
  22. ]);
  23. const historyOrders = common_vendor.ref([]);
  24. const currentOrderList = common_vendor.computed(() => {
  25. const orders = activeTab.value === "current" ? currentOrders.value : historyOrders.value;
  26. if (!searchKeyword.value) {
  27. return orders;
  28. }
  29. return orders.filter(
  30. (order) => order.orderNo.includes(searchKeyword.value) || order.storeName.includes(searchKeyword.value)
  31. );
  32. });
  33. const handleOrderDetail = (order) => {
  34. common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:113", "订单详情");
  35. utils_utils.go("/pages/orderInfo/orderDetail");
  36. };
  37. const switchTab = (tab) => {
  38. activeTab.value = tab;
  39. };
  40. const handleStoreClick = (order) => {
  41. common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:124", "点击店铺:", order);
  42. };
  43. const handleAddFood = (order) => {
  44. common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:130", "去加餐:", order);
  45. utils_utils.go("/pages/orderFood/index");
  46. };
  47. const handleCheckout = (order) => {
  48. common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:137", "去结算:", order);
  49. utils_utils.go("/pages/placeOrder/index");
  50. };
  51. common_vendor.onLoad((e) => {
  52. common_vendor.index.setNavigationBarTitle({
  53. title: "我的订单"
  54. });
  55. });
  56. return (_ctx, _cache) => {
  57. return common_vendor.e({
  58. a: common_vendor.unref(utils_file.getFileUrl)("img/personal/search.png"),
  59. b: searchKeyword.value,
  60. c: common_vendor.o(($event) => searchKeyword.value = $event.detail.value),
  61. d: activeTab.value === "current" ? 1 : "",
  62. e: common_vendor.o(($event) => switchTab("current")),
  63. f: activeTab.value === "history" ? 1 : "",
  64. g: common_vendor.o(($event) => switchTab("history")),
  65. h: common_vendor.f(currentOrderList.value, (order, index, i0) => {
  66. return {
  67. a: common_vendor.t(order.orderNo),
  68. b: common_vendor.t(order.storeName),
  69. c: common_vendor.t(order.statusText),
  70. d: common_vendor.n(order.statusClass),
  71. e: common_vendor.o(($event) => handleStoreClick(order), order.id || index),
  72. f: common_vendor.t(order.createTime),
  73. g: common_vendor.f(order.goodsImages, (image, imgIndex, i1) => {
  74. return {
  75. a: imgIndex,
  76. b: common_vendor.unref(utils_file.getFileUrl)(image)
  77. };
  78. }),
  79. h: common_vendor.t(order.totalPrice),
  80. i: common_vendor.t(order.goodsCount),
  81. j: common_vendor.o(($event) => handleOrderDetail(), order.id || index),
  82. k: common_vendor.o(($event) => handleAddFood(order), order.id || index),
  83. l: common_vendor.o(($event) => handleCheckout(order), order.id || index),
  84. m: order.id || index
  85. };
  86. }),
  87. i: currentOrderList.value.length === 0
  88. }, currentOrderList.value.length === 0 ? {} : {});
  89. };
  90. }
  91. };
  92. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c0232ef0"]]);
  93. wx.createPage(MiniProgramPage);
  94. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/orderInfo/index.js.map