vadd.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. <template>
  2. <view class="check">
  3. <uni-forms ref="form" :model="datainfo" :rules="rules">
  4. <view class="cbox" style="padding-bottom: 24rpx;">
  5. <view class="chtop flexc" @click="zhanflag=!zhanflag">
  6. <view class="line"></view>
  7. <view class="atit">常用访客</view>
  8. <view v-if="!delflag" class="btntit" @click.stop="delflag=true">删除</view>
  9. <view v-else class="btntit bttita" @click.stop="delflag=false">完成</view>
  10. <view class="flex1"></view>
  11. <image :src="upimg" class="upimg" :class="zhanflag?'act':''"></image>
  12. </view>
  13. <view class="peobox flexc" v-if="zhanflag">
  14. <view class="plists flexcc" v-for="(ite,idx) in visitList" :key="idx">
  15. <view class="tit overtwo">{{ite.name}}</view>
  16. <view class="addimg flexcc" v-if="delflag" @click.stop="getcyvisDel(ite.frequentlyVisitorManageId,idx)">
  17. <image :src="delimg" class="imgb"></image>
  18. </view>
  19. <view class="addimg flexcc" v-else @click.stop="getcyvisEdit(ite)">
  20. <image :src="addimg" class="imga"></image>
  21. </view>
  22. </view>
  23. <!-- <view class="plists flexcc">
  24. <view class="tit overtwo">王一</view>
  25. <view class="addimg flexcc">
  26. <image :src="addimg"></image>
  27. </view>
  28. </view> -->
  29. </view>
  30. </view>
  31. <view class="cbox">
  32. <view class="chtop flexc">
  33. <view class="line"></view>
  34. <view class="atit">访客信息</view>
  35. </view>
  36. <view class="chmain">
  37. <!-- 选择房屋 -->
  38. <uni-forms-item label="访客姓名" name="name">
  39. <view class="flexc">
  40. <uni-easyinput :disabled="isdisabled" v-model="datainfo.name" :inputBorder='false' placeholder="请输入访客姓名" />
  41. <!-- <uni-data-checkbox selectedColor="#0156FE" selectedTextColor="#272727" v-model="datainfo.sex" :localdata="sexs" /> -->
  42. </view>
  43. </uni-forms-item>
  44. <uni-forms-item label="来访人数" name="num">
  45. <view class="flexc">
  46. <!-- <uni-easyinput :disabled="isdisabled" v-model="datainfo.num" type="Number" :inputBorder='false' placeholder="请输入来访人数" /> -->
  47. <!-- <view class="flex1"></view> -->
  48. <view class="libox flexcw rslist">
  49. <view class="sylist flexcc" :class="datainfo.num==ite.value?'act':''" v-for="(ite,idx) in rslist" :key="idx" @click="getRsFn(ite)">{{ite.label}}</view>
  50. </view>
  51. <uni-easyinput :disabled="isdisabled" v-model="datainfo.num" type="Number" :inputBorder='false' placeholder="输入" />
  52. <view class="rimg"><image :src="rimg"></image></view>
  53. </view>
  54. </uni-forms-item>
  55. <uni-forms-item label="来访时间" name="reserveTime">
  56. <!-- :hide-second='true' -->
  57. <view class="flexc">
  58. <uni-datetime-picker type="datetime" :disabled="isdisabled" :class="datainfo.reserveTime?'co27':'coa'" placeholder="请选择来访时间" :border="false" v-model="datainfo.reserveTime" @change="changeLog" />
  59. <view class="rimg"><image :src="rimg"></image></view>
  60. </view>
  61. <!-- <picker range-key='dictLabel' :value="vxlbidx" :range="vxlbList" @change='bindDateChangea'>
  62. <view class="flexc">
  63. <view class="flex1 txr f13 co27" v-if="datainfo.maintenanceCategory&&!vxlb">{{statusFormats(datainfo.maintenanceCategory,vxlbList,'vxlb')}}</view>
  64. <view class="flex1 txr f13" v-else :class="vxlb?'co27':'coa'">{{vxlb||"请选择来访时间"}}</view>
  65. <view class="rimg"><image :src="rimg"></image></view>
  66. </view>
  67. </picker> -->
  68. </uni-forms-item>
  69. <uni-forms-item label="来访事由" name="reason">
  70. <view class="flexc ">
  71. <view class="flex1"></view>
  72. <view class="sylist flexcc" :class="syidx==ite.dictValue?'act':''" v-for="(ite,idx) in sylist" :key="idx" @click="getSyFn(ite.dictValue)">{{ite.dictLabel}}</view>
  73. <!-- <uni-easyinput :disabled="isdisabled" v-model="datainfo.reason" :inputBorder='false' placeholder="请输入来访事由" /> -->
  74. <view class="rimg"><image :src="rimg"></image></view>
  75. <!-- <picker range-key='dictLabel' :value="syqxidx" :range="sexs" @change='bindDateChange'>
  76. <view class="rimg"><image :src="rimg"></image></view>
  77. </picker> -->
  78. </view>
  79. </uni-forms-item>
  80. <uni-forms-item label="来访门户" name="houseId">
  81. <w-select
  82. style="margin-left: 20rpx;"
  83. v-model="chooseValue"
  84. :list='fwlist'
  85. valueName='label'
  86. keyName="value"
  87. :chosevalue="datainfo.houseAddress"
  88. :filterable='filterable'
  89. @change='getchange'
  90. >
  91. </w-select>
  92. </uni-forms-item>
  93. </view>
  94. </view>
  95. <view class="cbox">
  96. <view class="chtop flexc">
  97. <view class="line"></view>
  98. <view class="atit">驾车信息</view>
  99. </view>
  100. <view class="chmain">
  101. <uni-forms-item label="是否驾车" name="isCar">
  102. <view class="flexc" @click="getChangeFn">
  103. <view class="flex1"></view>
  104. <image :src="check" v-if="datainfo.isCar=='Y'" class="checkimg"></image>
  105. <image :src="ncheck" v-else class="checkimg"></image>
  106. </view>
  107. </uni-forms-item>
  108. <uni-forms-item label="车牌号码" name="plateNumber" v-if="datainfo.isCar=='Y'">
  109. <view class="flexc">
  110. <!-- disabled -->
  111. <!-- <uni-easyinput :disabled="isdisabled" v-model="datainfo.plateNumber" :inputBorder='false' placeholder="请输入车牌号" /> -->
  112. <view class="flex1"></view>
  113. <view class="carinput-input">
  114. <view class="carinput-input-i" :class="{'input-active':carIndex == i}" @tap.stop="inputKey" :data-index="i" v-for="(v,i) in carInput" :key="i" v-if="i < 2">
  115. {{carInput[i].val}}
  116. </view>
  117. <!-- 塞个点 -->
  118. <view class="cir"></view>
  119. <view class="carinput-input-i" :class="{'input-active':carIndex == i}" @tap.stop="inputKey" :data-index="i" v-for="(v,i) in carInput" :key="i" v-if="i < 7&&i>1">
  120. {{carInput[i].val}}
  121. </view>
  122. <view class="carinput-input-i " :class="{'input-active':carIndex == 7}" @tap.stop="inputKey" data-index="7">
  123. <block v-if="carInput[7].val">{{carInput[7].val}}</block>
  124. <view v-else class="newtit flexccc">
  125. <image :src="addnew"></image>
  126. 新能源
  127. </view>
  128. <!-- {{carInput[7].val?carInput[7].val:'+新能源'}} -->
  129. </view>
  130. </view>
  131. </view>
  132. </uni-forms-item>
  133. <uni-forms-item label="手机号码" name="mobileNumber">
  134. <view class="flexc">
  135. <uni-easyinput :disabled="isdisabled" v-model="datainfo.mobileNumber" :inputBorder='false' placeholder="请输入手机号码" />
  136. <view class="rimg"></view>
  137. </view>
  138. </uni-forms-item>
  139. <view class="tips">
  140. 如驾车,填写车牌后,访客到访时,车闸机自动打开
  141. </view>
  142. </view>
  143. </view>
  144. </uni-forms>
  145. <view class="pdlr12 mt34">
  146. <view class="rhbtnw mb20" @click="getVisAdd">设为常用访客</view>
  147. <view class="rhbtn" @click="getEditFn" v-if="isdisabled">修改</view>
  148. <view class="rhbtn" @click="getSubmit" v-else>确定</view>
  149. </view>
  150. <tki-float-keyboard ref="keybd" :mode="'car'" :type="keyType" :title="'车牌键盘'" @del="keyCbDel" @val="keyCbVal" @hide="keyCbHide"></tki-float-keyboard>
  151. <loading></loading>
  152. </view>
  153. </template>
  154. <script>
  155. import config from '@/config'
  156. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  157. import {uploadIdentify,uploadmore,geocodeAddress} from '@/utils/common.js'
  158. import {reservAdd,reservDet,reservPut,cyManageList,cyManageDet,cyManageAdd,cyManagePut,cyManageDel} from "@/api/work/people.js"
  159. import {getDictionaryFn} from "@/api/system/user.js"
  160. import {houseInfolistNoPage} from "@/api/work/work.js"
  161. import wSelect from "@/work/components/w-select/w-select.vue"
  162. import tkiFloatKeyboard from "@/mine/components/tki-float-keyboard/tki-float-keyboard.vue";
  163. var key='';
  164. // #ifdef H5
  165. key='8de52b560193f01932ad997dba3e76c0'
  166. // #endif
  167. // #ifdef APP-PLUS
  168. key='8de52b560193f01932ad997dba3e76c0'
  169. // #endif
  170. // #ifdef MP-WEIXIN
  171. key='8de52b560193f01932ad997dba3e76c0'
  172. // #endif
  173. export default {
  174. components: {wSelect,tkiFloatKeyboard},
  175. data() {
  176. return {
  177. rimg: require('@/static/images/rimg.png'),
  178. aphoto: require('@/work/static/visitor/aphoto.png'),
  179. upimg: require('@/work/static/manage/up.png'),
  180. addimg: require('@/work/static/manage/add.png'),
  181. delimg: require('@/mine/static/house/del.png'),
  182. check: require('@/mine/static/check.png'),
  183. ncheck: require('@/mine/static/ncheck.png'),
  184. baseUrl: config.baseUrl,
  185. checkflag:true,
  186. delflag:false,
  187. datainfo: {
  188. // "visitorManageId":"",//来访主键
  189. "houseId":"",//门户id
  190. "houseAddress":"",//门牌号
  191. "name":"",//访客姓名
  192. "num":"",//来访人数
  193. "reason":"",//来访事由
  194. "mobileNumber":"",//手机号码
  195. "isCar":"N",//是否驾车 N:否 Y:是
  196. "plateNumber":"",//车牌号码
  197. "reserveTime":"",//预约时间
  198. "visitorTime":"",//来访时间
  199. // "status":"",//状态 1:预约成功 2:已来访 3:已过期
  200. // "photo":""//人脸信息
  201. },
  202. syqxidx:'',
  203. sexs: [{
  204. text: '男',
  205. value: 0
  206. }, {
  207. text: '女',
  208. value: 1
  209. }],
  210. rules:{name: {rules: [{required: true,errorMessage: '请输入访客姓名' }]},
  211. houseId: {rules: [{required: true,errorMessage: '请选择来访门户' }]},
  212. mobileNumber: {rules: [{required: true,errorMessage: '请输入手机号'}, {pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,errorMessage:'请输入正确的手机号码'}]},},
  213. phofile:[],
  214. filterable:true,
  215. chooseValue:'',
  216. fwlist:[],
  217. id:'',
  218. zhanflag:false,
  219. isdisabled:false,
  220. ptype:'add',
  221. userId:this.$store.state.user.userId,
  222. syidx:'',
  223. rsidx:'',
  224. sylist:[],
  225. rslist:[{label:'1',value:'1'},{label:'2',value:'2'},{label:'3',value:'3'},{label:'4',value:'4'},{label:'5',value:'5'},{label:'6',value:'6'},{label:'7',value:'7'}],
  226. carIndex: -1,
  227. carInput: [
  228. { type: 2, val: "皖" },
  229. { type: 4, val: "A" },
  230. { type: 1, val: "" },
  231. { type: 1, val: "" },
  232. { type: 1, val: "" },
  233. { type: 1, val: "" },
  234. { type: 3, val: "" },
  235. { type: 1, val: "" }
  236. ],
  237. keyType: 0,
  238. isPower: false, // 新能源
  239. addnew:require('@/mine/static/house/add.png'),
  240. visitList:[],//常用访客
  241. }
  242. },
  243. onLoad: function(e) {
  244. if(e.id){
  245. this.id=e.id;
  246. this.ptype="edit";
  247. // this.isdisabled=true;
  248. this.getDetail()
  249. }
  250. this.init()
  251. this.getcyManageList()
  252. if(this.ptype=='add'){
  253. this.time()
  254. }
  255. },
  256. methods: {
  257. checkPermi,
  258. checkRole,
  259. getEditFn(){
  260. this.isdisabled=false;
  261. },
  262. changeLog(e){
  263. this.datainfo.visitorTime=e;
  264. },
  265. kaType(data, list) {
  266. return selectDictValue(list, data);
  267. },
  268. async getLocation(address) {
  269. var that=this;
  270. if (!address) {
  271. uni.showToast({ title: '请输入地址', icon: 'none' });
  272. return;
  273. }
  274. try {
  275. const { latitude, longitude } = await geocodeAddress(address, key);
  276. this.datainfo.lat=latitude;
  277. this.datainfo.lgt=longitude;
  278. } catch (error) {
  279. // uni.showToast({ title: '获取经纬度失败', icon: 'none' });
  280. }
  281. },
  282. time() {
  283. var date = new Date();
  284. var y = date.getFullYear();
  285. var m = date.getMonth() + 1;
  286. var d = date.getDate();
  287. var h = date.getHours();
  288. var min = date.getMinutes();
  289. var s = date.getSeconds();
  290. var yearStr = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d)
  291. var timeStr = (h < 10 ? ('0' + h) : h) + ':' + (min < 10 ? ('0' + min) : min) + ':' + (s < 10 ? (
  292. '0' + s) : s);
  293. var kaTime = yearStr + ' ' + timeStr;
  294. this.datainfo.visitorTime=kaTime;
  295. this.datainfo.reserveTime=kaTime;
  296. },
  297. getSyFn(e){
  298. this.syidx=e;
  299. this.datainfo.reason=e;
  300. },
  301. getRsFn(e){
  302. this.rsidx=e.value;
  303. this.datainfo.num=e.label;
  304. },
  305. getcyManageList(){
  306. var params={
  307. userId:this.userId,
  308. pageSize: 100,
  309. pageNum: 1,
  310. }
  311. cyManageList(params).then(res=>{
  312. if(res.code==200){
  313. this.visitList=res.rows
  314. }
  315. })
  316. },
  317. init(){
  318. // 自己的房屋
  319. var params={
  320. userId:this.userId,
  321. pageSize: 100,
  322. pageNum: 1,
  323. }
  324. houseInfolistNoPage(params).then(res=>{
  325. if(res.code==200){
  326. this.fwlist= res.rows.map(v => {
  327. return {
  328. label: v.detailedAddress,
  329. value: v.houseId,
  330. location: v.location
  331. }
  332. })
  333. }
  334. })
  335. // 获取事由
  336. getDictionaryFn('visit_reason').then(res=>{
  337. if(res.code==200){
  338. this.sylist = res.data.map(v => {
  339. return {
  340. dictLabel: v.dictLabel,
  341. dictValue: v.dictValue
  342. }
  343. })
  344. }
  345. })
  346. },
  347. bindDateChange(e){
  348. var val=e.detail.value;
  349. // this.datainfo.applicationBank=this.sdyhlist[val].value;
  350. // this.applicationBank=this.sdyhlist[val].label;
  351. },
  352. getChangeFn(){
  353. if(this.isdisabled){
  354. return
  355. }
  356. if(this.datainfo.isCar=='Y'){
  357. this.datainfo.isCar='N'
  358. }else{
  359. this.datainfo.isCar='Y'
  360. }
  361. },
  362. getDetail(){
  363. reservDet(this.id).then(res=>{
  364. if(res.code==200){
  365. this.datainfo=res.data;
  366. this.chooseValue=res.data.houseId
  367. }
  368. })
  369. },
  370. // 常用访客
  371. getVisAdd(){
  372. var params=JSON.parse(JSON.stringify(this.datainfo))
  373. if(params.frequentlyVisitorManageId){
  374. cyManagePut(params).then(res=>{
  375. if(res.code==200){
  376. this.$toast('操作成功')
  377. // this.getcyManageList()
  378. }
  379. })
  380. }else{
  381. cyManageAdd(params).then(res=>{
  382. if(res.code==200){
  383. this.$toast('添加成功')
  384. this.getcyManageList()
  385. }
  386. })
  387. }
  388. },
  389. getcyvisEdit(ite){
  390. this.datainfo=JSON.parse(JSON.stringify(ite))
  391. this.syidx=ite.reason
  392. },
  393. getcyvisDel(id,idx){
  394. cyManageDel(id).then(res=>{
  395. if(res.code==200){
  396. this.visitList.splice(idx,1)
  397. if(this.visitList.length<1){
  398. this.delflag=false;
  399. }
  400. var visid=this.datainfo.frequentlyVisitorManageId
  401. if(id==visid){
  402. this.datainfo.frequentlyVisitorManageId=''
  403. }
  404. }
  405. })
  406. },
  407. getSubmit(){
  408. var num=this.toBind()
  409. this.$refs.form.validate().then(res => {
  410. var params=JSON.parse(JSON.stringify(this.datainfo))
  411. if(!params.houseId){
  412. this.$toast("请选择来访门户")
  413. return
  414. }
  415. if(!params.reserveTime){
  416. this.$toast("请选择来访时间")
  417. return
  418. }
  419. if(params.isCar=='Y'&&!params.plateNumber){
  420. this.$toast("请输入车牌号")
  421. return
  422. }
  423. if(params.isCar!='Y'){
  424. params.plateNumber=''
  425. }else{
  426. if(num=='-1'){
  427. this.$toast('请输入完整的车牌号')
  428. return
  429. }
  430. }
  431. if(this.ptype=='add'){
  432. reservAdd(params).then(res=>{
  433. if(res.code==200){
  434. this.$toast("新增成功")
  435. setTimeout(function(){
  436. // uni.$emit("refComelist")
  437. uni.navigateBack({
  438. delta:1
  439. })
  440. },1500)
  441. }
  442. })
  443. }else{
  444. reservPut(params).then(res=>{
  445. if(res.code==200){
  446. this.$toast("修改成功")
  447. setTimeout(function(){
  448. // uni.$emit("refComelist")
  449. uni.navigateBack({
  450. delta:1
  451. })
  452. },1500)
  453. }
  454. })
  455. }
  456. })
  457. },
  458. getchange(e){
  459. this.datainfo.houseId=e.value;
  460. this.datainfo.houseAddress=e.label;
  461. this.datainfo.detailAddress=e.location;
  462. this.getLocation(e.location)
  463. },
  464. getaddImage(e) {
  465. let that = this;
  466. let file = [],
  467. count = 9
  468. uni.chooseImage({
  469. success: function(res) {
  470. let img = res.tempFilePaths;
  471. if (img.length + file.length > count) {
  472. uni.showToast({
  473. title: '最多上传' + count + '张图片',
  474. icon: 'none',
  475. duration: 2000
  476. })
  477. } else {
  478. let imglen = res.tempFilePaths.length;
  479. var fuwufile = [];
  480. uploadmore('/common/upload', img, 0, 0, 0, imglen, fuwufile, function(rs) {
  481. that.phofile = that.phofile.concat(rs);
  482. })
  483. }
  484. }
  485. });
  486. },
  487. // 车牌
  488. // 判定是否为空
  489. empty(v) {
  490. let tp = typeof v,
  491. rt = false;
  492. if (tp == "number" && String(v) == "") {
  493. rt = true
  494. } else if (tp == "undefined") {
  495. rt = true
  496. } else if (tp == "object") {
  497. if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
  498. } else if (tp == "string") {
  499. if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
  500. } else if (tp == "function") {
  501. rt = false
  502. }
  503. return rt
  504. },
  505. inputKey(e) {
  506. let that = this;
  507. let data = e.currentTarget.dataset;
  508. that.carIndex = data.index;
  509. if (data.index >= 7) {
  510. that.isPower=true;
  511. that.carIndex = 7;
  512. // if (!that.isPower) {
  513. // return false;
  514. // } else {
  515. // that.carIndex = 7;
  516. // }
  517. } else {
  518. that.carIndex = data.index;
  519. }
  520. that.upKeyType();
  521. that.keyShow();
  522. },
  523. keyCbVal(e) {
  524. let that = this;
  525. let index = Number(that.carIndex);
  526. if (index >= 0 && index < 6) {
  527. that.carInput[index].val = e;
  528. that.carIndex = index + 1;
  529. } else if (index == 6) {
  530. that.carInput[index].val = e;
  531. if (that.isPower) {
  532. // 新能源
  533. that.carIndex = 7;
  534. } else {
  535. // 不是新能源出输入结束
  536. that.keyHide();
  537. that.carIndex = -2;
  538. console.log('非新能源车输入完毕')
  539. }
  540. } else if (index == 7) {
  541. // 新能源车输入完毕
  542. that.carInput[index].val = e;
  543. that.keyHide();
  544. that.carIndex = -3;
  545. console.log('新能源车输入完毕')
  546. }
  547. that.upKeyType();
  548. },
  549. keyCbDel(e) {
  550. let index = this.carIndex;
  551. console.log(index,1)
  552. if (index > 0) {
  553. if (!this.empty(this.carInput[index].val)) {
  554. this.carInput[index].val = "";
  555. this.carIndex = index;
  556. } else {
  557. this.carInput[index - 1].val = "";
  558. this.carIndex = index - 1;
  559. }
  560. if(index==7){
  561. var obj={ type: 1, val: "" }
  562. this.carInput.splice(index,1,obj)
  563. this.isPower=false;
  564. }
  565. console.log(this.carInput)
  566. }
  567. this.upKeyType();
  568. },
  569. upKeyType() {
  570. if (!this.empty(this.carInput[this.carIndex])) {
  571. this.keyType = this.carInput[this.carIndex].type;
  572. }
  573. },
  574. keyShow() {
  575. this.$refs.keybd._keyShow();
  576. },
  577. keyHide() {
  578. this.$refs.keybd._keyHide();
  579. },
  580. keyCbHide() {
  581. if (this.carIndex != -3 || this.carIndex != -2) {
  582. this.carIndex = -1;
  583. }
  584. },
  585. powerChange(e) {
  586. let that = this
  587. let i = that.checkCar().i
  588. if (e.detail.value.length > 0) {
  589. that.isPower = true;
  590. if (i == -1) {
  591. that.carIndex = 7;
  592. } else {
  593. that.carIndex = i;
  594. }
  595. that.keyShow();
  596. } else {
  597. that.isPower = false;
  598. that.carInput[7].val = "";
  599. if (that.carIndex == 7) {
  600. that.keyHide();
  601. that.carIndex = -2;
  602. }
  603. }
  604. that.upKeyType();
  605. },
  606. checkCar() {
  607. // 检查车牌是否输入完成
  608. let that = this;
  609. let i = 7;
  610. let rt = { i: -1, isempty: false, val: "" };
  611. if (that.isPower) {
  612. i = 8;
  613. }
  614. for (let index = 0; index < i; index++) {
  615. const obj = that.carInput[index];
  616. if (this.empty(String(obj.val))) {
  617. rt.i = index;
  618. rt.isempty = true;
  619. rt.val = "";
  620. break;
  621. }
  622. rt.val += that.carInput[index].val;
  623. }
  624. return rt;
  625. },
  626. toBind() {
  627. let that = this
  628. let ck = that.checkCar();
  629. if (ck.i == -1 && !ck.isempty) {
  630. that.datainfo.plateNumber=ck.val;
  631. // if(this.isPower){
  632. // this.datainfo.vehicleEnergy='新能源'
  633. // }else{
  634. // this.datainfo.vehicleEnergy='燃油车'
  635. // }
  636. return ck.val
  637. } else {
  638. // 显示键盘输入
  639. // that.keyShow();
  640. // that.carIndex = ck.i;
  641. // that.keyType = that.carInput[ck.i].type;
  642. return '-1'
  643. }
  644. },
  645. //分解车牌
  646. toCarCode(code){
  647. var list=JSON.parse(JSON.stringify(this.carInput))
  648. var newArr=[]
  649. if(code){
  650. newArr=code.split('')
  651. }
  652. list.forEach((ite,idx)=>{
  653. ite.val=newArr[idx]
  654. })
  655. if(newArr.length==8){
  656. this.isPower=true;
  657. }
  658. this.carInput=JSON.parse(JSON.stringify(list))
  659. }
  660. }
  661. }
  662. </script>
  663. <style>
  664. page{background: #F3F3F0;}
  665. </style>
  666. <style lang="scss" scoped>
  667. .carinput-input{display: flex;justify-content: center;align-items: center;
  668. .input-active {color: #0256FD;border: 2rpx solid #0256FD;}
  669. .cir{width: 14rpx;height: 14rpx;background: #8D8D8D;border-radius: 50%;margin-right: 4rpx;}
  670. }
  671. .carinput-input-i{width: 52rpx;height: 80rpx;background: #F5F4F7;border-radius: 10rpx;font-weight: bold;font-size: 26rpx;color: #272727;margin-right: 4rpx;text-align: center;box-sizing: border-box;display: flex;flex-direction: column;align-items: center;justify-content: center;
  672. .newtit{
  673. font-weight: bold;font-size: 16rpx;color: #0256FD;
  674. image{width: 20rpx;height: 20rpx;margin-bottom: 4rpx;}
  675. }
  676. }
  677. .check /deep/ .uni-date-editor--x__disabled{opacity: 1;}
  678. .carinput-input-i:nth-last-child(1) {margin-right: 0}
  679. .coa /deep/ .uni-date__x-input{text-align: right;color: #AAAAAA;}
  680. .check /deep/ .select-wrap{border: none;width: 100%;}
  681. .check /deep/ .uni-forms-item{min-height: 106rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;border-bottom: 2rpx solid #E6E6E6;padding:10rpx 0;}
  682. .check .cbox /deep/ .uni-forms-item:last-child{border: none;}
  683. .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
  684. .check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
  685. .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
  686. .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  687. .check /deep/ .uni-input-input{font-size: 26rpx;}
  688. .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  689. .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  690. .check /deep/ .uni-data-checklist .checklist-group .checklist-box{margin:10rpx 8rpx 10rpx 16rpx;}
  691. .check /deep/ .uni-data-checklist{flex: 0 0 auto;}
  692. .check{min-height: 100vh;padding: 20rpx 18rpx 24rpx;box-sizing: border-box;}
  693. .cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;margin-bottom: 24rpx;
  694. .chtop{padding-top: 32rpx;margin-bottom: 8rpx;
  695. // image{width: 14rpx;height: 48rpx;margin-right: 20rpx;}
  696. .atit{font-weight: bold;font-size: 32rpx;color: #272727;}
  697. .upimg{width: 22rpx;height: 14rpx;margin-right: 36rpx;transform: rotate(180deg);transition: all 0.3s;
  698. &.act{transform: rotate(0deg);}
  699. }
  700. }
  701. .chmain{
  702. padding: 0 32rpx;
  703. .upbox{height: 224rpx;background: #EFF4FF;border-radius: 20rpx;display: flex;align-items: center;justify-content: center;flex-direction: column;margin-bottom: 8rpx;overflow: auto;
  704. .img{width: 100%;height: 100%;}
  705. .addimg{width: 70rpx;height: 70rpx;margin-bottom: 16rpx;}
  706. view{font-weight: bold;font-size: 26rpx;color: #4C6686;}
  707. }
  708. .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
  709. image{width: 100%;height: 100%;}
  710. }
  711. .checkimg{width: 80rpx;height: 40rpx;margin-right: 8rpx;}
  712. .aphoto{padding: 0 24rpx;border-left: 2rpx solid #e6e6e6;margin-left: 26rpx;
  713. image{width: 40rpx;height: 38rpx;}
  714. }
  715. }
  716. .peobox{padding:24rpx 16rpx 0;
  717. .plists{position: relative;background: #EEF4FF;position: relative;
  718. border-radius: 50%;width: 94rpx;height: 94rpx;margin: 0 20rpx 20rpx;padding: 4rpx;box-sizing: border-box;
  719. .tit{font-weight: 500;font-size: 22rpx;color: #0256FD;}
  720. .addimg{width: 36rpx;height: 36rpx;background: #FFFFFF;box-shadow: 0px 3px 5px 0px rgba(147,147,147,0.35);border-radius: 50%;position: absolute;bottom: -4rpx;right: 4rpx;
  721. .imga{width: 18rpx;height: 18rpx;}
  722. .imgb{width: 26rpx;height: 26rpx;}
  723. }
  724. }
  725. }
  726. }
  727. .libox{
  728. &.rslist{
  729. .sylist{min-width:40rpx;height: 40rpx;margin-left: 14rpx;}
  730. }
  731. }
  732. .sylist{background: #F0F0F0;border-radius: 26rpx;border:2rpx solid #DADADA;margin-left: 26rpx;font-weight: 500;min-width:112rpx;height: 54rpx;box-sizing: border-box;
  733. font-size: 26rpx;
  734. color: #666666;
  735. &.act{border: 2rpx solid #0256FD;background: #DCE8FF;color: #0256FD;}
  736. }
  737. .line{width: 14rpx;height: 48rpx;background: #0256FD;border-radius:0 12rpx 12rpx 0;margin-right: 18rpx;}
  738. .tips{font-weight: 500;font-size: 22rpx;color: #0256FD;padding: 20rpx 0;}
  739. .btntit{font-size: 26rpx;color: #FF6969;margin-left: 20rpx;
  740. &.bttita{color: #0256fd;}
  741. }
  742. </style>