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

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