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

115 lines
2.5 KiB

  1. const imgurl = require("../../utils/imgurl");
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. merchantVoList: {
  8. value: [],
  9. type: Array
  10. }
  11. },
  12. /**
  13. * 组件的初始数据
  14. */
  15. data: {
  16. teljpgUrl: imgurl.teljpg.url,
  17. showMore:false,
  18. more: "点击查看更多",
  19. hidden:"hidden",
  20. height: ""
  21. },
  22. /**
  23. * 组件的方法列表
  24. */
  25. methods: {
  26. /**
  27. * 跳转到门店列表的详情页面
  28. */
  29. gotoDetail(e) {
  30. tt.navigateTo({
  31. url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}`
  32. })
  33. },
  34. goCertification(e){
  35. tt.navigateTo({
  36. url: `/pages/shopCertification/shopCertification?id=${e.currentTarget.dataset.id}`
  37. })
  38. },
  39. goFitShop(){
  40. tt.navigateTo({
  41. url: `/pages/fitShop/fitShop?list=${JSON.stringify(this.data.merchantVoList)}`,
  42. success: (res) => {
  43. },
  44. fail: (res) => {
  45. },
  46. });
  47. },
  48. goMap(e){
  49. let {latitude,longitude} = e.currentTarget.dataset.item
  50. console.log(latitude,longitude);
  51. tt.openLocation({
  52. latitude:Number(latitude),
  53. longitude:Number(longitude),
  54. scale: 18,
  55. success() {
  56. console.log("打开地图成功");
  57. },
  58. fail(err) {
  59. console.log("打开地图失败:", err.errMsg);
  60. },
  61. });
  62. },
  63. // 点击查看更多
  64. more: function () {
  65. console.log(this.properties.merchantVoList,"merchantVoList");
  66. let that = this;
  67. if (that.data.more == '点击查看更多') {
  68. this.setData({
  69. hidden: "",
  70. height: 'auto!important',
  71. more: "点击收起",
  72. showMore: true
  73. })
  74. } else {
  75. that.setData({
  76. hidden: "hidden",
  77. height: 4 * 140 + 'rpx',
  78. more: "点击查看更多",
  79. showMore: true
  80. })
  81. }
  82. },
  83. phone: function (e) {
  84. let that = this;
  85. tt.makePhoneCall({
  86. phoneNumber: e.target.dataset.merchantlinkphone
  87. });
  88. },
  89. },
  90. ready: function () {
  91. let merchantVoList = this.properties.merchantVoList;
  92. if (merchantVoList.length>0){
  93. if (merchantVoList.length <= 4) {
  94. this.setData({
  95. height: merchantVoList.length * 140 + 'rpx',
  96. showMore: false,
  97. hidden:"hidden"
  98. })
  99. } else if (merchantVoList && merchantVoList.length > 4) {
  100. this.setData({
  101. height: 4 * 140 + 'rpx'
  102. })
  103. }
  104. }
  105. }
  106. });