合同小程序前端代码仓库
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.

270 lines
9.4 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const api = require("../../api.js");
  4. const common_assets = require("../../common/assets.js");
  5. const _sfc_main = common_vendor.defineComponent({
  6. data() {
  7. return {
  8. params: new UTSJSONObject({
  9. pageNo: 1,
  10. pageSize: 10,
  11. status: ""
  12. }),
  13. firstFocus: false,
  14. searchKey: "",
  15. activeTab: "全部",
  16. tabs: ["全部", "已生效", "已失效"],
  17. orders: [
  18. /* 从接口获取的数据 */
  19. ]
  20. };
  21. },
  22. mounted() {
  23. api.isToken();
  24. api.list(new UTSJSONObject({ pageNo: 1, pageSize: 10 })).then((res = null) => {
  25. for (var index = 0; index < res.result.records.length; index++) {
  26. this.orders.push(res.result.records[index]);
  27. }
  28. });
  29. },
  30. computed: {
  31. filteredOrders() {
  32. return this.orders.filter((item) => {
  33. return item.custName.includes(this.searchKey) || item.custPhone.includes(this.searchKey);
  34. });
  35. }
  36. },
  37. methods: {
  38. // 清楚搜索框信息
  39. clear() {
  40. this.searchKey = "";
  41. },
  42. // 到底部刷新
  43. scrolltolower() {
  44. this.params.pageNo++;
  45. common_vendor.index.showLoading({
  46. title: "刷新中.."
  47. });
  48. api.list(this.params).then((res = null) => {
  49. let orders = res.result.records;
  50. for (var index = 0; index < orders.length; index++) {
  51. this.orders.push(orders[index]);
  52. }
  53. common_vendor.index.hideLoading();
  54. });
  55. },
  56. changeStatus(status = null) {
  57. common_vendor.index.showLoading();
  58. this.activeTab = status;
  59. if (status == "已生效") {
  60. this.orders.splice(0);
  61. this.params.status = 1;
  62. this.params.pageNo = 1;
  63. api.list(this.params).then((res = null) => {
  64. let orders = res.result.records;
  65. for (var index = 0; index < orders.length; index++) {
  66. this.orders.push(orders[index]);
  67. }
  68. common_vendor.index.hideLoading();
  69. });
  70. } else if (status == "已失效") {
  71. this.orders.splice(0);
  72. this.params.status = 2;
  73. this.params.pageNo = 1;
  74. api.list(this.params).then((res = null) => {
  75. for (var index = 0; index < res.result.records.length; index++) {
  76. this.orders.push(res.result.records[index]);
  77. }
  78. });
  79. common_vendor.index.hideLoading();
  80. } else {
  81. this.params.status = "";
  82. this.params.pageNo = 1;
  83. api.list(this.params).then((res = null) => {
  84. common_vendor.index.__f__("log", "at pages/index/dingdan.uvue:143", res.result);
  85. this.orders.splice(0);
  86. for (var index = 0; index < res.result.records.length; index++) {
  87. this.orders.push(res.result.records[index]);
  88. }
  89. common_vendor.index.hideLoading();
  90. });
  91. }
  92. },
  93. // 回退
  94. toBack() {
  95. let canNavBack = getCurrentPages();
  96. if (canNavBack && canNavBack.length > 1) {
  97. common_vendor.index.navigateBack();
  98. } else {
  99. history.back();
  100. }
  101. },
  102. IsChinese(value = null) {
  103. const reg = /^[\u4e00-\u9fa5]+$/gi;
  104. return reg.test(value);
  105. },
  106. WhNumber(value = null) {
  107. return /^\d+$/.test(value);
  108. },
  109. // 搜索处理
  110. handleSearch() {
  111. common_vendor.index.showLoading();
  112. if (this.IsChinese(this.searchKey)) {
  113. api.list(new UTSJSONObject({ custName: this.searchKey, pageNo: 1, pageSize: 10 })).then((res = null) => {
  114. this.activeTab = "全部";
  115. this.orders.splice(0);
  116. let orders = res.result.records;
  117. for (var index = 0; index < orders.length; index++) {
  118. this.orders.push(orders[index]);
  119. }
  120. common_vendor.index.hideLoading();
  121. });
  122. } else if (this.WhNumber(this.searchKey)) {
  123. api.list(new UTSJSONObject({ custPhone: this.searchKey, pageNo: 1, pageSize: 10 })).then((res = null) => {
  124. this.activeTab = "全部";
  125. this.orders.splice(0);
  126. let orders = res.result.records;
  127. for (var index = 0; index < orders.length; index++) {
  128. this.orders.push(orders[index]);
  129. }
  130. common_vendor.index.hideLoading();
  131. });
  132. } else if (!this.searchKey) {
  133. api.list(new UTSJSONObject({ pageNo: 1, pageSize: 10 })).then((res = null) => {
  134. this.activeTab = "全部";
  135. this.orders.splice(0);
  136. let orders = res.result.records;
  137. for (var index = 0; index < orders.length; index++) {
  138. this.orders.push(orders[index]);
  139. }
  140. common_vendor.index.hideLoading();
  141. });
  142. }
  143. },
  144. // 复制订单号
  145. copyorderNum(orderNum = null) {
  146. common_vendor.index.setClipboardData({
  147. data: orderNum,
  148. success: () => {
  149. common_vendor.index.showToast({ title: "复制成功" });
  150. }
  151. });
  152. },
  153. // PDF下载
  154. downloadPDF(contractUrl = null) {
  155. return common_vendor.__awaiter(this, void 0, void 0, function* () {
  156. common_vendor.index.showLoading({ title: "下载中..." });
  157. common_vendor.index.downloadFile({
  158. url: contractUrl,
  159. success: (data) => {
  160. common_vendor.index.saveFile({
  161. tempFilePath: data.tempFilePath,
  162. // filePath:"内部存储/Documents/",
  163. success: (res) => {
  164. common_vendor.index.hideLoading();
  165. common_vendor.index.showToast({
  166. icon: "none",
  167. mask: true,
  168. title: "文件已下载,打开后请点击右上角保存!",
  169. duration: 2e3
  170. });
  171. setTimeout(() => {
  172. common_vendor.index.openDocument({
  173. filePath: res.savedFilePath,
  174. showMenu: true,
  175. success: function(res2) {
  176. api.list(new UTSJSONObject({ pageNo: 1, pageSize: 10 })).then((res3 = null) => {
  177. for (var index = 0; index < res3.result.records.length; index++) {
  178. this.orders.push(res3.result.records[index]);
  179. }
  180. });
  181. }
  182. });
  183. }, 3e3);
  184. }
  185. });
  186. },
  187. fail: (err) => {
  188. common_vendor.index.__f__("log", "at pages/index/dingdan.uvue:250", err);
  189. common_vendor.index.showToast({
  190. icon: "none",
  191. mask: true,
  192. title: "失败请重新下载"
  193. });
  194. }
  195. });
  196. });
  197. }
  198. }
  199. });
  200. if (!Array) {
  201. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  202. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  203. (_easycom_uni_icons2 + _easycom_uni_easyinput2)();
  204. }
  205. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  206. const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
  207. if (!Math) {
  208. (_easycom_uni_icons + _easycom_uni_easyinput)();
  209. }
  210. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  211. return {
  212. a: common_vendor.p({
  213. type: "left",
  214. size: "30",
  215. color: "#c2d4de"
  216. }),
  217. b: common_vendor.o((...args) => $options.toBack && $options.toBack(...args)),
  218. c: common_vendor.p({
  219. type: "search",
  220. size: 20
  221. }),
  222. d: common_vendor.o($options.clear),
  223. e: common_vendor.o(($event) => $data.searchKey = $event),
  224. f: common_vendor.p({
  225. inputBorder: false,
  226. placeholder: "请输入客户姓名/客户手机号",
  227. focus: $data.firstFocus,
  228. modelValue: $data.searchKey
  229. }),
  230. g: common_vendor.o((...args) => $options.handleSearch && $options.handleSearch(...args)),
  231. h: common_vendor.f($data.tabs, (tab, k0, i0) => {
  232. return {
  233. a: common_vendor.t(tab),
  234. b: tab,
  235. c: common_vendor.n($data.activeTab === tab ? "active" : ""),
  236. d: common_vendor.o(($event) => $options.changeStatus(tab), tab)
  237. };
  238. }),
  239. i: common_vendor.f($options.filteredOrders, (order, index, i0) => {
  240. return common_vendor.e({
  241. a: common_vendor.t(order.orderNum),
  242. b: common_vendor.o(($event) => $options.copyorderNum(order.orderNum), index),
  243. c: common_vendor.t(order.custName),
  244. d: common_vendor.t(order.custPhone),
  245. e: common_vendor.t(order.productName),
  246. f: common_vendor.t(order.createTime),
  247. g: common_vendor.t(order.saleName),
  248. h: common_vendor.t(order.storeName),
  249. i: order.status == 1 ? true : false
  250. }, (order.status == 1 ? true : false) ? {
  251. j: common_vendor.o(($event) => $options.downloadPDF(order.contractUrl), index)
  252. } : {}, {
  253. k: order.status == 1 ? true : false
  254. }, (order.status == 1 ? true : false) ? {
  255. l: common_assets._imports_0$3
  256. } : {}, {
  257. m: order.status == 1 ? false : true
  258. }, (order.status == 1 ? false : true) ? {
  259. n: common_assets._imports_1$2
  260. } : {}, {
  261. o: index
  262. });
  263. }),
  264. j: common_vendor.sei(_ctx.virtualHostId, "scroll-view"),
  265. k: common_vendor.o((...args) => $options.scrolltolower && $options.scrolltolower(...args))
  266. };
  267. }
  268. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-6e742b06"]]);
  269. wx.createPage(MiniProgramPage);
  270. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/dingdan.js.map