抖音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.

69 lines
2.1 KiB

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