bindCar.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view class="body">
  3. <view class="content">
  4. <view class="heade">
  5. 欢迎您光顾,请仔细填写您的车辆信息!
  6. </view>
  7. <!-- 姓名 -->
  8. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 1px solid #f8f8f8;">
  9. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  10. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">您的姓名</span> <input type="text"
  11. v-model="name" placeholder="请输入你的姓名"
  12. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 6vw; " />
  13. </p>
  14. </view>
  15. <!-- 手机号 -->
  16. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 1px solid #f8f8f8;">
  17. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  18. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">手机号码</span> <input type="text"
  19. placeholder="请输入你的电话" v-model="tel"
  20. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 6vw; " />
  21. </p>
  22. </view>
  23. <!-- 手机号 -->
  24. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 1px solid #f8f8f8;">
  25. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  26. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">车牌号</span> <input type="text"
  27. placeholder="请输入你的车牌" v-model="Number"
  28. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 9vw; " />
  29. </p>
  30. </view>
  31. <!-- 车型 -->
  32. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 1px solid #f8f8f8;">
  33. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  34. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">车型</span> <input type="text"
  35. placeholder="请输入您的车型" v-model="model"
  36. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 12vw; " />
  37. </p>
  38. </view>
  39. <!-- 车架号 -->
  40. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 1px solid #f8f8f8;">
  41. <p style="display: flex;"><span style="color: red; line-height: 11vw;"></span> <span
  42. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">车架号</span> <input type="text"
  43. placeholder="请输入您的车架号" v-model="vin"
  44. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 9vw; " />
  45. </p>
  46. </view>
  47. <!-- 年检到期时间 -->
  48. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 1px solid #f8f8f8;">
  49. <p style="display: flex;"><span style="color: red; line-height: 11vw;"></span> <span
  50. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">年检到期</span> <input type="text"
  51. placeholder="请输入您的年检到期时间" v-model="inspecEndDate" @focus="inspectShow"
  52. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 6vw; " />
  53. </p>
  54. </view>
  55. <!-- 保险到期时间 -->
  56. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 1px solid #f8f8f8;">
  57. <p style="display: flex;"><span style="color: red; line-height: 11vw;"></span> <span
  58. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">保险到期</span> <input type="text"
  59. placeholder="请输入您的保险到期时间" v-model="insureEndDate" @focus="insureShow"
  60. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 6vw; " />
  61. </p>
  62. </view>
  63. <!-- 提交-->
  64. <u-picker mode="time" v-model="inspecshows" @confirm="inspecconfirm" @cancel="cancel"></u-picker>
  65. <u-picker mode="time" v-model="insureshows" @confirm="insureconfirm" @cancel="cancel"></u-picker>
  66. <u-toast ref="uToast" />
  67. <view class="button" @click="submit">提交</view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. export default {
  73. data() {
  74. return {
  75. inspecshows: false,
  76. insureshows: false,
  77. date: '',
  78. name: '',
  79. tel: '',
  80. Number: '',
  81. model: '',
  82. vin: '',
  83. inspecEndDate: null,
  84. insureEndDate: null
  85. }
  86. },
  87. onLoad() {
  88. if(this.$db.get('tel')){
  89. this.tel=this.$db.get('tel')
  90. }
  91. if(this.$db.get('name')){
  92. this.name=this.$db.get('name')
  93. }
  94. },
  95. methods: {
  96. insureShow() {
  97. this.insureshows = true
  98. },
  99. inspectShow() {
  100. this.inspecshows = true
  101. },
  102. // 时间
  103. inspecconfirm(e) {
  104. this.inspecEndDate = e.year + '-' + e.month + '-' + e.day
  105. },
  106. insureconfirm(e) {
  107. this.insureEndDate = e.year + '-' + e.month + '-' + e.day
  108. },
  109. cancel() {
  110. this.show = false
  111. },
  112. // 提交
  113. submit() {
  114. if (!this.$db.get('token')) {
  115. uni.navigateTo({
  116. url: '/pages/login/login'
  117. })
  118. return
  119. }
  120. this.$api.postBindCar({
  121. name: this.name,
  122. tel: this.tel,
  123. number: this.Number,
  124. model: this.model,
  125. vin: this.vin,
  126. inspect_end_date: this.inspecEndDate,
  127. insure_end_date: this.insureEndDate
  128. }, res => {
  129. if (res.code == 0) {
  130. this.successToast('提交成功')
  131. this.$nextTick(() => {
  132. this.name = ''
  133. this.tel = ''
  134. this.Number = ''
  135. this.model = ''
  136. this.vin = ''
  137. this.inspecEndDate=null
  138. this.insureEndDate=null
  139. })
  140. } else {
  141. this.errorToast('请填写必填项')
  142. }
  143. })
  144. },
  145. successToast(msg) {
  146. this.$refs.uToast.show({
  147. title: msg,
  148. type: 'success',
  149. duration: 1000
  150. })
  151. },
  152. errorToast(msg) {
  153. this.$refs.uToast.show({
  154. title: msg,
  155. type: 'error',
  156. duration: 1000
  157. })
  158. },
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. .body {
  164. width: 100vw;
  165. height: 100vh;
  166. background-color: #f8f8f8;
  167. display: flex;
  168. justify-content: center;
  169. .content {
  170. width: 95vw;
  171. height: 80vh;
  172. background-color: white;
  173. border-radius: 5px;
  174. padding: 2vw;
  175. .heade {
  176. width: 95vw;
  177. height: 22vw;
  178. box-sizing: border-box;
  179. text-align: center;
  180. padding: 8vw 15vw 5vw 15vw;
  181. font-size: 0.9rem;
  182. color: gray;
  183. border-bottom: 1px solid #f8f8f8;
  184. ;
  185. }
  186. .picture {
  187. width: 95vw;
  188. height: 14vh;
  189. display: flex;
  190. justify-content: space-around;
  191. align-items: center;
  192. .front {
  193. width: 40vw;
  194. height: 25vw;
  195. background-color: #f8f8f8;
  196. border: 1px dashed #d8d8d8;
  197. display: flex;
  198. flex-direction: column;
  199. justify-content: center;
  200. align-items: center;
  201. }
  202. .opposite {
  203. width: 40vw;
  204. height: 25vw;
  205. background-color: #f8f8f8;
  206. border: 1px dashed #d8d8d8;
  207. display: flex;
  208. flex-direction: column;
  209. justify-content: center;
  210. align-items: center;
  211. }
  212. }
  213. .agreement {
  214. display: flex;
  215. font-size: 0.8rem;
  216. width: 96vw;
  217. justify-content: center;
  218. align-items: center;
  219. height: 10vh;
  220. }
  221. .button {
  222. width: 85vw;
  223. height: 10vw;
  224. margin-top: 10vw;
  225. background-color: red;
  226. line-height: 10vw;
  227. border-radius: 5vw;
  228. color: white;
  229. text-align: center;
  230. margin-left: 5vw;
  231. }
  232. }
  233. }
  234. </style>