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 11KB

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