合同小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
5.1 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = common_vendor.defineComponent({
  4. data() {
  5. return {
  6. firstFocus: false,
  7. searchKey: "",
  8. activeTab: "全部",
  9. tabs: ["全部", "已生效", "已失效"],
  10. orders: [
  11. new UTSJSONObject(
  12. /* 从接口获取的数据 */
  13. {
  14. customerName: "你可乐",
  15. orderNo: "1223333",
  16. phone: "",
  17. serviceName: "",
  18. orderTime: "",
  19. salesman: "",
  20. store: ""
  21. }
  22. ),
  23. new UTSJSONObject({
  24. customerName: "你可乐",
  25. orderNo: "1223333",
  26. phone: "",
  27. serviceName: "",
  28. orderTime: "",
  29. salesman: "",
  30. store: ""
  31. })
  32. ]
  33. };
  34. },
  35. computed: {
  36. // 过滤后的订单列表
  37. filteredOrders() {
  38. return this.orders.filter((order) => {
  39. const matchStatus = this.activeTab === "全部" || order.status === this.activeTab;
  40. const matchSearch = order.customerName.includes(this.searchKey) || order.phone.includes(this.searchKey);
  41. return matchStatus && matchSearch;
  42. });
  43. }
  44. },
  45. methods: {
  46. toBack() {
  47. let canNavBack = getCurrentPages();
  48. if (canNavBack && canNavBack.length > 1) {
  49. common_vendor.index.navigateBack();
  50. } else {
  51. history.back();
  52. }
  53. },
  54. // 搜索处理
  55. handleSearch() {
  56. common_vendor.index.__f__("log", "at pages/index/dingdan.uvue:111", "搜索关键词:", this.searchKey);
  57. },
  58. // 复制订单号
  59. copyOrderNo(orderNo = null) {
  60. common_vendor.index.setClipboardData({
  61. data: orderNo,
  62. success: () => {
  63. common_vendor.index.showToast({ title: "复制成功" });
  64. }
  65. });
  66. },
  67. // PDF下载
  68. downloadPDF(order = null) {
  69. return common_vendor.__awaiter(this, void 0, void 0, function* () {
  70. common_vendor.index.showLoading({ title: "下载中..." });
  71. try {
  72. const tempFilePath = (yield common_vendor.index.downloadFile({
  73. url: "https://your-api.com/download",
  74. header: new UTSJSONObject({ "order-id": order.id })
  75. })).tempFilePath;
  76. yield common_vendor.index.saveFile({
  77. tempFilePath,
  78. success: (res) => {
  79. common_vendor.index.showToast({ title: "下载成功" });
  80. common_vendor.index.__f__("log", "at pages/index/dingdan.uvue:140", "文件路径:", res.savedFilePath);
  81. }
  82. });
  83. common_vendor.index.openDocument({
  84. filePath: tempFilePath,
  85. showMenu: true
  86. });
  87. } catch (err) {
  88. common_vendor.index.showToast({ title: "下载失败", icon: "none" });
  89. } finally {
  90. common_vendor.index.hideLoading();
  91. }
  92. });
  93. }
  94. }
  95. });
  96. if (!Array) {
  97. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  98. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  99. (_easycom_uni_icons2 + _easycom_uni_easyinput2)();
  100. }
  101. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  102. const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
  103. if (!Math) {
  104. (_easycom_uni_icons + _easycom_uni_easyinput)();
  105. }
  106. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  107. return {
  108. a: common_vendor.p({
  109. type: "left",
  110. size: "30",
  111. color: "#c2d4de"
  112. }),
  113. b: common_vendor.o((...args) => $options.toBack && $options.toBack(...args)),
  114. c: common_vendor.p({
  115. type: "search",
  116. size: 20
  117. }),
  118. d: common_vendor.o(($event) => $data.searchKey = $event),
  119. e: common_vendor.p({
  120. inputBorder: false,
  121. placeholder: "请输入客户姓名/客户手机号",
  122. focus: $data.firstFocus,
  123. modelValue: $data.searchKey
  124. }),
  125. f: common_vendor.o((...args) => $options.handleSearch && $options.handleSearch(...args)),
  126. g: common_vendor.f($data.tabs, (tab, k0, i0) => {
  127. return {
  128. a: common_vendor.t(tab),
  129. b: tab,
  130. c: common_vendor.n($data.activeTab === tab ? "active" : ""),
  131. d: common_vendor.o(($event) => $data.activeTab = tab, tab)
  132. };
  133. }),
  134. h: common_vendor.f($options.filteredOrders, (order, index, i0) => {
  135. return {
  136. a: common_vendor.t(order.orderNo),
  137. b: common_vendor.o(($event) => $options.copyOrderNo(order.orderNo), index),
  138. c: common_vendor.t(order.customerName),
  139. d: common_vendor.t(order.phone),
  140. e: common_vendor.t(order.serviceName),
  141. f: common_vendor.t(order.orderTime),
  142. g: common_vendor.t(order.salesman),
  143. h: common_vendor.t(order.store),
  144. i: common_vendor.o(($event) => $options.downloadPDF(order), index),
  145. j: index
  146. };
  147. }),
  148. i: common_vendor.sei(_ctx.virtualHostId, "view")
  149. };
  150. }
  151. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-6e742b06"]]);
  152. wx.createPage(MiniProgramPage);
  153. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/dingdan.js.map