Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

form.vue 11KB

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