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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <template>
  2. <view class="oderPage">
  3. <view 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" v-if="form.defaultAddress ==1">默认</text>
  11. </view>
  12. <view class=""> {{form.area +form.address}}</view>
  13. </view>
  14. </view>
  15. <view class="edit" @click="address.show = true">
  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. <radio-group @change="radioChange" class="radios">
  25. <block v-for="(item, index) in radiolist1" :key="item.val">
  26. <view class="radio-box">
  27. <radio :value="item.val" checked color="#13e7c1" style="transform:scale(0.75)" />
  28. <view>{{item.name}}</view>
  29. </view>
  30. </block>
  31. </radio-group>
  32. </view>
  33. </u-form-item>
  34. </view>
  35. </u-form>
  36. <button style="margin-top: 50rpx;" class="submit" @click="toPage()">OBU增补申请</button>
  37. </view>
  38. <!-- 地址弹窗 -->
  39. <u-popup mode="bottom" v-model="address.show">
  40. <view class="address-line">
  41. <view v-if="address.list" v-for="(item, index) in address.list" :key="index" @click="addressSelected(item)"
  42. style="margin-bottom: 40rpx" class="flex-bettwen">
  43. <view class="flex">
  44. <view class="xing">
  45. {{ item.consignee.charAt(0) }}
  46. </view>
  47. <view class="content">
  48. <view class="flex">
  49. <view class="name">
  50. {{ item.consignee }}
  51. </view>
  52. <view class="phone">
  53. {{ item.consigneeTel }}
  54. </view>
  55. </view>
  56. <view class="address">
  57. {{ item.region + item.address }}
  58. </view>
  59. </view>
  60. </view>
  61. <view @click.stop="editAddress(item)" style="margin-left: 80rpx" class="picture">
  62. <image :showLoading="true" :src="`${$imgUrl}applyCard/edit.png`"
  63. style="width: 48rpx; height: 48rpx"></image>
  64. </view>
  65. </view>
  66. <view :style="address.list ? 'margin-top: 60rpx;' : ''" class="action-bottom">
  67. <button type="default" class="button" @click="goToAddAddress()">
  68. 添加收货地址
  69. </button>
  70. </view>
  71. </view>
  72. </u-popup>
  73. </template>
  74. <script setup lang="ts">
  75. import navBar from "./components/nav-bar.vue";
  76. import {
  77. checkStr
  78. } from "@/utils/utils";
  79. import {
  80. ref,
  81. reactive
  82. } from "vue";
  83. import {
  84. navTo
  85. } from "@/utils/utils";
  86. import {
  87. onReady,
  88. onLoad
  89. } from "@dcloudio/uni-app";
  90. import {
  91. request, requestNew
  92. } from "@/utils/network/request.js";
  93. import {
  94. getItem,
  95. StorageKeys
  96. } from "@/utils/storage";
  97. import {
  98. sendMessage,
  99. checkCode,
  100. addressQuery,
  101. queryOBUAdd,
  102. wechatPayConfigId
  103. } from "@/utils/network/api.js";
  104. import {
  105. stringToJson
  106. } from "@/utils/network/encryption";
  107. import {
  108. msg
  109. } from "@/utils/utils";
  110. // 表单数据
  111. const form = reactive({
  112. receiveMethod: "1",
  113. receiveMethodName: '邮寄',
  114. customerName: '',
  115. customerTel: '',
  116. mobile: "",
  117. code: '',
  118. address: '',
  119. area: '',
  120. postCode: '',
  121. defaultAddress: 2
  122. });
  123. const apply = reactive({
  124. data: {
  125. status: undefined,
  126. id: ''
  127. }
  128. });
  129. //入参
  130. const params = reactive({
  131. cardId: '',
  132. obuId: '',
  133. orderId: ''
  134. });
  135. // 单选数据列表
  136. const radiolist1 = reactive([
  137. // {
  138. // name: "不邮寄",
  139. // val: "0",
  140. // },
  141. {
  142. name: "邮寄",
  143. val: "1",
  144. },
  145. ]);
  146. // 验证规则
  147. const rules = {
  148. code: [{
  149. required: true,
  150. message: "请输入验证码",
  151. trigger: ["change", "blur"],
  152. }],
  153. };
  154. // 验证提示类型(toast要版本为1.3.5才支持)
  155. const errorType = ["toast"];
  156. // 设置验证规则
  157. const myForm = ref(null);
  158. //倒计时时常
  159. const codeDuration = ref(0);
  160. let interval = null;
  161. const address = reactive({
  162. list: [],
  163. show: false
  164. }); //地址list
  165. /* 验证码倒计时 */
  166. const codeInterval = () => {
  167. codeDuration.value = 60;
  168. interval = setInterval(() => {
  169. codeDuration.value--;
  170. if (codeDuration.value === 0) {
  171. if (interval) {
  172. clearInterval(interval);
  173. interval = null;
  174. }
  175. }
  176. }, 1000);
  177. };
  178. onReady(() => {
  179. myForm.value.setRules(rules);
  180. });
  181. onLoad((option) => {
  182. form.mobile = option.mobile
  183. params.cardId = option.cardId
  184. params.orderId = option.orderId
  185. getAddressList()
  186. });
  187. const getAddressList = () => {
  188. var data = {
  189. openId: getItem(StorageKeys.OpenId),
  190. };
  191. const options = {
  192. type: 2,
  193. data: data,
  194. method: "POST",
  195. showLoading: true,
  196. };
  197. request(addressQuery, options).then((res) => {
  198. const data = stringToJson(res.bizContent);
  199. address.list = data.data;
  200. if (address.list.length > 0) {
  201. var defaultAddress = address.list[0]
  202. form.customerName = defaultAddress.consignee
  203. form.customerTel = defaultAddress.consigneeTel
  204. form.address = defaultAddress.address
  205. form.area = defaultAddress.region
  206. form.postCode = defaultAddress.postalCode
  207. }
  208. });
  209. };
  210. const getCode = () => {
  211. if (codeDuration.value !== 0) {
  212. return;
  213. }
  214. const options = {
  215. type: 2,
  216. data: {
  217. mobile: form.mobile
  218. },
  219. method: "POST",
  220. showLoading: true,
  221. };
  222. requestNew(sendMessage, options)
  223. .then((res) => {
  224. codeInterval();
  225. msg("验证码发送成功!");
  226. })
  227. .catch((err) => {
  228. console.log(err);
  229. });
  230. }
  231. // 单选
  232. const radioChange = (e : any) => {
  233. console.log(e);
  234. form.receiveMethod = e.detail.value
  235. if (e.detail.value == 1) {
  236. form.receiveMethodName = "邮寄"
  237. } else {
  238. form.receiveMethodName = "不邮寄"
  239. }
  240. };
  241. //申请
  242. const queryOBUAddAction = () => {
  243. var data = {
  244. orderId: params.orderId,
  245. openId: getItem(StorageKeys.OpenId),
  246. configId: wechatPayConfigId,
  247. receiveMethod: form.receiveMethod,
  248. customerName: form.customerName,
  249. customerTel: form.customerTel,
  250. address: form.address,
  251. area: form.area,
  252. postCode: form.postCode
  253. };
  254. const options = {
  255. type: 2,
  256. data: data,
  257. method: "POST",
  258. showLoading: true,
  259. };
  260. return new Promise(async (resolve, reject) => {
  261. const res = await request(queryOBUAdd, options);
  262. const data = stringToJson(res.bizContent);
  263. resolve(data);
  264. }).catch((error) => {
  265. reject(error);
  266. });
  267. }
  268. //下一步
  269. const toPage = () => {
  270. queryOBUAddAction().then(val => {
  271. navTo(
  272. `/subpackage/after-sale/additional-equipment/result`
  273. )
  274. })
  275. };
  276. const addressSelected = (val : any) => {
  277. console.log(val);
  278. form.customerName = val.consignee
  279. form.customerTel = val.consigneeTel
  280. form.address = val.address
  281. form.area = val.region
  282. form.postCode = val.postalCode
  283. form.defaultAddress = val.defaultAddress
  284. address.show = false
  285. console.log("form.address", form.area, form.address)
  286. };
  287. const editAddress = (val) => {
  288. uni.navigateTo({
  289. url: `/subpackage/orders/editAddress?content=` + JSON.stringify(val),
  290. });
  291. };
  292. const goToAddAddress = () => {
  293. uni.navigateTo({
  294. url: "/subpackage/orders/addAddress",
  295. });
  296. };
  297. </script>
  298. <style>
  299. page {
  300. width: 100%;
  301. height: 100%;
  302. display: flex;
  303. flex-direction: column;
  304. background-color: ##eef7f7;
  305. }
  306. </style>
  307. <style lang="scss" scoped>
  308. .addr-box {
  309. margin-top: 20rpx;
  310. display: flex;
  311. background: #fff;
  312. padding: 30rpx;
  313. justify-content: space-between;
  314. align-items: center;
  315. .addr-box-left {
  316. display: flex;
  317. .text-image {
  318. width: 68rpx;
  319. height: 68rpx;
  320. background: #00b38b;
  321. border-radius: 50%;
  322. text-align: center;
  323. font-size: 26rpx;
  324. font-family: Microsoft YaHei;
  325. font-weight: 400;
  326. color: #ffffff;
  327. line-height: 68rpx;
  328. margin-right: 30rpx;
  329. }
  330. .content {
  331. view {
  332. font-size: 26rpx;
  333. font-family: Microsoft YaHei;
  334. font-weight: 400;
  335. color: #333333;
  336. .item1 {
  337. font-size: 30rpx;
  338. font-family: Microsoft YaHei;
  339. font-weight: 400;
  340. color: #333333;
  341. }
  342. .item2 {
  343. font-size: 24rpx;
  344. font-family: Microsoft YaHei;
  345. font-weight: 400;
  346. color: #999999;
  347. margin-left: 10rpx;
  348. }
  349. .item3 {
  350. width: 71rpx;
  351. height: 37rpx;
  352. background: #ffffff;
  353. border: 1px solid #ff8000;
  354. border-radius: 6rpx;
  355. font-size: 22rpx;
  356. font-family: Microsoft YaHei;
  357. font-weight: 400;
  358. color: #ff8000;
  359. padding: 3rpx 6rpx;
  360. margin-left: 10rpx;
  361. }
  362. }
  363. }
  364. }
  365. .edit {
  366. image {
  367. width: 50rpx;
  368. height: 50rpx;
  369. }
  370. }
  371. }
  372. .radios {
  373. display: flex;
  374. }
  375. .radio-box {
  376. display: flex;
  377. align-items: center;
  378. padding-left: 40rpx;
  379. }
  380. .hint2 {
  381. display: flex;
  382. .green {
  383. font-size: 28rpx;
  384. color: #00b38b;
  385. }
  386. .grey {
  387. font-size: 24rpx;
  388. color: #000000;
  389. margin-left: 16rpx;
  390. }
  391. }
  392. .addr-box {
  393. margin-top: 20rpx;
  394. display: flex;
  395. background: #fff;
  396. padding: 30rpx;
  397. justify-content: space-between;
  398. align-items: center;
  399. .addr-box-left {
  400. display: flex;
  401. .text-image {
  402. width: 68rpx;
  403. height: 68rpx;
  404. background: #00b38b;
  405. border-radius: 50%;
  406. text-align: center;
  407. font-size: 26rpx;
  408. font-family: Microsoft YaHei;
  409. font-weight: 400;
  410. color: #ffffff;
  411. line-height: 68rpx;
  412. margin-right: 30rpx;
  413. }
  414. .content {
  415. view {
  416. font-size: 26rpx;
  417. font-family: Microsoft YaHei;
  418. font-weight: 400;
  419. color: #333333;
  420. .item1 {
  421. font-size: 30rpx;
  422. font-family: Microsoft YaHei;
  423. font-weight: 400;
  424. color: #333333;
  425. }
  426. .item2 {
  427. font-size: 24rpx;
  428. font-family: Microsoft YaHei;
  429. font-weight: 400;
  430. color: #999999;
  431. margin-left: 10rpx;
  432. }
  433. .item3 {
  434. width: 71rpx;
  435. height: 37rpx;
  436. background: #ffffff;
  437. border: 1px solid #ff8000;
  438. border-radius: 6rpx;
  439. font-size: 22rpx;
  440. font-family: Microsoft YaHei;
  441. font-weight: 400;
  442. color: #ff8000;
  443. padding: 3rpx 6rpx;
  444. margin-left: 10rpx;
  445. }
  446. }
  447. }
  448. }
  449. .edit {
  450. image {
  451. width: 50rpx;
  452. height: 50rpx;
  453. }
  454. }
  455. }
  456. .oderPage {
  457. flex: 1;
  458. width: 100%;
  459. background-color: #f3f3f3;
  460. .from1 {
  461. background-color: #fff;
  462. margin-top: 30rpx;
  463. padding: 0 30rpx;
  464. ::v-deep .uni-forms-item {
  465. border-bottom: 1rpx solid #ccc;
  466. padding: 15rpx 0;
  467. margin-bottom: 0;
  468. .uni-forms-item__label {
  469. font-size: 28rpx;
  470. height: 50rpx;
  471. }
  472. .uni-forms-item__content {
  473. display: flex;
  474. }
  475. .uni-easyinput__content-input {
  476. font-size: 28rpx;
  477. height: 50rpx;
  478. }
  479. }
  480. .btn {
  481. line-height: 38rpx;
  482. font-size: 24rpx;
  483. font-family: Microsoft YaHei;
  484. font-weight: 400;
  485. color: #ffffff;
  486. background: #00b38b;
  487. border-radius: 10rpx;
  488. padding: 10rpx 15rpx;
  489. }
  490. }
  491. .from {
  492. background-color: #fff;
  493. margin-top: 30rpx;
  494. padding: 0 30rpx;
  495. ::v-deep .u-form-item {
  496. padding: 0;
  497. line-height: normal;
  498. .u-form-item__message {
  499. margin-bottom: 12rpx;
  500. }
  501. }
  502. .from_item {
  503. display: flex;
  504. flex-wrap: nowrap;
  505. justify-content: space-between;
  506. align-items: center;
  507. height: 80rpx;
  508. border-bottom: 1rpx solid #dcdcdc;
  509. .btn {
  510. font-size: 24rpx;
  511. font-family: Microsoft YaHei;
  512. font-weight: 400;
  513. color: #ffffff;
  514. background: #00b38b;
  515. border-radius: 10rpx;
  516. padding: 10rpx 15rpx;
  517. }
  518. ::v-deep .input {
  519. text-align: left;
  520. flex: 1;
  521. background: transparent;
  522. input {
  523. text-align: left;
  524. }
  525. }
  526. }
  527. .from_item1 {
  528. display: flex;
  529. flex-wrap: nowrap;
  530. flex-direction: column;
  531. justify-content: space-between;
  532. padding: 30rpx;
  533. border-bottom: #dcdcdc 1px solid;
  534. input {
  535. text-align: right;
  536. }
  537. .textarea {
  538. background-color: #f1f1f1;
  539. width: 100%;
  540. border-radius: 20rpx;
  541. margin-top: 10rpx;
  542. text-indent: 1rem;
  543. height: 180rpx;
  544. padding: 20rpx;
  545. box-sizing: border-box;
  546. }
  547. }
  548. }
  549. }
  550. .submit {
  551. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  552. width: 670rpx;
  553. height: 80rpx;
  554. color: #fff;
  555. border-radius: 100rpx;
  556. font-size: 32rpx;
  557. }
  558. .address-line {
  559. padding: 20px;
  560. .flex {
  561. display: flex;
  562. }
  563. .flex-bettwen {
  564. display: flex;
  565. align-items: center;
  566. justify-content: space-between;
  567. }
  568. .xing {
  569. width: 68rpx;
  570. height: 68rpx;
  571. background: rgba(0, 179, 139, 0.2);
  572. border-radius: 50%;
  573. font-size: 26rpx;
  574. font-weight: 400;
  575. color: #00b38b;
  576. line-height: 68rpx;
  577. text-align: center;
  578. }
  579. .content {
  580. margin-left: 20px;
  581. .name {
  582. font-size: 30rpx;
  583. font-family: Microsoft YaHei;
  584. font-weight: 500;
  585. color: #333333;
  586. display: inline-block;
  587. }
  588. .phone {
  589. margin-left: 10rpx;
  590. font-size: 24rpx;
  591. font-family: Microsoft YaHei;
  592. font-weight: 400;
  593. color: #999999;
  594. line-height: 36rpx;
  595. }
  596. .address {
  597. margin-top: 10rpx;
  598. font-size: 26rpx;
  599. font-family: Microsoft YaHei;
  600. font-weight: 400;
  601. color: #333333;
  602. line-height: 36rpx;
  603. }
  604. .picture {
  605. width: 48rpx;
  606. height: 48rpx;
  607. }
  608. .editIcon {
  609. width: 48rpx;
  610. height: 48rpx;
  611. }
  612. }
  613. }
  614. .action-bottom {
  615. padding-bottom: 30rpx;
  616. .button {
  617. height: 80rpx;
  618. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  619. border-radius: 40rpx;
  620. font-size: 32rpx;
  621. font-weight: 400;
  622. color: #ffffff;
  623. line-height: 80rpx;
  624. }
  625. }
  626. </style>