reservationCar.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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"
  12. placeholder="请输入你的姓名"
  13. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 6vw; " />
  14. </p>
  15. </view>
  16. <!-- 手机号 -->
  17. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 1px solid #f8f8f8;">
  18. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  19. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">手机号码</span> <input type="text"
  20. placeholder="请输入你的手机号码"
  21. v-model="tel"
  22. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 6vw; " />
  23. </p>
  24. </view>
  25. <!-- 意向门店 -->
  26. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 1px solid #f8f8f8;" @click="LikeStore">
  27. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  28. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">意向门店</span> <input type="text"
  29. placeholder="请选择意向门店"
  30. v-model="storeName"
  31. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 6vw; " />
  32. </p>
  33. </view>
  34. <!-- 车型 -->
  35. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 1px solid #f8f8f8;">
  36. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  37. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">车型</span> <input type="text"
  38. placeholder="请输入预约车型"
  39. v-model="model"
  40. disabled="true"
  41. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 12vw; " />
  42. </p>
  43. </view>
  44. <!-- 上牌日期 -->
  45. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 0.5px solid #f8f8f8;">
  46. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  47. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">预约日期</span>
  48. <input type="text" placeholder="预约日期"
  49. v-model="date"
  50. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 6vw; "
  51. @focus="TimeFocus" />
  52. <!-- <u-datetime-picker ref="datetimePicker" :formatter="formatter" :show="show" v-model="timeValue" -->
  53. <!-- @confirm="confirm" @cancel="cancel" mode="date"></u-datetime-picker> -->
  54. <u-picker mode="time" :params="params" v-model="show" @confirm="confirm" @cancel="cancel"></u-picker>
  55. </p>
  56. </view>
  57. <!-- 备注说明 -->
  58. <view style="width: 85vw; height: 12vw; display: flex; border-bottom: 0.5px solid #f8f8f8;">
  59. <p style="display: flex;"><span style="color: red; line-height: 11vw;"></span> <span
  60. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">备注说明</span> <input type="number"
  61. v-model="text"
  62. placeholder="请输入备注说明"
  63. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 6vw; " />
  64. </p>
  65. </view>
  66. <!-- 图片上传 -->
  67. <!-- <view class="picture">
  68. <view class="front" @click="chooseImageFront">
  69. <p v-if="frontImg==''? true : false ">
  70. <image style="width: 7vw; height: 7vw;" src="../../static/xiangji.png"></image>
  71. </p>
  72. <p v-if="frontImg==''? true : false " style="font-size: 0.8rem; color: #d4b9c0;">驾驶证正页拍照</p>
  73. <image v-if="frontImg!=''? true : false " style="width: 100%; height: 100%;" :src="frontImg"></image>
  74. </view>
  75. <view class="opposite" @click="choosePppositeImg">
  76. <p v-if="oppositeImg==''? true : false ">
  77. <image style="width: 7vw; height: 7vw;" src="../../static/xiangji.png"></image>
  78. </p>
  79. <p v-if="oppositeImg==''? true : false " style="font-size: 0.8rem; color: #d4b9c0;">驾驶证副页拍照</p>
  80. <image v-if="oppositeImg!=''? true : false " style="width: 100%; height: 100%;" :src="oppositeImg"></image>
  81. </view>
  82. </view> -->
  83. <!-- 协议 -->
  84. <view class="agreement" v-if="rechargeDetial!=''? true : false ">
  85. <u-checkbox-group>
  86. <u-checkbox @change="checkboxChange" v-model="checked" label-disabled="true" shape="circle"
  87. active-color="red">代表您已同意</u-checkbox>
  88. </u-checkbox-group>
  89. <p>代表您已同意</p>
  90. <p style="color: red;">《用户协议》,</p>
  91. <p style="color: red;">《隐私协议》</p>
  92. </view>
  93. <!-- 提交-->
  94. <u-toast ref="uToast" />
  95. <view class="button" @click="submit" >提交</view>
  96. </view>
  97. </view>
  98. </template>
  99. <script>
  100. export default {
  101. data() {
  102. return {
  103. show: false,
  104. time: '',
  105. checked: false,
  106. timeValue: Number(new Date()),
  107. frontImg:'',
  108. oppositeImg:'',
  109. name:'',
  110. tel:'',
  111. model:'',
  112. date:'',
  113. storeName:'',
  114. storeId:'',
  115. text:'',
  116. params: {
  117. year: true,
  118. month: true,
  119. day: true,
  120. hour: true,
  121. minute: true,
  122. second: true
  123. },
  124. }
  125. },
  126. onLoad(option) {
  127. if(option.id){
  128. this.id=option.id
  129. this.getBuyCarDetialInfo(option.id)
  130. }
  131. if(this.$db.get('tel')){
  132. this.tel=this.$db.get('tel')
  133. }
  134. if(this.$db.get('name')){
  135. this.name=this.$db.get('name')
  136. }
  137. },
  138. onShow(object) {
  139. if(object){
  140. this.storeName=object.name
  141. this.storeId=object.id
  142. }
  143. },
  144. methods: {
  145. // 提交
  146. submit(){
  147. if(!this.$db.get('token')){
  148. uni.navigateTo({
  149. url:'/pages/login/login'
  150. })
  151. return
  152. }
  153. if(this.checked==true){
  154. this.$api.postDriveReserve({shop:this.storeId,name:this.name,tel:this.tel,model:this.modelID,date:this.date,notes:this.text},res=>{
  155. if(res.code==0){
  156. this.successToast('操作成功')
  157. setTimeout(function(){
  158. uni.navigateBack({
  159. url:1
  160. })
  161. },1000)
  162. }else{
  163. this.errorToast('请填写必填项')
  164. }
  165. })
  166. }else{
  167. this.errorToast('请勾选协议')
  168. }
  169. },
  170. getBuyCarDetialInfo(id){
  171. this.$api.getBuyCarDetial(id,res=>{
  172. if(res.code==0){
  173. this.model=res.data.series_name
  174. this.modelID=res.data.id
  175. }
  176. })
  177. },
  178. LikeStore(){
  179. uni.navigateTo({
  180. url:'/pages/index/storeList'
  181. })
  182. },
  183. checkboxChange(e) {
  184. this.checked = e.value
  185. },
  186. // 选择图片
  187. chooseImageFront() {
  188. let that =this
  189. uni.chooseImage({
  190. count: 1,
  191. sizeType: ['original', 'compressed'],
  192. sourceType: ['album', 'camera'],
  193. success(e) {
  194. that.frontImg=e.tempFiles[0].path
  195. }
  196. })
  197. },
  198. choosePppositeImg(){
  199. let that =this
  200. uni.chooseImage({
  201. count: 1,
  202. sizeType: ['original', 'compressed'],
  203. sourceType: ['album', 'camera'],
  204. success(e) {
  205. that.oppositeImg=e.tempFiles[0].path
  206. }
  207. })
  208. },
  209. successToast(msg) {
  210. this.$refs.uToast.show({
  211. title: msg,
  212. type: 'success',
  213. duration: 1000
  214. })
  215. },
  216. errorToast(msg) {
  217. this.$refs.uToast.show({
  218. title: msg,
  219. type: 'error',
  220. duration: 1000
  221. })
  222. },
  223. TimeFocus() {
  224. this.show = true
  225. },
  226. // 时间
  227. confirm(e) {
  228. this.date=e.year+'-'+e.month+'-'+e.day
  229. },
  230. cancel() {
  231. this.show = false
  232. },
  233. }
  234. }
  235. </script>
  236. <style lang="scss" scoped>
  237. .body {
  238. width: 100vw;
  239. height: 100vh;
  240. background-color: #f8f8f8;
  241. display: flex;
  242. justify-content: center;
  243. .content {
  244. width: 95vw;
  245. height: 80vh;
  246. background-color: white;
  247. border-radius: 5px;
  248. padding: 2vw;
  249. .heade {
  250. width: 95vw;
  251. height: 22vw;
  252. box-sizing: border-box;
  253. text-align: center;
  254. padding: 8vw 15vw 5vw 15vw;
  255. font-size: 0.9rem;
  256. color: gray;
  257. border-bottom: 1px solid #f8f8f8;
  258. ;
  259. }
  260. .picture {
  261. width: 95vw;
  262. height: 14vh;
  263. display: flex;
  264. justify-content: space-around;
  265. align-items: center;
  266. .front {
  267. width: 40vw;
  268. height: 25vw;
  269. background-color: #f8f8f8;
  270. border: 1px dashed #d8d8d8;
  271. display: flex;
  272. flex-direction: column;
  273. justify-content: center;
  274. align-items: center;
  275. }
  276. .opposite {
  277. width: 40vw;
  278. height: 25vw;
  279. background-color: #f8f8f8;
  280. border: 1px dashed #d8d8d8;
  281. display: flex;
  282. flex-direction: column;
  283. justify-content: center;
  284. align-items: center;
  285. }
  286. }
  287. .agreement {
  288. display: flex;
  289. font-size: 0.8rem;
  290. width: 96vw;
  291. justify-content: center;
  292. align-items: center;
  293. height: 10vh;
  294. }
  295. .button{
  296. width: 85vw;
  297. height: 10vw;
  298. margin-top: 10vw;
  299. background-color: red;
  300. line-height: 10vw;
  301. border-radius: 5vw;
  302. color: white;
  303. text-align: center;
  304. margin-left: 5vw;
  305. }
  306. }
  307. }
  308. </style>