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.

404 lines
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. multiIndex:0,
  212. buildingFloor: [],
  213. building: null,
  214. floor:null,
  215. teljpgUrl: imgurl.teljpg.url
  216. },
  217. lastSearch: Date.now(),
  218. lifetimes: {
  219. attached: function attached() {
  220. this.getbuildingfloorlist();
  221. if (this.data.focus) {
  222. this.setData({
  223. searchState: true
  224. });
  225. }
  226. }
  227. },
  228. methods: {
  229. phone: function (e) {
  230. let that = this;
  231. if (e.currentTarget.dataset.merchantlinkphone) {
  232. wx.makePhoneCall({
  233. phoneNumber: e.currentTarget.dataset.merchantlinkphone
  234. })
  235. }
  236. },
  237. gotoDetail(e) {
  238. wx.navigateTo({
  239. url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}`
  240. })
  241. },
  242. bindMultiPickerColumnChange: function (e) {
  243. var data = {
  244. multiArray: this.data.multiArray,
  245. multiIndex: this.data.multiIndex
  246. };
  247. console.log(e)
  248. data.multiIndex[e.detail.column] = e.detail.value;
  249. switch (e.detail.column) {
  250. case 0:
  251. data.multiArray[1] = this.data.buildingFloor[e.detail.value].floors;
  252. break;
  253. }
  254. this.setData({
  255. multiArray: this.data.multiArray,
  256. multiIndex: this.data.multiIndex
  257. })
  258. },
  259. bindMultiPickerChange: function (e) {
  260. // 楼座 building
  261. // 楼层 floor
  262. this.setData({
  263. multiIndex: e.detail.value,
  264. building: this.data.multiArray[0][e.detail.value[0]],
  265. floor: this.data.multiArray[1][e.detail.value[1]],
  266. })
  267. this.getList(this.data.building.id, this.data.floor.id,1);
  268. },
  269. //获取楼层楼座
  270. getbuildingfloorlist() {
  271. Http.get({
  272. url: config.api.getbuildingfloorlist,
  273. data: {
  274. }
  275. }).then(res => {
  276. if(res.data.length>0){
  277. res.data.map(file=>{
  278. if (file.floors.length>0){
  279. file.floors.map(ever=>{
  280. ever.name = ever.floorName
  281. })
  282. }
  283. })
  284. }
  285. this.setData({
  286. buildingFloor:res.data
  287. })
  288. this.setData({
  289. multiArray: [[...this.data.buildingFloor], [...this.data.buildingFloor[0].floors]]
  290. })
  291. })
  292. .catch(err => {
  293. wx.showToast({
  294. title: err.errMsg,
  295. icon: 'none',
  296. duration: 2000,
  297. mask: false
  298. });
  299. })
  300. },
  301. getList: function (building, floor,page) {
  302. let that = this;
  303. let data = {
  304. pageNum: 1,
  305. pageSize: 10,
  306. building: building,
  307. floor: floor,
  308. };
  309. Http.get({
  310. url: config.api.merchantList,
  311. data: data
  312. }).then(res => {
  313. if (page == 1) {
  314. that.setData({
  315. merchantVoList: [],
  316. })
  317. }
  318. var tmpArr = that.data.merchantVoList;
  319. tmpArr.push.apply(tmpArr, res.data.list);
  320. that.setData({
  321. merchantVoList: tmpArr
  322. })
  323. })
  324. .catch(err => {
  325. wx.showToast({
  326. title: err.errMsg,
  327. icon: 'none',
  328. duration: 2000,
  329. mask: false
  330. });
  331. })
  332. },
  333. clearInput: function clearInput() {
  334. this.setData({
  335. value: ''
  336. });
  337. this.triggerEvent('clear');
  338. },
  339. inputFocus: function inputFocus(e) {
  340. this.triggerEvent('focus', e.detail);
  341. },
  342. inputBlur: function inputBlur(e) {
  343. this.setData({
  344. focus: false
  345. });
  346. this.triggerEvent('blur', e.detail);
  347. },
  348. showInput: function showInput() {
  349. this.setData({
  350. focus: true,
  351. searchState: true
  352. });
  353. },
  354. hideInput: function hideInput() {
  355. this.setData({
  356. searchState: false
  357. });
  358. },
  359. inputChange: function inputChange(e) {
  360. var _this = this;
  361. this.setData({
  362. value: e.detail.value
  363. });
  364. this.triggerEvent('input', e.detail);
  365. if (Date.now() - this.lastSearch < this.data.throttle) {
  366. return;
  367. }
  368. if (typeof this.data.search !== 'function') {
  369. return;
  370. }
  371. this.lastSearch = Date.now();
  372. this.timerId = setTimeout(function() {
  373. _this.data.search(e.detail.value).then(function(json) {
  374. _this.setData({
  375. result: json
  376. });
  377. }).catch(function(err) {
  378. console.log('search error', err);
  379. });
  380. }, this.data.throttle);
  381. },
  382. selectResult: function selectResult(e) {
  383. var index = e.currentTarget.dataset.index;
  384. var item = this.data.result[index];
  385. this.triggerEvent('selectresult', {
  386. index: index,
  387. item: item
  388. });
  389. }
  390. }
  391. });
  392. /***/
  393. })
  394. /******/
  395. });