選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

apply-ex-goods.vue 16KB

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