index.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. "use strict";
  2. var common_vendor = require("../../common/vendor.js");
  3. var uni_modules_mescrollUni_components_mescrollUni_mescrollMixins = require("../../uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js");
  4. var api_package = require("../../api/package.js");
  5. require("../../common/request.js");
  6. const Menu = () => "../../components/Menu.js";
  7. const _sfc_main = {
  8. components: { Menu },
  9. mixins: [uni_modules_mescrollUni_components_mescrollUni_mescrollMixins.MescrollMixin],
  10. data() {
  11. return {
  12. top: null,
  13. cates: [],
  14. diseaseType: 0,
  15. keyword: "",
  16. mescroll: null,
  17. downOption: {
  18. use: true,
  19. auto: false
  20. },
  21. upOption: {
  22. onScroll: false,
  23. use: true,
  24. page: {
  25. pae: 0,
  26. size: 10
  27. },
  28. noMoreSize: 10,
  29. textNoMore: "\u5DF2\u7ECF\u5230\u5E95\u4E86",
  30. empty: {
  31. icon: "https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png",
  32. tip: "\u6682\u65E0\u6570\u636E"
  33. }
  34. },
  35. dataList: []
  36. };
  37. },
  38. onLoad() {
  39. this.getPackagCateList(1);
  40. },
  41. methods: {
  42. menuClick(item) {
  43. this.diseaseType = item.cateCode;
  44. this.mescroll.resetUpScroll();
  45. },
  46. getPackagCateList(type) {
  47. var data = { type };
  48. var that = this;
  49. api_package.getPackagCateList(data).then((res) => {
  50. if (res.code == 200) {
  51. this.cates = res.data;
  52. var query = common_vendor.index.createSelectorQuery().in(that);
  53. setTimeout(function() {
  54. query.select(".top-content").boundingClientRect((data2) => {
  55. if (data2) {
  56. console.log("View height:", data2.height + "px");
  57. that.top = data2.height + "px";
  58. }
  59. }).exec();
  60. }, 500);
  61. }
  62. }, (err) => {
  63. });
  64. },
  65. doSearch() {
  66. this.mescroll.resetUpScroll();
  67. },
  68. navTo(url) {
  69. common_vendor.index.navigateTo({
  70. url
  71. });
  72. },
  73. mescrollInit(mescroll) {
  74. this.mescroll = mescroll;
  75. },
  76. downCallback() {
  77. this.mescroll.resetUpScroll();
  78. },
  79. upCallback(page) {
  80. var that = this;
  81. var data = {
  82. isShow: 1,
  83. diseaseType: this.diseaseType,
  84. keyword: this.keyword,
  85. pageNum: page.num,
  86. pageSize: page.size
  87. };
  88. api_package.getPackageList(data).then((res) => {
  89. if (res.code == 200) {
  90. if (page.num == 1) {
  91. that.dataList = res.data.list;
  92. } else {
  93. that.dataList = that.dataList.concat(res.data.list);
  94. }
  95. that.mescroll.endBySize(res.data.list.length, res.data.total);
  96. } else {
  97. common_vendor.index.showToast({
  98. icon: "none",
  99. title: "\u8BF7\u6C42\u5931\u8D25"
  100. });
  101. that.dataList = null;
  102. that.mescroll.endErr();
  103. }
  104. });
  105. }
  106. }
  107. };
  108. if (!Array) {
  109. const _component_Menu = common_vendor.resolveComponent("Menu");
  110. const _easycom_mescroll_body2 = common_vendor.resolveComponent("mescroll-body");
  111. (_component_Menu + _easycom_mescroll_body2)();
  112. }
  113. const _easycom_mescroll_body = () => "../../uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.js";
  114. if (!Math) {
  115. _easycom_mescroll_body();
  116. }
  117. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  118. return common_vendor.e({
  119. a: common_vendor.o((...args) => $options.doSearch && $options.doSearch(...args)),
  120. b: $data.keyword,
  121. c: common_vendor.o(($event) => $data.keyword = $event.detail.value),
  122. d: $data.cates.length > 0
  123. }, $data.cates.length > 0 ? {
  124. e: common_vendor.o($options.menuClick),
  125. f: common_vendor.p({
  126. list: $data.cates
  127. })
  128. } : {}, {
  129. g: $data.top != null
  130. }, $data.top != null ? {
  131. h: common_vendor.f($data.dataList, (item, index, i0) => {
  132. return {
  133. a: item.imgUrl,
  134. b: common_vendor.t(item.packageName),
  135. c: common_vendor.t(item.price.toFixed(2)),
  136. d: common_vendor.t(item.sales),
  137. e: common_vendor.o(($event) => $options.navTo("/pages_index/packageDetails?packageId=" + item.packageId))
  138. };
  139. }),
  140. i: common_vendor.sr("mescrollRef", "38de483b-1"),
  141. j: common_vendor.o($options.mescrollInit),
  142. k: common_vendor.o($options.downCallback),
  143. l: common_vendor.o($options.upCallback),
  144. m: common_vendor.p({
  145. top: $data.top,
  146. bottom: "0",
  147. down: $data.downOption,
  148. up: $data.upOption
  149. })
  150. } : {});
  151. }
  152. var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-38de483b"], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages/store/index.vue"]]);
  153. wx.createPage(MiniProgramPage);