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

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