index.js 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 switchTab = (tab) => {
  34. activeTab.value = tab;
  35. };
  36. const handleStoreClick = (order) => {
  37. common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:133", "点击店铺:", order);
  38. };
  39. const handleAddFood = (order) => {
  40. common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:139", "去加餐:", order);
  41. utils_utils.go("/pages/orderFood/index");
  42. };
  43. const handleCheckout = (order) => {
  44. common_vendor.index.__f__("log", "at pages/orderInfo/index.vue:146", "去结算:", order);
  45. utils_utils.go("/pages/placeOrder/index");
  46. };
  47. common_vendor.onLoad((e) => {
  48. common_vendor.index.setNavigationBarTitle({
  49. title: "我的订单"
  50. });
  51. });
  52. return (_ctx, _cache) => {
  53. return common_vendor.e({
  54. a: searchKeyword.value,
  55. b: common_vendor.o(($event) => searchKeyword.value = $event.detail.value),
  56. c: activeTab.value === "current" ? 1 : "",
  57. d: common_vendor.o(($event) => switchTab("current")),
  58. e: activeTab.value === "history" ? 1 : "",
  59. f: common_vendor.o(($event) => switchTab("history")),
  60. g: common_vendor.f(currentOrderList.value, (order, index, i0) => {
  61. return {
  62. a: common_vendor.t(order.orderNo),
  63. b: common_vendor.t(order.statusText),
  64. c: common_vendor.n(order.statusClass),
  65. d: common_vendor.t(order.storeName),
  66. e: common_vendor.o(($event) => handleStoreClick(order), order.id || index),
  67. f: common_vendor.t(order.createTime),
  68. g: common_vendor.f(order.goodsImages, (image, imgIndex, i1) => {
  69. return {
  70. a: imgIndex,
  71. b: common_vendor.unref(utils_file.getFileUrl)(image)
  72. };
  73. }),
  74. h: common_vendor.t(order.totalPrice),
  75. i: common_vendor.t(order.goodsCount),
  76. j: common_vendor.o(($event) => handleAddFood(order), order.id || index),
  77. k: common_vendor.o(($event) => handleCheckout(order), order.id || index),
  78. l: order.id || index
  79. };
  80. }),
  81. h: currentOrderList.value.length === 0
  82. }, currentOrderList.value.length === 0 ? {} : {});
  83. };
  84. }
  85. };
  86. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c0232ef0"]]);
  87. wx.createPage(MiniProgramPage);
  88. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/orderInfo/index.js.map