index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view>
  3. <u-navbar leftIconSize="0" title="幸运数字" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
  4. <view class="lucky">
  5. <view class="lucky-number">
  6. <view class="flex lucky-number-circle">
  7. <view class="title">幸运数字</view>
  8. <view class="num" v-if="info.status == 1">?</view>
  9. <view class="luckyNum" v-else>{{ info.plainLuckyNum }}</view>
  10. </view>
  11. </view>
  12. <view class="lucky-title">
  13. <view class="txt">{{ info.title }}</view>
  14. <view class="id">盲票序列号:{{ info.serialNo }}</view>
  15. </view>
  16. <view class="flex lucky-btn">
  17. <view class="pay" @click="pay" v-if="info.status == 1">支付{{ info.facePrice / 100 }}元 立即查看</view>
  18. <view class="pay" @click="screen" v-else>保存至手机相册</view>
  19. </view>
  20. <view class="index" @click="toIndex">去首页</view>
  21. </view>
  22. <pay-popup :pay-show="payShow" :pay-info="payInfo" @close="close" @success="getDetailInfo" />
  23. </view>
  24. </template>
  25. <script>
  26. import env from '../../config/env.js'
  27. import $http from '@/utils/request.js'
  28. import PayPopup from '../../components/pay-popup/pay-popup.vue'
  29. export default {
  30. components: {
  31. PayPopup
  32. },
  33. data() {
  34. return {
  35. serialNo: '',
  36. info: '',
  37. payInfo: {},
  38. payShow: false
  39. };
  40. },
  41. onLoad(options) {
  42. this.serialNo = options.id
  43. this.getDetail()
  44. },
  45. methods: {
  46. getDetail() {
  47. uni.showLoading({
  48. title: '加载中'
  49. });
  50. $http.post('/api/v1/mp/user/ticket/queryLuckyNum', {
  51. serialNo: this.serialNo,
  52. noToken: true
  53. }).then(res => {
  54. uni.hideLoading();
  55. if (res.code == 0) {
  56. if(res.data.status == 1){
  57. this.info = res.data
  58. }else{
  59. uni.redirectTo({
  60. url: `/pages/choice/index?id=${ res.data.ticketId }`
  61. })
  62. }
  63. }
  64. }).catch(() => {
  65. uni.hideLoading();
  66. })
  67. },
  68. getDetailInfo() {
  69. this.payShow = false
  70. uni.showLoading({
  71. title: '加载中'
  72. });
  73. $http.post('/api/v1/mp/user/ticket/queryLuckyNum', {
  74. serialNo: this.serialNo,
  75. noToken: true
  76. }).then(res => {
  77. uni.hideLoading();
  78. if (res.code == 0) {
  79. this.info = res.data
  80. }
  81. }).catch(() => {
  82. uni.hideLoading();
  83. })
  84. },
  85. close() {
  86. this.payShow = false
  87. },
  88. pay() {
  89. let data = {
  90. ticketId: this.info.ticketId,
  91. autoCoupon: 1
  92. }
  93. $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
  94. console.log(res);
  95. if (res.code == 0) {
  96. let info = {
  97. ...res.data,
  98. picUrl: env.filePublic + res.data.picUrl,
  99. }
  100. this.payInfo = info
  101. this.payShow = true
  102. console.log(info);
  103. }
  104. })
  105. },
  106. screen() {
  107. },
  108. toIndex() {
  109. uni.switchTab({
  110. url: '/pages/index/index'
  111. })
  112. },
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .lucky {
  118. width: 100%;
  119. height: calc(100vh - 50px);
  120. background: url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic3.zhimg.com%2F50%2Fv2-a6f5c8b5b66fe87e4e79c1fc82a61a36_hd.jpg&refer=http%3A%2F%2Fpic3.zhimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1649658373&t=f216ee4825d5b36e62aa3a490516bfb1) center center;
  121. &-number {
  122. padding-top: 400rpx;
  123. &-circle {
  124. box-sizing: border-box;
  125. flex-direction: column;
  126. width: 336rpx;
  127. height: 336rpx;
  128. background-color: $uni-bg-color;
  129. border-radius: 50%;
  130. margin: auto;
  131. .title {
  132. margin-bottom: 20rpx;
  133. }
  134. .num {
  135. font-size: 100rpx;
  136. }
  137. .luckyNum {
  138. font-size: 36rpx;
  139. }
  140. }
  141. }
  142. &-title {
  143. margin-top: 40rpx;
  144. margin-bottom: 70rpx;
  145. .txt {
  146. text-align: center;
  147. font-size: 36rpx;
  148. font-weight: bold;
  149. line-height: 50rpx;
  150. margin-bottom: 8rpx;
  151. }
  152. .id {
  153. line-height: 40rpx;
  154. text-align: center;
  155. }
  156. }
  157. &-btn {
  158. .pay {
  159. width: 400rpx;
  160. height: 60rpx;
  161. line-height: 60rpx;
  162. border-radius: 8rpx;
  163. background-color: rgba(235, 112, 9, 100);
  164. color: #FFFFFF;
  165. text-align: center;
  166. }
  167. }
  168. .index{
  169. margin: 60rpx 0;
  170. text-align: center;
  171. font-weight: bold;
  172. color: $uni-color-primary;
  173. }
  174. }
  175. </style>