index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <view class="content">
  3. <view class="one">
  4. <u-notice-bar :text="text"></u-notice-bar>
  5. </view>
  6. <view class="two">
  7. <view class="two_1">
  8. <view class="table_column">
  9. <view class="left">
  10. 商品编号
  11. </view>
  12. <view class="right">
  13. {{info._id||'暂无'}}
  14. </view>
  15. </view>
  16. <view class="table_column">
  17. <view class="left">
  18. 商品名称
  19. </view>
  20. <view class="right">
  21. {{info.series||'暂无'}} {{info.year||'暂无'}}款
  22. {{info.style||'暂无'}}
  23. </view>
  24. </view>
  25. <view class="table_column">
  26. <view class="left">
  27. 车辆识别号(VIN)
  28. </view>
  29. <view class="right">
  30. {{info.vin? '已上传' : '未上传'}}
  31. </view>
  32. </view>
  33. </view>
  34. <view class="text">档案手续</view>
  35. <view class="two_2">
  36. <view class="table_column">
  37. <view class="left">
  38. 表显里程
  39. </view>
  40. <view class="right">
  41. {{info.mileage||'暂无'}}万公里
  42. </view>
  43. </view>
  44. <view class="table_column">
  45. <view class="left">
  46. 排放标准
  47. </view>
  48. <view class="right">
  49. {{getDict(info.emission, 'emission')}}
  50. </view>
  51. </view>
  52. <view class="table_column">
  53. <view class="left">
  54. 首次上牌
  55. </view>
  56. <view class="right">
  57. {{moment(info.f_time).format('YYYY-MM')||'暂无日期'}}
  58. </view>
  59. </view>
  60. <view class="table_column">
  61. <view class="left">
  62. 过户次数
  63. </view>
  64. <view class="right">
  65. {{info.number||'0'}}次
  66. </view>
  67. </view>
  68. <view class="table_column">
  69. <view class="left">
  70. 车源地
  71. </view>
  72. <view class="right">
  73. {{info.place||'暂无'}}
  74. </view>
  75. </view>
  76. <view class="table_column">
  77. <view class="left">
  78. 车牌地
  79. </view>
  80. <view class="right">
  81. {{info.license||'暂无'}}
  82. </view>
  83. </view>
  84. <view class="table_column">
  85. <view class="left">
  86. 外观颜色
  87. </view>
  88. <view class="right">
  89. {{info.out_color||'暂无'}}
  90. </view>
  91. </view>
  92. <view class="table_column">
  93. <view class="left">
  94. 内饰颜色
  95. </view>
  96. <view class="right">
  97. {{info.in_color||'暂无'}}
  98. </view>
  99. </view>
  100. <view class="table_column">
  101. <view class="left">
  102. 车辆使用性质
  103. </view>
  104. <view class="right">
  105. {{getDict(info.use_type, 'use_type')}}
  106. </view>
  107. </view>
  108. </view>
  109. <view class="text">功能配置</view>
  110. <view class="two_2">
  111. <view class="table_column">
  112. <view class="left">
  113. 能源类型
  114. </view>
  115. <view class="right">
  116. {{getDict(info.energy, 'energy')}}
  117. </view>
  118. </view>
  119. <view class="table_column">
  120. <view class="left">
  121. 排量
  122. </view>
  123. <view class="right">
  124. {{info.displacement||'暂无'}}
  125. </view>
  126. </view>
  127. <view class="table_column">
  128. <view class="left">
  129. 级别
  130. </view>
  131. <view class="right">
  132. {{getDict(info.level, 'level')}}
  133. </view>
  134. </view>
  135. <view class="table_column">
  136. <view class="left">
  137. 变速箱
  138. </view>
  139. <view class="right">
  140. {{getDict(info.type, 'type')}}
  141. </view>
  142. </view>
  143. <view class="table_column">
  144. <view class="left">
  145. 驱动方式
  146. </view>
  147. <view class="right">
  148. {{getDict(info.drive, 'drive')}}
  149. </view>
  150. </view>
  151. <view class="table_column">
  152. <view class="left">
  153. 座位数
  154. </view>
  155. <view class="right">
  156. {{getDict(info.set, 'set')}}
  157. </view>
  158. </view>
  159. </view>
  160. <u-divider text="以上为全部内容"></u-divider>
  161. </view>
  162. </view>
  163. </template>
  164. <script setup lang="ts">
  165. import moment from 'moment';
  166. import { getCurrentInstance, computed, ref } from 'vue';
  167. //该依赖已内置不需要单独安装
  168. import { onLoad } from "@dcloudio/uni-app";
  169. // 请求接口
  170. const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
  171. // openid
  172. const openid = computed(() => {
  173. return uni.getStorageSync('openid');
  174. })
  175. // 基本信息
  176. const config = ref({});
  177. const id = ref('');
  178. const text = ref('以下内容为商家填写 购车前请谨慎核对,以实际情况为准');
  179. const info = ref({});
  180. // 字典表
  181. const useTypeList = ref([]);
  182. const boxTypeList = ref([]);
  183. const structureList = ref([]);
  184. const emissionList = ref([]);
  185. const energyList = ref([]);
  186. const setList = ref([]);
  187. const levelList = ref([]);
  188. const driveList = ref([]);
  189. onLoad(async (options) => {
  190. id.value = options && options.id
  191. await searchConfig();
  192. await searchOther();
  193. await search();
  194. })
  195. // 查询其他信息
  196. const searchOther = async () => {
  197. let res;
  198. // 车辆使用性质
  199. res = await $api(`dictData`, 'GET', { code: 'useType', is_use: '0' });
  200. if (res.errcode === 0) useTypeList.value = res.data;
  201. // 变速箱
  202. res = await $api(`dictData`, 'GET', { code: 'boxType', is_use: '0' });
  203. if (res.errcode === 0) boxTypeList.value = res.data;
  204. // 车身结构
  205. res = await $api(`dictData`, 'GET', { code: 'structure', is_use: '0' });
  206. if (res.errcode === 0) structureList.value = res.data;
  207. // 排放标准
  208. res = await $api(`dictData`, 'GET', { code: 'emission', is_use: '0' });
  209. if (res.errcode === 0) emissionList.value = res.data;
  210. // 能源类型
  211. res = await $api(`dictData`, 'GET', { code: 'energy', is_use: '0' });
  212. if (res.errcode === 0) energyList.value = res.data;
  213. // 座椅
  214. res = await $api(`dictData`, 'GET', { code: 'set', is_use: '0' });
  215. if (res.errcode === 0) setList.value = res.data;
  216. // 车辆级别
  217. res = await $api(`dictData`, 'GET', { code: 'level', is_use: '0' });
  218. if (res.errcode === 0) levelList.value = res.data;
  219. // 驱动方式
  220. res = await $api(`dictData`, 'GET', { code: 'drive', is_use: '0' });
  221. if (res.errcode === 0) driveList.value = res.data;
  222. };
  223. // config信息
  224. const searchConfig = async () => {
  225. config.value = uni.getStorageSync('config');
  226. };
  227. // 查询
  228. const search = async () => {
  229. if (id.value) {
  230. const res = await $api(`car/${id.value}`, 'GET', {});
  231. if (res.errcode === 0) {
  232. info.value = res.data
  233. } else {
  234. uni.showToast({
  235. title: res.errmsg || '',
  236. icon: 'error',
  237. });
  238. }
  239. }
  240. };
  241. // 数据处理
  242. const getDict = (data, model) => {
  243. let list;
  244. switch (model) {
  245. case 'use_type':
  246. list = useTypeList.value;
  247. break;
  248. case 'type':
  249. list = boxTypeList.value;
  250. break;
  251. case 'structure':
  252. list = structureList.value;
  253. break;
  254. case 'emission':
  255. list = emissionList.value;
  256. break;
  257. case 'energy':
  258. list = energyList.value;
  259. break;
  260. case 'set':
  261. list = setList.value;
  262. break;
  263. case 'level':
  264. list = levelList.value;
  265. break;
  266. case 'drive':
  267. list = driveList.value;
  268. break;
  269. default:
  270. break;
  271. }
  272. if (!list) return;
  273. const res = list.find((f) => f.value == data);
  274. return res?.label || '暂无';
  275. };
  276. </script>
  277. <style lang="scss" scoped>
  278. .content {
  279. display: flex;
  280. flex-direction: column;
  281. width: 100vw;
  282. height: 100vh;
  283. .two {
  284. padding: 2vw;
  285. .two_1 {
  286. margin: 2vw;
  287. .table_column {
  288. display: flex;
  289. font-size: var(--font12Size);
  290. .left {
  291. width: 25vw;
  292. text-align: center;
  293. padding: 2vw;
  294. border: 1px solid #e7e6e4;
  295. }
  296. .right {
  297. width: 65vw;
  298. padding: 2vw;
  299. border: 1px solid #e7e6e4;
  300. background-color: #f4f4f5;
  301. }
  302. }
  303. }
  304. .text {
  305. margin: 2vw;
  306. font-size: var(--font16Size);
  307. font-weight: bold;
  308. }
  309. .two_2 {
  310. margin: 2vw;
  311. display: flex;
  312. flex-wrap: wrap;
  313. .table_column {
  314. display: flex;
  315. font-size: var(--font12Size);
  316. width: 46vw;
  317. .left {
  318. display: flex;
  319. align-items: center;
  320. justify-content: center;
  321. padding: 2vw;
  322. border: 1px solid #e7e6e4;
  323. width: 20vw;
  324. }
  325. .right {
  326. padding: 2vw;
  327. border: 1px solid #e7e6e4;
  328. background-color: #f4f4f5;
  329. width: 24vw;
  330. }
  331. }
  332. }
  333. }
  334. }
  335. </style>