activity-entry.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view class="container cashier">
  3. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading="true" :loadingType="5" />
  4. <template v-else>
  5. <custom :navbar-data='nvabarData' />
  6. <view class="container-banner" :style="{ paddingTop:CustomBar + 170 +'px' }">
  7. <view class="container-title">{{ voteTitle }}</view>
  8. <view class="login-input">
  9. <input type="text"
  10. v-model="params.ticket"
  11. maxlength="20"
  12. disabled="true"
  13. class="input"
  14. />
  15. </view>
  16. <view class="login-input">
  17. <input type="text"
  18. v-model="params.name"
  19. maxlength="10"
  20. class="input"
  21. placeholder="您的姓名"
  22. />
  23. </view>
  24. <view class="login-input">
  25. <input type="text"
  26. v-model="params.idCard"
  27. maxlength="20"
  28. class="input"
  29. placeholder="证件号码(身份证/港澳台通行证/护照)"
  30. />
  31. </view>
  32. <view class="login-input">
  33. <input type="text"
  34. v-model="params.mobile"
  35. maxlength="11"
  36. class="input"
  37. placeholder="您的联系电话"
  38. />
  39. </view>
  40. <view class="login-input">
  41. <input type="text"
  42. v-model="params.work"
  43. maxlength="15"
  44. class="input"
  45. placeholder="您的职业"
  46. />
  47. </view>
  48. <view class="login-btn" v-show="isBundled" @click="handleEntry">绑定采美账号</view>
  49. <view class="login-text">
  50. 说明:门票绑定的证件号码是作为进入大会会场的凭证。
  51. </view>
  52. </view>
  53. </template>
  54. <!-- 提示弹窗 -->
  55. <tui-modal
  56. :show="modal"
  57. @click="handleClick"
  58. :content="contentModalText"
  59. :button="modalButton"
  60. color="#333"
  61. :size="32"
  62. shape="circle"
  63. :maskClosable="false"
  64. />
  65. </view>
  66. </template>
  67. <script>
  68. import { mapState, mapMutations } from 'vuex'
  69. import authorize from '@/common/config/authorize.js'
  70. import wxLogin from '@/common/config/wxLogin.js'
  71. export default{
  72. data(){
  73. return{
  74. nvabarData: { //顶部自定义导航
  75. haveBack:false,
  76. haveHome:true,
  77. showCapsule:1, // 是否显示左上角图标 1表示显示 0表示不显示,
  78. showSearch: 0,
  79. title: '', // 导航栏 中间的标题
  80. textLeft:this.$store.state.isIphone
  81. },
  82. isIphoneX:this.$store.state.isIphoneX,
  83. CustomBar:this.CustomBar,// 顶部导航栏高度
  84. skeletonShow:true,
  85. params:{
  86. name:'',
  87. idCard:'',
  88. ticket:'',
  89. mobile:'',
  90. work:'',
  91. userId:''
  92. },
  93. voteTitle:'',
  94. modal: false,
  95. contentModalText: '', //操作文字提示语句
  96. modalButton: [
  97. {
  98. text: '取消',
  99. type: 'gray',
  100. plain: true //是否空心
  101. },
  102. {
  103. text: '确认绑定',
  104. customStyle: {
  105. color: '#fff',
  106. bgColor: '#e10078'
  107. },
  108. plain: false
  109. }
  110. ],
  111. isBundled:true
  112. }
  113. },
  114. onLoad(option) {
  115. wxLogin.wxLoginAuthorize()
  116. setTimeout(()=>{
  117. this.initData(option)
  118. },2000)
  119. },
  120. computed: {
  121. ...mapState(['hasLogin', 'userInfo', ])
  122. },
  123. methods:{
  124. // 初始化
  125. async initData(option) {
  126. const userInfo = await this.$api.getStorage()
  127. this.params.ticket = option.ticket
  128. this.voteTitle = option.voteType*1 === 1 ? '大会通票' : '学术套票'
  129. console.log('userInfo',userInfo)
  130. if(userInfo.userId){
  131. this.params.userId = userInfo.userId
  132. this.contentModalText = `您的采美机构账号为【${userInfo.name}】,确认绑定吗?`
  133. }
  134. this.getTicketDetails({ ticket: option.ticket})
  135. },
  136. // 查询门票信息
  137. async getTicketDetails(params){
  138. try{
  139. const res = await this.UserService.getTicketDetails(params)
  140. const data = res.data
  141. if(data.userId){
  142. this.isBundled = false
  143. this.params = {...this.params ,...data}
  144. this.params.idCard = data.idCard.substring(0, 4) + '**********' + data.idCard.substring(data.idCard.length - 4);
  145. }else{
  146. this.isBundled = true
  147. }
  148. this.skeletonShow = false
  149. }catch(error){
  150. this.$util.msg(error.msg,2000)
  151. }
  152. },
  153. //确认操作
  154. handleClick(e) {
  155. if (e.index == 1) {
  156. this.userTicketBind(this.params)
  157. }
  158. this.modal = false
  159. },
  160. //点击绑定
  161. handleEntry(){
  162. if(!this.hasLogin){
  163. this.$util.msg('您还未登录采美机构账号,请先登录!', 2000)
  164. setTimeout(() => {
  165. const pages = getCurrentPages()
  166. const page = pages[pages.length - 1]
  167. uni.setStorageSync('LOGIN_REDIRECT_URL', page.$page.fullPath)
  168. this.$api.navigateTo('/pages/login/login')
  169. }, 2000)
  170. return
  171. }
  172. if(!this.params.name){
  173. this.$util.msg('请输入您的姓名~', 2000)
  174. return
  175. }
  176. if(!this.params.idCard){
  177. this.$util.msg('请输入您的证件号码~', 2000)
  178. return
  179. }
  180. if(!this.params.mobile){
  181. this.$util.msg('请输入您的联系电话~', 2000)
  182. return
  183. }
  184. if(!this.params.work){
  185. this.$util.msg('请输入您的职业~', 2000)
  186. return
  187. }
  188. this.modal = true
  189. },
  190. // 绑定门票
  191. async userTicketBind(params){
  192. try{
  193. await this.UserService.userTicketBind(params)
  194. this.$util.msg('绑定成功', 2000, true, 'success')
  195. this.params.idCard = ''
  196. setTimeout(()=>{
  197. this.$api.switchTabTo('/pages/tabBar/home/index')
  198. },2000)
  199. }catch(error){
  200. this.$util.msg(error.msg,2000)
  201. }
  202. }
  203. },
  204. onShow() {
  205. }
  206. }
  207. </script>
  208. <style lang="scss">
  209. page{
  210. background-color: #3d68eb;
  211. height: auto !important;
  212. }
  213. .container-banner{
  214. width: 100%;
  215. height: 1142rpx;
  216. background: url(https://admin.caimei365.com/userfiles/1/images/photo/2024/08/ziluo_bg.jpg) no-repeat;
  217. background-size: contain;
  218. box-sizing: border-box;
  219. padding: 0 110rpx;
  220. .container-title{
  221. height: 120rpx;
  222. line-height: 120rpx;
  223. font-size: $font-size-48;
  224. font-weight: 600;
  225. text-align: center;
  226. color: #FFFFFF;
  227. }
  228. .login-title{
  229. font-size: $font-size-28;
  230. line-height: 58rpx;
  231. color: #ffffff;
  232. }
  233. .login-input{
  234. width: 100%;
  235. height: 88rpx;
  236. padding:0 24rpx;
  237. margin: 0 auto;
  238. margin-bottom: 40rpx;
  239. background: #FFFFFF;
  240. box-sizing: border-box;
  241. border-radius: 50rpx;
  242. .input{
  243. width: 100%;
  244. height: 100%;
  245. background: #FFFFFF;
  246. font-size: $font-size-28;
  247. line-height: 88rpx;
  248. color: #333333;
  249. border-radius: 50rpx;
  250. }
  251. }
  252. .login-btn {
  253. width: 100%;
  254. height: 88rpx;
  255. font-size: $font-size-28;
  256. line-height: 88rpx;
  257. color: #ffffff;
  258. margin: 0 auto;
  259. text-align: center;
  260. background-color: #e10078;
  261. border-radius: 50rpx;
  262. }
  263. .login-text{
  264. font-size: $font-size-26;
  265. line-height: 48rpx;
  266. color: #ffffff;
  267. margin-top: 50rpx;
  268. }
  269. }
  270. </style>