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

268 lines
9.5 KiB

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