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.

essential-information-two.vue 15KB

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