You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

go-account.vue 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class='content'>
  3. <view class='content_all'>
  4. <view class="change" @click='change()'>切换</view>
  5. <view v-if="state.inputCarNumber">
  6. <view class="car-input">
  7. <view class="title">车牌号</view>
  8. <car-number-input @numberInputResult="carNumber"></car-number-input>
  9. </view>
  10. <u-form :model="form" ref="form1" label-width=180>
  11. <u-form-item label="车牌颜色"><u-input v-model="state.form.carColor" type="select" :select-open="state.showColor" @click="state.showColor = true" placeholder='车牌颜色'/></u-form-item>
  12. </u-form>
  13. </view>
  14. <u-form :model="form" ref="form1" label-width=180 v-else>
  15. <u-form-item label="请选择车辆"><u-input v-model="state.form.choiceCarVal" type="select" :select-open="state.show" @click="state.show = true" placeholder='请选择车辆'/></u-form-item>
  16. <u-form-item label="车牌颜色"><u-input v-model="state.form.carColor" disabled placeholder='车牌颜色'/></u-form-item>
  17. </u-form>
  18. <u-form :model="form" ref="form1" label-width=180>
  19. <u-form-item label="手机号" class="phoneBox" v-if='state.showPhone'>
  20. <u-input placeholder='手机号' type="number" v-model="state.form.tel" />
  21. <u-button type="success" size="mini" @click="getCode" v-if="waitTime==0">获取验证码</u-button>
  22. <text class="btn" v-else>{{waitTime}}后重试</text>
  23. </u-form-item>
  24. <u-form-item v-if='state.showPhone' label="验证码"><u-input v-model="state.form.code" placeholder='请输入短信验证码'/></u-form-item>
  25. </u-form>
  26. </view>
  27. <u-picker mode="selector" :range="state.array" v-model="state.show" @confirm="regionConfirm"></u-picker>
  28. <u-picker mode="selector" :range="state.colorList" v-model="state.showColor" @confirm="regionConfirmColor"></u-picker>
  29. <button type="success" class='search' @click='goOpen'>开户</button>
  30. </view>
  31. </template>
  32. <script setup lang="ts">
  33. import { reactive,ref } from "vue";
  34. import {request} from "@/utils/network/request.js";
  35. import {sendCode} from "@/utils/network/api.js";
  36. import carNumberInput from "@/components/car-number-input/car-number-input.vue";
  37. import { navTo } from "@/utils/utils";
  38. const state = reactive({
  39. index: 0,
  40. array: ['贵ZJSZ21 蓝色', '贵ZJSZ21 红色', '贵ZJSZ21 绿色', '贵ZJSZ21 白色'],
  41. colorList:['蓝色','白色'],
  42. form:{
  43. choiceCarVal:'',
  44. carColor:'',
  45. tel:'',
  46. code:''
  47. },
  48. show:false,
  49. vehiclePlate:'', //车牌号
  50. showPhone:false, //是否展示车牌号
  51. inputCarNumber:false, //是否需要输入车牌号
  52. showColor:false, //选择车牌颜色
  53. });
  54. let waitTime = ref(0);
  55. const getCode = () => {
  56. console.log(123);
  57. if (state.form.tel) {
  58. sendCodeApi()
  59. codeInterval()
  60. } else {
  61. uni.showToast({
  62. title: '请输入手机号',
  63. icon: 'none'
  64. });
  65. }
  66. }
  67. // 发送验证码
  68. const sendCodeApi = (type) => {
  69. //参数说明
  70. let options = {
  71. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  72. data: {
  73. mobile: state.form.tel
  74. }, //请求参数
  75. method: "POST", //提交方式(默认POST)
  76. showLoading: true, //是否显示加载中(默认显示)
  77. };
  78. //调用方式
  79. request(sendCode, options)
  80. .then((res) => {
  81. let data = stringToJson(res.bizContent)
  82. console.log(data, "#################");
  83. if (data.info == "成功.") {
  84. console.log('######################CCCCCCCCCCCCCCCCC');
  85. }
  86. })
  87. .catch((err) => {
  88. console.log(err);
  89. });
  90. }
  91. //倒计时函数
  92. const codeInterval = () => {
  93. waitTime.value = 60
  94. let timer = setInterval(() => {
  95. if (waitTime.value == 1) {
  96. clearInterval(timer)
  97. }
  98. waitTime.value -= 1
  99. }, 1000)
  100. }
  101. const bindPickerChange=(e)=>{
  102. state.index = e.detail.value
  103. }
  104. // 选择车牌回调
  105. const regionConfirm = (e : any) => {
  106. console.log("e",e)
  107. state.form.choiceCarVal = state.array[e];
  108. state.showPhone=true;
  109. };
  110. // 选择颜色的回调
  111. const regionConfirmColor=(e : any)=>{
  112. state.form.carColor=state.colorList[e]
  113. }
  114. const change=()=>{
  115. console.log("11")
  116. state.inputCarNumber=!state.inputCarNumber
  117. state.form.choiceCarVal='';
  118. state.form.carColor='';
  119. }
  120. const carNumber = (val: any) => {
  121. state.vehiclePlate = val;
  122. };
  123. // 去开户页面
  124. const goOpen=()=>{
  125. navTo(`/subpackage/after-sale/account-recharge/open-account`);
  126. }
  127. </script>
  128. <style scoped>
  129. .content{
  130. background-color:rgb(246,246,246);
  131. height:100vh;
  132. }
  133. .content_all{
  134. background-color:white;
  135. }
  136. .change{
  137. text-align: right;
  138. padding-right: 20rpx;
  139. font-size: 32rpx;
  140. }
  141. .item{
  142. display:flex;
  143. border-bottom:2rpx solid rgb(239,239,239);
  144. padding: 18rpx 36rpx;
  145. font-size:32rpx;
  146. align-items: center;
  147. }
  148. /deep/.u-form{
  149. padding:0 40rpx !important;
  150. }
  151. .btn {
  152. flex: 1;
  153. background: rgb(75,217,97);
  154. font-size: 30rpx;
  155. color: white;
  156. z-index: 999;
  157. text-align: center;
  158. }
  159. ::v-deep .u-form-item--right__content__slot{
  160. display: flex;
  161. justify-content: space-between;
  162. }
  163. .title{
  164. margin-top: -32rpx;
  165. font-size: 32rpx;
  166. margin-bottom: 40rpx;
  167. margin-left:30rpx;
  168. }
  169. .search{
  170. background-color: rgb(25,190,107);
  171. color: white;
  172. height: 100rpx;
  173. line-height: 100rpx;
  174. font-size: 40rpx;
  175. margin-top: 70rpx;
  176. }
  177. </style>