選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

etc-log-off.vue 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <view class="oderPage">
  3. <u-form :model="form" ref="myForm" :error-type="errorType">
  4. <view class="from">
  5. <u-form-item v-if="(form.type==='2'||form.type==='3')" prop="equipmentState">
  6. <view class="from_item">
  7. <text><text style="color: red">*</text>是否有设备注销::</text>
  8. <!-- <u-radio-group v-model="form.equipmentStateName">
  9. <u-radio :customStyle="{ marginBottom: '8px' }" activeColor="#2CE242"
  10. v-for="(item, index) in radiolist" :key="index" :label="item.disabled" :name="item.name"
  11. @change="radioChange(item)">
  12. {{ item.name }}
  13. </u-radio>
  14. </u-radio-group> -->
  15. <radio-group @change="radioChange" class="radios">
  16. <block v-for="(item, index) in radiolist" :key="item.val">
  17. <view class="radio-box">
  18. <radio :value="item.val" :checked="form.equipmentState == item.val" color="#13e7c1" style="transform:scale(0.75)" />
  19. <view>{{item.name}}</view>
  20. </view>
  21. </block>
  22. </radio-group>
  23. </view>
  24. </u-form-item>
  25. <u-form-item prop="phone">
  26. <view class="from_item" style="background-color: #f7f7f7">
  27. <text><text style="color: red"></text>手机号:</text>
  28. <u-input v-model="form.mobile" class="input" />
  29. </view>
  30. </u-form-item>
  31. <u-form-item prop="code">
  32. <view class="from_item">
  33. <text><text style="color: red"></text>验证码:</text>
  34. <u-input v-model="form.code" placeholder="请输入验证码" class="input" />
  35. <view class="hint2">
  36. <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
  37. <view class="grey" @click="getCode">{{
  38. codeDuration === 0 ? "发送验证码" : "秒后可重发"
  39. }}</view>
  40. </view>
  41. </view>
  42. </u-form-item>
  43. </view>
  44. </u-form>
  45. <button class="submit" @click="toPage()">下一步</button>
  46. </view>
  47. </template>
  48. <script setup lang="ts">
  49. import navBar from "./components/nav-bar.vue";
  50. import {
  51. checkStr
  52. } from "@/utils/utils";
  53. import {
  54. ref,
  55. reactive
  56. } from "vue";
  57. import {
  58. navTo
  59. } from "../../utils/utils";
  60. import {
  61. onReady,
  62. onLoad
  63. } from "@dcloudio/uni-app";
  64. import {
  65. request
  66. } from "../../utils/network/request.js";
  67. import {
  68. sendCode,
  69. checkCode
  70. } from "@/utils/network/api.js";
  71. import {
  72. msg
  73. } from "@/utils/utils";
  74. // 表单数据
  75. const form = reactive({
  76. equipmentState: 2,
  77. equipmentStateName: "否",
  78. mobile: "",
  79. code: '',
  80. type: undefined,
  81. });
  82. //入参
  83. const params = reactive({
  84. cardId: '',
  85. obuId: '',
  86. orderId: ''
  87. });
  88. // 验证规则
  89. const rules = {
  90. code: [{
  91. required: true,
  92. message: "请输入验证码",
  93. trigger: ["change", "blur"],
  94. }],
  95. };
  96. // 验证提示类型(toast要版本为1.3.5才支持)
  97. const errorType = ["toast"];
  98. // 单选数据列表
  99. const radiolist = reactive([{
  100. name: "是",
  101. val: 1,
  102. },
  103. {
  104. name: "否",
  105. val: 2,
  106. },
  107. ]);
  108. // 设置验证规则
  109. const myForm = ref(null);
  110. //倒计时时常
  111. const codeDuration = ref(0);
  112. let interval = null;
  113. /* 验证码倒计时 */
  114. const codeInterval = () => {
  115. codeDuration.value = 60;
  116. interval = setInterval(() => {
  117. codeDuration.value--;
  118. if (codeDuration.value === 0) {
  119. if (interval) {
  120. clearInterval(interval);
  121. interval = null;
  122. }
  123. }
  124. }, 1000);
  125. };
  126. onReady(() => {
  127. myForm.value.setRules(rules);
  128. });
  129. onLoad((option) => {
  130. form.mobile = option.mobile
  131. form.type = option.type
  132. params.cardId = option.cardId
  133. params.obuId = option.obuId
  134. });
  135. const getCode = () => {
  136. if (codeDuration.value !== 0) {
  137. return;
  138. }
  139. const options = {
  140. type: 2,
  141. data: {
  142. mobile: form.mobile
  143. },
  144. method: "POST",
  145. showLoading: true,
  146. };
  147. request(sendCode, options)
  148. .then((res) => {
  149. codeInterval();
  150. msg("验证码发送成功!");
  151. })
  152. .catch((err) => {
  153. console.log(err);
  154. });
  155. }
  156. // 单选
  157. const radioChange = (e : any) => {
  158. console.log(e);
  159. form.equipmentState = e.detail.value
  160. // if (val.name === '是') {
  161. // form.equipmentState = '1';
  162. // } else {
  163. // form.equipmentState = '2';
  164. // }
  165. };
  166. //下一步
  167. const toPage = () => {
  168. myForm.value.validate((valid) => {
  169. console.log(valid);
  170. if (valid) {
  171. const options = {
  172. type: 2,
  173. data: {
  174. mobile: form.mobile,
  175. code: form.code
  176. },
  177. method: "POST",
  178. showLoading: true,
  179. };
  180. request(checkCode, options)
  181. .then(() => {
  182. navTo(
  183. `/after-sale/ETC-log-off/upload-card?obuId=${params.obuId}&&cardId=${params.cardId}&&orderId=${params.orderId}&&equipmentState=${form.equipmentState}`
  184. );
  185. })
  186. .catch((err) => {
  187. console.log(err);
  188. });
  189. } else {
  190. console.log("验证未通过");
  191. }
  192. });
  193. };
  194. </script>
  195. <style>
  196. page {
  197. width: 100%;
  198. height: 100%;
  199. display: flex;
  200. flex-direction: column;
  201. background-color: ##eef7f7;
  202. }
  203. </style>
  204. <style lang="scss" scoped>
  205. .radios{
  206. display: flex;
  207. }
  208. .radio-box{
  209. display: flex;
  210. align-items: center;
  211. padding-left: 40rpx;
  212. }
  213. .hint2 {
  214. display: flex;
  215. .green {
  216. font-size: 28rpx;
  217. color: #00b38b;
  218. }
  219. .grey {
  220. font-size: 24rpx;
  221. color: #000000;
  222. margin-left: 16rpx;
  223. }
  224. }
  225. .oderPage {
  226. flex: 1;
  227. width: 100%;
  228. .from1 {
  229. background-color: #fff;
  230. margin-top: 30rpx;
  231. padding: 0 30rpx;
  232. ::v-deep .uni-forms-item {
  233. border-bottom: 1rpx solid #ccc;
  234. padding: 15rpx 0;
  235. margin-bottom: 0;
  236. .uni-forms-item__label {
  237. font-size: 28rpx;
  238. height: 50rpx;
  239. }
  240. .uni-forms-item__content {
  241. display: flex;
  242. }
  243. .uni-easyinput__content-input {
  244. font-size: 28rpx;
  245. height: 50rpx;
  246. }
  247. }
  248. .btn {
  249. line-height: 38rpx;
  250. font-size: 24rpx;
  251. font-family: Microsoft YaHei;
  252. font-weight: 400;
  253. color: #ffffff;
  254. background: #00b38b;
  255. border-radius: 10rpx;
  256. padding: 10rpx 15rpx;
  257. }
  258. }
  259. .from {
  260. background-color: #fff;
  261. margin-top: 30rpx;
  262. padding: 0 30rpx;
  263. ::v-deep .u-form-item {
  264. padding: 0;
  265. line-height: normal;
  266. .u-form-item__message {
  267. margin-bottom: 12rpx;
  268. }
  269. }
  270. .from_item {
  271. display: flex;
  272. flex-wrap: nowrap;
  273. justify-content: space-between;
  274. align-items: center;
  275. height: 80rpx;
  276. border-bottom: 1rpx solid #dcdcdc;
  277. .btn {
  278. font-size: 24rpx;
  279. font-family: Microsoft YaHei;
  280. font-weight: 400;
  281. color: #ffffff;
  282. background: #00b38b;
  283. border-radius: 10rpx;
  284. padding: 10rpx 15rpx;
  285. }
  286. ::v-deep .input {
  287. text-align: left;
  288. flex: 1;
  289. input {
  290. text-align: left;
  291. }
  292. }
  293. }
  294. .from_item1 {
  295. display: flex;
  296. flex-wrap: nowrap;
  297. flex-direction: column;
  298. justify-content: space-between;
  299. padding: 30rpx;
  300. border-bottom: #dcdcdc 1px solid;
  301. input {
  302. text-align: right;
  303. }
  304. .textarea {
  305. background-color: #f1f1f1;
  306. width: 100%;
  307. border-radius: 20rpx;
  308. margin-top: 10rpx;
  309. text-indent: 1rem;
  310. height: 180rpx;
  311. padding: 20rpx;
  312. box-sizing: border-box;
  313. }
  314. }
  315. }
  316. }
  317. .submit {
  318. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  319. width: 670rpx;
  320. height: 80rpx;
  321. color: #fff;
  322. border-radius: 100rpx;
  323. position: fixed;
  324. left: 50%;
  325. transform: translate(-50%);
  326. bottom: 60rpx;
  327. font-size: 32rpx;
  328. }
  329. </style>