C端小程序
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.

413 rivejä
11 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 44) * 2;
  2. const config = require("../../config/config");
  3. const Http = require("../../utils/HttpBasics");
  4. const imgurl = require("../../utils/imgurl");
  5. module.exports =
  6. /******/
  7. (function(modules) { // webpackBootstrap
  8. /******/ // The module cache
  9. /******/
  10. var installedModules = {};
  11. /******/
  12. /******/ // The require function
  13. /******/
  14. function __webpack_require__(moduleId) {
  15. /******/
  16. /******/ // Check if module is in cache
  17. /******/
  18. if (installedModules[moduleId]) {
  19. /******/
  20. return installedModules[moduleId].exports;
  21. /******/
  22. }
  23. /******/ // Create a new module (and put it into the cache)
  24. /******/
  25. var module = installedModules[moduleId] = {
  26. /******/
  27. i: moduleId,
  28. /******/
  29. l: false,
  30. /******/
  31. exports: {}
  32. /******/
  33. };
  34. /******/
  35. /******/ // Execute the module function
  36. /******/
  37. modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  38. /******/
  39. /******/ // Flag the module as loaded
  40. /******/
  41. module.l = true;
  42. /******/
  43. /******/ // Return the exports of the module
  44. /******/
  45. return module.exports;
  46. /******/
  47. }
  48. /******/
  49. /******/
  50. /******/ // expose the modules object (__webpack_modules__)
  51. /******/
  52. __webpack_require__.m = modules;
  53. /******/
  54. /******/ // expose the module cache
  55. /******/
  56. __webpack_require__.c = installedModules;
  57. /******/
  58. /******/ // define getter function for harmony exports
  59. /******/
  60. __webpack_require__.d = function(exports, name, getter) {
  61. /******/
  62. if (!__webpack_require__.o(exports, name)) {
  63. /******/
  64. Object.defineProperty(exports, name, {
  65. enumerable: true,
  66. get: getter
  67. });
  68. /******/
  69. }
  70. /******/
  71. };
  72. /******/
  73. /******/ // define __esModule on exports
  74. /******/
  75. __webpack_require__.r = function(exports) {
  76. /******/
  77. if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  78. /******/
  79. Object.defineProperty(exports, Symbol.toStringTag, {
  80. value: 'Module'
  81. });
  82. /******/
  83. }
  84. /******/
  85. Object.defineProperty(exports, '__esModule', {
  86. value: true
  87. });
  88. /******/
  89. };
  90. /******/
  91. /******/ // create a fake namespace object
  92. /******/ // mode & 1: value is a module id, require it
  93. /******/ // mode & 2: merge all properties of value into the ns
  94. /******/ // mode & 4: return value when already ns object
  95. /******/ // mode & 8|1: behave like require
  96. /******/
  97. __webpack_require__.t = function(value, mode) {
  98. /******/
  99. if (mode & 1) value = __webpack_require__(value);
  100. /******/
  101. if (mode & 8) return value;
  102. /******/
  103. if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  104. /******/
  105. var ns = Object.create(null);
  106. /******/
  107. __webpack_require__.r(ns);
  108. /******/
  109. Object.defineProperty(ns, 'default', {
  110. enumerable: true,
  111. value: value
  112. });
  113. /******/
  114. if (mode & 2 && typeof value != 'string')
  115. for (var key in value) __webpack_require__.d(ns, key, function(key) {
  116. return value[key];
  117. }.bind(null, key));
  118. /******/
  119. return ns;
  120. /******/
  121. };
  122. /******/
  123. /******/ // getDefaultExport function for compatibility with non-harmony modules
  124. /******/
  125. __webpack_require__.n = function(module) {
  126. /******/
  127. var getter = module && module.__esModule ?
  128. /******/
  129. function getDefault() {
  130. return module['default'];
  131. } :
  132. /******/
  133. function getModuleExports() {
  134. return module;
  135. };
  136. /******/
  137. __webpack_require__.d(getter, 'a', getter);
  138. /******/
  139. return getter;
  140. /******/
  141. };
  142. /******/
  143. /******/ // Object.prototype.hasOwnProperty.call
  144. /******/
  145. __webpack_require__.o = function(object, property) {
  146. return Object.prototype.hasOwnProperty.call(object, property);
  147. };
  148. /******/
  149. /******/ // __webpack_public_path__
  150. /******/
  151. __webpack_require__.p = "";
  152. /******/
  153. /******/
  154. /******/ // Load entry module and return exports
  155. /******/
  156. return __webpack_require__(__webpack_require__.s = 19);
  157. /******/
  158. })
  159. /************************************************************************/
  160. /******/
  161. ({
  162. /***/
  163. 19:
  164. /***/
  165. (function(module, exports, __webpack_require__) {
  166. "use strict";
  167. Component({
  168. options: {
  169. addGlobalClass: true
  170. },
  171. properties: {
  172. extClass: {
  173. type: String,
  174. value: ''
  175. },
  176. focus: {
  177. type: Boolean,
  178. value: false
  179. },
  180. placeholder: {
  181. type: String,
  182. value: '请输入'
  183. },
  184. value: {
  185. type: String,
  186. value: ''
  187. },
  188. search: {
  189. type: Function,
  190. value: null
  191. },
  192. throttle: {
  193. type: Number,
  194. value: 500
  195. },
  196. cancelText: {
  197. type: String,
  198. value: '取消'
  199. },
  200. cancel: {
  201. type: Boolean,
  202. value: true
  203. }
  204. },
  205. data: {
  206. result: [],
  207. navigationBarHeight,
  208. multiArray: [
  209. [],[]
  210. ],
  211. searchText:"请输入",
  212. multiIndex:0,
  213. buildingFloor: [],
  214. building: null,
  215. floor:null,
  216. teljpgUrl: imgurl.teljpg.url
  217. },
  218. lastSearch: Date.now(),
  219. lifetimes: {
  220. attached: function attached() {
  221. this.getbuildingfloorlist();
  222. if (this.data.focus) {
  223. this.setData({
  224. searchState: true
  225. });
  226. }
  227. }
  228. },
  229. methods: {
  230. phone: function (e) {
  231. let that = this;
  232. if (e.currentTarget.dataset.merchantlinkphone) {
  233. wx.makePhoneCall({
  234. phoneNumber: e.currentTarget.dataset.merchantlinkphone
  235. })
  236. }
  237. },
  238. gotoDetail(e) {
  239. wx.navigateTo({
  240. url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}`
  241. })
  242. },
  243. bindMultiPickerColumnChange: function (e) {
  244. var data = {
  245. multiArray: this.data.multiArray,
  246. multiIndex: this.data.multiIndex
  247. };
  248. console.log(e)
  249. data.multiIndex[e.detail.column] = e.detail.value;
  250. switch (e.detail.column) {
  251. case 0:
  252. data.multiArray[1] = this.data.buildingFloor[e.detail.value].floors;
  253. break;
  254. }
  255. this.setData({
  256. multiArray: this.data.multiArray,
  257. multiIndex: this.data.multiIndex
  258. })
  259. },
  260. bindMultiPickerChange: function (e) {
  261. // 楼座 building
  262. // 楼层 floor
  263. this.setData({
  264. multiIndex: e.detail.value,
  265. building: this.data.multiArray[0][e.detail.value[0]],
  266. floor: this.data.multiArray[1][e.detail.value[1]],
  267. })
  268. this.getList(this.data.building.id, this.data.floor.id,1);
  269. this.setData({
  270. searchText: this.data.building.name + this.data.floor.floorName
  271. })
  272. },
  273. //获取楼层楼座
  274. getbuildingfloorlist() {
  275. Http.get({
  276. url: config.api.getbuildingfloorlist,
  277. data: {
  278. }
  279. }).then(res => {
  280. if(res.data.length>0){
  281. res.data.map(file=>{
  282. if (file.floors.length>0){
  283. file.floors.map(ever=>{
  284. ever.name = ever.floorName
  285. })
  286. }
  287. })
  288. }
  289. this.setData({
  290. buildingFloor:res.data
  291. })
  292. this.setData({
  293. multiArray: [[...this.data.buildingFloor], [...this.data.buildingFloor[0].floors]]
  294. })
  295. })
  296. .catch(err => {
  297. wx.showToast({
  298. title: err.errMsg,
  299. icon: 'none',
  300. duration: 2000,
  301. mask: false
  302. });
  303. })
  304. },
  305. getList: function (building, floor,page) {
  306. let that = this;
  307. let data = {
  308. pageNum: 1,
  309. pageSize: 10,
  310. building: building ? building:null,
  311. floor: floor ? floor:null,
  312. };
  313. Http.get({
  314. url: config.api.merchantList,
  315. data: data
  316. }).then(res => {
  317. if (page == 1) {
  318. that.setData({
  319. merchantVoList: [],
  320. })
  321. }
  322. var tmpArr = that.data.merchantVoList;
  323. tmpArr.push.apply(tmpArr, res.data.list);
  324. that.setData({
  325. merchantVoList: tmpArr
  326. })
  327. })
  328. .catch(err => {
  329. wx.showToast({
  330. title: err.errMsg,
  331. icon: 'none',
  332. duration: 2000,
  333. mask: false
  334. });
  335. })
  336. },
  337. clearInput: function clearInput() {
  338. this.setData({
  339. value: ''
  340. });
  341. this.triggerEvent('clear');
  342. },
  343. inputFocus: function inputFocus(e) {
  344. this.triggerEvent('focus', e.detail);
  345. },
  346. inputBlur: function inputBlur(e) {
  347. this.setData({
  348. focus: false
  349. });
  350. this.triggerEvent('blur', e.detail);
  351. },
  352. showInput: function showInput() {
  353. this.setData({
  354. focus: true,
  355. searchState: true
  356. });
  357. },
  358. hideInput: function hideInput() {
  359. this.setData({
  360. searchState: false
  361. });
  362. this.setData({
  363. searchText:"请输入",
  364. merchantVoList:[]
  365. })
  366. },
  367. inputChange: function inputChange(e) {
  368. var _this = this;
  369. this.setData({
  370. value: e.detail.value
  371. });
  372. this.triggerEvent('input', e.detail);
  373. if (Date.now() - this.lastSearch < this.data.throttle) {
  374. return;
  375. }
  376. if (typeof this.data.search !== 'function') {
  377. return;
  378. }
  379. this.lastSearch = Date.now();
  380. this.timerId = setTimeout(function() {
  381. _this.data.search(e.detail.value).then(function(json) {
  382. _this.setData({
  383. result: json
  384. });
  385. }).catch(function(err) {
  386. console.log('search error', err);
  387. });
  388. }, this.data.throttle);
  389. },
  390. selectResult: function selectResult(e) {
  391. var index = e.currentTarget.dataset.index;
  392. var item = this.data.result[index];
  393. this.triggerEvent('selectresult', {
  394. index: index,
  395. item: item
  396. });
  397. }
  398. }
  399. });
  400. /***/
  401. })
  402. /******/
  403. });