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.

101 lines
2.0 KiB

  1. const Http = require("../../../utils/HttpBasics");
  2. const imgurl = require("../../../utils/imgurl");
  3. const config = require("../../../config/config");
  4. let app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. teljpgUrl: imgurl.teljpg.url,
  11. page: 1,
  12. imglist:null,
  13. shopVoList:[],
  14. data:{
  15. currentTabsIndex:0,
  16. },
  17. id:null
  18. },
  19. /**
  20. * 生命周期函数--监听页面加载
  21. */
  22. onLoad: function (options) {
  23. let that=this;
  24. if (options && options.id){
  25. this.setData({
  26. id: options.id
  27. });
  28. that.getList(options.id);
  29. }
  30. },
  31. /**
  32. * tab切换
  33. */
  34. onTabsItemTap:function(e){
  35. var index=product.getDataSet(e,'index');
  36. this.setData({
  37. currentTabsIndex:index
  38. })
  39. },
  40. /**
  41. * 拨打电话
  42. */
  43. phone: function (e) {
  44. let that = this;
  45. wx.makePhoneCall({
  46. phoneNumber: e.target.dataset.merchantlinkphone
  47. });
  48. },
  49. /**
  50. * 获取商户详情
  51. */
  52. getList: function (id) {
  53. let that = this;
  54. let data;
  55. data = {
  56. pageNum: that.data.page,
  57. pageSize: 15,
  58. id:id
  59. }
  60. Http.get({
  61. url: config.api.merchantList,
  62. data: data
  63. }).then(res => {
  64. that.setData({
  65. data: res.data.list[0],
  66. shopVoList: res.data.list[0].shopVoList,
  67. imglist: JSON.parse(res.data.list[0].coverPicture) ? JSON.parse(res.data.list[0].coverPicture) : res.data.list[0].merchantImgUrl,
  68. })
  69. })
  70. .catch(err => {
  71. wx.showToast({
  72. title: err.errMsg,
  73. icon: 'none',
  74. duration: 2000,
  75. mask: false
  76. });
  77. })
  78. },
  79. /**
  80. * 获取多商铺列表
  81. */
  82. shopList:function(e){
  83. wx.navigateTo({
  84. url: `/pages/index/merchantList/index?id=${e.currentTarget.dataset.id}`
  85. })
  86. },
  87. /**
  88. * 生命周期函数--监听页面隐藏
  89. */
  90. onHide: function () {
  91. },
  92. /**
  93. * 页面相关事件处理函数--监听用户下拉动作
  94. */
  95. onPullDownRefresh: function () {
  96. },
  97. })