Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

essential-information-two.vue 15KB

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