index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view>
  3. <view class="top">
  4. <image :src="picUrlss+'guwen_bg.png'" mode="widthFix" class="bg"></image>
  5. <view class="top-c">
  6. <view>添加金牌顾问微信~</view>
  7. <text>领取权益</text>
  8. </view>
  9. </view>
  10. <view class="con">
  11. <view class="con-t">
  12. <image :src="id?about.pic:picUrlss+'kefu_img1.png'" class="kf-img"></image>
  13. <view class="name">{{id?about.title:'循力源'}}</view>
  14. <view class="tag">金牌顾问</view>
  15. <view class="shop">{{id?merchant.title:'循力源口腔医院'}}</view>
  16. <view class="tags ddflex" v-if="about.fieldValues&&about.fieldValues.label&&about.fieldValues.label.length>0">
  17. <text v-for="(item,index) in about.fieldValues.label" :key="index">{{item}}</text>
  18. </view>
  19. <view class="tips">尊敬的会员您好,我是循力源的金牌顾问,可以为您提供专业的牙健康指导以及到店的贴心服务哦。</view>
  20. </view>
  21. <view class="qrcode">
  22. <image :src="id?about.fieldValues.qrcode:about.service_prcode" show-menu-by-longpress="true"></image>
  23. <view>1.长按扫码<text>2.添加好友</text></view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. //index.js
  30. //获取应用实例
  31. const app = getApp();
  32. const req = require('../../utils/request.js');
  33. const api = require('../../utils/api.js');
  34. const utils = require('../../utils/util.js');
  35. export default {
  36. data() {
  37. return {
  38. picUrlss: req.public.picUrls + 'blue/',
  39. id: '',
  40. merchant: {},
  41. about: {}
  42. };
  43. },
  44. onLoad: async function(options) {
  45. this.id = options.id
  46. this.getMerchant()
  47. if(this.id){
  48. this.getDetail()
  49. }else{
  50. this.getConfig()
  51. }
  52. },
  53. async onShow() {
  54. },
  55. methods: {
  56. getMerchant(){
  57. if(req.getStorage('MERCHANT')){
  58. this.merchant = req.getStorage('MERCHANT')
  59. }else{
  60. this.merchant = req.getStorage('defaultMerchant')
  61. }
  62. },
  63. splitLabel(label){
  64. if(!label){
  65. return false;
  66. }else{
  67. return label.split('、');
  68. }
  69. },
  70. getDetail() {
  71. var _this = this;
  72. return new Promise((res, rej) => {
  73. req.getRequest(
  74. '/api/content/detail',{id: this.id},
  75. data => {
  76. if(data.fieldValues && data.fieldValues.label){
  77. data.fieldValues.label = this.splitLabel(data.fieldValues.label)
  78. }
  79. this.about = data;
  80. res(data);
  81. },
  82. true
  83. );
  84. });
  85. },
  86. getConfig() {
  87. var _this = this;
  88. return new Promise((res, rej) => {
  89. req.g(
  90. '/api/config',
  91. data => {
  92. this.about = data;
  93. res(data);
  94. },
  95. true
  96. );
  97. });
  98. },
  99. }
  100. };
  101. </script>
  102. <style>
  103. @import "./index.css";
  104. </style>