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

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