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

essential-information-two.vue 15KB

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