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-huanhuo.vue 9.5KB

hace 10 meses
hace 10 meses
hace 10 meses
hace 10 meses
hace 10 meses
hace 10 meses
hace 10 meses
hace 10 meses
hace 10 meses
hace 10 meses
hace 10 meses
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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" @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. } from "@dcloudio/uni-app";
  67. import {requestNew} from "@/utils/network/request.js";
  68. import {
  69. sendMessage,
  70. changeCardObuExchangeApply
  71. } from "@/utils/network/api.js";
  72. import {
  73. msg
  74. } from "@/utils/utils";
  75. const state = reactive({
  76. imageList: [], //图片数据
  77. imageStyles: {
  78. width: 80,
  79. height: 80,
  80. },
  81. isPicture: false, //是否上传图片
  82. vehicleId:"",
  83. })
  84. // 表单数据
  85. const form = reactive({
  86. damageMode: "ARTIFICIAL",
  87. damageModeName: '人为损坏',
  88. applyType: '1',
  89. applyTypeName: '卡',
  90. mobile: "",
  91. code: '',
  92. applyRes: ''
  93. });
  94. const apply = reactive({
  95. data: {
  96. status: undefined,
  97. id: ''
  98. }
  99. });
  100. //入参
  101. const params = reactive({
  102. cardId: '',
  103. obuId: '',
  104. orderId: '',
  105. id:""
  106. });
  107. // 单选数据列表
  108. const radiolist1 = reactive([{
  109. name: "卡",
  110. val: "1",
  111. },
  112. {
  113. name: "OBU",
  114. val: "2",
  115. }, {
  116. name: "卡和OBU",
  117. val: "3",
  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.id = option.id
  166. params.orderId = option.orderId
  167. state.vehicleId = option.vehicleId
  168. });
  169. const select = (e) => {
  170. console.log('选择文件:', e)
  171. uploadFile(e.tempFilePaths[0], "", "").then((data) => {
  172. const imgArr = state.imageList
  173. imgArr.push(data)
  174. state.imageList = imgArr;
  175. console.log("data.data.url", state.imageList)
  176. })
  177. }
  178. // 单选
  179. const radioChange = (e : any) => {
  180. console.log(e);
  181. form.applyType = e.detail.value
  182. };
  183. // 单选
  184. const typeChange = (e : any) => {
  185. console.log(e);
  186. form.damageMode = e.detail.value
  187. if (e.detail.value == 'NATURAL') {
  188. state.isPicture = true
  189. } else {
  190. state.isPicture = false
  191. }
  192. };
  193. const getCode = () => {
  194. if (codeDuration.value !== 0) {
  195. return;
  196. }
  197. const options = {
  198. type: 2,
  199. data: {
  200. mobile: form.mobile
  201. },
  202. method: "POST",
  203. showLoading: true,
  204. };
  205. requestNew(sendMessage, options)
  206. .then((res) => {
  207. codeInterval();
  208. msg("验证码发送成功!");
  209. })
  210. .catch((err) => {
  211. console.log(err);
  212. });
  213. }
  214. //申请
  215. const queryCckChangejzCardAction = () => {
  216. if (form.damageMode == "2") {
  217. if (state.imageList.length == 0) {
  218. msg('请上传图片');
  219. return;
  220. }
  221. }
  222. var data = {
  223. orderId: params.orderId,
  224. exchangeType: form.applyType, //换货类型 1-只换卡 2-只换签 3-卡签都换
  225. damageMode: form.damageMode,//0 --- 人为损坏 1 --- 自然损坏 当为换卡签的时候必传
  226. fileUrl: state.imageList.toString(),
  227. vehicleId:state.vehicleId,
  228. oldCardId:params.cardId,
  229. id:params.id // 售后订单 id
  230. };
  231. const options = {
  232. type: 2,
  233. data: data,
  234. method: "POST",
  235. showLoading: true,
  236. };
  237. return new Promise(async (resolve, reject) => {
  238. const res = await requestNew(changeCardObuExchangeApply, options);
  239. var resultData = res
  240. console.log("data88888", resultData)
  241. resolve(res);
  242. }).catch((error) => {
  243. reject(error);
  244. });
  245. }
  246. //下一步
  247. const toPage = () => {
  248. console.log("sdkchkdscn", apply.data)
  249. console.log("form.damageMode", form.damageMode,form.applyType)
  250. queryCckChangejzCardAction().then(val => {
  251. console.log("val888888", val)
  252. navTo(
  253. `/subpackage/after-sale/replace-equipment/form-huanhuo?orderId=${params.orderId}&&id=${val}&&damageMode=${form.damageMode}&&oldCardId=${params.cardId}&&oldObuId=${params.obuId}&&vehicleId=${state.vehicleId}`
  254. )
  255. })
  256. };
  257. </script>
  258. <style>
  259. page {
  260. width: 100%;
  261. height: 100%;
  262. display: flex;
  263. flex-direction: column;
  264. background-color: ##eef7f7;
  265. }
  266. </style>
  267. <style lang="scss" scoped>
  268. .radios {
  269. display: flex;
  270. }
  271. .radio-box {
  272. display: flex;
  273. align-items: center;
  274. padding-left: 20rpx;
  275. }
  276. .hint2 {
  277. display: flex;
  278. .green {
  279. font-size: 28rpx;
  280. color: #00b38b;
  281. }
  282. .grey {
  283. font-size: 24rpx;
  284. color: #000000;
  285. margin-left: 16rpx;
  286. }
  287. }
  288. .oderPage {
  289. flex: 1;
  290. width: 100%;
  291. .from1 {
  292. background-color: #fff;
  293. margin-top: 30rpx;
  294. padding: 0 30rpx;
  295. ::v-deep .uni-forms-item {
  296. border-bottom: 1rpx solid #ccc;
  297. padding: 15rpx 0;
  298. margin-bottom: 0;
  299. .uni-forms-item__label {
  300. font-size: 28rpx;
  301. height: 50rpx;
  302. }
  303. .uni-forms-item__content {
  304. display: flex;
  305. }
  306. .uni-easyinput__content-input {
  307. font-size: 28rpx;
  308. height: 50rpx;
  309. }
  310. }
  311. .btn {
  312. line-height: 38rpx;
  313. font-size: 24rpx;
  314. font-family: Microsoft YaHei;
  315. font-weight: 400;
  316. color: #ffffff;
  317. background: #00b38b;
  318. border-radius: 10rpx;
  319. padding: 10rpx 15rpx;
  320. }
  321. }
  322. .from {
  323. background-color: #fff;
  324. margin-top: 30rpx;
  325. padding: 0 30rpx;
  326. ::v-deep .u-form-item {
  327. padding: 0;
  328. line-height: normal;
  329. .u-form-item__message {
  330. margin-bottom: 12rpx;
  331. }
  332. }
  333. .from_item {
  334. display: flex;
  335. flex-wrap: nowrap;
  336. justify-content: space-between;
  337. align-items: center;
  338. height: 80rpx;
  339. border-bottom: 1rpx solid #dcdcdc;
  340. .btn {
  341. font-size: 24rpx;
  342. font-family: Microsoft YaHei;
  343. font-weight: 400;
  344. color: #ffffff;
  345. background: #00b38b;
  346. border-radius: 10rpx;
  347. padding: 10rpx 15rpx;
  348. }
  349. ::v-deep .input {
  350. text-align: left;
  351. flex: 1;
  352. background: transparent;
  353. input {
  354. text-align: left;
  355. }
  356. }
  357. }
  358. .from_item1 {
  359. display: flex;
  360. flex-wrap: nowrap;
  361. flex-direction: column;
  362. justify-content: space-between;
  363. padding: 30rpx;
  364. border-bottom: #dcdcdc 1px solid;
  365. input {
  366. text-align: right;
  367. }
  368. .textarea {
  369. background-color: #f1f1f1;
  370. width: 100%;
  371. border-radius: 20rpx;
  372. margin-top: 10rpx;
  373. text-indent: 1rem;
  374. height: 180rpx;
  375. padding: 20rpx;
  376. box-sizing: border-box;
  377. }
  378. }
  379. }
  380. }
  381. .btn-wrapper {
  382. display: flex;
  383. padding-top: 60rpx;
  384. }
  385. .button::after {
  386. border: none;
  387. }
  388. .default {
  389. height: 80rpx;
  390. background: rgba(0, 179, 139, .1);
  391. border-radius: 40rpx;
  392. font-size: 32rpx;
  393. font-weight: 400;
  394. color: #00B38B;
  395. line-height: 80rpx;
  396. width: 45%;
  397. border: 1px solid #00B38B;
  398. }
  399. .submit {
  400. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  401. height: 80rpx;
  402. line-height: 80rpx;
  403. color: #fff;
  404. border-radius: 100rpx;
  405. font-size: 32rpx;
  406. width: 45%;
  407. }
  408. .upload-img {
  409. margin-top: 10rpx;
  410. }
  411. .please {
  412. font-size: 28rpx;
  413. margin-bottom: 20rpx;
  414. }
  415. .attention {
  416. padding: 20rpx;
  417. font-size: 28rpx;
  418. }
  419. </style>