Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

essential-information.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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. <!-- 车牌输入 -->
  6. <view class="car-input">
  7. <view class="title">请输入申办车牌</view>
  8. <car-number-input @numberInputResult="carNumber"></car-number-input>
  9. </view>
  10. <!-- 车牌颜色 -->
  11. <view class="chepai-lane">
  12. <view class="title">选择车牌颜色</view>
  13. <numberplate-color :numberplate="state.data.vehiclePlateNumber" :type="state.data.type"
  14. @numberplateResult="checkNumberplateColor">
  15. </numberplate-color>
  16. </view>
  17. <view style="margin-top: 30rpx" class="action">
  18. <button type="default" class="button" @click="nextAction()">
  19. 下一步
  20. </button>
  21. </view>
  22. <view>
  23. </view>
  24. </view>
  25. <!-- 地址弹窗 -->
  26. <u-popup mode="bottom" v-model="state.show">
  27. <view class="address-line">
  28. <view v-if="state.addressArray" v-for="(item, index) in state.addressArray" :key="index"
  29. @click="addressSelected(item)" style="margin-bottom: 60rpx" class="flex-bettwen">
  30. <view class="flex">
  31. <view class="xing">
  32. {{ item.consignee.charAt(0) }}
  33. </view>
  34. <view class="content">
  35. <view class="flex">
  36. <view class="name">
  37. {{ item.consignee }}
  38. </view>
  39. <view class="phone">
  40. {{ item.consigneeTel }}
  41. <text class="default" v-if="item.defaultAddress==1">默认</text>
  42. </view>
  43. </view>
  44. <view class="address">
  45. {{ item.region + item.address }}
  46. </view>
  47. </view>
  48. </view>
  49. <view @click.stop="editAddress(item)" style="margin-left: 80rpx" class="picture">
  50. <image :showLoading="true" :src="`${$imgUrl}applyCard/edit.png`"
  51. style="width: 48rpx; height: 48rpx"></image>
  52. </view>
  53. </view>
  54. <view :style="state.addressArray ? 'margin-top: 60rpx;' : ''" class="action-bottom">
  55. <button type="default" class="button" @click="goToAddAddress()">
  56. 添加收货地址
  57. </button>
  58. </view>
  59. </view>
  60. </u-popup>
  61. </template>
  62. <script setup lang="ts">
  63. /*导航*/
  64. import navBgCar from "./components/nav-bg-car2";
  65. import carNumberInput from "@/components/car-number-input/car-number-input.vue";
  66. import numberplateColor from "./components/layout-numberplate-color";
  67. import { getItem, StorageKeys } from "@/utils/storage";
  68. import { stringToJson } from "@/utils/network/encryption";
  69. import navBar from "@/components/nav-bar/nav-bar2.vue";
  70. import { onLoad, onShow, onPageScroll, onUnload } from "@dcloudio/uni-app";
  71. import {
  72. addressQuery,
  73. etcCreatOrder,
  74. etcVehiclePlateVer,
  75. searchOrder,
  76. productReCode,
  77. infoQuery,
  78. envs,
  79. addProduct,
  80. isSubmitOrderApi
  81. } from "@/utils/network/api.js";
  82. import { request } from "@/utils/network/request.js";
  83. import { reactive, ref } from "vue";
  84. import { msg, noticeUser } from "@/utils/utils";
  85. // import amap from "../../lib/amap-uni.130.js";//引入高德地图小程序插件
  86. const scrollTop = ref(0);
  87. const state = reactive({
  88. data: {
  89. vehiclePlate: undefined, //车牌号
  90. vehiclePlateNumber: "", //车牌号
  91. vehiclePlateColor: 0, //车牌颜色
  92. type: "1", //车牌类型
  93. userType: 1,
  94. whetherToMail: getItem(StorageKeys.OpenId) ? 0 : "", //是否需要邮寄 小程序默认邮寄 0邮寄||1不邮寄 不登录为1
  95. orderSource: "WECHAT",
  96. opId: "",
  97. consignee: "", //收货人
  98. consigneeTel: "", //收货电话
  99. region: "",
  100. address: "",
  101. postalCode: "",
  102. promoteId: "",
  103. longitude: "",
  104. latitude: "",
  105. detailedAddress: '', //通过经纬度转的地址
  106. cardType: '' //卡类型
  107. },
  108. show: false,
  109. addressArray: [],
  110. isSign: '',
  111. isValueCard: '',
  112. agreeURL: "",
  113. orderId: "",
  114. totalAmount: "",
  115. equityId: ""
  116. });
  117. /* 选择车牌颜色 */
  118. const checkNumberplateColor = (item : any) => {
  119. state.data.vehiclePlateColor = item;
  120. };
  121. const goToAddAddress = () => {
  122. uni.navigateTo({
  123. url: "/subpackage/orders/addAddress",
  124. });
  125. };
  126. const editAddress = (val) => {
  127. console.log("val", val)
  128. uni.navigateTo({
  129. url: `/subpackage/orders/editAddress?content=` + JSON.stringify(val),
  130. });
  131. };
  132. const carNumber = (val : any) => {
  133. state.data.vehiclePlate = val;
  134. state.data.vehiclePlateNumber = val;
  135. };
  136. const addressSelected = (val : any) => {
  137. console.log("val", val)
  138. state.data = {
  139. ...state.data,
  140. ...val,
  141. };
  142. console.log("state.data.address", state.data.address)
  143. state.show = false;
  144. };
  145. const nextAction = () => {
  146. if (!state.data.vehiclePlate) {
  147. msg("请输入申办车牌");
  148. return;
  149. }
  150. noticeUser(() => {
  151. nextActionRequest()
  152. });
  153. };
  154. const nextActionRequest = () => {
  155. if (!state.data.vehiclePlate) {
  156. msg("请输入申办车牌");
  157. return;
  158. }
  159. state.data.vehiclePlate = state.data.vehiclePlate.trim();
  160. console.log(state.data.vehiclePlate);
  161. console.log(state.data.vehiclePlate.length);
  162. if (state.data.vehiclePlate.length < 7) {
  163. msg("请输入正确的申办车牌");
  164. return;
  165. }
  166. //1.优先车牌校验 2.在进行订单创建
  167. isSubmitOrderRequest(state.data.vehiclePlate, state.data.vehiclePlateColor).then((item) => {
  168. console.log("item.data.data.canSubmit", item.data.data.canSubmit)
  169. if (item.data.data.canSubmit == 1) {
  170. var vehicleData = {
  171. vehiclePlate: state.data.vehiclePlate,
  172. vehiclePlateColor: state.data.vehiclePlateColor,
  173. };
  174. const options = {
  175. type: 2,
  176. data: vehicleData,
  177. method: "POST",
  178. showLoading: true,
  179. };
  180. console.log("车牌信息", options)
  181. request(etcVehiclePlateVer, options).then((res) => {
  182. uni.redirectTo({
  183. url: `/subpackage/orders/essential-information-two?promoteId=${getItem("promoteId")}&userType=${state.data.userType}&type=${state.data.type}&isValueCard=${state.isValueCard}&totalAmount=${state.totalAmount}&equityId=${state.equityId}&vehiclePlate=${state.data.vehiclePlate}&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  184. });
  185. });
  186. } else {
  187. msg(item.data.data.canSubmitMsg);
  188. }
  189. })
  190. }
  191. //按照订单阶段去跳转
  192. const orderGoAction = () => {
  193. var orderParmas = {
  194. vehicleId: state.data.vehiclePlate + "_" + state.data.vehiclePlateColor,
  195. opId: getItem(StorageKeys.OpenId),
  196. source: "WECHAT",
  197. };
  198. const options = {
  199. type: 2,
  200. data: orderParmas,
  201. method: "POST",
  202. showLoading: true,
  203. };
  204. request(searchOrder, options).then((res) => {
  205. const data = stringToJson(res.bizContent);
  206. console.log(data);
  207. orderStepGoActon(data);
  208. });
  209. };
  210. //订单状态舔砖
  211. const orderStepGoActon = (val : any) => {
  212. console.log("订单状态舔砖", val);
  213. //完成填写基本信息
  214. if (val.orderStep === 1) {
  215. if (state.data.userType === 1 || val.orderStep === 27) {
  216. uni.redirectTo({
  217. url: `/subpackage/orders/opening-account-people?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  218. });
  219. } else {
  220. uni.redirectTo({
  221. url: `/subpackage/orders/opening-account-unit?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  222. });
  223. }
  224. } else if (val.orderStep === 2) {
  225. uni.redirectTo({
  226. url: `/subpackage/orders/car-release?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  227. });
  228. } else if (val.orderStep === 3) {
  229. uni.redirectTo({
  230. url: `/subpackage/orders/choice-product?orderId=${val.orderId}`,
  231. });
  232. } else if (val.orderStep === 4) {
  233. uni.redirectTo({
  234. url: `/subpackage/orders/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  235. });
  236. } else if (val.orderStep === 26) {
  237. uni.redirectTo({
  238. url: `/subpackage/orders/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  239. });
  240. }
  241. };
  242. onLoad((option : any) => {
  243. state.data.type = option.type; //1客车 2货车
  244. state.data.opId = getItem(StorageKeys.OpenId);
  245. state.data.userType = option.userType;
  246. state.data.promoteId = option.promoteId;
  247. state.isValueCard = option.isValueCard
  248. state.data.cardType = option.isValueCard
  249. state.totalAmount = option.totalAmount;
  250. state.equityId = option.equityId;
  251. console.log("订单选择推广发行产品接口", option)
  252. });
  253. //监听页面滚动
  254. onPageScroll((e) => {
  255. scrollTop.value = e.scrollTop;
  256. });
  257. onShow((option) => {
  258. var data = {
  259. openId: getItem(StorageKeys.OpenId),
  260. };
  261. if (getItem(StorageKeys.OpenId)) {
  262. const options = {
  263. type: 2,
  264. data: data,
  265. method: "POST",
  266. showLoading: true,
  267. };
  268. request(addressQuery, options).then((res) => {
  269. const data = stringToJson(res.bizContent);
  270. console.log("111", data);
  271. state.addressArray = data.data ? data.data : [];
  272. for (var i = 0; i < state.addressArray.length; i++) {
  273. if (state.addressArray[i]['defaultAddress'] == 1) {
  274. state.data = {
  275. ...state.data,
  276. ...state.addressArray[i],
  277. };
  278. }
  279. }
  280. });
  281. }
  282. uni.$on('updateData', function (data) {
  283. var arr = [];
  284. arr.push(data)
  285. state.addressArray = arr
  286. console.log("dizhi", arr)
  287. })
  288. // 删除地址
  289. if (option) {
  290. if (option.del == 1) {
  291. state.addressArray = [];
  292. }
  293. }
  294. });
  295. onUnload(() => {
  296. uni.$off('updateData');
  297. })
  298. const productReCodeAction = (orderId) => {
  299. var data = {
  300. promoteId: state.data.promoteId,
  301. orderId: orderId,
  302. isValueCard: state.isValueCard,
  303. loginSource: getItem("loginSource")
  304. };
  305. const options = {
  306. type: 2,
  307. data: data,
  308. method: "POST",
  309. showLoading: true,
  310. };
  311. return new Promise(async (resolve, reject) => {
  312. const res = await request(productReCode, options);
  313. const data = stringToJson(res.bizContent);
  314. console.log("111")
  315. resolve(data);
  316. }).catch((error) => {
  317. console.log("222")
  318. reject(error);
  319. });
  320. };
  321. const addProductRequest = () => {
  322. const options = {
  323. type: 2,
  324. data: {
  325. orderId: state.orderId, //订单编号
  326. openId: getItem(StorageKeys.OpenId), //操作人 id
  327. equityId: state.equityId, //权益Id
  328. totalAmount: state.totalAmount, //总金额
  329. isRepeatPurchase: 0
  330. },
  331. method: "POST",
  332. showLoading: true,
  333. };
  334. console.log("optionss", options);
  335. return new Promise(async (resolve, reject) => {
  336. const res = await request(addProduct, options);
  337. const data = stringToJson(res.bizContent);
  338. console.log("111")
  339. resolve(data);
  340. }).catch((error) => {
  341. console.log("222")
  342. reject(error);
  343. });
  344. }
  345. // 老中台-检测能否提交订单
  346. const isSubmitOrderRequest = (vehiclePlate, vehiclePlateColor) => {
  347. const options = {
  348. type: 2,
  349. data: {
  350. vehicleId: vehiclePlate + "_" + vehiclePlateColor
  351. },
  352. method: "POST",
  353. showLoading: true,
  354. };
  355. return new Promise(async (resolve, reject) => {
  356. const res = await request(isSubmitOrderApi, options);
  357. const data = stringToJson(res.bizContent);
  358. console.log("111")
  359. resolve(data);
  360. }).catch((error) => {
  361. console.log("222")
  362. reject(error);
  363. });
  364. }
  365. </script>
  366. <style lang="scss" scoped>
  367. .flex {
  368. display: flex;
  369. align-items: center;
  370. }
  371. .content-wrap {
  372. position: relative;
  373. margin-top: -50rpx;
  374. padding: 0rpx 30rpx;
  375. .title {
  376. font-size: 30rpx;
  377. font-family: Noto Sans S Chinese;
  378. font-weight: 400;
  379. color: #000000;
  380. line-height: 30rpx;
  381. margin-bottom: 30rpx;
  382. }
  383. .car-input {}
  384. .chepai-lane {
  385. margin-top: 60rpx;
  386. margin-bottom: 20rpx;
  387. }
  388. .address-lane {
  389. margin-bottom: 30rpx;
  390. .title {
  391. font-size: 30rpx;
  392. font-weight: 400;
  393. color: #000000;
  394. line-height: 30rpx;
  395. }
  396. }
  397. }
  398. .address-content {
  399. display: flex;
  400. align-items: center;
  401. justify-content: space-between;
  402. padding-bottom: 30rpx;
  403. border-bottom: 1rpx solid #dcdcdc;
  404. .name {
  405. font-size: 26rpx;
  406. font-family: Microsoft YaHei;
  407. font-weight: 400;
  408. color: #999999;
  409. font-size: 26rpx;
  410. }
  411. .phone {
  412. font-size: 26rpx;
  413. font-family: Microsoft YaHei;
  414. font-weight: 400;
  415. color: #999999;
  416. line-height: 26rpx;
  417. margin-left: 20rpx;
  418. }
  419. .arror .icon {
  420. width: 36rpx;
  421. height: 36rpx;
  422. }
  423. .address {
  424. font-size: 32rpx;
  425. font-family: Microsoft YaHei;
  426. font-weight: 400;
  427. color: #333333;
  428. line-height: 32rpx;
  429. }
  430. }
  431. .address-line {
  432. padding: 20px;
  433. .flex-bettwen {
  434. display: flex;
  435. align-items: center;
  436. justify-content: space-between;
  437. }
  438. .xing {
  439. width: 68rpx;
  440. height: 68rpx;
  441. background: rgba(0, 179, 139, 0.2);
  442. border-radius: 50%;
  443. font-size: 26rpx;
  444. font-weight: 400;
  445. color: #00b38b;
  446. line-height: 68rpx;
  447. text-align: center;
  448. }
  449. .content {
  450. margin-left: 20px;
  451. .name {
  452. font-size: 30rpx;
  453. font-family: Microsoft YaHei;
  454. font-weight: 500;
  455. color: #333333;
  456. }
  457. .phone {
  458. margin-left: 10rpx;
  459. font-size: 24rpx;
  460. font-family: Microsoft YaHei;
  461. font-weight: 400;
  462. color: #999999;
  463. line-height: 36rpx;
  464. }
  465. .address {
  466. margin-top: 10rpx;
  467. font-size: 26rpx;
  468. font-family: Microsoft YaHei;
  469. font-weight: 400;
  470. color: #333333;
  471. line-height: 36rpx;
  472. }
  473. .picture {
  474. width: 48rpx;
  475. height: 48rpx;
  476. }
  477. .editIcon {
  478. width: 48rpx;
  479. height: 48rpx;
  480. }
  481. }
  482. }
  483. .action {
  484. padding-bottom: 100rpx;
  485. .button {
  486. height: 80rpx;
  487. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  488. border-radius: 40rpx;
  489. font-size: 32rpx;
  490. font-weight: 400;
  491. color: #ffffff;
  492. line-height: 80rpx;
  493. }
  494. }
  495. .action-bottom {
  496. padding-bottom: 30rpx;
  497. .button {
  498. height: 80rpx;
  499. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  500. border-radius: 40rpx;
  501. font-size: 32rpx;
  502. font-weight: 400;
  503. color: #ffffff;
  504. line-height: 80rpx;
  505. }
  506. }
  507. :deep(.numberplates .numberplate-bg) {
  508. width: 190rpx;
  509. }
  510. :deep(.numberplates .numberplate) {
  511. margin-right: 0rpx !important;
  512. width: 190rpx;
  513. }
  514. :deep(.numberplates) {
  515. justify-content: space-between;
  516. }
  517. .default {
  518. border: 1rpx solid #00b38b;
  519. border-radius: 5rpx;
  520. padding: 2rpx 4rpx;
  521. color: #00b38b;
  522. margin-left: 4rpx;
  523. }
  524. </style>