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 14KB

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