|
|
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const api = require("../../api.js");
- const common_assets = require("../../common/assets.js");
- const _sfc_main = common_vendor.defineComponent({
- data() {
- return {
- params: new UTSJSONObject({
- pageNo: 1,
- pageSize: 10,
- status: ""
- }),
- firstFocus: false,
- searchKey: "",
- activeTab: "全部",
- tabs: ["全部", "已生效", "已失效"],
- orders: [
- /* 从接口获取的数据 */
- ]
- };
- },
- mounted() {
- api.isToken();
- api.list(new UTSJSONObject({ pageNo: 1, pageSize: 10 })).then((res = null) => {
- for (var index = 0; index < res.result.records.length; index++) {
- this.orders.push(res.result.records[index]);
- }
- });
- },
- computed: {
- filteredOrders() {
- return this.orders.filter((item) => {
- return item.custName.includes(this.searchKey) || item.custPhone.includes(this.searchKey);
- });
- }
- },
- methods: {
- scrolltolower() {
- this.params.pageNo++;
- common_vendor.index.__f__("log", "at pages/index/dingdan.uvue:97", "pageNo", this.params.pageNo);
- common_vendor.index.showLoading({
- title: "刷新中.."
- });
- api.list(this.params).then((res = null) => {
- let orders = res.result.records;
- for (var index = 0; index < orders.length; index++) {
- this.orders.push(orders[index]);
- }
- common_vendor.index.hideLoading();
- });
- },
- changeStatus(status = null) {
- common_vendor.index.showLoading();
- this.activeTab = status;
- if (status == "已生效") {
- this.orders.splice(0);
- this.params.status = 0;
- this.params.pageNo = 1;
- api.list(this.params).then((res = null) => {
- let orders = res.result.records;
- for (var index = 0; index < orders.length; index++) {
- this.orders.push(orders[index]);
- }
- common_vendor.index.hideLoading();
- });
- } else if (status == "已失效") {
- this.orders.splice(0);
- this.params.status = 1;
- this.params.pageNo = 1;
- api.list(this.params).then((res = null) => {
- for (var index = 0; index < res.result.records.length; index++) {
- this.orders.push(res.result.records[index]);
- }
- });
- common_vendor.index.hideLoading();
- } else {
- this.params.status = "";
- this.params.pageNo = 1;
- api.list(this.params).then((res = null) => {
- common_vendor.index.__f__("log", "at pages/index/dingdan.uvue:138", res.result);
- this.orders.splice(0);
- for (var index = 0; index < res.result.records.length; index++) {
- this.orders.push(res.result.records[index]);
- }
- common_vendor.index.hideLoading();
- });
- }
- },
- // 回退
- 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:159", "搜索关键词:", this.searchKey);
- },
- // 复制订单号
- copyorderNum(orderNum = null) {
- common_vendor.index.setClipboardData({
- data: orderNum,
- 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:188", "文件路径:", 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) => $options.changeStatus(tab), tab)
- };
- }),
- h: common_vendor.f($options.filteredOrders, (order, index, i0) => {
- return common_vendor.e({
- a: common_vendor.t(order.orderNum),
- b: common_vendor.o(($event) => $options.copyorderNum(order.orderNum), index),
- c: common_vendor.t(order.custName),
- d: common_vendor.t(order.custPhone),
- e: common_vendor.t(order.productName),
- f: common_vendor.t(order.createTime),
- g: common_vendor.t(order.saleName),
- h: common_vendor.t(order.storeName),
- i: common_vendor.o(($event) => $options.downloadPDF(order), index),
- j: order.status == 0 ? true : false
- }, (order.status == 0 ? true : false) ? {
- k: common_assets._imports_0$3
- } : {}, {
- l: order.status == 0 ? false : true
- }, (order.status == 0 ? false : true) ? {
- m: common_assets._imports_1$2
- } : {}, {
- n: index
- });
- }),
- i: common_vendor.sei(_ctx.virtualHostId, "scroll-view"),
- j: common_vendor.o((...args) => $options.scrolltolower && $options.scrolltolower(...args))
- };
- }
- 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
|