您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

essential-information.vue 10KB

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