authCode.vue 5.4 KB

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