Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

essential-information.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <template>
  2. <navBar title="九州ETC"></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" :numberplateCor="{ id: 0 }"
  14. @numberplateResult="checkNumberplateColor">
  15. </numberplate-color>
  16. </view>
  17. <!-- 收货地址 -->
  18. <view v-if="!state.data.address" class="address-lane">
  19. <view class="title">请选择或新增收货地址</view>
  20. <view style="margin-top: 30rpx" class="action">
  21. <button type="default" class="button" @click="state.show = true">
  22. 添加收货地址
  23. </button>
  24. </view>
  25. </view>
  26. <view v-if="state.data.address" class="address-lane">
  27. <view class="title">收货地址</view>
  28. <view @click="state.show = true" class="address-content" style="margin-top: 30rpx">
  29. <view class="flex">
  30. <image :showLoading="true" :src="`${$imgUrl}applyCard/location.png`"
  31. style="width: 48rpx; height: 48rpx">
  32. </image>
  33. <view style="margin-left: 18rpx" class="">
  34. <view class="address">
  35. {{ state.data.region + state.data.address }}
  36. </view>
  37. <view style="margin-top: 15rpx" class="flex">
  38. <view class="name">
  39. {{ state.data.consignee }}
  40. </view>
  41. <view class="phone">
  42. {{ state.data.consigneeTel }}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="arror"> > </view>
  48. </view>
  49. <view style="margin-top: 30rpx" class="action">
  50. <button type="default" class="button" @click="nextAction()">
  51. 下一步
  52. </button>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 地址弹窗 -->
  57. <u-popup mode="bottom" v-model="state.show">
  58. <view class="address-line">
  59. <view v-if="state.addressArray" v-for="(item, index) in state.addressArray" :key="index"
  60. @click="addressSelected(item)" style="margin-bottom: 60rpx" class="flex-bettwen">
  61. <view class="flex">
  62. <view class="xing">
  63. {{ item.consignee.charAt(0) }}
  64. </view>
  65. <view class="content">
  66. <view class="flex">
  67. <view class="name">
  68. {{ item.consignee }}
  69. </view>
  70. <view class="phone">
  71. {{ item.consigneeTel }}
  72. </view>
  73. </view>
  74. <view class="address">
  75. {{ item.region + item.address }}
  76. </view>
  77. </view>
  78. </view>
  79. <view @click.stop="editAddress(item)" style="margin-left: 80rpx" class="picture">
  80. <image :showLoading="true" :src="`${$imgUrl}applyCard/edit.png`"
  81. style="width: 48rpx; height: 48rpx"></image>
  82. </view>
  83. </view>
  84. <view :style="state.addressArray ? 'margin-top: 60rpx;' : ''" class="action-bottom">
  85. <button type="default" class="button" @click="goToAddAddress()">
  86. 添加收货地址
  87. </button>
  88. </view>
  89. </view>
  90. </u-popup>
  91. </template>
  92. <script setup lang="ts">
  93. /*导航*/
  94. import navBgCar from "./components/nav-bg-car1";
  95. import carNumberInput from "@/components/car-number-input/car-number-input.vue";
  96. import numberplateColor from "./components/layout-numberplate-color";
  97. import {
  98. getItem,
  99. StorageKeys
  100. } from "@/utils/storage";
  101. import {
  102. stringToJson
  103. } from "@/utils/network/encryption";
  104. import navBar from "../components/nav-bar/nav-bar2.vue";
  105. import {
  106. onLoad,
  107. onShow
  108. } from "@dcloudio/uni-app";
  109. import {
  110. addressQuery,
  111. etcCreatOrder,
  112. etcVehiclePlateVer,
  113. searchOrder
  114. } from "@/utils/network/api.js";
  115. import {
  116. request
  117. } from "@/utils/network/request.js";
  118. import {
  119. reactive
  120. } from "vue";
  121. import {
  122. msg
  123. } from "@/utils/utils";
  124. const state = reactive({
  125. data: {
  126. vehiclePlate: undefined, //车牌号
  127. vehiclePlateNumber: "贵A1234", //车牌号
  128. vehiclePlateColor: 0, //车盘颜色
  129. type: "0", //车牌类型
  130. userType: "1",
  131. whetherToMail: 0, //是否需要邮寄 小程序默认邮寄
  132. orderSource: "WECHAT",
  133. opId: "",
  134. consignee: "", //收货人
  135. consigneeTel: "", //收货电话
  136. region: "",
  137. address: "",
  138. postalCode: "",
  139. },
  140. show: false,
  141. addressArray: undefined,
  142. });
  143. /* 选择车牌颜色 */
  144. const checkNumberplateColor = (item: any) => {
  145. state.data.vehiclePlateColor = item.id;
  146. };
  147. const goToAddAddress = () => {
  148. uni.navigateTo({
  149. url: "/applyCard/addAddress",
  150. });
  151. };
  152. const editAddress = (val) => {
  153. uni.navigateTo({
  154. url: `/applyCard/editAddress?content=` + JSON.stringify(val),
  155. });
  156. };
  157. const carNumber = (val: any) => {
  158. state.data.vehiclePlate = val;
  159. state.data.vehiclePlateNumber = val
  160. };
  161. const addressSelected = (val: any) => {
  162. state.data = {
  163. ...state.data,
  164. ...val,
  165. };
  166. state.show = false;
  167. };
  168. const nextAction = () => {
  169. if (!state.data.vehiclePlate) {
  170. msg('请输入申办车牌');
  171. return;
  172. }
  173. state.data.vehiclePlate = state.data.vehiclePlate.trim();
  174. console.log(state.data.vehiclePlate)
  175. console.log(state.data.vehiclePlate.length)
  176. if (state.data.vehiclePlate.length < 7) {
  177. msg('请输入正确的申办车牌');
  178. return;
  179. }
  180. //1.优先车牌校验 2.在进行订单创建
  181. var vehicleData = {
  182. vehiclePlate: state.data.vehiclePlate,
  183. vehiclePlateColor: state.data.vehiclePlateColor,
  184. };
  185. const options = {
  186. type: 2,
  187. data: vehicleData,
  188. method: "POST",
  189. showLoading: true,
  190. };
  191. request(etcVehiclePlateVer, options).then((res) => {
  192. var data = state.data;
  193. const options = {
  194. type: 2,
  195. data: data,
  196. method: "POST",
  197. showLoading: true,
  198. };
  199. request(etcCreatOrder, options).then((res) => {
  200. console.log(res);
  201. if (res.statusCode === 600) {
  202. orderGoAction()
  203. } else {
  204. const data = stringToJson(res.bizContent);
  205. if (state.data.userType === "1") {
  206. uni.navigateTo({
  207. url: `/applyCard/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  208. });
  209. } else {
  210. uni.navigateTo({
  211. url: `/applyCard/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  212. });
  213. }
  214. }
  215. });
  216. });
  217. };
  218. //按照订单阶段去跳转
  219. const orderGoAction = () => {
  220. var orderParmas = {
  221. vehicleId: state.data.vehiclePlate + '_' + state.data.vehiclePlateColor,
  222. opId: getItem(StorageKeys.OpenId),
  223. source: 'WECHAT'
  224. }
  225. const options = {
  226. type: 2,
  227. data: orderParmas,
  228. method: "POST",
  229. showLoading: true,
  230. };
  231. request(searchOrder, options).then((res) => {
  232. const data = stringToJson(res.bizContent);
  233. orderStepGoActon(data)
  234. });
  235. }
  236. //订单状态舔砖
  237. const orderStepGoActon = (val: any) => {
  238. //完成填写基本信息
  239. if (val.orderStep === 1) {
  240. if (state.data.userType === "1") {
  241. uni.navigateTo({
  242. url: `/applyCard/opening-account-people?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  243. });
  244. } else {
  245. uni.navigateTo({
  246. url: `/applyCard/opening-account-unit?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  247. });
  248. }
  249. } else if (val.orderStep === 2) {
  250. uni.navigateTo({
  251. url: `/applyCard/car-release?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  252. });
  253. } else if (val.orderStep === 3) {
  254. uni.navigateTo({
  255. url: `/applyCard/choice-product?orderId=${val.orderId}`,
  256. });
  257. } else if (val.orderStep === 4) {
  258. uni.navigateTo({
  259. url: `/applyCard/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  260. });
  261. }
  262. };
  263. onLoad((option: any) => {
  264. state.data.opId = getItem(StorageKeys.OpenId);
  265. state.data.type = option.type; //客车
  266. state.data.userType = option.userType;
  267. });
  268. onShow(() => {
  269. var data = {
  270. openId: getItem(StorageKeys.OpenId),
  271. };
  272. const options = {
  273. type: 2,
  274. data: data,
  275. method: "POST",
  276. showLoading: true,
  277. };
  278. request(addressQuery, options).then((res) => {
  279. const data = stringToJson(res.bizContent);
  280. state.addressArray = data.data;
  281. });
  282. });
  283. </script>
  284. <style lang="scss" scoped>
  285. .flex {
  286. display: flex;
  287. align-items: center;
  288. }
  289. .content-wrap {
  290. position: relative;
  291. margin-top: -50rpx;
  292. padding: 0rpx 30rpx;
  293. .title {
  294. font-size: 30rpx;
  295. font-family: Noto Sans S Chinese;
  296. font-weight: 400;
  297. color: #000000;
  298. line-height: 30rpx;
  299. margin-bottom: 30rpx;
  300. }
  301. .car-input {}
  302. .chepai-lane {
  303. margin-top: 60rpx;
  304. margin-bottom: 20rpx;
  305. }
  306. .address-lane {
  307. margin-bottom: 30rpx;
  308. .title {
  309. font-size: 30rpx;
  310. font-weight: 400;
  311. color: #000000;
  312. line-height: 30rpx;
  313. }
  314. }
  315. }
  316. .address-content {
  317. display: flex;
  318. align-items: center;
  319. justify-content: space-between;
  320. padding-bottom: 30rpx;
  321. border-bottom: 1rpx solid #dcdcdc;
  322. .name {
  323. font-size: 26rpx;
  324. font-family: Microsoft YaHei;
  325. font-weight: 400;
  326. color: #999999;
  327. font-size: 26rpx;
  328. }
  329. .phone {
  330. font-size: 26rpx;
  331. font-family: Microsoft YaHei;
  332. font-weight: 400;
  333. color: #999999;
  334. line-height: 26rpx;
  335. margin-left: 20rpx;
  336. }
  337. .arror {
  338. width: 16rpx;
  339. height: 30rpx;
  340. color: rgba(153, 153, 153, 1);
  341. }
  342. .address {
  343. font-size: 32rpx;
  344. font-family: Microsoft YaHei;
  345. font-weight: 400;
  346. color: #333333;
  347. line-height: 32rpx;
  348. }
  349. }
  350. .address-line {
  351. padding: 20px;
  352. .flex-bettwen {
  353. display: flex;
  354. align-items: center;
  355. justify-content: space-between;
  356. }
  357. .xing {
  358. width: 68rpx;
  359. height: 68rpx;
  360. background: rgba(0, 179, 139, 0.2);
  361. border-radius: 50%;
  362. font-size: 26rpx;
  363. font-weight: 400;
  364. color: #00b38b;
  365. line-height: 68rpx;
  366. text-align: center;
  367. }
  368. .content {
  369. margin-left: 20px;
  370. .name {
  371. font-size: 30rpx;
  372. font-family: Microsoft YaHei;
  373. font-weight: 500;
  374. color: #333333;
  375. }
  376. .phone {
  377. margin-left: 10rpx;
  378. font-size: 24rpx;
  379. font-family: Microsoft YaHei;
  380. font-weight: 400;
  381. color: #999999;
  382. line-height: 36rpx;
  383. }
  384. .address {
  385. margin-top: 10rpx;
  386. font-size: 26rpx;
  387. font-family: Microsoft YaHei;
  388. font-weight: 400;
  389. color: #333333;
  390. line-height: 36rpx;
  391. }
  392. .picture {
  393. width: 48rpx;
  394. height: 48rpx;
  395. }
  396. .editIcon {
  397. width: 48rpx;
  398. height: 48rpx;
  399. }
  400. }
  401. }
  402. .action {
  403. padding-bottom: 100rpx;
  404. .button {
  405. height: 80rpx;
  406. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  407. border-radius: 40rpx;
  408. font-size: 32rpx;
  409. font-weight: 400;
  410. color: #ffffff;
  411. line-height: 80rpx;
  412. }
  413. }
  414. .action-bottom {
  415. padding-bottom: 30rpx;
  416. .button {
  417. height: 80rpx;
  418. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  419. border-radius: 40rpx;
  420. font-size: 32rpx;
  421. font-weight: 400;
  422. color: #ffffff;
  423. line-height: 80rpx;
  424. }
  425. }
  426. </style>