|
|
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const _sfc_main = common_vendor.defineComponent({
- data() {
- return {
- firstFocus: false,
- searchKey: "",
- activeTab: "全部",
- tabs: ["全部", "已生效", "已失效"],
- orders: [
- new UTSJSONObject(
- /* 从接口获取的数据 */
- {
- customerName: "你可乐",
- orderNo: "1223333",
- phone: "",
- serviceName: "",
- orderTime: "",
- salesman: "",
- store: ""
- }
- ),
- new UTSJSONObject({
- customerName: "你可乐",
- orderNo: "1223333",
- phone: "",
- serviceName: "",
- orderTime: "",
- salesman: "",
- store: ""
- })
- ]
- };
- },
- 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: {
- toBack() {
- let canNavBack = getCurrentPages();
- if (canNavBack && canNavBack.length > 1) {
- common_vendor.index.navigateBack();
- } else {
- history.back();
- }
- },
- // 搜索处理
- handleSearch() {
- common_vendor.index.__f__("log", "at pages/index/dingdan.uvue:111", "搜索关键词:", 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:140", "文件路径:", res.savedFilePath);
- }
- });
- common_vendor.index.openDocument({
- filePath: tempFilePath,
- showMenu: true
- });
- } catch (err) {
- common_vendor.index.showToast({ title: "下载失败", icon: "none" });
- } finally {
- common_vendor.index.hideLoading();
- }
- });
- }
- }
- });
- if (!Array) {
- const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
- const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
- (_easycom_uni_icons2 + _easycom_uni_easyinput2)();
- }
- const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
- const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
- if (!Math) {
- (_easycom_uni_icons + _easycom_uni_easyinput)();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: common_vendor.p({
- type: "left",
- size: "30",
- color: "#c2d4de"
- }),
- b: common_vendor.o((...args) => $options.toBack && $options.toBack(...args)),
- c: common_vendor.p({
- type: "search",
- size: 20
- }),
- d: common_vendor.o(($event) => $data.searchKey = $event),
- e: common_vendor.p({
- inputBorder: false,
- placeholder: "请输入客户姓名/客户手机号",
- focus: $data.firstFocus,
- modelValue: $data.searchKey
- }),
- f: common_vendor.o((...args) => $options.handleSearch && $options.handleSearch(...args)),
- g: 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)
- };
- }),
- h: 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
- };
- }),
- i: 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
|