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.

62 line
1.8 KiB

  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. navigationBarHeight,
  14. weekName:[],
  15. times:[],
  16. dateArr:[
  17. { name: "星期一", value: "0" },
  18. { name: "星期二", value: "1" },
  19. { name: "星期三", value: "2" },
  20. { name: "星期四", value: "3" },
  21. { name: "星期五", value: "4" },
  22. { name: "星期六", value: "5" },
  23. { name: "星期天", value: "6" }
  24. ],
  25. },
  26. /**
  27. * 生命周期函数--监听页面显示
  28. */
  29. onShow: function () {
  30. let that = this;
  31. console.log("渲染开始")
  32. Http.get({
  33. url: config.api.getMallInfo,
  34. })
  35. .then(res => {
  36. console.log(res)
  37. let businessHours = JSON.parse(res.data.businessHours)
  38. businessHours.map((item,index)=>{
  39. 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],
  40. item.time = [util.fmtDate(item.time[0]), util.fmtDate(item.time[1])]
  41. console.log(item.time)
  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. parkingSpace: res.data.parkingSpace,
  50. businessHoursH: businessHours,
  51. })
  52. })
  53. .catch(err => {
  54. wx.showModal({
  55. title: '提示',
  56. content: err.message,
  57. showCancel: false
  58. })
  59. })
  60. },
  61. })