您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

verification.vue 10KB

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