Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

form.vue 15KB

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