C端小程序
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

mallInfo.js 2.2 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // pages/mallInfo.js
  2. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px';
  3. var config = require("../../config/config.js");
  4. var app = getApp();
  5. const Http = require("../../utils/HttpBasics");
  6. const imgurl = require("../../utils/imgurl");
  7. const util = require("../../utils/util");
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. teljpgUrl: imgurl.teljpg.url,
  14. navigationBarHeight,
  15. weekName:[],
  16. times:[],
  17. dateArr:[
  18. { name: "星期一", value: "0" },
  19. { name: "星期二", value: "1" },
  20. { name: "星期三", value: "2" },
  21. { name: "星期四", value: "3" },
  22. { name: "星期五", value: "4" },
  23. { name: "星期六", value: "5" },
  24. { name: "星期天", value: "6" }
  25. ],
  26. },
  27. /**
  28. * 生命周期函数--监听页面显示
  29. */
  30. onShow: function () {
  31. let that = this;
  32. console.log("渲染开始")
  33. Http.get({
  34. url: config.api.getMallInfo,
  35. })
  36. .then(res => {
  37. if (res.data.businessHours){
  38. let businessHours = JSON.parse(res.data.businessHours)
  39. businessHours.map((item, index) => {
  40. item.weekName = [that.data.dateArr.filter(e => e.value == item.week[0])[0].name, that.data.dateArr.filter(e => e.value == item.week[1])[0].name].toString().replace(/\,/g, ' -- '),
  41. item.time = [util.convertUTCTimeToLocalTime(item.time[0]), util.convertUTCTimeToLocalTime(item.time[1])].toString().replace(/\,/g, ' -')
  42. })
  43. console.log(businessHours, 222)
  44. that.setData({
  45. name: res.data.name,
  46. servicePhone: res.data.servicePhone,
  47. img: res.data.img,
  48. introduction: res.data.introduction,
  49. parkPlaceNumber: res.data.parkPlaceNumber,
  50. businessHoursH: businessHours,
  51. })
  52. }
  53. })
  54. .catch(err => {
  55. wx.showModal({
  56. title: '提示',
  57. content: err.message,
  58. showCancel: false
  59. })
  60. })
  61. },
  62. phone: function (e) {
  63. let that = this;
  64. if (e.currentTarget.dataset.merchantlinkphone) {
  65. wx.makePhoneCall({
  66. phoneNumber: e.currentTarget.dataset.merchantlinkphone
  67. })
  68. }
  69. },
  70. })