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.

verification.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  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="cardState">
  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 radiolist1" :key="item.val">
  10. <view class="radio-box">
  11. <radio :value="item.val" :checked="form.applyType == 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="cardState">
  20. <view class="from_item">
  21. <text><text style="color: red">*</text>设备损坏类型:</text>
  22. <radio-group @change="typeChange" class="radios">
  23. <block v-for="(item, index) in radiolist2" :key="item.val">
  24. <view class="radio-box">
  25. <radio :value="item.val" :checked="form.damageMode == item.val" color="#13e7c1"
  26. style="transform:scale(0.75)" />
  27. <view>{{item.name}}</view>
  28. </view>
  29. </block>
  30. </radio-group>
  31. </view>
  32. </u-form-item>
  33. </view>
  34. </u-form>
  35. <view style="margin: 30rpx;" v-if="state.isPicture">
  36. <view class="please"><text style="color: red">*</text>请上传图片:</view>
  37. <uni-file-picker fileMediatype="image" mode="grid" :limit="9" @select="select"
  38. :image-styles="state.imageStyles" />
  39. </view>
  40. <view class="attention">
  41. <view>注意事项:</view>
  42. <view>1.设备人为损坏时需要支付设备费用;</view>
  43. <view>2.设备自然损坏时:</view>
  44. <view>&nbsp;(1)更换的设备中有设备不在质保期内,需要支付对应的设备费用;</view>
  45. <view>&nbsp;(2)选择自然损坏需要将损坏的设备寄回,不寄回则视为人为损坏,需要支付设备费用;</view>
  46. <view>&nbsp;(3)寄回的设备由专业人员进行检测,检测结果为自然损坏且在质保期内,则免费更换,检测结果为人为损坏则需要支付设备费用;</view>
  47. <view>3.设备费用,卡20元,obu130元。</view>
  48. </view>
  49. <view class="btn-wrapper">
  50. <button class="submit button" v-if="apply.data.status === 'APPLY'||!apply.data.status" @click="toPage()"
  51. type="default">下一步填写资料</button>
  52. </view>
  53. </view>
  54. </template>
  55. <script setup lang="ts">
  56. import { jump } from "@/datas/9901Jump.js";
  57. import {
  58. ref,
  59. reactive
  60. } from "vue";
  61. import {
  62. navTo, uploadFile
  63. } from "@/utils/utils";
  64. import {
  65. onReady,
  66. onLoad,
  67. onShow,
  68. } from "@dcloudio/uni-app";
  69. import {
  70. request
  71. } from "@/utils/network/request.js";
  72. import {
  73. sendCode,
  74. changeCardApply,
  75. changeCardQuery,
  76. } from "@/utils/network/api.js";
  77. import {
  78. stringToJson
  79. } from "@/utils/network/encryption";
  80. import {
  81. msg
  82. } from "@/utils/utils";
  83. const state = reactive({
  84. imageList: [], //图片数据
  85. imageStyles: {
  86. width: 80,
  87. height: 80,
  88. },
  89. isPicture: false, //是否上传图片
  90. })
  91. // 表单数据
  92. const form = reactive({
  93. damageMode: "0",
  94. damageModeName: '人为损坏',
  95. applyType: 'EXCHANGE_CARD',
  96. applyTypeName: '卡',
  97. mobile: "",
  98. code: '',
  99. applyRes: ''
  100. });
  101. const apply = reactive({
  102. data: {
  103. status: undefined,
  104. id: ''
  105. }
  106. });
  107. //入参
  108. const params = reactive({
  109. cardId: '',
  110. obuId: '',
  111. orderId: ''
  112. });
  113. // 单选数据列表
  114. const radiolist1 = reactive([{
  115. name: "卡",
  116. val: "EXCHANGE_CARD",
  117. },
  118. {
  119. name: "OBU",
  120. val: "EXCHANGE_OBU",
  121. }, {
  122. name: "卡和OBU",
  123. val: "EXCHANGE_ALL",
  124. },
  125. ]);
  126. // 单选数据列表
  127. const radiolist2 = reactive([{
  128. name: "人为损坏",
  129. val: "0",
  130. },
  131. {
  132. name: "自然损坏",
  133. val: "1",
  134. }
  135. ]);
  136. // 验证规则
  137. const rules = {
  138. code: [{
  139. required: true,
  140. message: "请输入验证码",
  141. trigger: ["change", "blur"],
  142. }],
  143. };
  144. // 验证提示类型(toast要版本为1.3.5才支持)
  145. const errorType = ["toast"];
  146. // 设置验证规则
  147. const myForm = ref(null);
  148. //倒计时时常
  149. const codeDuration = ref(0);
  150. let interval = null;
  151. /* 验证码倒计时 */
  152. const codeInterval = () => {
  153. codeDuration.value = 60;
  154. interval = setInterval(() => {
  155. codeDuration.value--;
  156. if (codeDuration.value === 0) {
  157. if (interval) {
  158. clearInterval(interval);
  159. interval = null;
  160. }
  161. }
  162. }, 1000);
  163. };
  164. onReady(() => {
  165. myForm.value.setRules(rules);
  166. });
  167. onLoad((option) => {
  168. form.mobile = option.mobile
  169. params.cardId = option.cardId
  170. params.orderId = option.orderId
  171. });
  172. onShow(() => {
  173. changeCardQueryAction()
  174. })
  175. const select = (e) => {
  176. console.log('选择文件:', e)
  177. uploadFile(e.tempFilePaths[0], "", "").then((data) => {
  178. const imgArr = state.imageList
  179. imgArr.push(data)
  180. state.imageList = imgArr;
  181. console.log("data.data.url", state.imageList)
  182. })
  183. }
  184. // 单选
  185. const radioChange = (e : any) => {
  186. console.log(e);
  187. form.applyType = e.detail.value
  188. };
  189. // 单选
  190. const typeChange = (e : any) => {
  191. console.log(e);
  192. form.damageMode = e.detail.value
  193. if (e.detail.value == 1) {
  194. state.isPicture = true
  195. } else {
  196. state.isPicture = false
  197. }
  198. };
  199. const getCode = () => {
  200. if (codeDuration.value !== 0) {
  201. return;
  202. }
  203. const options = {
  204. type: 2,
  205. data: {
  206. mobile: form.mobile
  207. },
  208. method: "POST",
  209. showLoading: true,
  210. };
  211. request(sendCode, options)
  212. .then((res) => {
  213. codeInterval();
  214. msg("验证码发送成功!");
  215. })
  216. .catch((err) => {
  217. console.log(err);
  218. });
  219. }
  220. //查询申请单
  221. const changeCardQueryAction = () => {
  222. var data = {
  223. orderId: params.orderId
  224. };
  225. const options = {
  226. type: 2,
  227. data: data,
  228. method: "POST",
  229. showLoading: true,
  230. };
  231. request(changeCardQuery, options).then((res) => {
  232. const data = stringToJson(res.bizContent);
  233. if (data) {
  234. apply.data = data;
  235. apply.data.status = data.status;
  236. }
  237. })
  238. }
  239. //申请
  240. const queryCckChangejzCardAction = () => {
  241. if (form.damageMode == "1") {
  242. if (state.imageList.length == 0) {
  243. msg('请上传图片');
  244. return;
  245. }
  246. }
  247. var data = {
  248. orderId: params.orderId,
  249. applyType: form.applyType,
  250. damageMode: form.damageMode,//0 --- 人为损坏 1 --- 自然损坏 当为换卡签的时候必传
  251. fileUrl: state.imageList.toString()
  252. };
  253. const options = {
  254. type: 2,
  255. data: data,
  256. method: "POST",
  257. showLoading: true,
  258. };
  259. return new Promise(async (resolve, reject) => {
  260. const res = await request(changeCardApply, options);
  261. var resultData = res.bizContent
  262. console.log("data88888", JSON.parse(resultData))
  263. resolve(JSON.parse(resultData));
  264. }).catch((error) => {
  265. reject(error);
  266. });
  267. }
  268. //下一步
  269. const toPage = () => {
  270. console.log("sdkchkdscn", apply.data)
  271. console.log("form.damageMode", form.damageMode)
  272. // if(state.aa){
  273. // let obj={
  274. // applyType:form.applyType,
  275. // vehicleId:form.vehicleId,
  276. // cardId:params.cardId,
  277. // }
  278. // const params = encodeURIComponent(JSON.stringify(obj))
  279. // jump("5",params)
  280. // }else{
  281. queryCckChangejzCardAction().then(val => {
  282. console.log("val888888", val)
  283. navTo(
  284. `/subpackage/after-sale/replace-equipment/form?orderId=${params.orderId}&&id=${val.id}&&damageMode=${form.damageMode}&&msg=${val.msg}&&cardExpire=${val.cardExpire}&&obuExpire=${val.obuExpire}`
  285. )
  286. })
  287. // }
  288. };
  289. </script>
  290. <style>
  291. page {
  292. width: 100%;
  293. height: 100%;
  294. display: flex;
  295. flex-direction: column;
  296. background-color: ##eef7f7;
  297. }
  298. </style>
  299. <style lang="scss" scoped>
  300. .radios {
  301. display: flex;
  302. }
  303. .radio-box {
  304. display: flex;
  305. align-items: center;
  306. padding-left: 20rpx;
  307. }
  308. .hint2 {
  309. display: flex;
  310. .green {
  311. font-size: 28rpx;
  312. color: #00b38b;
  313. }
  314. .grey {
  315. font-size: 24rpx;
  316. color: #000000;
  317. margin-left: 16rpx;
  318. }
  319. }
  320. .oderPage {
  321. flex: 1;
  322. width: 100%;
  323. .from1 {
  324. background-color: #fff;
  325. margin-top: 30rpx;
  326. padding: 0 30rpx;
  327. ::v-deep .uni-forms-item {
  328. border-bottom: 1rpx solid #ccc;
  329. padding: 15rpx 0;
  330. margin-bottom: 0;
  331. .uni-forms-item__label {
  332. font-size: 28rpx;
  333. height: 50rpx;
  334. }
  335. .uni-forms-item__content {
  336. display: flex;
  337. }
  338. .uni-easyinput__content-input {
  339. font-size: 28rpx;
  340. height: 50rpx;
  341. }
  342. }
  343. .btn {
  344. line-height: 38rpx;
  345. font-size: 24rpx;
  346. font-family: Microsoft YaHei;
  347. font-weight: 400;
  348. color: #ffffff;
  349. background: #00b38b;
  350. border-radius: 10rpx;
  351. padding: 10rpx 15rpx;
  352. }
  353. }
  354. .from {
  355. background-color: #fff;
  356. margin-top: 30rpx;
  357. padding: 0 30rpx;
  358. ::v-deep .u-form-item {
  359. padding: 0;
  360. line-height: normal;
  361. .u-form-item__message {
  362. margin-bottom: 12rpx;
  363. }
  364. }
  365. .from_item {
  366. display: flex;
  367. flex-wrap: nowrap;
  368. justify-content: space-between;
  369. align-items: center;
  370. height: 80rpx;
  371. border-bottom: 1rpx solid #dcdcdc;
  372. .btn {
  373. font-size: 24rpx;
  374. font-family: Microsoft YaHei;
  375. font-weight: 400;
  376. color: #ffffff;
  377. background: #00b38b;
  378. border-radius: 10rpx;
  379. padding: 10rpx 15rpx;
  380. }
  381. ::v-deep .input {
  382. text-align: left;
  383. flex: 1;
  384. background: transparent;
  385. input {
  386. text-align: left;
  387. }
  388. }
  389. }
  390. .from_item1 {
  391. display: flex;
  392. flex-wrap: nowrap;
  393. flex-direction: column;
  394. justify-content: space-between;
  395. padding: 30rpx;
  396. border-bottom: #dcdcdc 1px solid;
  397. input {
  398. text-align: right;
  399. }
  400. .textarea {
  401. background-color: #f1f1f1;
  402. width: 100%;
  403. border-radius: 20rpx;
  404. margin-top: 10rpx;
  405. text-indent: 1rem;
  406. height: 180rpx;
  407. padding: 20rpx;
  408. box-sizing: border-box;
  409. }
  410. }
  411. }
  412. }
  413. .btn-wrapper {
  414. display: flex;
  415. padding-top: 60rpx;
  416. }
  417. .button::after {
  418. border: none;
  419. }
  420. .default {
  421. height: 80rpx;
  422. background: rgba(0, 179, 139, .1);
  423. border-radius: 40rpx;
  424. font-size: 32rpx;
  425. font-weight: 400;
  426. color: #00B38B;
  427. line-height: 80rpx;
  428. width: 45%;
  429. border: 1px solid #00B38B;
  430. }
  431. .submit {
  432. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  433. height: 80rpx;
  434. line-height: 80rpx;
  435. color: #fff;
  436. border-radius: 100rpx;
  437. font-size: 32rpx;
  438. width: 45%;
  439. }
  440. .upload-img {
  441. margin-top: 10rpx;
  442. }
  443. .please {
  444. font-size: 28rpx;
  445. margin-bottom: 20rpx;
  446. }
  447. .attention {
  448. padding: 20rpx;
  449. font-size: 28rpx;
  450. }
  451. </style>