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.

additional-equipment-verification.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <view class="oderPage">
  3. <view v-if="form.receiveMethodName==='邮寄'" class="addr-box">
  4. <view class="addr-box-left">
  5. <view class="text-image">{{form.customerName.charAt(0)}} </view>
  6. <view class="content">
  7. <view class="">
  8. <text class="item1">{{form.customerName}}</text>
  9. <text class="item2">{{form.customerTel}}</text>
  10. <text class="item3">默认</text>
  11. </view>
  12. <view class=""> {{form.area +form.address}}</view>
  13. </view>
  14. </view>
  15. <view class="edit">
  16. <image :src="`${$imgUrl}applyCard/edit.png`" mode=""></image>
  17. </view>
  18. </view>
  19. <u-form :model="form" ref="myForm" :error-type="errorType">
  20. <view class="from">
  21. <u-form-item prop="cardState">
  22. <view class="from_item">
  23. <text><text style="color: red">*</text>是否邮寄:</text>
  24. <u-radio-group v-model="form.receiveMethodName">
  25. <u-radio :customStyle="{ marginBottom: '8px' }" activeColor="#2CE242"
  26. v-for="(item, index) in radiolist1" :key="index" :label="item.disabled"
  27. :name="item.name">
  28. {{ item.name }}
  29. </u-radio>
  30. </u-radio-group>
  31. </view>
  32. </u-form-item>
  33. <!-- <u-form-item prop="phone">
  34. <view class="from_item" style="background-color: #f7f7f7">
  35. <text><text style="color: red"></text>手机号:</text>
  36. <u-input v-model="form.mobile" :disabled="true" class="input" />
  37. </view>
  38. </u-form-item>
  39. <u-form-item prop="code">
  40. <view class="from_item">
  41. <text><text style="color: red"></text>验证码:</text>
  42. <u-input v-model="form.code" placeholder="请输入验证码" class="input" />
  43. <view class="hint2">
  44. <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
  45. <view class="grey" @click="getCode">{{
  46. codeDuration === 0 ? "发送验证码" : "秒后可重发"
  47. }}</view>
  48. </view>
  49. </view>
  50. </u-form-item> -->
  51. </view>
  52. </u-form>
  53. <button style="margin-top: 50rpx;" class="submit" @click="toPage()">OBU增补申请</button>
  54. </view>
  55. </template>
  56. <script setup lang="ts">
  57. import navBar from "./components/nav-bar.vue";
  58. import {
  59. checkStr
  60. } from "@/utils/utils";
  61. import {
  62. ref,
  63. reactive
  64. } from "vue";
  65. import {
  66. navTo
  67. } from "../../utils/utils";
  68. import {
  69. onReady,
  70. onLoad
  71. } from "@dcloudio/uni-app";
  72. import {
  73. request
  74. } from "../../utils/network/request.js";
  75. import {
  76. getItem,
  77. StorageKeys
  78. } from "@/utils/storage";
  79. import {
  80. sendCode,
  81. checkCode,
  82. addressQuery,
  83. queryOBUAdd,
  84. wechatPayConfigId
  85. } from "@/utils/network/api.js";
  86. import {
  87. stringToJson
  88. } from "@/utils/network/encryption";
  89. import {
  90. msg
  91. } from "@/utils/utils";
  92. // 表单数据
  93. const form = reactive({
  94. receiveMethod: "0",
  95. receiveMethodName: '不邮寄',
  96. customerName: '',
  97. customerTel: '',
  98. mobile: "",
  99. code: '',
  100. address: '',
  101. area: '',
  102. postCode: ''
  103. });
  104. const apply = reactive({
  105. data: {
  106. status: undefined,
  107. id: ''
  108. }
  109. });
  110. //入参
  111. const params = reactive({
  112. cardId: '',
  113. obuId: '',
  114. orderId: ''
  115. });
  116. // 单选数据列表
  117. const radiolist1 = reactive([{
  118. name: "不邮寄",
  119. disabled: false,
  120. },
  121. {
  122. name: "邮寄",
  123. disabled: false,
  124. },
  125. ]);
  126. // 单选数据列表
  127. const radiolist2 = reactive([{
  128. name: "人为损坏",
  129. disabled: false,
  130. },
  131. {
  132. name: "自然损坏",
  133. disabled: false,
  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. const address = reactive({
  152. list: []
  153. }); //地址list
  154. /* 验证码倒计时 */
  155. const codeInterval = () => {
  156. codeDuration.value = 60;
  157. interval = setInterval(() => {
  158. codeDuration.value--;
  159. if (codeDuration.value === 0) {
  160. if (interval) {
  161. clearInterval(interval);
  162. interval = null;
  163. }
  164. }
  165. }, 1000);
  166. };
  167. onReady(() => {
  168. myForm.value.setRules(rules);
  169. });
  170. onLoad((option) => {
  171. form.mobile = option.mobile
  172. params.cardId = option.cardId
  173. params.orderId = option.orderId
  174. getAddressList()
  175. });
  176. const getAddressList = () => {
  177. var data = {
  178. openId: getItem(StorageKeys.OpenId),
  179. };
  180. const options = {
  181. type: 2,
  182. data: data,
  183. method: "POST",
  184. showLoading: true,
  185. };
  186. request(addressQuery, options).then((res) => {
  187. const data = stringToJson(res.bizContent);
  188. address.list = data.data;
  189. if (address.list.length > 0) {
  190. var defaultAddress = address.list[0]
  191. form.customerName = defaultAddress.consignee
  192. form.customerTel = defaultAddress.consigneeTel
  193. form.address = defaultAddress.address
  194. form.area = defaultAddress.region
  195. form.postCode = defaultAddress.postalCode
  196. }
  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 queryOBUAddAction = () => {
  222. if (form.receiveMethodName === '不邮寄') {
  223. form.receiveMethod = '0'
  224. } else {
  225. form.receiveMethod = '1'
  226. }
  227. var data = {
  228. orderId: params.orderId,
  229. openId: getItem(StorageKeys.OpenId),
  230. configId: wechatPayConfigId,
  231. receiveMethod: form.receiveMethod,
  232. customerName: form.customerName,
  233. customerTel: form.customerTel,
  234. address: form.address,
  235. area: form.area,
  236. postCode: form.postCode
  237. };
  238. const options = {
  239. type: 2,
  240. data: data,
  241. method: "POST",
  242. showLoading: true,
  243. };
  244. return new Promise(async (resolve, reject) => {
  245. const res = await request(queryOBUAdd, options);
  246. const data = stringToJson(res.bizContent);
  247. resolve(data);
  248. }).catch((error) => {
  249. reject(error);
  250. });
  251. }
  252. //下一步
  253. const toPage = () => {
  254. queryOBUAddAction().then(val => {
  255. navTo(
  256. `/after-sale/additional-equipment/result`
  257. )
  258. })
  259. };
  260. </script>
  261. <style>
  262. page {
  263. width: 100%;
  264. height: 100%;
  265. display: flex;
  266. flex-direction: column;
  267. background-color: ##eef7f7;
  268. }
  269. </style>
  270. <style lang="scss" scoped>
  271. .hint2 {
  272. display: flex;
  273. .green {
  274. font-size: 28rpx;
  275. color: #00b38b;
  276. }
  277. .grey {
  278. font-size: 24rpx;
  279. color: #000000;
  280. margin-left: 16rpx;
  281. }
  282. }
  283. .addr-box {
  284. margin-top: 20rpx;
  285. display: flex;
  286. background: #fff;
  287. padding: 30rpx;
  288. justify-content: space-between;
  289. align-items: center;
  290. .addr-box-left {
  291. display: flex;
  292. .text-image {
  293. width: 68rpx;
  294. height: 68rpx;
  295. background: #00b38b;
  296. border-radius: 50%;
  297. text-align: center;
  298. font-size: 26rpx;
  299. font-family: Microsoft YaHei;
  300. font-weight: 400;
  301. color: #ffffff;
  302. line-height: 68rpx;
  303. margin-right: 30rpx;
  304. }
  305. .content {
  306. view {
  307. font-size: 26rpx;
  308. font-family: Microsoft YaHei;
  309. font-weight: 400;
  310. color: #333333;
  311. .item1 {
  312. font-size: 30rpx;
  313. font-family: Microsoft YaHei;
  314. font-weight: 400;
  315. color: #333333;
  316. }
  317. .item2 {
  318. font-size: 24rpx;
  319. font-family: Microsoft YaHei;
  320. font-weight: 400;
  321. color: #999999;
  322. margin-left: 10rpx;
  323. }
  324. .item3 {
  325. width: 71rpx;
  326. height: 37rpx;
  327. background: #ffffff;
  328. border: 1px solid #ff8000;
  329. border-radius: 6rpx;
  330. font-size: 22rpx;
  331. font-family: Microsoft YaHei;
  332. font-weight: 400;
  333. color: #ff8000;
  334. padding: 3rpx 6rpx;
  335. margin-left: 10rpx;
  336. }
  337. }
  338. }
  339. }
  340. .edit {
  341. image {
  342. width: 50rpx;
  343. height: 50rpx;
  344. }
  345. }
  346. }
  347. .oderPage {
  348. flex: 1;
  349. width: 100%;
  350. .from1 {
  351. background-color: #fff;
  352. margin-top: 30rpx;
  353. padding: 0 30rpx;
  354. ::v-deep .uni-forms-item {
  355. border-bottom: 1rpx solid #ccc;
  356. padding: 15rpx 0;
  357. margin-bottom: 0;
  358. .uni-forms-item__label {
  359. font-size: 28rpx;
  360. height: 50rpx;
  361. }
  362. .uni-forms-item__content {
  363. display: flex;
  364. }
  365. .uni-easyinput__content-input {
  366. font-size: 28rpx;
  367. height: 50rpx;
  368. }
  369. }
  370. .btn {
  371. line-height: 38rpx;
  372. font-size: 24rpx;
  373. font-family: Microsoft YaHei;
  374. font-weight: 400;
  375. color: #ffffff;
  376. background: #00b38b;
  377. border-radius: 10rpx;
  378. padding: 10rpx 15rpx;
  379. }
  380. }
  381. .from {
  382. background-color: #fff;
  383. margin-top: 30rpx;
  384. padding: 0 30rpx;
  385. ::v-deep .u-form-item {
  386. padding: 0;
  387. line-height: normal;
  388. .u-form-item__message {
  389. margin-bottom: 12rpx;
  390. }
  391. }
  392. .from_item {
  393. display: flex;
  394. flex-wrap: nowrap;
  395. justify-content: space-between;
  396. align-items: center;
  397. height: 80rpx;
  398. border-bottom: 1rpx solid #dcdcdc;
  399. .btn {
  400. font-size: 24rpx;
  401. font-family: Microsoft YaHei;
  402. font-weight: 400;
  403. color: #ffffff;
  404. background: #00b38b;
  405. border-radius: 10rpx;
  406. padding: 10rpx 15rpx;
  407. }
  408. ::v-deep .input {
  409. text-align: left;
  410. flex: 1;
  411. input {
  412. text-align: left;
  413. }
  414. }
  415. }
  416. .from_item1 {
  417. display: flex;
  418. flex-wrap: nowrap;
  419. flex-direction: column;
  420. justify-content: space-between;
  421. padding: 30rpx;
  422. border-bottom: #dcdcdc 1px solid;
  423. input {
  424. text-align: right;
  425. }
  426. .textarea {
  427. background-color: #f1f1f1;
  428. width: 100%;
  429. border-radius: 20rpx;
  430. margin-top: 10rpx;
  431. text-indent: 1rem;
  432. height: 180rpx;
  433. padding: 20rpx;
  434. box-sizing: border-box;
  435. }
  436. }
  437. }
  438. }
  439. .submit {
  440. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  441. width: 670rpx;
  442. height: 80rpx;
  443. color: #fff;
  444. border-radius: 100rpx;
  445. font-size: 32rpx;
  446. }
  447. </style>