merc.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
  5. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  6. const _easycom_u_button2 = common_vendor.resolveComponent("u-button");
  7. const _easycom_u_loadmore2 = common_vendor.resolveComponent("u-loadmore");
  8. const _easycom_u_empty2 = common_vendor.resolveComponent("u-empty");
  9. const _easycom_u__input2 = common_vendor.resolveComponent("u--input");
  10. const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
  11. (_easycom_u_navbar2 + _easycom_u_icon2 + _easycom_u_button2 + _easycom_u_loadmore2 + _easycom_u_empty2 + _easycom_u__input2 + _easycom_u_popup2)();
  12. }
  13. const _easycom_u_navbar = () => "../../../node-modules/uview-plus/components/u-navbar/u-navbar.js";
  14. const _easycom_u_icon = () => "../../../node-modules/uview-plus/components/u-icon/u-icon.js";
  15. const _easycom_u_button = () => "../../../node-modules/uview-plus/components/u-button/u-button.js";
  16. const _easycom_u_loadmore = () => "../../../node-modules/uview-plus/components/u-loadmore/u-loadmore.js";
  17. const _easycom_u_empty = () => "../../../node-modules/uview-plus/components/u-empty/u-empty.js";
  18. const _easycom_u__input = () => "../../../node-modules/uview-plus/components/u--input/u--input.js";
  19. const _easycom_u_popup = () => "../../../node-modules/uview-plus/components/u-popup/u-popup.js";
  20. if (!Math) {
  21. (_easycom_u_navbar + _easycom_u_icon + _easycom_u_button + _easycom_u_loadmore + _easycom_u_empty + _easycom_u__input + _easycom_u_popup)();
  22. }
  23. const _sfc_main = {
  24. __name: "merc",
  25. setup(__props) {
  26. const {
  27. proxy
  28. } = common_vendor.getCurrentInstance();
  29. const instance = common_vendor.getCurrentInstance();
  30. const {
  31. device_type,
  32. device_online_status,
  33. device_busy_status,
  34. device_active_status
  35. } = proxy.$useDict("device_type", "device_online_status", "device_busy_status", "device_active_status");
  36. const dicts = common_vendor.reactive({
  37. device_type: [],
  38. online_status: [],
  39. busy_status: [],
  40. active_status: []
  41. });
  42. const searchMenu = common_vendor.reactive({
  43. showPopMenu: false,
  44. selStatus: 0,
  45. style: {
  46. marginTop: "174rpx"
  47. },
  48. searchMenu_body_style: {
  49. height: "600rpx"
  50. },
  51. params: {
  52. searchKey: void 0,
  53. contact: void 0,
  54. contactPhone: void 0,
  55. deviceId: void 0
  56. },
  57. reqUrls: {
  58. searchMerc: "/merc/be/merc/searchTreeList"
  59. },
  60. dataList: []
  61. });
  62. function openSearchMenu() {
  63. searchMenu.showPopMenu = true;
  64. }
  65. function resetSearchMenu() {
  66. searchMenu.params.searchKey = void 0;
  67. searchMenu.params.contact = void 0;
  68. searchMenu.params.contactPhone = void 0;
  69. }
  70. function doSearch(o) {
  71. if (o == 0)
  72. resetSearchMenu();
  73. setTimeout(function() {
  74. searchMenu.showPopMenu = false;
  75. data.curPage = 1;
  76. getList();
  77. }, 500);
  78. }
  79. const data = common_vendor.reactive({
  80. reqUrls: {
  81. list: "/merc/be/merc/page",
  82. token: "/merc/mini/adminToMerc",
  83. tree: "/sys/sys-code-configure/tree"
  84. },
  85. curPage: 1,
  86. loadmoreStatus: "nomore",
  87. params: {
  88. page: {
  89. current: 1,
  90. size: 10,
  91. orders: [{
  92. asc: false,
  93. column: "create_time"
  94. }]
  95. }
  96. },
  97. fullHeight: 0,
  98. screenHeight: 1920,
  99. // screenWidht:1080,
  100. dataList: [],
  101. total: 0
  102. });
  103. common_vendor.onMounted(() => {
  104. dicts.device_type = [{
  105. value: null,
  106. label: "全部"
  107. }].concat(device_type.value);
  108. dicts.online_status = [{
  109. value: null,
  110. label: "全部"
  111. }].concat(device_online_status.value);
  112. data.screenHeight = common_vendor.index.getSystemInfoSync().windowHeight;
  113. searchMenu.searchMenu_body_style.height = data.screenHeight - 90 + "px";
  114. getList();
  115. const query = common_vendor.index.createSelectorQuery().in(instance);
  116. query.select(".scrollview").boundingClientRect((r) => {
  117. common_vendor.index.getSystemInfo({
  118. success(res2) {
  119. const model = res2.model;
  120. const modelInclude = [
  121. "iPhone X",
  122. "iPhone XR",
  123. "iPhone XS",
  124. "iPhone XS MAX",
  125. "iPhone 12/13 mini",
  126. "iPhone 12/13 (Pro)",
  127. "iPhone 12/13 Pro Max",
  128. "iPhone 14 Pro Max"
  129. ];
  130. let safeDistance = modelInclude.includes(model);
  131. console.log(res2.windowHeight, r.top);
  132. let h = 0;
  133. if (safeDistance) {
  134. h = res2.windowHeight - r.top;
  135. } else {
  136. h = res2.windowHeight - r.top;
  137. }
  138. data.fullHeight += h + "px";
  139. }
  140. });
  141. }).exec();
  142. });
  143. function scrolltolower() {
  144. if (data.loadmoreStatus == "nomore")
  145. return;
  146. data.curPage++;
  147. getList();
  148. }
  149. function getList() {
  150. return new Promise((resolve2, reject2) => {
  151. data.params.page.current = data.curPage;
  152. data.params.searchKey = searchMenu.params.searchKey;
  153. data.params.contact = searchMenu.params.contact;
  154. data.params.contactPhone = searchMenu.params.contactPhone;
  155. if (data.curPage == 1) {
  156. data.dataList = [];
  157. }
  158. proxy.$request({
  159. url: data.reqUrls.list,
  160. data: data.params,
  161. method: "post"
  162. }).then((res2) => {
  163. console.log("***", res2);
  164. if (res2.records) {
  165. data.dataList = data.dataList.concat(res2.records);
  166. }
  167. data.total = res2.total;
  168. if (res2.records.length < 10) {
  169. data.loadmoreStatus = "nomore";
  170. } else {
  171. data.loadmoreStatus = "loadmore";
  172. }
  173. resolve2(res2);
  174. }).catch((err) => {
  175. reject2(err);
  176. });
  177. });
  178. }
  179. function doSearchMerc() {
  180. return new Promise((resolve2, reject2) => {
  181. proxy.$request({
  182. url: searchMenu.reqUrls.searchMerc,
  183. data: {
  184. searchKey: searchMenu.params.deviceId
  185. },
  186. method: "post"
  187. }).then((data2) => {
  188. searchMenu.dataList = data2;
  189. console.log("机器号查找商户", searchMenu.dataList);
  190. resolve2(res);
  191. }).catch((err) => {
  192. reject2(err);
  193. });
  194. });
  195. }
  196. function gotoMerc(merc) {
  197. proxy.$request({
  198. url: data.reqUrls.token,
  199. data: {
  200. mercId: merc.id
  201. },
  202. method: "post"
  203. }).then((data2) => {
  204. console.log("token", data2);
  205. common_vendor.wx$1.navigateToMiniProgram({
  206. appId: "wxde6edfb4b2c1e7db",
  207. path: "pages/login",
  208. extraData: {
  209. mercId: data2.mercId,
  210. mercName: data2.mercName,
  211. token: data2.mercSatoken,
  212. type: 1
  213. },
  214. envVersion: "trial",
  215. //跳转体验版
  216. success(res2) {
  217. console.log(res2);
  218. }
  219. });
  220. resolve(res);
  221. }).catch((err) => {
  222. reject(err);
  223. });
  224. }
  225. function rightClick() {
  226. console.log("点击了右侧");
  227. }
  228. return (_ctx, _cache) => {
  229. return common_vendor.e({
  230. a: common_vendor.o(rightClick),
  231. b: common_vendor.p({
  232. title: "商户管理",
  233. titleStyle: "color:#fff;fontSize:36rpx;",
  234. bgColor: "#2C6FF3",
  235. autoBack: true,
  236. leftIconColor: "#fff",
  237. placeholder: true
  238. }),
  239. c: common_vendor.t(data.total),
  240. d: common_vendor.p({
  241. name: "arrow-right",
  242. size: "14"
  243. }),
  244. e: common_vendor.o(openSearchMenu),
  245. f: data.dataList.length > 0
  246. }, data.dataList.length > 0 ? common_vendor.e({
  247. g: common_vendor.f(data.dataList, (item1, index1, i0) => {
  248. return common_vendor.e({
  249. a: item1.name
  250. }, item1.name ? {
  251. b: common_vendor.t(item1.name),
  252. c: common_vendor.t(item1.mercCode)
  253. } : {
  254. d: common_vendor.t(item1.mercCode)
  255. }, {
  256. e: common_vendor.t(item1.parentName),
  257. f: common_vendor.t(item1.parentId),
  258. g: common_vendor.t(item1.loginName),
  259. h: common_vendor.t(item1.contact),
  260. i: common_vendor.t(item1.contactPhone),
  261. j: common_vendor.t(item1.mercType),
  262. k: common_vendor.t(item1.createTime),
  263. l: common_vendor.o(($event) => gotoMerc(item1), item1.deviceId),
  264. m: "c90a5174-2-" + i0,
  265. n: item1.deviceId
  266. });
  267. }),
  268. h: common_vendor.p({
  269. size: "mini",
  270. type: "primary",
  271. text: "管理"
  272. }),
  273. i: data.dataList.length > 0
  274. }, data.dataList.length > 0 ? {
  275. j: common_vendor.p({
  276. status: data.loadmoreStatus
  277. })
  278. } : {}) : {
  279. k: common_vendor.p({
  280. mode: "data",
  281. text: "数据为空"
  282. })
  283. }, {
  284. l: common_vendor.o(scrolltolower),
  285. m: data.fullHeight,
  286. n: common_vendor.o(($event) => searchMenu.params.searchKey = $event),
  287. o: common_vendor.p({
  288. placeholder: "商户名称/编号",
  289. border: "surround",
  290. modelValue: searchMenu.params.searchKey
  291. }),
  292. p: common_vendor.o(($event) => searchMenu.params.contact = $event),
  293. q: common_vendor.p({
  294. placeholder: "联系人",
  295. border: "surround",
  296. modelValue: searchMenu.params.contact
  297. }),
  298. r: common_vendor.o(($event) => searchMenu.params.contactPhone = $event),
  299. s: common_vendor.p({
  300. placeholder: "联系电话",
  301. border: "surround",
  302. modelValue: searchMenu.params.contactPhone
  303. }),
  304. t: common_vendor.o(($event) => searchMenu.params.deviceId = $event),
  305. v: common_vendor.p({
  306. placeholder: "机器ID号",
  307. border: "surround",
  308. modelValue: searchMenu.params.deviceId
  309. }),
  310. w: common_vendor.o(($event) => doSearchMerc()),
  311. x: common_vendor.p({
  312. size: "normal",
  313. plain: true,
  314. text: "查找"
  315. }),
  316. y: common_vendor.f(searchMenu.dataList, (item2, index1, i0) => {
  317. return {
  318. a: common_vendor.t(item2.name),
  319. b: common_vendor.t(item2.mercCode),
  320. c: common_vendor.o(($event) => searchMenu.params.searchKey = item2.name, item2.id),
  321. d: item2.id
  322. };
  323. }),
  324. z: common_vendor.o(($event) => doSearch(0)),
  325. A: common_vendor.p({
  326. size: "normal",
  327. plain: true,
  328. text: "关闭"
  329. }),
  330. B: common_vendor.o(resetSearchMenu),
  331. C: common_vendor.p({
  332. size: "normal",
  333. type: "primary",
  334. plain: true,
  335. text: "重置"
  336. }),
  337. D: common_vendor.o(($event) => doSearch(1)),
  338. E: common_vendor.p({
  339. size: "normal",
  340. type: "primary",
  341. text: "查找"
  342. }),
  343. F: common_vendor.s(searchMenu.searchMenu_body_style),
  344. G: common_vendor.p({
  345. show: searchMenu.showPopMenu,
  346. duration: "0",
  347. customStyle: searchMenu.style,
  348. round: 10,
  349. mode: "right",
  350. duration: 300,
  351. overlay: false
  352. })
  353. });
  354. };
  355. }
  356. };
  357. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c90a5174"], ["__file", "F:/兴元/开门柜项目/平台端管理系统小程序/src/pages/xy_merc_be/mercManager/merc.vue"]]);
  358. wx.createPage(MiniProgramPage);