detail.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="app-container">
  3. <view class="nav" :style="{'padding-top': statusBarHeight + 'px'}">
  4. <uni-icons type="back" style="font-size: 48rpx" @click="getBack" />
  5. <text class="title">积分抽奖</text>
  6. </view>
  7. <view class="form">
  8. <view class="tips">请检查您的信息填写正确,确认后无法更改噢</view>
  9. <view class="form-item">
  10. <view>收货人</view>
  11. <input type="text" v-model="form.receiveName" placeholder="请输入收货人姓名" />
  12. </view>
  13. <view class="form-item">
  14. <view>手机号</view>
  15. <input type="number" v-model="form.receivePhone" placeholder="请输入手机号" />
  16. </view>
  17. <view class="form-item">
  18. <view>收货地址</view>
  19. <textarea v-model="form.receiveAddress" placeholder="请输入收货地址" />
  20. </view>
  21. <button @click="getSubmit" :disabled="disabled">确认</button>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import { receive } from '@/api/lottery.js'
  27. export default {
  28. data() {
  29. return {
  30. // 状态栏
  31. statusBarHeight: getApp().globalData.statusBarHeight,
  32. // 表单
  33. form: {},
  34. // 防重复点击
  35. disabled: false
  36. }
  37. },
  38. onLoad(e) {
  39. this.form = {
  40. prizeId: e.prizeId,
  41. lotteryCode: decodeURIComponent(e.lotteryCode)
  42. }
  43. },
  44. methods: {
  45. // 返回
  46. getBack() {
  47. uni.redirectTo({
  48. url: `/pages/lottery/index`
  49. })
  50. },
  51. // 确定
  52. getSubmit() {
  53. if (!this.form.receiveName) {
  54. uni.showToast({
  55. icon: 'none',
  56. title: '请输入收货人姓名'
  57. })
  58. } else if (!this.form.receivePhone) {
  59. uni.showToast({
  60. icon: 'none',
  61. title: '请输入手机号'
  62. })
  63. } else if (!this.form.receiveAddress) {
  64. uni.showToast({
  65. icon: 'none',
  66. title: '请输入收货地址'
  67. })
  68. } else {
  69. this.disabled = true
  70. receive(getApp().globalData.userInfo, this.form).then(res => {
  71. if (res.data.code === 0) {
  72. uni.showToast({
  73. title: '提交成功!',
  74. duration: 3000
  75. })
  76. setTimeout(() => {
  77. this.getBack()
  78. }, 3000)
  79. }
  80. })
  81. }
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .app-container {
  88. position: relative;
  89. background: url('@/static/lottery/bg-1.png');
  90. background-size: cover;
  91. background-repeat: no-repeat;
  92. width: 100%;
  93. height: 100%;
  94. color: #000;
  95. padding: 0 32rpx 32rpx;
  96. .nav {
  97. height: 88rpx;
  98. display: flex;
  99. align-items: center;
  100. color: #333333;
  101. font-weight: bold;
  102. font-size: 36rpx;
  103. position: relative;
  104. box-sizing: content-box;
  105. .title {
  106. position: absolute;
  107. left: 50%;
  108. transform: translate(-50%);
  109. }
  110. }
  111. .form {
  112. margin-top: 32rpx;
  113. height: 1122rpx;
  114. background: #fff;
  115. border-radius: 32rpx;
  116. padding: 32rpx;
  117. .tips {
  118. color: #999;
  119. font-size: 24rpx;
  120. text-align: center;
  121. }
  122. .form-item {
  123. margin: 32rpx 0 0 0;
  124. }
  125. button {
  126. background: linear-gradient(180deg, #72cdae 0%, #599f82 100%);
  127. color: #fff;
  128. width: 480rpx;
  129. height: 80rpx;
  130. line-height: 80rpx;
  131. border-radius: 50rpx;
  132. font-size: 32rpx;
  133. margin-top: 66rpx;
  134. }
  135. }
  136. }
  137. </style>