authCode.vue 5.4 KB

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