Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

form.vue 17KB

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