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

141 lines
4.6 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
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const api = require("../../api.js");
  4. const _sfc_main = common_vendor.defineComponent({
  5. data() {
  6. return {
  7. firstFocus: true,
  8. ServiceName: "",
  9. product: [],
  10. product_2: [],
  11. product_3: [],
  12. product_4: [],
  13. FirstIndex: 0,
  14. name: ""
  15. };
  16. },
  17. onLoad() {
  18. api.isToken();
  19. api.getProduct().then((res = null) => {
  20. this.product = res.result;
  21. this.product_2 = res.result[0].products;
  22. for (var index = 1; index < this.product.length; index++) {
  23. this.product_4.push(this.product[index]);
  24. }
  25. this.product_3 = res.result[0].products;
  26. getApp().productName = res.result[0].products[0].name;
  27. this.name = res.result[0].products[0].name;
  28. });
  29. },
  30. methods: {
  31. toBack() {
  32. let canNavBack = getCurrentPages();
  33. if (canNavBack && canNavBack.length > 1) {
  34. common_vendor.index.navigateBack();
  35. } else {
  36. history.back();
  37. }
  38. },
  39. toNext() {
  40. common_vendor.index.__f__("log", "at pages/views/dingDanCreate.uvue:80", 111);
  41. common_vendor.index.navigateTo({ url: "/pages/index/PayPal" });
  42. },
  43. clear() {
  44. this.ServiceName = "";
  45. },
  46. FirstLevelChange(id = null) {
  47. this.FirstIndex = id;
  48. this.product_2 = this.product[id].products;
  49. },
  50. selctRadio(name = null) {
  51. getApp().productName = name;
  52. this.name = name;
  53. },
  54. handleSearch(event = null) {
  55. this.FirstIndex = 0;
  56. if (event) {
  57. this.product_2 = [];
  58. for (var index = 0; index < this.product_4.length; index++) {
  59. this.product_4[index].products.map((item = null) => {
  60. if (item.name.indexOf(event) !== -1) {
  61. this.product_2.push(item);
  62. }
  63. });
  64. }
  65. } else {
  66. this.product_2 = [];
  67. this.product_2 = this.product_3;
  68. }
  69. },
  70. searchName() {
  71. this.FirstIndex = 0;
  72. if (this.ServiceName) {
  73. this.product_2 = [];
  74. for (var index = 0; index < this.product_4.length; index++) {
  75. this.product_4[index].products.map((item = null) => {
  76. if (item.name.indexOf(this.ServiceName) !== -1) {
  77. this.product_2.push(item);
  78. }
  79. });
  80. }
  81. } else {
  82. this.product_2 = [];
  83. this.product_2 = this.product_3;
  84. }
  85. }
  86. }
  87. });
  88. if (!Array) {
  89. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  90. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  91. (_easycom_uni_icons2 + _easycom_uni_easyinput2)();
  92. }
  93. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  94. const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
  95. if (!Math) {
  96. (_easycom_uni_icons + _easycom_uni_easyinput)();
  97. }
  98. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  99. return {
  100. a: common_vendor.p({
  101. type: "left",
  102. size: "30",
  103. color: "#c2d4de"
  104. }),
  105. b: common_vendor.o((...args) => $options.toBack && $options.toBack(...args)),
  106. c: common_vendor.p({
  107. type: "search",
  108. size: 20
  109. }),
  110. d: common_vendor.o($options.handleSearch),
  111. e: common_vendor.o($options.clear),
  112. f: common_vendor.o(($event) => $data.ServiceName = $event),
  113. g: common_vendor.p({
  114. inputBorder: false,
  115. placeholder: "请输入服务名称",
  116. focus: $data.firstFocus,
  117. modelValue: $data.ServiceName
  118. }),
  119. h: common_vendor.o((...args) => $options.searchName && $options.searchName(...args)),
  120. i: common_vendor.f($data.product, (item, index, i0) => {
  121. return {
  122. a: common_vendor.t(item.categoryName),
  123. b: common_vendor.n($data.FirstIndex === item.categoryId ? "click_color" : ""),
  124. c: common_vendor.o(($event) => $options.FirstLevelChange(item.categoryId))
  125. };
  126. }),
  127. j: common_vendor.f($data.product_2, (item, index, i0) => {
  128. return {
  129. a: common_vendor.t(item.name),
  130. b: common_vendor.n(item.name === $data.name ? "select_color" : ""),
  131. c: item.name == $data.name,
  132. d: common_vendor.o(($event) => $options.selctRadio(item.name))
  133. };
  134. }),
  135. k: common_vendor.o((...args) => $options.toNext && $options.toNext(...args)),
  136. l: common_vendor.sei(_ctx.virtualHostId, "view")
  137. };
  138. }
  139. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  140. wx.createPage(MiniProgramPage);
  141. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/views/dingDanCreate.js.map