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.

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