skinPlan.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. isTestSkin:false,//肤质跳转标识
  23. },
  24. /**
  25. * 生命周期函数--监听页面加载
  26. */
  27. onLoad(options) {
  28. console.log(options);
  29. let isTestSkin = false
  30. if(options.isTestSkin){
  31. isTestSkin = true
  32. }
  33. this.setData({
  34. store_id:wx.getStorageSync('store_id'),
  35. scheme_id:options.scheme_id,
  36. isTestSkin
  37. })
  38. },
  39. /**
  40. * 生命周期函数--监听页面初次渲染完成
  41. */
  42. onReady() {
  43. },
  44. /**
  45. * 生命周期函数--监听页面显示
  46. */
  47. onShow() {
  48. // 获取护理方案
  49. this.getSkinPlan()
  50. },
  51. /**
  52. * 生命周期函数--监听页面隐藏
  53. */
  54. onHide() {
  55. },
  56. /**
  57. * 生命周期函数--监听页面卸载
  58. */
  59. onUnload() {
  60. },
  61. /**
  62. * 页面相关事件处理函数--监听用户下拉动作
  63. */
  64. onPullDownRefresh() {
  65. },
  66. /**
  67. * 页面上拉触底事件的处理函数
  68. */
  69. onReachBottom() {
  70. },
  71. /**
  72. * 用户点击右上角分享
  73. */
  74. onShareAppMessage() {
  75. },
  76. // 获取护理方案
  77. getSkinPlan(){
  78. get('v2/api/scheme/info',{
  79. scheme_id:"", //方案ID,不填则获取最新方案
  80. },(res)=>{
  81. if(res.code==200){
  82. res.data.forEach(item=>{
  83. item.project_list.forEach(item1=>{
  84. item1.category_id = 'p'+item1.category_id
  85. item1.project_name = item1.project_name.substring(item1.project_name.lastIndexOf("】")+1);
  86. })
  87. })
  88. this.setData({
  89. skinPlanList:res.data
  90. })
  91. }
  92. })
  93. },
  94. // 跳转到项目详情
  95. goProjectDetail(e){
  96. let id = e.currentTarget.dataset.id
  97. wx.navigateTo({
  98. url: `/pages/projectDetail/projectDetail?source=project&id=${id}&store_id=${this.data.store_id}&isSkinPlan=true&isTestSkin=${this.data.isTestSkin}`,
  99. })
  100. }
  101. })