skinPlan.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import { get } from "../../../utils/http"
  2. // subPackagesD/pages/skinPlan/skinPlan.js
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. store_id:'',//店铺ID
  9. skinPlanList:[],//护理方案详情
  10. scheme_id:'',//推荐方案id
  11. icon:{
  12. p10:'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20221108/pjbs%402x.png',
  13. p18:'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20221108/bsbs%402x.png',
  14. p12:'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20221108/mbdy%402x%20%281%29.png',
  15. p28:'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20221108/mbdy%402x%281%29.png',
  16. p13:'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20221108/mbdy%402x.png',
  17. p25:'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20221108/ybhl%402x.png',
  18. p26:'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20221108/pdxy%402x.png',
  19. p27:'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20221108/tljz%402x.png',
  20. p22:'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20221108/dbks%402x.png',
  21. }
  22. },
  23. /**
  24. * 生命周期函数--监听页面加载
  25. */
  26. onLoad(options) {
  27. this.setData({
  28. store_id:wx.getStorageSync('store_id'),
  29. scheme_id:options.scheme_id
  30. })
  31. },
  32. /**
  33. * 生命周期函数--监听页面初次渲染完成
  34. */
  35. onReady() {
  36. },
  37. /**
  38. * 生命周期函数--监听页面显示
  39. */
  40. onShow() {
  41. // 获取护理方案
  42. this.getSkinPlan()
  43. },
  44. /**
  45. * 生命周期函数--监听页面隐藏
  46. */
  47. onHide() {
  48. },
  49. /**
  50. * 生命周期函数--监听页面卸载
  51. */
  52. onUnload() {
  53. },
  54. /**
  55. * 页面相关事件处理函数--监听用户下拉动作
  56. */
  57. onPullDownRefresh() {
  58. },
  59. /**
  60. * 页面上拉触底事件的处理函数
  61. */
  62. onReachBottom() {
  63. },
  64. /**
  65. * 用户点击右上角分享
  66. */
  67. onShareAppMessage() {
  68. },
  69. // 获取护理方案
  70. getSkinPlan(){
  71. get('v2/api/scheme/info',{
  72. scheme_id:"", //方案ID,不填则获取最新方案
  73. },(res)=>{
  74. if(res.code==200){
  75. res.data.forEach(item=>{
  76. item.project_list.forEach(item1=>{
  77. item1.category_id = 'p'+item1.category_id
  78. item1.project_name = item1.project_name.substring(item1.project_name.lastIndexOf("】")+1);
  79. })
  80. })
  81. this.setData({
  82. skinPlanList:res.data
  83. })
  84. }
  85. })
  86. },
  87. // 跳转到项目详情
  88. goProjectDetail(e){
  89. let id = e.currentTarget.dataset.id
  90. // source=project&id=137&store_id=20
  91. wx.navigateTo({
  92. url: `/pages/projectDetail/projectDetail?source=project&id=${id}&store_id=${this.data.store_id}`,
  93. })
  94. }
  95. })