authCode.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view class="intro-page common">
  3. <view class="top-class"></view>
  4. <view class="title">
  5. 七榔
  6. </view>
  7. <view class="head">
  8. <u-row class="row-class" justify="flex-end">
  9. <u-col span="4">
  10. <image class="logo-rules" @click="openDetail" src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/qilang/common/rules.png" />
  11. </u-col>
  12. </u-row>
  13. </view>
  14. <view class="content">
  15. <view class="title-1">
  16. <view class="content_imgView">
  17. <image style="height: 400rpx" src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/qilang/commodity.png"
  18. mode="heightFix" />
  19. </view>
  20. </view>
  21. <view class="detail">
  22. <view class="text-detail">
  23. 您所查询的是七榔槟榔,是正牌产品,感谢您的购买!
  24. </view>
  25. <view class="" style="padding: 20rpx;">
  26. <u-row class="row-class">
  27. <u-col span="9">
  28. <u--input placeholder="输入包装内侧验证码" border="surround" v-model="value" color="#293993" ></u--input>
  29. </u-col>
  30. <u-col span="3">
  31. <u-button text="开始抽奖" class="custom-style" color="#293993" @click="startDraw" ></u-button>
  32. </u-col>
  33. </u-row>
  34. </view>
  35. <view class="hint">
  36. 实物大奖:如您中实物,请凭中奖外包袋兑奖,谢谢!
  37. </view>
  38. </view>
  39. </view>
  40. <u-toast ref="uToast"></u-toast>
  41. <CustomTabbar />
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. getScanData,
  47. confirmCode
  48. } from '@/api/scan'
  49. import CustomTabbar from '@/components/tabbar_common.vue';
  50. export default {
  51. components: {
  52. CustomTabbar
  53. },
  54. data() {
  55. return {
  56. scanUserData: {},
  57. prizeJson: {},
  58. value: '',
  59. scanCode: ''
  60. }
  61. },
  62. onLoad() {
  63. this.scanCode = uni.getStorageSync('scanCode');
  64. },
  65. methods: {
  66. goBack() {
  67. uni.navigateBack();
  68. },
  69. openDetail() {
  70. uni.navigateTo({
  71. url: '/pages/qilang/index/rules'
  72. });
  73. },
  74. startDraw() {
  75. confirmCode(this.scanCode, this.value).then(res => {
  76. if (res.code === 0) {
  77. getScanData(this.scanCode).then(res => {
  78. if (res.code === 0) {
  79. // 获取当前页面路径
  80. const pages = getCurrentPages();
  81. const currentPage = pages[pages.length - 1];
  82. const route = currentPage.route;
  83. const dirPath = route.substring(0, route.lastIndexOf('/'));
  84. let url = '/' + dirPath + '/index';
  85. uni.setStorageSync('scanDetail', res.data);
  86. uni.redirectTo({
  87. url: url
  88. })
  89. }else {
  90. let params = {
  91. type: "error",
  92. title: "失败",
  93. message: res.msg,
  94. iconUrl: "https://uviewui.com/demo/toast/error.png",
  95. }
  96. this.$refs.uToast.show({
  97. ...params
  98. });
  99. }
  100. })
  101. } else {
  102. let params = {
  103. type: "error",
  104. title: "失败",
  105. message: res.msg,
  106. iconUrl: "https://uviewui.com/demo/toast/error.png",
  107. }
  108. this.$refs.uToast.show({
  109. ...params
  110. });
  111. }
  112. });
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. @import url('../../../static/scss/common_qilang.css');
  119. .row-class {
  120. height: 60rpx;
  121. }
  122. .theme-text {
  123. height: 10vh;
  124. text-align: center;
  125. line-height: 11vh;
  126. .textImage {
  127. height: 80rpx;
  128. width: 400rpx;
  129. }
  130. }
  131. .title-1 {
  132. text-align: center;
  133. color: #A7001C;
  134. font-size: 18px;
  135. letter-spacing: 4px;
  136. font-weight: 600;
  137. }
  138. .winning-picture {
  139. height: 460rpx;
  140. background-image: url(https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/bgiZj.png);
  141. background-size: contain;
  142. background-position: center;
  143. background-repeat: no-repeat;
  144. display: flex;
  145. justify-content: center;
  146. /* 水平居中 */
  147. // align-items: center; /* 垂直居中 */
  148. }
  149. .detail {
  150. margin: 20rpx 40rpx;
  151. border-radius: 10rpx;
  152. padding: 10rpx;
  153. height: 20vh;
  154. background: #FDE2B1;
  155. border: 4px solid #FB911B;
  156. }
  157. .text-detail {
  158. margin-top: 20rpx;
  159. margin-bottom: 10rpx;
  160. padding: 0px 10px;
  161. font-weight: 600;
  162. font-size: 26rpx;
  163. color: #3D3D3D;
  164. }
  165. .text-one {
  166. font-weight: 400;
  167. font-size: 26rpx;
  168. color: #293993 ;
  169. margin-bottom: 10rpx;
  170. }
  171. .detail-btn {
  172. text-align: center;
  173. color: #F9D395;
  174. height: 60rpx;
  175. line-height: 60rpx;
  176. margin-right: 20rpx;
  177. font-size: 13px;
  178. background-color: #901710;
  179. padding: 3px;
  180. border-radius: 5px;
  181. }
  182. .center-image {
  183. height: 280rpx;
  184. object-fit: contain;
  185. /* 保持图片的宽高比,确保不会被拉伸或裁切 */
  186. }
  187. ::v-deep .detail-btn span {
  188. background-color: #8E1813;
  189. padding: 4rpx;
  190. border-radius: 8rpx;
  191. font-weight: 400;
  192. font-size: 26rpx;
  193. }
  194. .hint {
  195. font-weight: 500;
  196. font-size: 24rpx;
  197. color: #F94C28 ;
  198. text-align: center;
  199. }
  200. .custom-style {
  201. height: 74rpx;
  202. }
  203. .content {
  204. margin-top: 16vh;
  205. }
  206. ::v-deep .u-border{
  207. border-color: #293993 !important;
  208. }
  209. </style>