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.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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. <!-- 车牌输入 -->
  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.vanType"
  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. isSubmitOrderApi,
  74. plateCheck,
  75. etcVehiclePlateVer
  76. } from "@/utils/network/api.js";
  77. import { request, requestNew } from "@/utils/network/request.js";
  78. import { reactive, ref } from "vue";
  79. import { msg, noticeUser } from "@/utils/utils";
  80. const scrollTop = ref(0);
  81. const state = reactive({
  82. data: {
  83. vehiclePlate: undefined, //车牌号
  84. vehiclePlateNumber: "", //车牌号
  85. vehiclePlateColor: 0, //车牌颜色
  86. vanType: 1, //车牌类型
  87. userType: 1,
  88. whetherToMail: getItem(StorageKeys.OpenId) ? 0 : "", //是否需要邮寄 小程序默认邮寄 0邮寄||1不邮寄 不登录为1
  89. orderSource: "WECHAT",
  90. opId: "",
  91. consignee: "", //收货人
  92. consigneeTel: "", //收货电话
  93. region: "",
  94. address: "",
  95. postalCode: "",
  96. longitude: "",
  97. latitude: "",
  98. detailedAddress: '', //通过经纬度转的地址
  99. cardType: '' ,//卡类型
  100. productId:""
  101. },
  102. show: false,
  103. addressArray: [],
  104. isSign: '',
  105. isValueCard: '',
  106. agreeURL: "",
  107. orderId: "",
  108. totalAmount: "",
  109. equityId: ""
  110. });
  111. /* 选择车牌颜色 */
  112. const checkNumberplateColor = (item : any) => {
  113. state.data.vehiclePlateColor = item;
  114. };
  115. const goToAddAddress = () => {
  116. uni.navigateTo({
  117. url: "/subpackage/orders/addAddress",
  118. });
  119. };
  120. const editAddress = (val) => {
  121. console.log("val", val)
  122. uni.navigateTo({
  123. url: `/subpackage/orders/editAddress?content=` + JSON.stringify(val),
  124. });
  125. };
  126. const carNumber = (val : any) => {
  127. state.data.vehiclePlate = val;
  128. state.data.vehiclePlateNumber = val;
  129. };
  130. const addressSelected = (val : any) => {
  131. console.log("val", val)
  132. state.data = {
  133. ...state.data,
  134. ...val,
  135. };
  136. console.log("state.data.address", state.data.address)
  137. state.show = false;
  138. };
  139. const nextAction = () => {
  140. if (!state.data.vehiclePlate) {
  141. msg("请输入申办车牌");
  142. return;
  143. }
  144. noticeUser(() => {
  145. nextActionRequest()
  146. });
  147. };
  148. const nextActionRequest = () => {
  149. if (!state.data.vehiclePlate) {
  150. msg("请输入申办车牌");
  151. return;
  152. }
  153. state.data.vehiclePlate = state.data.vehiclePlate.trim();
  154. console.log(state.data.vehiclePlate);
  155. console.log(state.data.vehiclePlate.length);
  156. if (state.data.vehiclePlate.length < 7) {
  157. msg("请输入正确的申办车牌");
  158. return;
  159. }
  160. //1.优先车牌校验 2.在进行订单创建
  161. isSubmitOrderRequest(state.data.vehiclePlate, state.data.vehiclePlateColor).then((item) => {
  162. console.log("item.data.data.canSubmit", item.data.data.canSubmit)
  163. if (item.data.data.canSubmit == 1) {
  164. var vehicleData = {
  165. vehiclePlate: state.data.vehiclePlate,
  166. vehiclePlateColor: state.data.vehiclePlateColor,
  167. };
  168. const options = {
  169. type: 2,
  170. data: vehicleData,
  171. method: "POST",
  172. showLoading: true,
  173. };
  174. console.log("车牌信息", options)
  175. // 车牌校验有问题 还没改好
  176. // requestNew(plateCheck, options).then((res) => {
  177. // uni.redirectTo({
  178. // url: `/subpackage/orders/essential-information-two?userType=${state.data.userType}&vanType=${state.data.vanType}&isValueCard=${state.isValueCard}&totalAmount=${state.totalAmount}&equityId=${state.equityId}&vehiclePlate=${state.data.vehiclePlate}&vehiclePlateColor=${state.data.vehiclePlateColor}&productId=${state.data.productId}`,
  179. // });
  180. // });
  181. request(etcVehiclePlateVer, options).then((res) => {
  182. uni.redirectTo({
  183. url: `/subpackage/orders/essential-information-two?userType=${state.data.userType}&vanType=${state.data.vanType}&isValueCard=${state.isValueCard}&totalAmount=${state.totalAmount}&equityId=${state.equityId}&vehiclePlate=${state.data.vehiclePlate}&vehiclePlateColor=${state.data.vehiclePlateColor}&productId=${state.data.productId}`,
  184. });
  185. });
  186. } else {
  187. msg(item.data.data.canSubmitMsg);
  188. }
  189. })
  190. }
  191. onLoad((option : any) => {
  192. state.data.vanType = option.vanType; //1客车 2货车
  193. state.data.opId = getItem(StorageKeys.OpenId);
  194. state.data.userType = option.userType;
  195. state.data.productId = option.productId;
  196. state.isValueCard = option.isValueCard
  197. state.data.cardType = option.isValueCard
  198. state.totalAmount = option.totalAmount;
  199. state.equityId = option.equityId;
  200. console.log("订单选择推广发行产品接口", option)
  201. });
  202. //监听页面滚动
  203. onPageScroll((e) => {
  204. scrollTop.value = e.scrollTop;
  205. });
  206. onShow((option) => {
  207. var data = {
  208. openId: getItem(StorageKeys.OpenId),
  209. };
  210. if (getItem(StorageKeys.OpenId)) {
  211. const options = {
  212. type: 2,
  213. data: data,
  214. method: "POST",
  215. showLoading: true,
  216. };
  217. request(addressQuery, options).then((res) => {
  218. const data = stringToJson(res.bizContent);
  219. console.log("111", data);
  220. state.addressArray = data.data ? data.data : [];
  221. for (var i = 0; i < state.addressArray.length; i++) {
  222. if (state.addressArray[i]['defaultAddress'] == 1) {
  223. state.data = {
  224. ...state.data,
  225. ...state.addressArray[i],
  226. };
  227. }
  228. }
  229. });
  230. }
  231. uni.$on('updateData', function (data) {
  232. var arr = [];
  233. arr.push(data)
  234. state.addressArray = arr
  235. console.log("dizhi", arr)
  236. })
  237. // 删除地址
  238. if (option) {
  239. if (option.del == 1) {
  240. state.addressArray = [];
  241. }
  242. }
  243. });
  244. onUnload(() => {
  245. uni.$off('updateData');
  246. })
  247. // 老中台-检测能否提交订单
  248. const isSubmitOrderRequest = (vehiclePlate, vehiclePlateColor) => {
  249. const options = {
  250. type: 2,
  251. data: {
  252. vehicleId: vehiclePlate + "_" + vehiclePlateColor
  253. },
  254. method: "POST",
  255. showLoading: true,
  256. };
  257. return new Promise(async (resolve, reject) => {
  258. const res = await request(isSubmitOrderApi, options);
  259. const data = stringToJson(res.bizContent);
  260. console.log("111")
  261. resolve(data);
  262. }).catch((error) => {
  263. console.log("222")
  264. reject(error);
  265. });
  266. }
  267. </script>
  268. <style lang="scss" scoped>
  269. .flex {
  270. display: flex;
  271. align-items: center;
  272. }
  273. .content-wrap {
  274. position: relative;
  275. margin-top: -50rpx;
  276. padding: 0rpx 30rpx;
  277. .title {
  278. font-size: 30rpx;
  279. font-family: Noto Sans S Chinese;
  280. font-weight: 400;
  281. color: #000000;
  282. line-height: 30rpx;
  283. margin-bottom: 30rpx;
  284. }
  285. .car-input {}
  286. .chepai-lane {
  287. margin-top: 60rpx;
  288. margin-bottom: 20rpx;
  289. }
  290. .address-lane {
  291. margin-bottom: 30rpx;
  292. .title {
  293. font-size: 30rpx;
  294. font-weight: 400;
  295. color: #000000;
  296. line-height: 30rpx;
  297. }
  298. }
  299. }
  300. .address-content {
  301. display: flex;
  302. align-items: center;
  303. justify-content: space-between;
  304. padding-bottom: 30rpx;
  305. border-bottom: 1rpx solid #dcdcdc;
  306. .name {
  307. font-size: 26rpx;
  308. font-family: Microsoft YaHei;
  309. font-weight: 400;
  310. color: #999999;
  311. font-size: 26rpx;
  312. }
  313. .phone {
  314. font-size: 26rpx;
  315. font-family: Microsoft YaHei;
  316. font-weight: 400;
  317. color: #999999;
  318. line-height: 26rpx;
  319. margin-left: 20rpx;
  320. }
  321. .arror .icon {
  322. width: 36rpx;
  323. height: 36rpx;
  324. }
  325. .address {
  326. font-size: 32rpx;
  327. font-family: Microsoft YaHei;
  328. font-weight: 400;
  329. color: #333333;
  330. line-height: 32rpx;
  331. }
  332. }
  333. .address-line {
  334. padding: 20px;
  335. .flex-bettwen {
  336. display: flex;
  337. align-items: center;
  338. justify-content: space-between;
  339. }
  340. .xing {
  341. width: 68rpx;
  342. height: 68rpx;
  343. background: rgba(0, 179, 139, 0.2);
  344. border-radius: 50%;
  345. font-size: 26rpx;
  346. font-weight: 400;
  347. color: #00b38b;
  348. line-height: 68rpx;
  349. text-align: center;
  350. }
  351. .content {
  352. margin-left: 20px;
  353. .name {
  354. font-size: 30rpx;
  355. font-family: Microsoft YaHei;
  356. font-weight: 500;
  357. color: #333333;
  358. }
  359. .phone {
  360. margin-left: 10rpx;
  361. font-size: 24rpx;
  362. font-family: Microsoft YaHei;
  363. font-weight: 400;
  364. color: #999999;
  365. line-height: 36rpx;
  366. }
  367. .address {
  368. margin-top: 10rpx;
  369. font-size: 26rpx;
  370. font-family: Microsoft YaHei;
  371. font-weight: 400;
  372. color: #333333;
  373. line-height: 36rpx;
  374. }
  375. .picture {
  376. width: 48rpx;
  377. height: 48rpx;
  378. }
  379. .editIcon {
  380. width: 48rpx;
  381. height: 48rpx;
  382. }
  383. }
  384. }
  385. .action {
  386. padding-bottom: 100rpx;
  387. .button {
  388. height: 80rpx;
  389. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  390. border-radius: 40rpx;
  391. font-size: 32rpx;
  392. font-weight: 400;
  393. color: #ffffff;
  394. line-height: 80rpx;
  395. }
  396. }
  397. .action-bottom {
  398. padding-bottom: 30rpx;
  399. .button {
  400. height: 80rpx;
  401. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  402. border-radius: 40rpx;
  403. font-size: 32rpx;
  404. font-weight: 400;
  405. color: #ffffff;
  406. line-height: 80rpx;
  407. }
  408. }
  409. :deep(.numberplates .numberplate-bg) {
  410. width: 190rpx;
  411. }
  412. :deep(.numberplates .numberplate) {
  413. margin-right: 0rpx !important;
  414. width: 190rpx;
  415. }
  416. :deep(.numberplates) {
  417. justify-content: space-between;
  418. }
  419. .default {
  420. border: 1rpx solid #00b38b;
  421. border-radius: 5rpx;
  422. padding: 2rpx 4rpx;
  423. color: #00b38b;
  424. margin-left: 4rpx;
  425. }
  426. </style>