index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <view class="content">
  3. <view class="info">
  4. <scroll-view scroll-y="true" class="scroll-view">
  5. <view class="list-scroll-view">
  6. <view class="one">
  7. <view class="text">
  8. 免费估值 精准报价
  9. </view>
  10. </view>
  11. <view class="two">
  12. <view class="text">为爱车估值</view>
  13. <view class="two_1" @tap="toSelect" v-if="!form.brand&&!form.brand?.title">
  14. <u-icon name="plus-circle-fill" size="20" color="#ffbc00"></u-icon>
  15. <text>请选择车辆品牌</text>
  16. </view>
  17. <view class="two_2" @tap="toSelect" v-else>
  18. <image class="image"
  19. :src="form.brand?.url&&form.brand?.url.length>0?form.brand?.url[0].url:'/static/logo.png'">
  20. </image>
  21. <view class="title">{{form.brand?.title}}</view>
  22. <u-icon name="arrow-right"></u-icon>
  23. </view>
  24. <u--form class="form" :model="form" ref="uForm" :rules="rules" labelWidth="65"
  25. :border-bottom="true">
  26. <u-form-item label="车辆车系" prop="bank">
  27. <input class="input" v-model="form.bank" placeholder="填写车辆车系" />
  28. <template #right>
  29. <u-icon name="arrow-right"></u-icon>
  30. </template>
  31. </u-form-item>
  32. <u-form-item label="车辆车型" prop="type">
  33. <input class="input" v-model="form.type" placeholder="填写车辆车型" />
  34. <template #right>
  35. <u-icon name="arrow-right"></u-icon>
  36. </template>
  37. </u-form-item>
  38. <u-form-item label="上牌日期" prop="date">
  39. <picker name="date" @change="dateChange" mode="date">
  40. <view class="picker">{{form.date||'请选择'}}</view>
  41. </picker>
  42. <template #right>
  43. <u-icon name="arrow-right"></u-icon>
  44. </template>
  45. </u-form-item>
  46. <u-form-item label="行驶里程" prop="course">
  47. <picker name="course" @change="courseChange" :value="index" :range="courseList"
  48. range-key="label">
  49. <view class="picker">{{form.course||'请选择'}}</view>
  50. </picker>
  51. <template #right>
  52. <u-icon name="arrow-right"></u-icon>
  53. </template>
  54. </u-form-item>
  55. <u-form-item label="上牌城市" prop="city">
  56. <text class="picker" @tap="toCity">{{form.city?.name||'请选择'}}</text>
  57. <template #right>
  58. <u-icon name="arrow-right"></u-icon>
  59. </template>
  60. </u-form-item>
  61. <u-form-item label="估值地区" prop="phone">
  62. <text class="picker" @tap="toCity">{{form.city?.name||'请选择'}}</text>
  63. <template #right>
  64. <u-icon name="arrow-right"></u-icon>
  65. </template>
  66. </u-form-item>
  67. <u-form-item label="手机号" prop="phone">
  68. <input class="input" v-model="form.phone" placeholder="填写常用手机号" />
  69. </u-form-item>
  70. </u--form>
  71. </view>
  72. </view>
  73. </scroll-view>
  74. </view>
  75. <view class="foot">
  76. <view class="foot_1">
  77. <button class="btn" @click="toEvaluate">免费估价</button>
  78. </view>
  79. <view class="foot_2">
  80. <checkbox-group @change="changeAgree">
  81. <label>
  82. <checkbox color="#ffbc00" style="transform:scale(0.7)" :checked="agree" />
  83. <text @tap.stop="toAgree">已阅读并同意 《个人信息保护声明》,提交后将会有1-3家服务商为您提供报价服务</text>
  84. </label>
  85. </checkbox-group>
  86. </view>
  87. </view>
  88. </view>
  89. </template>
  90. <script setup lang="ts">
  91. import { getCurrentInstance, ref } from 'vue';
  92. //该依赖已内置不需要单独安装
  93. import { onLoad, onShow } from "@dcloudio/uni-app";
  94. // 请求接口
  95. const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
  96. const $config = getCurrentInstance()?.appContext.config.globalProperties.$config;
  97. // 基本信息
  98. const config = ref({});
  99. // 用户协议
  100. const agree = ref(false);
  101. // 用户信息
  102. const user = ref({});
  103. const form = ref({ phone: "" });
  104. const rules = ref({
  105. phone: [
  106. {
  107. required: true,
  108. message: '请输入手机号',
  109. trigger: ['blur', 'change']
  110. }
  111. ]
  112. });
  113. // 字典表
  114. const courseList = ref([{ value: '1', label: '1万' }, { value: '2', label: '2万' }, { value: '3', label: '3万' }, { value: '4', label: '4万' }, { value: '5', label: '5万' }]);
  115. onLoad(async () => {
  116. await searchConfig();
  117. await search();
  118. })
  119. onShow(() => {
  120. uni.$on('toRoute', function (data) {
  121. form.value.brand = data
  122. })
  123. uni.$on('toCity', function (data) {
  124. form.value.city = data
  125. })
  126. })
  127. // config信息
  128. const searchConfig = async () => {
  129. config.value = uni.getStorageSync('config');
  130. };
  131. // 查询
  132. const search = async () => {
  133. };
  134. // 上牌日期
  135. const dateChange = (e) => {
  136. console.log(e);
  137. };
  138. // 行驶里程
  139. const courseChange = (e) => {
  140. console.log(e);
  141. };
  142. // 选择城市
  143. const toCity = () => {
  144. uni.navigateTo({
  145. url: `/pagesHome/city/index`,
  146. })
  147. };
  148. // 选择品牌
  149. const toSelect = () => {
  150. uni.navigateTo({
  151. url: `/pagesHome/brand/index`,
  152. })
  153. };
  154. // 估价
  155. const toEvaluate = async () => {
  156. if (agree.value) {
  157. $refs.form.validate().then(res => {
  158. uni.$u.toast('校验通过')
  159. }).catch(errors => {
  160. uni.$u.toast('校验失败')
  161. })
  162. } else {
  163. uni.showToast({
  164. title: '请阅读并同意用户协议和隐私政策',
  165. icon: 'none'
  166. })
  167. }
  168. };
  169. // 查看隐私协议
  170. const toAgree = () => {
  171. uni.navigateTo({
  172. url: `/pagesHome/agree/index`
  173. })
  174. };
  175. // 同意隐私协议
  176. const changeAgree = () => {
  177. agree.value = !agree.value;
  178. };
  179. </script>
  180. <style lang="scss" scoped>
  181. .content {
  182. display: flex;
  183. flex-direction: column;
  184. width: 100vw;
  185. height: 100vh;
  186. .info {
  187. position: relative;
  188. flex-grow: 1;
  189. background-color: var(--f1Color);
  190. .one {
  191. display: flex;
  192. align-items: center;
  193. justify-content: center;
  194. height: 25vh;
  195. background: linear-gradient(to bottom, #ffbc00, #f1f1f1);
  196. .text {
  197. background-image: -webkit-linear-gradient(left, #000, #ffbc00 10%, #ffbc00 20%, #ffbc00 30%, #ffbc00 40%, #ffbc00 50%, #ffbc00 60%, #ffbc00 70%, #ffbc00 80%, #ffbc00 90%, #000 100%);
  198. -webkit-text-fill-color: transparent;
  199. -webkit-background-clip: text;
  200. -webkit-background-size: 200% 100%;
  201. -webkit-animation: masked-animation 4s linear infinite;
  202. font-size: 30px;
  203. font-weight: bold;
  204. }
  205. @keyframes masked-animation {
  206. 0% {
  207. background-position: 0 0;
  208. }
  209. 100% {
  210. background-position: -100% 0;
  211. }
  212. }
  213. }
  214. .two {
  215. background-color: var(--mainColor);
  216. margin: 0 3vw 2vw 3vw;
  217. padding: 2vw;
  218. border-radius: 10px;
  219. .text {
  220. font-size: var(--font16Size);
  221. font-weight: bold;
  222. padding: 2vw;
  223. }
  224. .two_1 {
  225. display: flex;
  226. align-items: center;
  227. justify-content: center;
  228. background-color: var(--f1Color);
  229. padding: 6vw 2vw;
  230. text {
  231. font-size: var(--font16Size);
  232. margin: 0 0 0 1vw;
  233. }
  234. }
  235. .two_2 {
  236. display: flex;
  237. align-items: center;
  238. color: #323233;
  239. padding: 2vw 0;
  240. font-size: var(--font16Size);
  241. border-bottom: 1px solid var(--f5Color);
  242. .image {
  243. width: 60px;
  244. height: 60px;
  245. border-radius: 60px;
  246. }
  247. .title {
  248. width: 75%;
  249. margin: 0 0 0 2vw;
  250. }
  251. }
  252. .form {
  253. .picker {
  254. padding: 2vw;
  255. }
  256. .input {
  257. padding: 2vw;
  258. }
  259. }
  260. }
  261. }
  262. .foot {
  263. padding: 2vw;
  264. .foot_1 {
  265. .btn {
  266. background-color: var(--fFFColor);
  267. font-size: var(--font16Size);
  268. }
  269. }
  270. .foot_2 {
  271. font-size: var(--font12Size);
  272. color: var(--f85Color);
  273. margin: 1vw;
  274. }
  275. }
  276. }
  277. .scroll-view {
  278. position: absolute;
  279. top: 0;
  280. left: 0;
  281. right: 0;
  282. bottom: 0;
  283. .list-scroll-view {
  284. display: flex;
  285. flex-direction: column;
  286. }
  287. }
  288. </style>