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.

form.vue 17KB

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