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

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