index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="page flex-row justify-center" :style="{'width':sysWidth,'height':sysHeight}">
  3. <view class="content">
  4. <swiper :style="{'height':sysHeight}" :duration="0" :current="pageIndex">
  5. <swiper-item @touchmove.stop>
  6. <view class="flex-row justify-center">
  7. <image class="stepImg" src="/static/me/step1.png"></image>
  8. </view>
  9. <u--form labelPosition="top" :model="userInfo" :rules="rules" ref="uForm" :labelStyle="labelStyle">
  10. <view class="flex-row justify-center">
  11. <view class="formView flex-col justify-around">
  12. <view>
  13. <u-form-item labelWidth="auto" label="老系统手机号" prop="phone" borderBottom>
  14. <u--input v-model="userInfo.phone" border="none" placeholder="填写老系统电话"></u--input>
  15. </u-form-item>
  16. </view>
  17. <view>
  18. <u-form-item labelWidth="auto" label="老系统会员姓名" prop="memberName" borderBottom>
  19. <u--input v-model="userInfo.memberName" border="none" placeholder="填写姓名"></u--input>
  20. </u-form-item>
  21. </view>
  22. <view>
  23. <u-form-item labelWidth="auto" label="当前手机号" prop="phonenumber" borderBottom>
  24. <u--input v-model="userInfo.phonenumber" border="none" placeholder="填写当前手机号"></u--input>
  25. </u-form-item>
  26. </view>
  27. <view>
  28. <u-form-item labelWidth="auto" label="验证码" prop="smsCode">
  29. <view class="flex-row">
  30. <u--input v-model="userInfo.smsCode" border="none" placeholder="请输入验证码"></u--input>
  31. <view class="flex-col justify-center" @click="getCode">{{tips}}</view>
  32. </view>
  33. </u-form-item>
  34. </view>
  35. </view>
  36. </view>
  37. </u--form>
  38. <view class="flex-row justify-center">
  39. <view class="selectButton" @click="selectUserMsg">
  40. <text>查询</text>
  41. </view>
  42. </view>
  43. <u-code ref="uCode" @change="codeChange" seconds="60" @start="disabled1 = true" @end="disabled1 = false"></u-code>
  44. </swiper-item>
  45. <swiper-item @touchmove.stop>
  46. <scroll-view scroll-y="true" class="scroll-Y" :style="{'height':scrollHeight}">
  47. <view class="flex-row justify-center">
  48. <image class="stepImg" src="/static/me/step2.png"></image>
  49. </view>
  50. <view class="flex-row justify-center">
  51. <view class="userMsg flex-col justify-around">
  52. <view class="flex-row"><text class="key">会员姓名</text><text class="value">张三</text></view>
  53. <view class="flex-row"><text class="key">手机号码</text><text class="value">17365224542</text></view>
  54. <view class="flex-row"><text class="key">会员卡号</text><text class="value">SSS000001</text></view>
  55. <view class="flex-row"><text class="key">会员编号</text><text class="value">SSS000001</text></view>
  56. <view class="flex-row"><text class="key">积分</text><text class="value">366666</text></view>
  57. <view class="flex-row"><text class="key">账户余额</text><text class="value">¥22222</text></view>
  58. <view class="flex-row"><text class="key">赠送余额</text><text class="value">¥22222</text></view>
  59. </view>
  60. </view>
  61. <view class="list" :style="{'height':scrollHeight}">
  62. <view class="flex-row justify-center">
  63. <view class="flex-row justify-center recordView">
  64. <view :class="recordIndex === 0? 'selectRecord':'record'" @click="clickRecord(0)">
  65. <text>充值记录</text>
  66. </view>
  67. <view :class="recordIndex === 1? 'selectRecord':'record'" @click="clickRecord(1)">
  68. <text>消费记录</text>
  69. </view>
  70. </view>
  71. </view>
  72. <swiper :style="{'height':swiperHeight}" :current="recordIndex"
  73. @change="recordSwiperChange">
  74. <swiper-item v-for="(item,index) in 2" :key="index">
  75. <mescroll-item ref="MescrollItem" :i="index" :index="recordIndex"
  76. :height="swiperHeight">
  77. </mescroll-item>
  78. </swiper-item>
  79. </swiper>
  80. </view>
  81. </scroll-view>
  82. <view class="step2Button flex-row">
  83. <view class="last" @click="lastStep"><text>上一步</text></view>
  84. <view class="next" @click="migration"><text>下一步</text></view>
  85. </view>
  86. </swiper-item>
  87. <swiper-item @touchmove.stop>
  88. <view class="flex-row justify-center">
  89. <image class="stepImg" src="/static/me/step3.png"></image>
  90. </view>
  91. <view class="flex-row justify-center">
  92. <image class="successImg" src="/static/me/success.png"></image>
  93. </view>
  94. <view class="flex-row justify-center successText">
  95. <text>账户迁移成功</text>
  96. </view>
  97. <view class="flex-row justify-center ">
  98. <view class="endButton" @click="migrationEnd">
  99. <text>确认</text>
  100. </view>
  101. </view>
  102. </swiper-item>
  103. </swiper>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. import MescrollItem from "./module/mescrollUni-item.vue";
  109. export default {
  110. components: {
  111. MescrollItem
  112. },
  113. data() {
  114. return {
  115. pageIndex: 0,
  116. sysWidth: '',
  117. sysHeight: '',
  118. scrollHeight: '',
  119. swiperHeight: '',
  120. recordIndex: 0,
  121. tips: '',
  122. re:'^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-9])|(18[0-9])|166|195|198|199|191|(147))\\d{8}$', //手机号正则表达式
  123. labelStyle: {
  124. fontSize: '28rpx',
  125. color: '#333333',
  126. fontWeight: 'bold'
  127. },
  128. userInfo: {
  129. phone:'',
  130. memberName:'',
  131. phonenumber:'',
  132. smsCode:''
  133. },
  134. rules: {
  135. phone: {
  136. type: 'string',
  137. required: true,
  138. message: '请输入11位电话号码',
  139. trigger: ['blur', 'change']
  140. },
  141. memberName: {
  142. type: 'string',
  143. min: 1,
  144. required: true,
  145. message: '请输入名字',
  146. trigger: ['blur', 'change']
  147. },
  148. phonenumber: {
  149. type: 'string',
  150. min: 11,
  151. max: 11,
  152. required: true,
  153. message: '请输入11位电话号码',
  154. trigger: ['blur', 'change']
  155. },
  156. smsCode: {
  157. type: 'string',
  158. min: 4,
  159. max: 6,
  160. required: true,
  161. message: '请输入验证码',
  162. trigger: ['blur', 'change']
  163. },
  164. },
  165. };
  166. },
  167. onLoad() {
  168. let sysInfo = uni.getSystemInfoSync()
  169. this.sysWidth = sysInfo.windowWidth + 'px'
  170. this.sysHeight = sysInfo.windowHeight + 'px'
  171. this.scrollHeight = sysInfo.windowHeight - (sysInfo.windowWidth / 750) * 132 + 'px'
  172. this.swiperHeight = (750 / sysInfo.windowWidth) * sysInfo.windowHeight - 80 - 132 + 'rpx'
  173. },
  174. methods: {
  175. selectUserMsg() {
  176. //查询个人信息 todo
  177. this.$refs.uForm.validate().then(res => {
  178. this.$api.getOldMember(this.userInfo).then((res) => {
  179. console.log(res.data.data)
  180. if (res.data.data){
  181. this.pageIndex = 1
  182. }
  183. })
  184. }).catch(errors => {
  185. })
  186. },
  187. lastStep() {
  188. this.pageIndex = 0
  189. },
  190. migration() {
  191. //数据迁移 todo
  192. this.pageIndex = 2
  193. },
  194. migrationEnd() {
  195. uni.switchTab({
  196. url: '/pages/my/index'
  197. })
  198. },
  199. recordSwiperChange(e) {
  200. this.recordIndex = e.detail.current
  201. },
  202. clickRecord(num) {
  203. this.recordIndex = num
  204. },
  205. codeChange(text) {
  206. this.tips = text;
  207. },
  208. getCode() {
  209. let regExp=new RegExp(this.re);
  210. let b= regExp.test(this.userInfo.phonenumber)
  211. if (!b){
  212. uni.$u.toast('请输入正确的手机号')
  213. return
  214. }
  215. if (this.$refs.uCode.canGetCode) {
  216. // 模拟向后端请求验证码
  217. uni.showLoading({
  218. title: '正在获取验证码'
  219. })
  220. this.$api.getSmsCode({phonenumber: this.userInfo.phonenumber}).then(res=>{
  221. uni.$u.toast('验证码已发送');
  222. // 通知验证码组件内部开始倒计时
  223. this.$refs.uCode.start();
  224. })
  225. } else {
  226. uni.$u.toast('倒计时结束后再发送');
  227. }
  228. },
  229. }
  230. };
  231. </script>
  232. <style scoped lang="scss">
  233. @import './index.rpx.scss';
  234. </style>