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.

mailing_information.vue 14KB

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