|
|
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const _sfc_main = common_vendor.defineComponent({
- data() {
- return {
- searchKey: "",
- activeTab: "全部",
- tabs: ["全部", "已生效", "已失效"],
- orders: [
- /* 从接口获取的数据 */
- ]
- };
- },
- computed: {
- // 过滤后的订单列表
- filteredOrders() {
- return this.orders.filter((order) => {
- const matchStatus = this.activeTab === "全部" || order.status === this.activeTab;
- const matchSearch = order.customerName.includes(this.searchKey) || order.phone.includes(this.searchKey);
- return matchStatus && matchSearch;
- });
- }
- },
- methods: {
- // 搜索处理
- handleSearch() {
- common_vendor.index.__f__("log", "at pages/index/dingdan.uvue:78", "搜索关键词:", this.searchKey);
- },
- // 复制订单号
- copyOrderNo(orderNo = null) {
- common_vendor.index.setClipboardData({
- data: orderNo,
- success: () => {
- common_vendor.index.showToast({ title: "复制成功" });
- }
- });
- },
- // PDF下载
- downloadPDF(order = null) {
- return common_vendor.__awaiter(this, void 0, void 0, function* () {
- common_vendor.index.showLoading({ title: "下载中..." });
- try {
- const tempFilePath = (yield common_vendor.index.downloadFile({
- url: "https://your-api.com/download",
- header: new UTSJSONObject({ "order-id": order.id })
- })).tempFilePath;
- yield common_vendor.index.saveFile({
- tempFilePath,
- success: (res) => {
- common_vendor.index.showToast({ title: "下载成功" });
- common_vendor.index.__f__("log", "at pages/index/dingdan.uvue:107", "文件路径:", res.savedFilePath);
- }
- });
- common_vendor.index.openDocument({
- filePath: tempFilePath,
- showMenu: true
- });
- } catch (err) {
- common_vendor.index.showToast({ title: "下载失败", icon: "none" });
- } finally {
- common_vendor.index.hideLoading();
- }
- });
- }
- }
- });
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: $data.searchKey,
- b: common_vendor.o(($event) => $data.searchKey = $event.detail.value),
- c: common_vendor.o((...args) => $options.handleSearch && $options.handleSearch(...args)),
- d: common_vendor.f($data.tabs, (tab, k0, i0) => {
- return {
- a: common_vendor.t(tab),
- b: tab,
- c: common_vendor.n($data.activeTab === tab ? "active" : ""),
- d: common_vendor.o(($event) => $data.activeTab = tab, tab)
- };
- }),
- e: common_vendor.f($options.filteredOrders, (order, index, i0) => {
- return {
- a: common_vendor.t(order.orderNo),
- b: common_vendor.o(($event) => $options.copyOrderNo(order.orderNo), index),
- c: common_vendor.t(order.customerName),
- d: common_vendor.t(order.phone),
- e: common_vendor.t(order.serviceName),
- f: common_vendor.t(order.orderTime),
- g: common_vendor.t(order.salesman),
- h: common_vendor.t(order.store),
- i: common_vendor.o(($event) => $options.downloadPDF(order), index),
- j: index
- };
- }),
- f: common_vendor.sei(_ctx.virtualHostId, "view")
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-6e742b06"]]);
- wx.createPage(MiniProgramPage);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/dingdan.js.map
|