buyPromo.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class=" ">
  3. <view class="font header">
  4. 优惠码价格:{{price}}元/个
  5. </view>
  6. <view class="font header">
  7. <view class="font">
  8. 你要购买的数量:
  9. </view>
  10. <view class="input-two">
  11. <input type="text" class="input" v-model="num" />
  12. </view>
  13. <view class="font3">
  14. </view>
  15. </view>
  16. <view class="font2 header">
  17. <view class="font">
  18. 有效期:
  19. </view>
  20. <view class="input-two">
  21. <input type="text" class="input" v-model="day" />
  22. </view>
  23. <view class="font3">
  24. 天.(最长90天)
  25. </view>
  26. </view>
  27. <view class="font2 header">
  28. 合计:{{num*price}}元
  29. </view>
  30. <view class="button">
  31. <button type="primary" @click="buy()" class="button2">
  32. <p class="p">购买</p>
  33. </button>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. price:null,
  42. num:'10',
  43. day:'30'
  44. }
  45. },
  46. onLoad() {
  47. },
  48. onShow() {
  49. this.findPrice();
  50. },
  51. methods: {
  52. findPrice(){
  53. uni.request({
  54. url: this.serverurl + '/TPromoCode/findPrice',
  55. method: "GET",
  56. success: (res) => {
  57. this.price = res.data.data;
  58. }
  59. })
  60. },
  61. buy(){
  62. if(this.day>90){
  63. uni.showModal({
  64. content: '有效期不能超过90天',
  65. showCancel: false
  66. });
  67. return null;
  68. }
  69. console.log(this.num+this.day)
  70. }
  71. },
  72. }
  73. </script>
  74. <style>
  75. .header {
  76. display: flex;
  77. flex-direction: row;
  78. justify-content: flex-start;
  79. padding-left: 20upx;
  80. }
  81. .font{
  82. padding-top: 20upx;
  83. height: 70upx;
  84. color: #363D44;
  85. font-size: 36upx;
  86. font-family: "PingFang-SC-Bold";
  87. }
  88. .font2{
  89. padding-top: 40upx;
  90. padding-bottom: 30upx;
  91. height: 70upx;
  92. color: #363D44;
  93. font-size: 36upx;
  94. font-family: "PingFang-SC-Bold";
  95. }
  96. .font3{
  97. padding-left: 30upx;
  98. padding-top: 23upx;
  99. height: 70upx;
  100. color: #363D44;
  101. font-size: 36upx;
  102. font-family: "PingFang-SC-Bold";
  103. }
  104. .input-two {
  105. width: 80upx;
  106. height: 30upx;
  107. padding-top: 23upx;
  108. padding-left: 30upx;
  109. }
  110. .input {
  111. padding-left: 20upx;
  112. background-color: #FFFFFF;
  113. width: 80upx;
  114. height: 30upx;
  115. box-shadow: 0upx 0upx 20upx #D3D3D3;
  116. border-radius: 5upx;
  117. }
  118. .button{
  119. padding-top: 70upx;
  120. margin: auto;
  121. width: 80%;
  122. height: 100upx;
  123. }
  124. .button2{
  125. margin: auto;
  126. width: 80%;
  127. height: 100upx;
  128. }
  129. .p{
  130. padding-top: 2upx;
  131. margin: 0 auto;
  132. font-size: 45upx;
  133. font-family: "PingFang-SC-Bold";
  134. }
  135. </style>