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

146 lines
4.7 KiB

  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = common_vendor.defineComponent({
  4. data() {
  5. return {
  6. firstFocus: true,
  7. ServiceName: "",
  8. product: [
  9. new UTSJSONObject({
  10. id: 1,
  11. name: "数码",
  12. children: [
  13. new UTSJSONObject({
  14. id: 12,
  15. name: "耳机",
  16. children: [
  17. new UTSJSONObject({ id: 121, name: "漫步者" }),
  18. new UTSJSONObject({ id: 122, name: "倍思" })
  19. ]
  20. }),
  21. new UTSJSONObject({
  22. id: 13,
  23. name: "电脑",
  24. children: [
  25. new UTSJSONObject({ id: 131, name: "联想" }),
  26. new UTSJSONObject({ id: 132, name: "小米" }),
  27. new UTSJSONObject({ id: 133, name: "戴尔" })
  28. ]
  29. })
  30. ]
  31. }),
  32. new UTSJSONObject({
  33. id: 2,
  34. name: "家用电器",
  35. // 类似数码的子结构
  36. children: [
  37. new UTSJSONObject({
  38. id: 11,
  39. name: "手机",
  40. children: [
  41. new UTSJSONObject({ id: 111, name: "iphone" }),
  42. new UTSJSONObject({ id: 112, name: "vivo" }),
  43. new UTSJSONObject({ id: 113, name: "oppo" })
  44. ]
  45. })
  46. ]
  47. })
  48. ],
  49. product_2: [],
  50. FirstIndex: 0,
  51. name: ""
  52. };
  53. },
  54. onLoad() {
  55. common_vendor.index.request({
  56. url: "https://gpt.aiym.run/contract/miniapp/product/categories",
  57. method: "GET",
  58. header: new UTSJSONObject({
  59. "Content-Type": "application/json",
  60. "X-Access-Token": "11"
  61. }),
  62. success: (res) => {
  63. common_vendor.index.__f__("log", "at pages/views/dingDanCreate.uvue:100", res.data.result);
  64. }
  65. });
  66. },
  67. methods: {
  68. toBack() {
  69. let canNavBack = getCurrentPages();
  70. if (canNavBack && canNavBack.length > 1) {
  71. common_vendor.index.navigateBack();
  72. } else {
  73. history.back();
  74. }
  75. },
  76. toNext() {
  77. common_vendor.index.__f__("log", "at pages/views/dingDanCreate.uvue:116", 111);
  78. common_vendor.index.navigateTo({ url: "/pages/index/PayPal" });
  79. },
  80. nameClick() {
  81. },
  82. FirstLevelChange(id = null) {
  83. this.FirstIndex = id;
  84. this.product_2 = this.product[id - 1].children;
  85. },
  86. selctRadio(name = null) {
  87. common_vendor.index.__f__("log", "at pages/views/dingDanCreate.uvue:129", name);
  88. this.name = name;
  89. }
  90. },
  91. searchName() {
  92. common_vendor.index.__f__("log", "at pages/views/dingDanCreate.uvue:134", "1");
  93. }
  94. });
  95. if (!Array) {
  96. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  97. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  98. (_easycom_uni_icons2 + _easycom_uni_easyinput2)();
  99. }
  100. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  101. const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
  102. if (!Math) {
  103. (_easycom_uni_icons + _easycom_uni_easyinput)();
  104. }
  105. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  106. return {
  107. a: common_vendor.p({
  108. type: "left",
  109. size: "30",
  110. color: "#c2d4de"
  111. }),
  112. b: common_vendor.o((...args) => $options.toBack && $options.toBack(...args)),
  113. c: common_vendor.p({
  114. type: "search",
  115. size: 20
  116. }),
  117. d: common_vendor.o(($event) => $data.ServiceName = $event),
  118. e: common_vendor.p({
  119. inputBorder: false,
  120. placeholder: "请输入服务名称",
  121. focus: $data.firstFocus,
  122. modelValue: $data.ServiceName
  123. }),
  124. f: common_vendor.o((...args) => _ctx.searchName && _ctx.searchName(...args)),
  125. g: common_vendor.f($data.product, (item, index, i0) => {
  126. return {
  127. a: common_vendor.t(item.name),
  128. b: common_vendor.n($data.FirstIndex === item.id ? "click_color" : ""),
  129. c: common_vendor.o(($event) => $options.FirstLevelChange(item.id))
  130. };
  131. }),
  132. h: common_vendor.f($data.product_2, (item, index, i0) => {
  133. return {
  134. a: common_vendor.t(item.name),
  135. b: common_vendor.n(item.name === $data.name ? "select_color" : ""),
  136. c: item.name == $data.name,
  137. d: common_vendor.o(($event) => $options.selctRadio(item.name))
  138. };
  139. }),
  140. i: common_vendor.o((...args) => $options.toNext && $options.toNext(...args)),
  141. j: common_vendor.sei(_ctx.virtualHostId, "view")
  142. };
  143. }
  144. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  145. wx.createPage(MiniProgramPage);
  146. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/views/dingDanCreate.js.map