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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  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. // import amap from "../../lib/amap-uni.130.js";//引入高德地图小程序插件
  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. },
  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. console.log("订单选择推广发行产品接口", option)
  264. uni.getLocation({
  265. type: 'wgs84',
  266. success: function (res) {
  267. state.data.longitude = res.longitude;
  268. state.data.latitude = res.latitude;
  269. console.log("成功回调", res)
  270. uni.request({
  271. url: 'https://apis.map.qq.com/ws/geocoder/v1/',
  272. data: {
  273. location: (res.latitude + "," + res.longitude),
  274. key: 'U3EBZ-EITC3-SRW3P-3PKVC-LWFD6-SJBAE',
  275. },
  276. success: function (res) {
  277. console.log("成功回调", res)
  278. state.data.detailedAddress = res.data.result.address; // 详细地址信息
  279. // 处理获取到的地址信息
  280. },
  281. fail: function (error) {
  282. // 请求失败的处理
  283. }
  284. });
  285. }
  286. });
  287. });
  288. //监听页面滚动
  289. onPageScroll((e) => {
  290. scrollTop.value = e.scrollTop;
  291. });
  292. onShow((option) => {
  293. var data = {
  294. openId: getItem(StorageKeys.OpenId),
  295. };
  296. if (getItem(StorageKeys.OpenId)) {
  297. const options = {
  298. type: 2,
  299. data: data,
  300. method: "POST",
  301. showLoading: true,
  302. };
  303. request(addressQuery, options).then((res) => {
  304. const data = stringToJson(res.bizContent);
  305. console.log("111", data);
  306. state.addressArray = data.data ? data.data : [];
  307. for (var i = 0; i < state.addressArray.length; i++) {
  308. if (state.addressArray[i]['defaultAddress'] == 1) {
  309. state.data = {
  310. ...state.data,
  311. ...state.addressArray[i],
  312. };
  313. }
  314. }
  315. });
  316. }
  317. uni.$on('updateData', function (data) {
  318. var arr = [];
  319. arr.push(data)
  320. state.addressArray = arr
  321. console.log("dizhi", arr)
  322. })
  323. // 删除地址
  324. if (option) {
  325. if (option.del == 1) {
  326. state.addressArray = [];
  327. }
  328. }
  329. });
  330. onUnload(() => {
  331. uni.$off('updateData');
  332. })
  333. const productReCodeAction = (orderId) => {
  334. var data = {
  335. promoteId: state.data.promoteId,
  336. orderId: orderId,
  337. isValueCard: state.isValueCard,
  338. loginSource: getItem("loginSource")
  339. };
  340. const options = {
  341. type: 2,
  342. data: data,
  343. method: "POST",
  344. showLoading: true,
  345. };
  346. return new Promise(async (resolve, reject) => {
  347. const res = await request(productReCode, options);
  348. const data = stringToJson(res.bizContent);
  349. console.log("111")
  350. resolve(data);
  351. }).catch((error) => {
  352. console.log("222")
  353. reject(error);
  354. });
  355. };
  356. const addProductRequest = () => {
  357. const options = {
  358. type: 2,
  359. data: {
  360. orderId: state.orderId, //订单编号
  361. openId: getItem(StorageKeys.OpenId), //操作人 id
  362. equityId: state.equityId, //权益Id
  363. totalAmount: state.totalAmount, //总金额
  364. isRepeatPurchase: 0
  365. },
  366. method: "POST",
  367. showLoading: true,
  368. };
  369. console.log("optionss", options);
  370. return new Promise(async (resolve, reject) => {
  371. const res = await request(addProduct, options);
  372. const data = stringToJson(res.bizContent);
  373. console.log("111")
  374. resolve(data);
  375. }).catch((error) => {
  376. console.log("222")
  377. reject(error);
  378. });
  379. }
  380. // 老中台-检测能否提交订单
  381. const isSubmitOrderRequest = (vehiclePlate, vehiclePlateColor) => {
  382. const options = {
  383. type: 2,
  384. data: {
  385. vehicleId: vehiclePlate + "_" + vehiclePlateColor
  386. },
  387. method: "POST",
  388. showLoading: true,
  389. };
  390. return new Promise(async (resolve, reject) => {
  391. const res = await request(isSubmitOrderApi, options);
  392. const data = stringToJson(res.bizContent);
  393. console.log("111")
  394. resolve(data);
  395. }).catch((error) => {
  396. console.log("222")
  397. reject(error);
  398. });
  399. }
  400. </script>
  401. <style lang="scss" scoped>
  402. .flex {
  403. display: flex;
  404. align-items: center;
  405. }
  406. .content-wrap {
  407. position: relative;
  408. margin-top: -50rpx;
  409. padding: 0rpx 30rpx;
  410. .title {
  411. font-size: 30rpx;
  412. font-family: Noto Sans S Chinese;
  413. font-weight: 400;
  414. color: #000000;
  415. line-height: 30rpx;
  416. margin-bottom: 30rpx;
  417. }
  418. .car-input {}
  419. .chepai-lane {
  420. margin-top: 60rpx;
  421. margin-bottom: 20rpx;
  422. }
  423. .address-lane {
  424. margin-bottom: 30rpx;
  425. .title {
  426. font-size: 30rpx;
  427. font-weight: 400;
  428. color: #000000;
  429. line-height: 30rpx;
  430. }
  431. }
  432. }
  433. .address-content {
  434. display: flex;
  435. align-items: center;
  436. justify-content: space-between;
  437. padding-bottom: 30rpx;
  438. border-bottom: 1rpx solid #dcdcdc;
  439. .name {
  440. font-size: 26rpx;
  441. font-family: Microsoft YaHei;
  442. font-weight: 400;
  443. color: #999999;
  444. font-size: 26rpx;
  445. }
  446. .phone {
  447. font-size: 26rpx;
  448. font-family: Microsoft YaHei;
  449. font-weight: 400;
  450. color: #999999;
  451. line-height: 26rpx;
  452. margin-left: 20rpx;
  453. }
  454. .arror .icon {
  455. width: 36rpx;
  456. height: 36rpx;
  457. }
  458. .address {
  459. font-size: 32rpx;
  460. font-family: Microsoft YaHei;
  461. font-weight: 400;
  462. color: #333333;
  463. line-height: 32rpx;
  464. width: 86%;
  465. word-break: break-word;
  466. }
  467. }
  468. .address-line {
  469. padding: 20px;
  470. .flex-bettwen {
  471. display: flex;
  472. align-items: center;
  473. justify-content: space-between;
  474. }
  475. .xing {
  476. width: 68rpx;
  477. height: 68rpx;
  478. background: rgba(0, 179, 139, 0.2);
  479. border-radius: 50%;
  480. font-size: 26rpx;
  481. font-weight: 400;
  482. color: #00b38b;
  483. line-height: 68rpx;
  484. text-align: center;
  485. }
  486. .content {
  487. margin-left: 20px;
  488. .name {
  489. font-size: 30rpx;
  490. font-family: Microsoft YaHei;
  491. font-weight: 500;
  492. color: #333333;
  493. }
  494. .phone {
  495. margin-left: 10rpx;
  496. font-size: 24rpx;
  497. font-family: Microsoft YaHei;
  498. font-weight: 400;
  499. color: #999999;
  500. line-height: 36rpx;
  501. }
  502. .address {
  503. margin-top: 10rpx;
  504. font-size: 26rpx;
  505. font-family: Microsoft YaHei;
  506. font-weight: 400;
  507. color: #333333;
  508. line-height: 36rpx;
  509. }
  510. .picture {
  511. width: 48rpx;
  512. height: 48rpx;
  513. }
  514. .editIcon {
  515. width: 48rpx;
  516. height: 48rpx;
  517. }
  518. }
  519. }
  520. .action {
  521. padding-bottom: 100rpx;
  522. .button {
  523. height: 80rpx;
  524. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  525. border-radius: 40rpx;
  526. font-size: 32rpx;
  527. font-weight: 400;
  528. color: #ffffff;
  529. line-height: 80rpx;
  530. }
  531. }
  532. .action-bottom {
  533. padding-bottom: 30rpx;
  534. .button {
  535. height: 80rpx;
  536. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  537. border-radius: 40rpx;
  538. font-size: 32rpx;
  539. font-weight: 400;
  540. color: #ffffff;
  541. line-height: 80rpx;
  542. }
  543. }
  544. :deep(.numberplates .numberplate-bg) {
  545. width: 190rpx;
  546. }
  547. :deep(.numberplates .numberplate) {
  548. margin-right: 0rpx !important;
  549. width: 190rpx;
  550. }
  551. :deep(.numberplates) {
  552. justify-content: space-between;
  553. }
  554. .default {
  555. border: 1rpx solid #00b38b;
  556. border-radius: 5rpx;
  557. padding: 2rpx 4rpx;
  558. color: #00b38b;
  559. margin-left: 4rpx;
  560. }
  561. </style>