freeCharge.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <view class="container-freecharge" v-if="isShowFreeBtn">
  3. <image @click="toggle" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/free_icon.png"></image>
  4. <image @click="removeBton" class="remove-icon" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/free_%20remove.png"></image>
  5. </view>
  6. </template>
  7. <script>
  8. import { FreeButton } from "@/config/api.js";
  9. export default {
  10. data() {
  11. return {};
  12. },
  13. props: {
  14. isShowFreeBtn: {
  15. type: Boolean,
  16. default: false,
  17. },
  18. },
  19. watch: {
  20. },
  21. methods: {
  22. //跳转到免费送月卡页面
  23. toggle() {
  24. uni.navigateTo({
  25. url: "/pageMy/freeTrial/freeTrial",
  26. });
  27. },
  28. //隐藏当天的按钮
  29. async removeBton() {
  30. const res = await FreeButton.userFreeButtonUpdate();
  31. if(res.Ret === 200){
  32. this.$parent.isShowFree = false;
  33. }
  34. },
  35. },
  36. };
  37. </script>
  38. <style scoped lang="scss">
  39. .container-freecharge {
  40. position: relative;
  41. image {
  42. width: 156rpx;
  43. height: 156rpx;
  44. }
  45. .remove-icon {
  46. width: 31rpx;
  47. height: 31rpx;
  48. position: absolute;
  49. right: 0;
  50. top: 0;
  51. }
  52. }
  53. </style>