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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. <template>
  2. <view class="oderPage">
  3. <view class="addr-box">
  4. <view class="addr-box-left">
  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">默认</text>
  11. </view>
  12. <view class=""> {{form.region +form.address}}</view>
  13. </view>
  14. </view>
  15. <view class="edit">
  16. <image :src="`${$imgUrl}applyCard/edit.png`" mode=""></image>
  17. </view>
  18. </view>
  19. <u-form :model="form" ref="myForm">
  20. <view class="from">
  21. <u-form-item prop="cardState">
  22. <view class="from_item">
  23. <text><text style="color: red">*</text>是否寄回设备:</text>
  24. <!-- <u-radio-group v-model="form.sendStatusName">
  25. <u-radio :customStyle="{ marginBottom: '8px' }" activeColor="#2CE242"
  26. v-for="(item, index) in radiolist1" :key="index" :label="item.disabled"
  27. :name="item.name">
  28. {{ item.name }}
  29. </u-radio>
  30. </u-radio-group> -->
  31. <radio-group @change="sendChange" class="radios">
  32. <block v-for="(item, index) in radiolist1" :key="item.val">
  33. <view class="radio-box">
  34. <radio :value="item.val" :checked="form.sendStatus == item.val" color="#13e7c1"
  35. style="transform:scale(0.75)" />
  36. <view>{{item.name}}</view>
  37. </view>
  38. </block>
  39. </radio-group>
  40. </view>
  41. </u-form-item>
  42. <u-form-item prop="logistics" v-if="form.sendStatusName == '寄回'">
  43. <view class="from_item">
  44. <text><text style="color: red">*</text>退货物流公司:</text>
  45. <view style="display: flex">
  46. <u-input v-model="form.courierCompany" class="input" @click="showPicker"
  47. placeholder="请选择" />
  48. <u-icon name="arrow-right" style="margin-left: 10px;display: flex;"></u-icon>
  49. </view>
  50. </view>
  51. </u-form-item>
  52. <u-form-item prop="returnNum" v-if="form.sendStatusName == '寄回'">
  53. <view class="from_item">
  54. <text><text style="color: red"></text>退货单号:</text>
  55. <u-input v-model="form.courierOrderId" class="input" />
  56. </view>
  57. </u-form-item>
  58. <u-form-item prop="cardState">
  59. <view class="from_item">
  60. <text><text style="color: red">*</text>收货方式:</text>
  61. <!-- <u-radio-group v-model="form.receiveMethodName">
  62. <u-radio :customStyle="{ marginBottom: '8px' }" activeColor="#2CE242"
  63. v-for="(item, index) in radiolist2" :key="index" :label="item.disabled"
  64. :name="item.name">
  65. {{ item.name }}
  66. </u-radio>
  67. </u-radio-group> -->
  68. <radio-group @change="receiveChange" class="radios">
  69. <block v-for="(item, index) in radiolist2" :key="item.val">
  70. <view class="radio-box">
  71. <radio :value="item.val" :checked="form.receiveMethod == item.val" color="#13e7c1"
  72. style="transform:scale(0.75)" />
  73. <view>{{item.name}}</view>
  74. </view>
  75. </block>
  76. </radio-group>
  77. </view>
  78. </u-form-item>
  79. <u-form-item prop="remark">
  80. <view class="from_item">
  81. <text><text style="color: red"></text>注销原因:</text>
  82. <view style="display: flex">
  83. <u-input v-model="form.applyRes" @click="showApplyResPicker()" class="input" disabled
  84. placeholder="请选择" />
  85. <u-icon name="arrow-right" style="margin-left: 10px;display: flex;"></u-icon>
  86. </view>
  87. </view>
  88. </u-form-item>
  89. </view>
  90. </u-form>
  91. <!-- 物流弹窗 -->
  92. <view>
  93. <!-- 物流 -->
  94. <u-select v-model="show" mode="single-column" :list="list" @confirm="confirm"></u-select>
  95. <!-- 原因 -->
  96. <u-select v-model="showApplyRes" mode="single-column" :list="applyResList" @confirm="applyResConfirm">
  97. </u-select>
  98. </view>
  99. <button class="submit" @click="submit">下一步</button>
  100. </view>
  101. </template>
  102. <script setup lang="ts">
  103. // import navBar from "../ETCcancellation/components/nav-bar.vue";
  104. import {
  105. reactive,
  106. ref
  107. } from "vue";
  108. import {
  109. onLoad,
  110. onShow,
  111. onReady
  112. } from "@dcloudio/uni-app";
  113. import {
  114. navTo,
  115. checkStr
  116. } from "@/utils/utils";
  117. import {
  118. request
  119. } from "../../utils/network/request.js";
  120. import {
  121. getLogistics,
  122. addressQuery,
  123. changeCardInfo
  124. } from "../../utils/network/api.js";
  125. import {
  126. stringToJson
  127. } from "../../utils/network/encryption.js";
  128. import {
  129. getItem,
  130. StorageKeys
  131. } from "@/utils/storage";
  132. import {
  133. wechatPayConfigId,
  134. } from "@/utils/network/api";
  135. const list = reactive([]); //物流数据
  136. const address = reactive({
  137. list: []
  138. }); //地址list
  139. const form = reactive({
  140. consignee: '',
  141. consigneeTel: '',
  142. address: '',
  143. region: '',
  144. sendStatusName: '寄回',
  145. sendStatus: '1', //0 --- 不邮寄 1 --- 邮寄
  146. courierCompany: '',
  147. courierOrderId: '',
  148. receiveMethod: '1',
  149. postCode: '',
  150. receiveMethodName: '邮寄', //0 --- 不邮寄 1 --- 邮寄
  151. applyRes: ''
  152. });
  153. //入参
  154. const params = reactive({
  155. /* cardId: '',
  156. obuId: '', */
  157. orderId: '',
  158. id: '',
  159. });
  160. const applyResList = reactive([{
  161. //原因
  162. value: "原因1",
  163. label: "原因1",
  164. },
  165. {
  166. value: "原因1",
  167. label: "原因1",
  168. },
  169. {
  170. value: "原因1",
  171. label: "原因1",
  172. },
  173. ]);
  174. // 单选数据列表
  175. const radiolist1 = reactive([{
  176. name: "寄回",
  177. val: "1",
  178. },
  179. {
  180. name: "不寄回",
  181. val: "0",
  182. },
  183. ]);
  184. const radiolist2 = reactive([{
  185. name: "邮寄",
  186. val: "1",
  187. },
  188. {
  189. name: "不邮寄",
  190. val: "0",
  191. },
  192. ]);
  193. // 寄回单选
  194. const sendChange = (e : any) => {
  195. console.log(e);
  196. form.sendStatus = e.detail.value
  197. };
  198. // 邮寄单选
  199. const receiveChange = (e : any) => {
  200. console.log(e);
  201. form.receiveMethod = e.detail.value
  202. };
  203. let showApplyRes = ref(false);
  204. // 打开物流先择器
  205. const showApplyResPicker = function () {
  206. showApplyRes.value = true;
  207. };
  208. const applyResConfirm = (e) => {
  209. form.applyRes = e[0].value;
  210. console.log(e[0].value);
  211. };
  212. let show = ref(false);
  213. // 打开物流先择器
  214. const showPicker = function () {
  215. show.value = true;
  216. };
  217. const confirm = (e) => {
  218. form.courierCompany = e[0].value;
  219. console.log(e[0].value);
  220. };
  221. onLoad((option) => {
  222. params.orderId = option.orderId
  223. params.id = option.id
  224. getexpresslist();
  225. getAddressList();
  226. });
  227. const getexpresslist = () => {
  228. //参数说明
  229. let options = {
  230. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  231. data: {
  232. // opId: getItem("openId"),
  233. // source: "WECHAT",
  234. // tabIndex: "0",
  235. }, //请求参数
  236. method: "POST", //提交方式(默认POST)
  237. showLoading: true, //是否显示加载中(默认显示)
  238. };
  239. //调用方式
  240. request(getLogistics, options)
  241. .then((res) => {
  242. // stringToJson(res.bizContent)
  243. stringToJson(res.bizContent).forEach((item) => {
  244. list.push({
  245. value: item,
  246. label: item,
  247. });
  248. });
  249. })
  250. .catch((err) => {
  251. console.log(err);
  252. });
  253. };
  254. const getAddressList = () => {
  255. var data = {
  256. openId: getItem(StorageKeys.OpenId),
  257. };
  258. const options = {
  259. type: 2,
  260. data: data,
  261. method: "POST",
  262. showLoading: true,
  263. };
  264. request(addressQuery, options).then((res) => {
  265. const data = stringToJson(res.bizContent);
  266. address.list = data.data;
  267. if (address.list.length > 0) {
  268. var defaultAddress = address.list[0]
  269. form.consignee = defaultAddress.consignee
  270. form.consigneeTel = defaultAddress.consigneeTel
  271. form.address = defaultAddress.address
  272. form.region = defaultAddress.region
  273. form.postCode = defaultAddress.postalCode
  274. }
  275. });
  276. };
  277. const submit = () => {
  278. // if (form.sendStatusName === '寄回') {
  279. // form.sendStatus = '1'
  280. // } else {
  281. // form.sendStatus = '0'
  282. // }
  283. // if (form.receiveMethodName === '邮寄') {
  284. // form.receiveMethod = '1'
  285. // } else {
  286. // form.receiveMethod = '0'
  287. // }
  288. queryCckChangejzCardInfo().then(val => {
  289. console.log(val)
  290. navTo(
  291. `/after-sale/replace-equipment/result`
  292. )
  293. })
  294. };
  295. const queryCckChangejzCardInfo = () => {
  296. var data = {
  297. id: params.id,
  298. sendStatus: form.sendStatus,
  299. configId: wechatPayConfigId,
  300. courierCompany: form.courierCompany,
  301. courierOrderId: form.courierOrderId,
  302. receiveMethod: form.receiveMethod,
  303. consignee: form.consignee,
  304. consigneeTel: form.consigneeTel,
  305. address: form.address,
  306. region: form.region,
  307. postCode: form.postCode,
  308. applyRes: form.applyRes
  309. };
  310. const options = {
  311. type: 2,
  312. data: data,
  313. method: "POST",
  314. showLoading: true,
  315. };
  316. return new Promise(async (resolve, reject) => {
  317. const res = await request(changeCardInfo, options);
  318. const data = stringToJson(res.bizContent);
  319. resolve(data);
  320. }).catch((error) => {
  321. reject(error);
  322. });
  323. }
  324. </script>
  325. <style>
  326. page {
  327. width: 100%;
  328. height: 100%;
  329. display: flex;
  330. flex-direction: column;
  331. background-color: #f3f3f3;
  332. }
  333. </style>
  334. <style lang="scss" scoped>
  335. .radios{
  336. display: flex;
  337. }
  338. .radio-box{
  339. display: flex;
  340. align-items: center;
  341. padding-left: 20rpx;
  342. }
  343. .oderPage {
  344. flex: 1;
  345. width: 100%;
  346. .addr-box {
  347. margin-top: 20rpx;
  348. display: flex;
  349. background: #fff;
  350. padding: 30rpx;
  351. justify-content: space-between;
  352. align-items: center;
  353. .addr-box-left {
  354. display: flex;
  355. .text-image {
  356. width: 68rpx;
  357. height: 68rpx;
  358. background: #00b38b;
  359. border-radius: 50%;
  360. text-align: center;
  361. font-size: 26rpx;
  362. font-family: Microsoft YaHei;
  363. font-weight: 400;
  364. color: #ffffff;
  365. line-height: 68rpx;
  366. margin-right: 30rpx;
  367. }
  368. .content {
  369. view {
  370. font-size: 26rpx;
  371. font-family: Microsoft YaHei;
  372. font-weight: 400;
  373. color: #333333;
  374. .item1 {
  375. font-size: 30rpx;
  376. font-family: Microsoft YaHei;
  377. font-weight: 400;
  378. color: #333333;
  379. }
  380. .item2 {
  381. font-size: 24rpx;
  382. font-family: Microsoft YaHei;
  383. font-weight: 400;
  384. color: #999999;
  385. margin-left: 10rpx;
  386. }
  387. .item3 {
  388. width: 71rpx;
  389. height: 37rpx;
  390. background: #ffffff;
  391. border: 1px solid #ff8000;
  392. border-radius: 6rpx;
  393. font-size: 22rpx;
  394. font-family: Microsoft YaHei;
  395. font-weight: 400;
  396. color: #ff8000;
  397. padding: 3rpx 6rpx;
  398. margin-left: 10rpx;
  399. }
  400. }
  401. }
  402. }
  403. .edit {
  404. image {
  405. width: 50rpx;
  406. height: 50rpx;
  407. }
  408. }
  409. }
  410. .from {
  411. background-color: #fff;
  412. margin-top: 30rpx;
  413. padding: 0 30rpx;
  414. ::v-deep .u-form-item {
  415. padding: 0;
  416. line-height: normal;
  417. .u-form-item__message {
  418. margin-bottom: 12rpx;
  419. }
  420. }
  421. .from_item {
  422. display: flex;
  423. flex-wrap: nowrap;
  424. justify-content: space-between;
  425. align-items: center;
  426. height: 80rpx;
  427. border-bottom: 1rpx solid #dcdcdc;
  428. .btn {
  429. font-size: 24rpx;
  430. font-family: Microsoft YaHei;
  431. font-weight: 400;
  432. color: #ffffff;
  433. background: #00b38b;
  434. border-radius: 10rpx;
  435. padding: 10rpx 15rpx;
  436. }
  437. ::v-deep .input {
  438. text-align: left;
  439. flex: 1;
  440. input {
  441. text-align: left;
  442. }
  443. }
  444. }
  445. .from_item1 {
  446. display: flex;
  447. flex-wrap: nowrap;
  448. flex-direction: column;
  449. justify-content: space-between;
  450. padding: 30rpx 0;
  451. border-bottom: #dcdcdc 1px solid;
  452. input {
  453. text-align: right;
  454. }
  455. .textarea {
  456. background-color: #f1f1f1;
  457. width: 100%;
  458. border-radius: 20rpx;
  459. margin-top: 10rpx;
  460. text-indent: 1rem;
  461. height: 180rpx;
  462. padding: 20rpx;
  463. box-sizing: border-box;
  464. }
  465. }
  466. }
  467. }
  468. .submit {
  469. width: 670rpx;
  470. height: 80rpx;
  471. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  472. box-shadow: 0rpx 4rpx 11rpx 1rpx rgba(223, 223, 223, 0.5);
  473. border-radius: 40rpx;
  474. font-size: 32rpx;
  475. font-family: Microsoft YaHei;
  476. font-weight: 400;
  477. color: #ffffff;
  478. line-height: 80rpx;
  479. margin-top: 60rpx;
  480. }
  481. </style>