index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="content">
  3. <image class="logo" :src="$PIC(giftimg)"></image>
  4. <view class="text-area">
  5. <view style="height: 336rpx;"></view>
  6. <view class="info-box">
  7. <view class="title">礼品兑换中心</view>
  8. <view class="input-title">输入卡号</view>
  9. <view><input type="text" placeholder-style="color:#ccc" value="" placeholder="请输入礼品卡号" v-model="giftInfo.card_id"/></view>
  10. <view class="input-title">输入密码</view>
  11. <view><input type="text" value="" placeholder-style="color:#ccc" placeholder="请输入涂层密码" v-model="giftInfo.card_pwd"/></view>
  12. <view class="yzm" v-if="captcha=='1'">
  13. <view>
  14. <view class="input-title">验证码</view>
  15. <view><input style="margin-bottom: 0;" placeholder-style="color:#ccc" type="text" value="" placeholder="点击更换验证码" v-model="giftInfo.code"/></view>
  16. </view>
  17. <view class="yzn-img" @click="GetValidCode"><image :src="$ANNEX_URL + '/index.php?s=/captcha&j=' + j"></image></view>
  18. </view>
  19. <view class="btn" @click="submit">提交 </view>
  20. <view class="concord">
  21. <checkbox-group class="checkbox" @tap="changeAgreeConcord">
  22. <checkbox :checked="agreeConcord" value="1"/>
  23. </checkbox-group>
  24. <view @tap="changeAgreeConcord" class="text">我已同意该平台获取我的地址信息</view>
  25. </view>
  26. <!-- <view class="btn contact" open-type="contact" @contact="contact">联系客服 </view> -->
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. title: '卡密验证',
  36. giftimg: '',
  37. j:'',
  38. captcha: '0',
  39. erweima: '',
  40. agreeConcord:false,
  41. giftInfo: {
  42. card_id: '',
  43. card_pwd: '',
  44. code: ''
  45. }
  46. }
  47. },
  48. onLoad(e) {
  49. var id = e.id
  50. var _this = this;
  51. _this.$GET_FUN('/addons/pickup/pickupapi/getGiftPackage', {'id': id}, res => {
  52. if (res.data.code == 1) {
  53. if(res.data.data.gift.image){
  54. this.giftimg = res.data.data.gift.image
  55. }
  56. }
  57. });
  58. _this.$GET_FUN('/addons/pickup/pickupapi/config',{}, res => {
  59. if (res.data.code == 1) {
  60. if(_this.giftimg==''){
  61. _this.giftimg=res.data.data.bg
  62. }
  63. uni.setStorageSync("captcha",res.data.data.captcha)
  64. if(res.data.data.captcha=='1') {
  65. this.captcha = res.data.data.captcha
  66. this.GetValidCode()
  67. }
  68. }else {
  69. }
  70. }, res => {
  71. });
  72. },
  73. methods: {
  74. changeAgreeConcord(){
  75. this.agreeConcord=!this.agreeConcord;
  76. },
  77. contact(a,b){console.log('contact',a,b)},
  78. submit() {
  79. var _this = this;
  80. var card_id = this.giftInfo.card_id
  81. var card_pwd = this.giftInfo.card_pwd
  82. var code = this.giftInfo.code
  83. if(!this.agreeConcord){
  84. uni.showToast({
  85. title: '请阅读并同意相关协议',
  86. icon: 'none'
  87. });
  88. return;
  89. }
  90. // 兑换礼包
  91. if(this.giftInfo.card_id) {
  92. if(this.giftInfo.card_pwd) {
  93. _this.$GET_FUN('/addons/pickup/pickupapi/receiveGiftPackage', this.giftInfo, res => {
  94. if (res.data.code == 1) {
  95. uni.setStorageSync("card_id",card_id)
  96. uni.setStorageSync("card_pwd",card_pwd)
  97. let gp_id = res.data.data.giftCardcode.gp_id
  98. if(res.data.data.giftCardcode.card_status=="2") {
  99. uni.navigateTo({
  100. url: "/pages/gift/gift?gp_id=" + gp_id
  101. })
  102. }else if(res.data.data.giftCardcode.card_status=="3") {
  103. uni.navigateTo({
  104. url: "/pages/success/success"
  105. })
  106. }else {
  107. uni.showToast({
  108. title: res.data.msg,
  109. icon: 'none'
  110. });
  111. }
  112. }else {
  113. uni.showToast({
  114. title: res.data.msg,
  115. icon: 'none'
  116. });
  117. }
  118. });
  119. }else {
  120. uni.showToast({
  121. title: '请输入密码',
  122. icon: 'none'
  123. });
  124. }
  125. }else{
  126. uni.showToast({
  127. title: '请输入卡号',
  128. icon: 'none'
  129. });
  130. }
  131. },
  132. GetValidCode() {
  133. var j = Math.random()
  134. this.j = j
  135. }
  136. }
  137. }
  138. </script>
  139. <style>
  140. .content {
  141. display: flex;
  142. flex-direction: column;
  143. align-items: center;
  144. justify-content: center;
  145. position: relative;
  146. }
  147. .logo {
  148. height: 366rpx;
  149. width: 750rpx;
  150. }
  151. .text-area {
  152. width: 100%;
  153. position: absolute;
  154. top: 0;
  155. }
  156. .info-box {
  157. background: #FFFFFF;
  158. border-top-left-radius: 24rpx;
  159. border-top-right-radius: 24rpx;
  160. line-height: 1;
  161. padding: 80rpx 30rpx 240rpx;
  162. box-sizing: border-box;
  163. }
  164. .title {
  165. font-size: 56rpx;
  166. color: #1A1A1A;
  167. font-weight: 800;
  168. margin-bottom: 140rpx;
  169. }
  170. .input-title {
  171. font-size: 30rpx;
  172. color: #050505;
  173. font-weight: bold;
  174. margin-bottom: 30rpx;
  175. }
  176. input {
  177. font-size: 36rpx;
  178. margin-bottom: 74rpx;
  179. }
  180. .yzm {
  181. display: flex;
  182. justify-content: space-between;
  183. align-items: center;
  184. margin-bottom: 82rpx;
  185. }
  186. .yzn-img {
  187. width: 190rpx;
  188. height: 86rpx;
  189. flex: 1;
  190. }
  191. .yzn-img image {
  192. width: 100%;
  193. height: 100%;
  194. }
  195. .btn {
  196. width: 500rpx;
  197. height: 94rpx;
  198. margin: 0 auto;
  199. text-align: center;
  200. line-height: 94rpx;
  201. border-radius: 6rpx;
  202. background: linear-gradient(to top, #C82D2D, #E06363);
  203. font-size: 36rpx;
  204. color: #FFFFFF;
  205. font-weight: bold;
  206. }
  207. .concord{ margin: 30rpx 80rpx 0; height: 60rpx; line-height: 60rpx; }
  208. .concord .checkbox{ float: left;}
  209. .concord .checkbox checkbox{ transform: scale(0.6,0.6);}
  210. .concord .text{ font-size: 28rpx; color: #565656; margin-top: 2rpx;}
  211. .contact{ margin-top: 60rpx; height: 80rpx; line-height: 80rpx; background:#42b983; color: #ffffff;}
  212. </style>