conversion.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view >
  3. <ujp-navbar title="优惠券兑换"></ujp-navbar>
  4. <view class="input-box">
  5. <u-input v-model="exchangeCode" placeholder="请输入兑换码" :placeholder-style="elderStatus ? 'font-size: 16px;' : ''"></u-input>
  6. </view>
  7. <u-button class="couversion-btn oldTextjp2" oldstyle="font-size: 18px;" type="success" shape="circle" @click="redeemNow">立即兑换</u-button>
  8. </view>
  9. </template>
  10. <script>
  11. import * as userApi from '@/apis/user.js'
  12. export default{
  13. data(){
  14. return{
  15. exchangeCode: '',
  16. elderStatus: false,
  17. }
  18. },
  19. onReady() {
  20. if(this.carhelp.get("getElderModeClass") == "长辈模式") {
  21. this.elderStatus = true;
  22. } else {
  23. this.elderStatus = false;
  24. }
  25. },
  26. methods:{
  27. redeemNow() {
  28. uni.showLoading({
  29. title: "加载中",
  30. mask: true,
  31. })
  32. userApi.exchange({
  33. key: this.exchangeCode
  34. }).then((res) => {
  35. uni.hideLoading();
  36. uni.navigateBack({
  37. })
  38. }).catch(error => {
  39. uni.showToast({
  40. title: error,
  41. icon: "none"
  42. })
  43. })
  44. },
  45. }
  46. }
  47. </script>
  48. <style>
  49. page{
  50. background-color: #fff;
  51. }
  52. </style>
  53. <style lang="scss" scoped>
  54. .input-box{
  55. padding: 4px 0;
  56. margin: 20px 28px;
  57. border-bottom: 1px solid #f7f7f7;
  58. box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  59. font-size: 100px;
  60. }
  61. .couversion-btn{
  62. margin: 28px ;
  63. background-color:#00B962!important;
  64. border-color: #00B962!important;
  65. color:#fff!important;
  66. }
  67. </style>