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

essential-information.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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. //1.优先车牌校验 2.在进行订单创建
  175. var vehicleData = {
  176. vehiclePlate: state.data.vehiclePlate,
  177. vehiclePlateColor: state.data.vehiclePlateColor,
  178. };
  179. const options = {
  180. type: 2,
  181. data: vehicleData,
  182. method: "POST",
  183. showLoading: true,
  184. };
  185. request(etcVehiclePlateVer, options).then((res) => {
  186. var data = state.data;
  187. const options = {
  188. type: 2,
  189. data: data,
  190. method: "POST",
  191. showLoading: true,
  192. };
  193. request(etcCreatOrder, options).then((res) => {
  194. console.log(res);
  195. if (res.statusCode === 600) {
  196. orderGoAction()
  197. } else {
  198. const data = stringToJson(res.bizContent);
  199. if (state.data.userType === "1") {
  200. uni.navigateTo({
  201. url: `/applyCard/opening-account-people?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  202. });
  203. } else {
  204. uni.navigateTo({
  205. url: `/applyCard/opening-account-unit?orderId=${data.orderId}&&vehiclePlateColor=${state.data.vehiclePlateColor}`,
  206. });
  207. }
  208. }
  209. });
  210. });
  211. };
  212. //按照订单阶段去跳转
  213. const orderGoAction = () => {
  214. var orderParmas = {
  215. vehicleId: state.data.vehiclePlate + '_' + state.data.vehiclePlateColor,
  216. opId: getItem(StorageKeys.OpenId),
  217. source: 'WECHAT'
  218. }
  219. const options = {
  220. type: 2,
  221. data: orderParmas,
  222. method: "POST",
  223. showLoading: true,
  224. };
  225. request(searchOrder, options).then((res) => {
  226. const data = stringToJson(res.bizContent);
  227. orderStepGoActon(data)
  228. });
  229. }
  230. //订单状态舔砖
  231. const orderStepGoActon = (val: any) => {
  232. //完成填写基本信息
  233. if (val.orderStep === 1) {
  234. if (state.data.userType === "1") {
  235. uni.navigateTo({
  236. url: `/applyCard/opening-account-people?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  237. });
  238. } else {
  239. uni.navigateTo({
  240. url: `/applyCard/opening-account-unit?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  241. });
  242. }
  243. } else if (val.orderStep === 2) {
  244. uni.navigateTo({
  245. url: `/applyCard/car-release?orderId=${val.orderId}&&vehiclePlateColor=${val.vehiclePlateColor}`,
  246. });
  247. } else if (val.orderStep === 3) {
  248. uni.navigateTo({
  249. url: `/applyCard/choice-product?orderId=${val.orderId}`,
  250. });
  251. } else if (val.orderStep === 4) {
  252. uni.navigateTo({
  253. url: `/applyCard/product-detail?orderId=${val.orderId}&&clientFee=${val.product.clientFee}&&id=${val.productId}`,
  254. });
  255. }
  256. };
  257. onLoad((option: any) => {
  258. state.data.opId = getItem(StorageKeys.OpenId);
  259. state.data.type = option.type; //客车
  260. state.data.userType = option.userType;
  261. });
  262. onShow(() => {
  263. var data = {
  264. openId: getItem(StorageKeys.OpenId),
  265. };
  266. const options = {
  267. type: 2,
  268. data: data,
  269. method: "POST",
  270. showLoading: true,
  271. };
  272. request(addressQuery, options).then((res) => {
  273. const data = stringToJson(res.bizContent);
  274. state.addressArray = data.data;
  275. });
  276. });
  277. </script>
  278. <style lang="scss" scoped>
  279. .flex {
  280. display: flex;
  281. align-items: center;
  282. }
  283. .content-wrap {
  284. position: relative;
  285. margin-top: -50rpx;
  286. padding: 0rpx 30rpx;
  287. .title {
  288. font-size: 30rpx;
  289. font-family: Noto Sans S Chinese;
  290. font-weight: 400;
  291. color: #000000;
  292. line-height: 30rpx;
  293. margin-bottom: 30rpx;
  294. }
  295. .car-input {}
  296. .chepai-lane {
  297. margin-top: 60rpx;
  298. margin-bottom: 20rpx;
  299. }
  300. .address-lane {
  301. margin-bottom: 30rpx;
  302. .title {
  303. font-size: 30rpx;
  304. font-weight: 400;
  305. color: #000000;
  306. line-height: 30rpx;
  307. }
  308. }
  309. }
  310. .address-content {
  311. display: flex;
  312. align-items: center;
  313. justify-content: space-between;
  314. padding-bottom: 30rpx;
  315. border-bottom: 1rpx solid #dcdcdc;
  316. .name {
  317. font-size: 26rpx;
  318. font-family: Microsoft YaHei;
  319. font-weight: 400;
  320. color: #999999;
  321. font-size: 26rpx;
  322. }
  323. .phone {
  324. font-size: 26rpx;
  325. font-family: Microsoft YaHei;
  326. font-weight: 400;
  327. color: #999999;
  328. line-height: 26rpx;
  329. margin-left: 20rpx;
  330. }
  331. .arror {
  332. width: 16rpx;
  333. height: 30rpx;
  334. color: rgba(153, 153, 153, 1);
  335. }
  336. .address {
  337. font-size: 32rpx;
  338. font-family: Microsoft YaHei;
  339. font-weight: 400;
  340. color: #333333;
  341. line-height: 32rpx;
  342. }
  343. }
  344. .address-line {
  345. padding: 20px;
  346. .flex-bettwen {
  347. display: flex;
  348. align-items: center;
  349. justify-content: space-between;
  350. }
  351. .xing {
  352. width: 68rpx;
  353. height: 68rpx;
  354. background: rgba(0, 179, 139, 0.2);
  355. border-radius: 50%;
  356. font-size: 26rpx;
  357. font-weight: 400;
  358. color: #00b38b;
  359. line-height: 68rpx;
  360. text-align: center;
  361. }
  362. .content {
  363. margin-left: 20px;
  364. .name {
  365. font-size: 30rpx;
  366. font-family: Microsoft YaHei;
  367. font-weight: 500;
  368. color: #333333;
  369. }
  370. .phone {
  371. margin-left: 10rpx;
  372. font-size: 24rpx;
  373. font-family: Microsoft YaHei;
  374. font-weight: 400;
  375. color: #999999;
  376. line-height: 36rpx;
  377. }
  378. .address {
  379. margin-top: 10rpx;
  380. font-size: 26rpx;
  381. font-family: Microsoft YaHei;
  382. font-weight: 400;
  383. color: #333333;
  384. line-height: 36rpx;
  385. }
  386. .picture {
  387. width: 48rpx;
  388. height: 48rpx;
  389. }
  390. .editIcon {
  391. width: 48rpx;
  392. height: 48rpx;
  393. }
  394. }
  395. }
  396. .action {
  397. padding-bottom: 100rpx;
  398. .button {
  399. height: 80rpx;
  400. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  401. border-radius: 40rpx;
  402. font-size: 32rpx;
  403. font-weight: 400;
  404. color: #ffffff;
  405. line-height: 80rpx;
  406. }
  407. }
  408. .action-bottom {
  409. padding-bottom: 30rpx;
  410. .button {
  411. height: 80rpx;
  412. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  413. border-radius: 40rpx;
  414. font-size: 32rpx;
  415. font-weight: 400;
  416. color: #ffffff;
  417. line-height: 80rpx;
  418. }
  419. }
  420. </style>