Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

essential-information-two.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. <template>
  2. <navBar title="九州ETC" navbgClass="nav-bgXin" fontColor='#fff' :scrollTop="scrollTop" :type="state.data.vanType"
  3. :userType="state.data.userType"></navBar>
  4. <navBgCar :activeNum='2'></navBgCar>
  5. <view class="content-wrap">
  6. <view>
  7. <!-- 收货地址 -->
  8. <view v-if="!state.data.region" class="address-lane">
  9. <view class="title">请选择或新增收货地址</view>
  10. <view style="margin-top: 30rpx" class="action">
  11. <button type="default" class="ui-btn" @click="state.show = true">
  12. 添加收货地址
  13. </button>
  14. </view>
  15. </view>
  16. <view v-if="state.data.region" class="address-lane">
  17. <view class="title">收货地址</view>
  18. <view @click="state.show = true" class="address-content" style="margin-top: 30rpx">
  19. <view class="flex l-info">
  20. <image :showLoading="true" :src="`${$imgUrl}issuance/l-icon.png`" class="l-icon">
  21. </image>
  22. <view style="margin-left: 18rpx;flex: 1 1 auto;" class="">
  23. <view class="address">
  24. {{ state.data.region + state.data.address }}
  25. </view>
  26. <view style="margin-top: 15rpx" class="flex">
  27. <view class="name">
  28. {{ state.data.consignee }}
  29. </view>
  30. <view class="phone">
  31. {{ state.data.consigneeTel }}
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="arror">
  37. <image :src="`${$imgUrl}issuance/r-more.png`" class="icon" mode='aspectFit'></image>
  38. </view>
  39. </view>
  40. <view style="margin-top: 30rpx" class="action">
  41. <button type="default" class="button" @click="nextAction()">
  42. 下一步
  43. </button>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 地址弹窗 -->
  49. <u-popup mode="bottom" v-model="state.show">
  50. <view class="address-line">
  51. <view v-if="state.addressArray" v-for="(item, index) in state.addressArray" :key="index"
  52. @click="addressSelected(item)" style="margin-bottom: 60rpx" class="flex-bettwen">
  53. <view class="flex">
  54. <view class="xing">
  55. {{ item.consignee.charAt(0) }}
  56. </view>
  57. <view class="content">
  58. <view class="flex">
  59. <view class="name">
  60. {{ item.consignee }}
  61. </view>
  62. <view class="phone">
  63. {{ item.consigneeTel }}
  64. <text class="default" v-if="item.defaultAddress==1">默认</text>
  65. </view>
  66. </view>
  67. <view class="address">
  68. {{ item.region + item.address }}
  69. </view>
  70. </view>
  71. </view>
  72. <view @click.stop="editAddress(item)" style="margin-left: 80rpx" class="picture">
  73. <image :showLoading="true" :src="`${$imgUrl}applyCard/edit.png`" style="width: 48rpx; height: 48rpx"></image>
  74. </view>
  75. </view>
  76. <view :style="state.addressArray ? 'margin-top: 60rpx;' : ''" class="action-bottom">
  77. <button type="default" class="ui-btn" @click="goToAddAddress()">
  78. 添加收货地址
  79. </button>
  80. </view>
  81. </view>
  82. </u-popup>
  83. </template>
  84. <script setup lang="ts">
  85. /*导航*/
  86. import navBgCar from "./components/nav-bg-car1";
  87. import numberplateColor from "./components/layout-numberplate-color";
  88. import { getItem, StorageKeys } from "@/utils/storage";
  89. import { stringToJson } from "@/utils/network/encryption";
  90. import navBar from "@/components/nav-bar/nav-bar2.vue";
  91. import { onLoad, onShow, onPageScroll, onUnload } from "@dcloudio/uni-app";
  92. import {
  93. addressQueryNew,
  94. productReCode,
  95. addProduct,
  96. orderAdd, orderDetailQuery
  97. } from "@/utils/network/api.js";
  98. import { request, requestNew } from "@/utils/network/request.js";
  99. import { reactive, ref } from "vue";
  100. import { msg, noticeUser } from "@/utils/utils";
  101. const scrollTop = ref(0);
  102. const state = reactive({
  103. data: {
  104. vehiclePlate: undefined, //车牌号
  105. vehiclePlateNumber: "", //车牌号
  106. vehiclePlateColor: 0, //车牌颜色
  107. vanType: 1, //客货类型
  108. userType: 1,
  109. whetherToMail: getItem(StorageKeys.OpenId) ? true : "", //是否需要邮寄 小程序默认邮寄 true邮寄||1不邮寄 不登录为1
  110. orderSource: "WECHAT",
  111. opId: "",
  112. consignee: "", //收货人
  113. consigneeTel: "", //收货电话
  114. region: "",
  115. address: "",
  116. postalCode: "",
  117. longitude: "",
  118. latitude: "",
  119. detailedAddress: '', //通过经纬度转的地址
  120. cardType: '', //卡类型
  121. productId: "",//产品编号
  122. },
  123. show: false,
  124. addressArray: [],
  125. isSign: '',
  126. isValueCard: '',
  127. agreeURL: "",
  128. orderId: "",
  129. totalAmount: "",
  130. equityId: ""
  131. });
  132. const goToAddAddress = () => {
  133. uni.navigateTo({
  134. url: "/subpackage/orders/addAddress",
  135. });
  136. };
  137. const editAddress = (val) => {
  138. console.log("val", val)
  139. uni.navigateTo({
  140. url: `/subpackage/orders/editAddress?content=` + JSON.stringify(val),
  141. });
  142. };
  143. const addressSelected = (val : any) => {
  144. console.log("val", val)
  145. state.data = {
  146. ...state.data,
  147. ...val,
  148. };
  149. console.log("state.data.address", state.data.address)
  150. state.show = false;
  151. };
  152. const nextAction = () => {
  153. nextActionRequest()
  154. };
  155. const nextActionRequest = () => {
  156. var data = state.data;
  157. // #ifdef MP-ALIPAY
  158. data.orderSource = 'ALI'
  159. // #endif
  160. const options = {
  161. type: 2,
  162. data: data,
  163. method: "POST",
  164. showLoading: true,
  165. };
  166. requestNew(orderAdd, options).then((res) => {
  167. console.log("res===", res);
  168. if (res.statusCode === 600) {
  169. orderGoAction();
  170. } else {
  171. const data = res;
  172. state.orderId = data.orderId
  173. console.log(data);
  174. //提交产品信息 接口直接不要了
  175. // productReCodeAction(data.orderId).then((result) => {
  176. // 加购权益产品
  177. // addProductRequest().then((res) => { //接口直接不要了
  178. var vehicleId = state.data.vehiclePlate + "_" + state.data.vehiclePlateColor
  179. console.log("state.data.vehiclePlate", state.data.vehiclePlate, state.data.vehiclePlateColor, vehicleId)
  180. if (state.data.userType == 1) {
  181. uni.navigateTo({
  182. url: `/subpackage/orders/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&vanType=${state.data.vanType}&vehicleId=${vehicleId}`,
  183. });
  184. } else {
  185. uni.navigateTo({
  186. url: `/subpackage/orders/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}&isSign=${state.isValueCard}&vanType=${state.data.vanType}&vehicleId=${vehicleId}`,
  187. });
  188. }
  189. // })
  190. // })
  191. }
  192. });
  193. }
  194. //按照订单阶段去跳转
  195. const orderGoAction = () => {
  196. var orderParmas = {
  197. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  198. opId: getItem(StorageKeys.OpenId),
  199. source: "WECHAT",
  200. };
  201. const options = {
  202. type: 2,
  203. data: orderParmas,
  204. method: "POST",
  205. showLoading: true,
  206. };
  207. requestNew(orderDetailQuery, options).then((res) => {
  208. const data = res;
  209. console.log(data);
  210. orderStepGoActon(data);
  211. });
  212. };
  213. //订单状态舔砖
  214. const orderStepGoActon = (val : any) => {
  215. console.log("订单状态舔砖", val);
  216. //完成填写基本信息
  217. if (val.orderStep === 1) {
  218. if (state.data.userType === 1 || val.orderStep === 27) {
  219. uni.redirectTo({
  220. url: `/ subpackage / orders / opening - account - people ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  221. });
  222. } else {
  223. uni.redirectTo({
  224. url: `/ subpackage / orders / opening - account - unit ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  225. });
  226. }
  227. } else if (val.orderStep === 2) {
  228. uni.redirectTo({
  229. url: `/ subpackage / orders / car - release ? orderId = ${val.orderId}&& vehiclePlateColor=${val.vehiclePlateColor} `,
  230. });
  231. } else if (val.orderStep === 3) {
  232. uni.redirectTo({
  233. url: `/ subpackage / orders / choice - product ? orderId = ${val.orderId} `,
  234. });
  235. } else if (val.orderStep === 4) {
  236. uni.redirectTo({
  237. url: `/ subpackage / orders / product - detail ? orderId = ${val.orderId}&& clientFee=${val.product.clientFee}&& id=${val.productId} `,
  238. });
  239. } else if (val.orderStep === 26) {
  240. uni.redirectTo({
  241. url: `/ subpackage / orders / product - detail ? orderId = ${val.orderId}&& clientFee=${val.product.clientFee}&& id=${val.productId} `,
  242. });
  243. }
  244. };
  245. onLoad((option : any) => {
  246. state.data.vanType = Number(option.vanType); //1客车 2货车
  247. state.data.opId = getItem(StorageKeys.OpenId);
  248. state.data.userType = Number(option.userType);
  249. state.data.productId = option.productId;
  250. state.data.vehiclePlate = option.vehiclePlate;
  251. state.data.vehiclePlateColor = option.vehiclePlateColor;
  252. state.isValueCard = option.isValueCard
  253. state.data.cardType = option.cardType
  254. state.totalAmount = option.totalAmount;
  255. state.equityId = option.equityId;
  256. console.log("订单选择推广发行产品接口", option)
  257. uni.getLocation({
  258. type: 'wgs84',
  259. success: function (res) {
  260. state.data.longitude = res.longitude;
  261. state.data.latitude = res.latitude;
  262. console.log("成功回调", res)
  263. uni.request({
  264. url: 'https://apis.map.qq.com/ws/geocoder/v1/',
  265. data: {
  266. location: (res.latitude + "," + res.longitude),
  267. key: 'U3EBZ-EITC3-SRW3P-3PKVC-LWFD6-SJBAE',
  268. },
  269. success: function (res) {
  270. console.log("成功回调", res)
  271. state.data.detailedAddress = res.data.result.address; // 详细地址信息
  272. // 处理获取到的地址信息
  273. },
  274. fail: function (error) {
  275. // 请求失败的处理
  276. }
  277. });
  278. }
  279. });
  280. });
  281. //监听页面滚动
  282. onPageScroll((e) => {
  283. scrollTop.value = e.scrollTop;
  284. });
  285. onShow((option) => {
  286. var data = {
  287. openId: getItem(StorageKeys.OpenId),
  288. };
  289. if (getItem(StorageKeys.OpenId)) {
  290. const options = {
  291. type: 2,
  292. data: data,
  293. method: "POST",
  294. showLoading: true,
  295. };
  296. requestNew(addressQueryNew, options).then((res) => {
  297. const data = res;
  298. console.log("111", data);
  299. state.addressArray = data.result ? data.result : [];
  300. for (var i = 0; i < state.addressArray.length; i++) {
  301. if (state.addressArray[i]['defaultAddress'] == 1) {
  302. state.data = {
  303. ...state.data,
  304. ...state.addressArray[i],
  305. };
  306. }
  307. }
  308. });
  309. }
  310. uni.$on('updateData', function (data) {
  311. var arr = [];
  312. arr.push(data)
  313. state.addressArray = arr
  314. console.log("dizhi", arr)
  315. })
  316. // 删除地址
  317. if (option) {
  318. if (option.del == 1) {
  319. state.addressArray = [];
  320. }
  321. }
  322. });
  323. onUnload(() => {
  324. uni.$off('updateData');
  325. })
  326. const productReCodeAction = (orderId) => {
  327. var data = {
  328. promoteId: state.data.productId,
  329. orderId: orderId,
  330. isValueCard: state.isValueCard,
  331. loginSource: getItem("loginSource")
  332. };
  333. const options = {
  334. type: 2,
  335. data: data,
  336. method: "POST",
  337. showLoading: true,
  338. };
  339. return new Promise(async (resolve, reject) => {
  340. const res = await request(productReCode, options);
  341. const data = stringToJson(res.bizContent);
  342. console.log("111")
  343. resolve(data);
  344. }).catch((error) => {
  345. console.log("222")
  346. reject(error);
  347. });
  348. };
  349. // const addProductRequest = () => {
  350. // const options = {
  351. // type: 2,
  352. // data: {
  353. // orderId: state.orderId, //订单编号
  354. // openId: getItem(StorageKeys.OpenId), //操作人 id
  355. // equityId: state.equityId, //权益Id
  356. // totalAmount: state.totalAmount, //总金额
  357. // isRepeatPurchase: 0
  358. // },
  359. // method: "POST",
  360. // showLoading: true,
  361. // };
  362. // console.log("optionss", options);
  363. // return new Promise(async (resolve, reject) => {
  364. // const res = await request(addProduct, options);
  365. // const data = stringToJson(res.bizContent);
  366. // console.log("111")
  367. // resolve(data);
  368. // }).catch((error) => {
  369. // console.log("222")
  370. // reject(error);
  371. // });
  372. // }
  373. </script>
  374. <style lang="scss" scoped>
  375. .flex {
  376. display: flex;
  377. align-items: center;
  378. }
  379. .content-wrap {
  380. position: absolute;
  381. padding: 0rpx 30rpx;
  382. top: 370rpx;
  383. min-height: calc(100% - 370rpx);
  384. box-sizing: border-box;
  385. width: 100%;
  386. .title {
  387. font-size: 30rpx;
  388. font-family: Noto Sans S Chinese;
  389. font-weight: 400;
  390. color: #000000;
  391. line-height: 30rpx;
  392. margin-bottom: 30rpx;
  393. }
  394. .car-input {}
  395. .chepai-lane {
  396. margin-top: 60rpx;
  397. margin-bottom: 20rpx;
  398. }
  399. .address-lane {
  400. background-color: #fff;
  401. padding: 30rpx;
  402. border-radius: 12rpx;
  403. .title {
  404. font-size: 30rpx;
  405. font-weight: bold;
  406. line-height: 30rpx;
  407. margin-bottom: 30rpx;
  408. font-family: SourceHanSansSC, SourceHanSansSC;
  409. color: #01243A;
  410. }
  411. }
  412. }
  413. .address-content {
  414. display: flex;
  415. align-items: center;
  416. justify-content: space-between;
  417. padding-bottom: 30rpx;
  418. border-bottom: 1rpx solid #dcdcdc;
  419. .l-info {
  420. flex: 1 1 auto;
  421. .l-icon {
  422. flex-shrink: 0;
  423. width: 74rpx;
  424. height: 74rpx;
  425. }
  426. }
  427. .arror {
  428. flex-shrink: 0;
  429. .icon {
  430. width: 24rpx;
  431. height: 24rpx;
  432. }
  433. }
  434. .name {
  435. font-size: 26rpx;
  436. font-family: Microsoft YaHei;
  437. font-weight: 400;
  438. color: #999999;
  439. font-size: 26rpx;
  440. }
  441. .phone {
  442. font-size: 26rpx;
  443. font-family: Microsoft YaHei;
  444. font-weight: 400;
  445. color: #999999;
  446. line-height: 26rpx;
  447. margin-left: 20rpx;
  448. }
  449. .address {
  450. font-size: 32rpx;
  451. font-family: Microsoft YaHei;
  452. font-weight: 400;
  453. color: #333333;
  454. line-height: 32rpx;
  455. width: 86%;
  456. word-break: break-word;
  457. }
  458. }
  459. .address-line {
  460. padding: 20px;
  461. .flex-bettwen {
  462. display: flex;
  463. align-items: center;
  464. justify-content: space-between;
  465. }
  466. .xing {
  467. width: 68rpx;
  468. height: 68rpx;
  469. background: rgba(0, 52, 87, 0.2);
  470. border-radius: 50%;
  471. font-size: 26rpx;
  472. font-weight: 400;
  473. color: #fff;
  474. line-height: 68rpx;
  475. text-align: center;
  476. }
  477. .content {
  478. margin-left: 20px;
  479. .name {
  480. font-size: 30rpx;
  481. font-family: Microsoft YaHei;
  482. font-weight: 500;
  483. color: #333333;
  484. }
  485. .phone {
  486. margin-left: 10rpx;
  487. font-size: 24rpx;
  488. font-family: Microsoft YaHei;
  489. font-weight: 400;
  490. color: #999999;
  491. line-height: 36rpx;
  492. }
  493. .address {
  494. margin-top: 10rpx;
  495. font-size: 26rpx;
  496. font-family: Microsoft YaHei;
  497. font-weight: 400;
  498. color: #333333;
  499. line-height: 36rpx;
  500. }
  501. .picture {
  502. width: 48rpx;
  503. height: 48rpx;
  504. }
  505. .editIcon {
  506. width: 48rpx;
  507. height: 48rpx;
  508. }
  509. }
  510. }
  511. .action {
  512. position: absolute;
  513. bottom: 0rpx;
  514. left: 0;
  515. height: 128rpx;
  516. background-color: #fff;
  517. border-radius: 30rpx 30rpx 0 0;
  518. width: 100vw;
  519. display: flex;
  520. align-items: center;
  521. justify-content: center;
  522. .button {
  523. height: 88rpx;
  524. background: radial-gradient(at 0% 0%, #01243A 0%, #004576 100%);
  525. border-radius: 40rpx;
  526. font-size: 32rpx;
  527. font-weight: 400;
  528. color: #ffffff;
  529. line-height: 88rpx;
  530. width: 660rpx;
  531. margin: 0 auto;
  532. }
  533. }
  534. .action-bottom {
  535. padding-bottom: 30rpx;
  536. .button {
  537. height: 88rpx;
  538. background: radial-gradient(at 0% 0%, #01243A 0%, #004576 100%);
  539. border-radius: 40rpx;
  540. font-size: 32rpx;
  541. font-weight: 400;
  542. color: #ffffff;
  543. line-height: 88rpx;
  544. width: 660rpx;
  545. margin: 0 auto;
  546. }
  547. }
  548. :deep(.numberplates .numberplate-bg) {
  549. width: 190rpx;
  550. }
  551. :deep(.numberplates .numberplate) {
  552. margin-right: 0rpx !important;
  553. width: 190rpx;
  554. }
  555. :deep(.numberplates) {
  556. justify-content: space-between;
  557. }
  558. .default {
  559. border: 1rpx solid #00b38b;
  560. border-radius: 5rpx;
  561. padding: 2rpx 4rpx;
  562. color: #00b38b;
  563. margin-left: 4rpx;
  564. }
  565. </style>