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

etc-log-off.vue 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <view class="oderPage">
  3. <u-form :model="form" ref="myForm" :error-type="errorType">
  4. <view class="from">
  5. <u-form-item prop="equipmentState">
  6. <view class="from_item">
  7. <text><text style="color: red">*</text>设备注销:</text>
  8. <radio-group @change="radioChange" class="radios">
  9. <block v-for="(item, index) in radiolist" :key="item.val">
  10. <view class="radio-box">
  11. <radio :value="item.val" :checked="form.equipmentState == item.val" color="#13e7c1"
  12. style="transform:scale(0.75)" />
  13. <view>{{item.name}}</view>
  14. </view>
  15. </block>
  16. </radio-group>
  17. </view>
  18. </u-form-item>
  19. <u-form-item prop="phone">
  20. <view class="from_item" style="background-color: #f7f7f7">
  21. <text><text style="color: red"></text>手机号:</text>
  22. <u-input v-model="form.mobile" class="input" />
  23. </view>
  24. </u-form-item>
  25. <u-form-item prop="code">
  26. <view class="from_item">
  27. <text><text style="color: red"></text>验证码:</text>
  28. <u-input v-model="form.code" placeholder="请输入验证码" class="input" type="number" />
  29. <view class="hint2">
  30. <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
  31. <view class="grey" @click="getCode">{{
  32. codeDuration === 0 ? "发送验证码" : "秒后可重发"
  33. }}</view>
  34. </view>
  35. </view>
  36. </u-form-item>
  37. </view>
  38. </u-form>
  39. <button class="submit" @click="toPage()">下一步</button>
  40. </view>
  41. </template>
  42. <script setup lang="ts">
  43. import {
  44. ref,
  45. reactive
  46. } from "vue";
  47. import {
  48. navTo
  49. } from "@/utils/utils";
  50. import {
  51. onReady,
  52. onLoad
  53. } from "@dcloudio/uni-app";
  54. import {requestNew} from "@/utils/network/request.js";
  55. import {
  56. sendMessage,
  57. messageValid
  58. } from "@/utils/network/api.js";
  59. import {
  60. msg
  61. } from "@/utils/utils";
  62. // 表单数据
  63. const form = reactive({
  64. equipmentState: 2,
  65. equipmentStateName: "否",
  66. mobile: "",
  67. code: '',
  68. type: undefined,
  69. customerIdnum: "",
  70. userType: ""
  71. });
  72. //入参
  73. const params = reactive({
  74. cardId: '',
  75. obuId: '',
  76. orderId: ''
  77. });
  78. // 验证规则
  79. const rules = {
  80. code: [{
  81. required: true,
  82. message: "请输入验证码",
  83. trigger: ["change", "blur"],
  84. }],
  85. };
  86. // 验证提示类型(toast要版本为1.3.5才支持)
  87. const errorType = ["toast"];
  88. // 单选数据列表
  89. const radiolist = reactive([{
  90. name: "连接设备注销",
  91. val: 1,
  92. },
  93. {
  94. name: "无设备注销",
  95. val: 2,
  96. },
  97. ]);
  98. // 设置验证规则
  99. const myForm = ref(null);
  100. //倒计时时常
  101. const codeDuration = ref(0);
  102. let interval = null;
  103. /* 验证码倒计时 */
  104. const codeInterval = () => {
  105. codeDuration.value = 60;
  106. interval = setInterval(() => {
  107. codeDuration.value--;
  108. if (codeDuration.value === 0) {
  109. if (interval) {
  110. clearInterval(interval);
  111. interval = null;
  112. }
  113. }
  114. }, 1000);
  115. };
  116. onReady(() => {
  117. myForm.value.setRules(rules);
  118. });
  119. onLoad((option) => {
  120. let options = JSON.parse(decodeURIComponent(option.params))
  121. console.log("options", options)
  122. form.mobile = options.mobile
  123. form.type = options.type
  124. params.cardId = options.cardId
  125. params.obuId = options.obuId
  126. params.orderId = options.orderId
  127. form.customerIdnum = options.customerIdnum
  128. form.userType = options.userType
  129. });
  130. const getCode = () => {
  131. if (codeDuration.value !== 0) {
  132. return;
  133. }
  134. const options = {
  135. type: 2,
  136. data: {
  137. mobile: form.mobile
  138. },
  139. method: "POST",
  140. showLoading: true,
  141. };
  142. requestNew(sendMessage, options)
  143. .then((res) => {
  144. codeInterval();
  145. msg("验证码发送成功!");
  146. })
  147. .catch((err) => {
  148. console.log(err);
  149. });
  150. }
  151. // 单选
  152. const radioChange = (e : any) => {
  153. form.equipmentState = e.detail.value
  154. console.log(form.equipmentState, "222");
  155. };
  156. //下一步
  157. const toPage = () => {
  158. myForm.value.validate((valid) => {
  159. console.log(valid);
  160. if (valid) {
  161. const options = {
  162. type: 2,
  163. data: {
  164. mobile: form.mobile,
  165. code: form.code
  166. },
  167. method: "POST",
  168. showLoading: true,
  169. };
  170. requestNew(messageValid, options)
  171. .then(() => {
  172. let obj = {
  173. obuId: params.obuId,
  174. cardId: params.cardId,
  175. orderId: params.orderId,
  176. equipmentState: form.equipmentState,
  177. mobile: form.mobile,
  178. customerIdnum: form.customerIdnum,
  179. userType: form.userType
  180. }
  181. const paramss = encodeURIComponent(JSON.stringify(obj))
  182. navTo(
  183. `/subpackage/after-sale/ETC-log-off/upload-card?params=${paramss}`
  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. background: transparent;
  290. input {
  291. text-align: left;
  292. }
  293. }
  294. }
  295. .from_item1 {
  296. display: flex;
  297. flex-wrap: nowrap;
  298. flex-direction: column;
  299. justify-content: space-between;
  300. padding: 30rpx;
  301. border-bottom: #dcdcdc 1px solid;
  302. input {
  303. text-align: right;
  304. }
  305. .textarea {
  306. background-color: #f1f1f1;
  307. width: 100%;
  308. border-radius: 20rpx;
  309. margin-top: 10rpx;
  310. text-indent: 1rem;
  311. height: 180rpx;
  312. padding: 20rpx;
  313. box-sizing: border-box;
  314. }
  315. }
  316. }
  317. }
  318. .submit {
  319. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  320. width: 670rpx;
  321. height: 80rpx;
  322. color: #fff;
  323. border-radius: 100rpx;
  324. position: fixed;
  325. left: 50%;
  326. transform: translate(-50%);
  327. bottom: 60rpx;
  328. font-size: 32rpx;
  329. }
  330. </style>