apply.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <template>
  2. <view class="content">
  3. <!-- 自定义导航 -->
  4. <view class="zdyNavBox">
  5. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  6. <view class="zdyNav">
  7. <view class="zdyNavLeft">
  8. <image src="../../static/img/nav_icon_back.png" mode="aspectFit" class="backImg" @click="goback">
  9. </image>
  10. </view>
  11. <view class="zdyNavTitle">网约车优享</view>
  12. <view style="width: 50px;"></view>
  13. </view>
  14. </view>
  15. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  16. <view style="height: 44px;"></view>
  17. <view class="top">
  18. 填写认证信息
  19. </view>
  20. <view class="box">
  21. <view class="cont">
  22. <view class="line">
  23. <view class="lineLeft"><span class="stars">*</span>姓名</view>
  24. <view class="lineRight">
  25. <input type="text" v-model="customerName" class="lineInput" placeholder="请填写姓名"/>
  26. </view>
  27. </view>
  28. <view class="line">
  29. <view class="lineLeft"><span class="stars">*</span>手机号</view>
  30. <view class="lineRight">
  31. <input type="text" v-model="mobilePhone" class="lineInput" placeholder="请填写手机号"/>
  32. </view>
  33. </view>
  34. <view class="line">
  35. <view class="lineLeft"><span class="stars">*</span>车牌号</view>
  36. <view class="lineRight">
  37. <input type="text" v-model="plateNumber" class="lineInput" placeholder="请填写车牌号"/>
  38. </view>
  39. </view>
  40. <view class="line">
  41. <view class="lineLeft">车型</view>
  42. <view class="lineRight2">
  43. <view class="cxBox" @click="carmodel(1)">
  44. <img src="../../static/img/icon_checked.png" v-if="carmodelType==1" alt="" class="cxIcon"/>
  45. <img src="../../static/img/ckn.png" v-if="carmodelType==2" alt="" class="cxIcon"/>
  46. <span>丰田网约车</span>
  47. </view>
  48. <view class="cxBox" @click="carmodel(2)" style="padding-left: 20rpx;">
  49. <img src="../../static/img/icon_checked.png" v-if="carmodelType==2" alt="" class="cxIcon"/>
  50. <img src="../../static/img/ckn.png" v-if="carmodelType==1" alt="" class="cxIcon"/>
  51. <span>其他网约车</span>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="line">
  56. <view class="lineLeft"><span class="stars">*</span>上传图片</view>
  57. <view class="lineImgBOx">
  58. <view class="lineimghz" v-for="(item,index) in imgListArr">
  59. <img src="../../static/img/del.png" alt="" class="lineimgdel" @click="delimg(index)" >
  60. <img :src="item" alt="" class="lineimg" @click="previewImage(item)">
  61. </view>
  62. <view class="lineimghz" @click="upimg">
  63. <img src="../../static/img/scimg.png" alt="" class="lineimg">
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="submit" @click="submit">提交</view>
  70. <w-compress ref='wCompress' />
  71. </view>
  72. </template>
  73. <script>
  74. import WCompress from '@/components/w-compress/w-compress.vue'
  75. export default {
  76. components: {
  77. WCompress
  78. },
  79. data() {
  80. return {
  81. iStatusBarHeight:'',
  82. rzShow:false,
  83. imgListArr:[],
  84. file:'',
  85. customerName:'',
  86. mobilePhone:'',
  87. plateNumber:'',
  88. carmodelType:1,
  89. shopID:'86B933FF-3782-4F82-A192-176E7A45AA13',
  90. shopName:'fzh123',
  91. sourceUserID:'00958045-3341-4AF7-9460-801F5B52E3E2',
  92. sourceName:'姜国远',
  93. uid:'',
  94. }
  95. },
  96. onLoad(opt) {
  97. // this.shopID=opt.shopID;
  98. // this.shopName=opt.shopName;
  99. this.uid=opt.uid;
  100. //this.sourceName=opt.sourceName;
  101. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  102. },
  103. created() {
  104. },
  105. methods: {
  106. submit(){
  107. this.plateNumber = this.plateNumber.replace(/\s*/g,"");
  108. var regex = /(^[安京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([A-HJ-NP-Z0-9]{5})|([A-HJ-NP-Z0-9]{6}))$)|(^[安京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-HJ-NP-Z0-9]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$)/u;
  109. if (regex.test(this.plateNumber)) {
  110. } else {
  111. uni.showToast({
  112. title: '请输入正确车牌号',
  113. icon: 'none',
  114. duration: 3000
  115. });
  116. return false;
  117. }
  118. //this.convertToUpperCase(this.plateNumber)
  119. if(!this.customerName){
  120. uni.showToast({
  121. title: '请输入姓名',
  122. icon: 'none',
  123. duration: 3000
  124. });
  125. return false;
  126. }
  127. this.plateNumber=this.plateNumber.toUpperCase()
  128. console.log(this.plateNumber)
  129. /* var reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/;
  130. if(reg.test(this.mobilePhone) == false ){
  131. console.log("手机号码格式不正确");
  132. uni.showToast({
  133. title: '请输入正确的手机号',
  134. icon: 'none',
  135. duration: 3000
  136. });
  137. return false;
  138. } */
  139. if(this.mobilePhone.length!=11){
  140. uni.showToast({
  141. title: '请输入正确的手机号',
  142. icon: 'none',
  143. duration: 3000
  144. });
  145. return false;
  146. }
  147. if(!this.mobilePhone){
  148. uni.showToast({
  149. title: '请输入手机号',
  150. icon: 'none',
  151. duration: 3000
  152. });
  153. return false;
  154. }
  155. if(this.imgListArr.length==0){
  156. uni.showToast({
  157. title: '请上传图片',
  158. icon: 'none',
  159. duration: 3000
  160. });
  161. return false;
  162. }
  163. uni.showLoading({
  164. title: '加载中'
  165. });
  166. this.isload = false;
  167. this.$http('api/online-apply/add', {
  168. customerName:this.customerName,
  169. mobilePhone:this.mobilePhone,
  170. plateNumber:this.plateNumber,
  171. carmodelType:this.carmodelType,
  172. //shopID:this.shopID,
  173. //shopName:this.shopName,
  174. sourceUserID:this.uid,
  175. //sourceName:this.sourceName,
  176. imgs:this.imgListArr.join(','),
  177. }, 'POST').then(res => {
  178. uni.hideLoading();
  179. this.isload = true;
  180. if(res.code==0){
  181. uni.navigateTo({
  182. url:'/pages/wyCar/success'
  183. })
  184. }else{
  185. uni.showToast({
  186. title: '二维码链接已过期,请重新生成二维码',
  187. icon:'none',
  188. duration: 3000,
  189. });
  190. }
  191. })
  192. },
  193. convertToUpperCase(text) {
  194. return text.replace(/[a-z]/g, function(match) {
  195. return String.fromCharCode(match.charCodeAt(0) - 32);
  196. });
  197. },
  198. carmodel(num){
  199. this.carmodelType=num
  200. },
  201. delimg(index){
  202. this.imgListArr.splice(index, 1)
  203. },
  204. previewImage(img){
  205. var arr=[]
  206. arr.push(img)
  207. uni.previewImage({
  208. urls: arr,
  209. longPressActions: {
  210. itemList: ['发送给朋友', '保存图片',],
  211. success: function(data) {},
  212. fail: function(err) {}
  213. }
  214. });
  215. },
  216. upimg(){
  217. var that = this;
  218. uni.chooseImage({
  219. sourceType: ['album','camera'],
  220. count:9,
  221. sizeType:['compressed'],
  222. success: (chooseImageRes) => {
  223. const tempFilePaths = chooseImageRes.tempFilePaths;
  224. //console.log(tempFilePaths)
  225. that.file=tempFilePaths
  226. that.$refs.wCompress.start(that.file, {
  227. pixels: 600000, // 最大分辨率,默认二百万
  228. quality: 0.9, // 压缩质量,默认0.8
  229. type: 'png', // 图片类型,默认jpg
  230. base64: true, // 是否返回base64,默认false,非H5有效
  231. }).then(resxx => {
  232. // console.log(resxx)
  233. resxx.forEach(item=>{
  234. uni.uploadFile({
  235. url: that.$request.baseUrl+'api/online-apply/uploadFile', //仅为示例,非真实的接口地址
  236. filePath: item,
  237. name: 'file',
  238. formData: {
  239. 'user': 'test'
  240. },
  241. success: (uploadFileRes) => {
  242. that.imgListArr=that.imgListArr.concat(JSON.parse(uploadFileRes.data).data)
  243. }
  244. });
  245. })
  246. }).catch(e => {
  247. })
  248. }
  249. });
  250. },
  251. goback(){
  252. //app交互
  253. var standalone = window.navigator.standalone
  254. var userAgent = window.navigator.userAgent.toLowerCase()
  255. var safari = /safari/.test(userAgent)
  256. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  257. var android = /android/.test(userAgent)
  258. if (ios) {
  259. if ( true) {//!standalone&& !safari
  260. window.webkit.messageHandlers.goMyNav.postMessage(null)
  261. }
  262. } else if (android) {
  263. window.android.postMessage()
  264. }
  265. },
  266. }
  267. }
  268. </script>
  269. <style scoped>
  270. .box{
  271. padding: 0 24rpx;
  272. }
  273. .submit{
  274. width: 493rpx;
  275. height: 74rpx;
  276. background: #FF8130;
  277. border-radius: 37rpx;
  278. font-weight: 500;
  279. color: #FFFFFF;
  280. font-size: 30rpx;
  281. line-height: 74rpx;
  282. text-align: center;
  283. margin: 0 auto;
  284. margin-top: 40rpx;
  285. }
  286. .cont{
  287. background: #FFFFFF;border-radius: 10rpx;
  288. padding: 0 20rpx;
  289. }
  290. .cxBox{
  291. display: flex;line-height: 28rpx;
  292. padding-top: 6rpx;
  293. }
  294. .cxBox span{
  295. color: #3C3C3C;padding-left: 8rpx;
  296. }
  297. .cxIcon{
  298. width: 28rpx;
  299. height: 28rpx;
  300. }
  301. .lineImgBOx{
  302. display: flex;
  303. flex-wrap: wrap;
  304. width: 540rpx;
  305. }
  306. .lineimghz{
  307. margin-right: 24rpx;
  308. position: relative;
  309. margin-bottom: 24rpx;
  310. }
  311. .lineimg{
  312. width: 150rpx;
  313. height: 150rpx;
  314. border-radius: 6rpx;
  315. }
  316. .lineimgdel{
  317. width: 37rpx;
  318. height: 37rpx;
  319. position: absolute;
  320. top: -18rpx;
  321. right: -18rpx;
  322. }
  323. .lineRight2{
  324. display: flex;
  325. }
  326. .line{
  327. display: flex;font-size: 28rpx;
  328. color: #666666;padding: 29rpx 0;
  329. border-bottom: 1px solid #EEEEEE;
  330. }
  331. .lineLeft{
  332. width: 130rpx;
  333. }
  334. .lineInput{
  335. font-size: 28rpx; color: #3c3c3c;
  336. }
  337. .top{
  338. color: #666666;font-size: 28rpx;
  339. line-height: 40rpx;padding: 20rpx 44rpx;
  340. }
  341. .content{
  342. min-height: 100vh;
  343. background: #F6F6F6;
  344. }
  345. .zdyNavBox {
  346. width: 100vw;
  347. background: #FFFFFF;
  348. position: fixed;
  349. top: 0;
  350. left: 0;
  351. z-index: 99;
  352. }
  353. .zdyNav {
  354. height: 44px;
  355. display: flex;
  356. justify-content: space-between;
  357. align-items: center;
  358. }
  359. .backImg {
  360. width: 44rpx;
  361. height: 44rpx;
  362. margin-left: 10rpx;
  363. margin-right: 20rpx;
  364. }
  365. .homeImg {
  366. width: 44rpx;
  367. height: 44rpx;
  368. }
  369. .zdyNavLeft {
  370. display: flex;
  371. align-items: center;
  372. }
  373. .zdyNavTitle {
  374. height: 44px;
  375. background: #FFFFFF;
  376. text-align: center;
  377. font-size: 34rpx;
  378. line-height: 44px;
  379. }
  380. .tab {
  381. background: #FFFFFF;
  382. display: flex;
  383. justify-content: space-between;
  384. line-height: 92rpx;
  385. /* position: fixed; */
  386. width: calc(100vw - 100rpx);
  387. padding-left: 50rpx;
  388. padding-right: 50rpx;
  389. height: 92rpx;
  390. z-index: 11;
  391. border-top: 1px solid #EEEEEE;
  392. }
  393. .tabLine {
  394. font-size: 28rpx;
  395. color: #333333;
  396. text-align: center;
  397. }
  398. .tabActive {
  399. color: #FF0000;
  400. font-weight: bold;
  401. border-bottom: 4rpx solid #FF0000;
  402. }
  403. .main {
  404. padding-top: 260rpx;
  405. padding-bottom: 20rpx;
  406. background-color: #F4F5F7;
  407. }
  408. .itemBg {
  409. margin: 20rpx 24rpx;
  410. background-color: #FFFFFF;
  411. border-radius: 10rpx;
  412. padding: 20rpx;
  413. }
  414. .itemTop {
  415. display: flex;
  416. justify-content: space-between;
  417. }
  418. .itemType {
  419. color: #999999;
  420. font-size: 24rpx;
  421. }
  422. .itemSheetState {
  423. font-size: 24rpx;
  424. color: #999999
  425. }
  426. .redColor {
  427. color: #FF0000;
  428. }
  429. .orangeColor {
  430. color: #F19D01;
  431. }
  432. .greenColor {
  433. color: #00A040;
  434. }
  435. .itemShopBg {
  436. display: flex;
  437. justify-content: space-between;
  438. margin-top: 20rpx;
  439. }
  440. .shopName {
  441. color: #333333;
  442. font-size: 30rpx;
  443. font-weight: bold;
  444. /* 隐藏文字显示 ...不换行 */
  445. overflow: hidden;
  446. text-overflow: ellipsis;
  447. white-space: nowrap;
  448. }
  449. .price {
  450. color: #333333;
  451. font-weight: bold;
  452. font-size: 32rpx;
  453. }
  454. .itemName {
  455. color: #666666;
  456. font-size: 24rpx;
  457. padding-top: 16rpx;
  458. height: 30rpx;
  459. overflow: hidden;
  460. text-overflow: ellipsis;
  461. white-space: nowrap;
  462. }
  463. .plateBg {
  464. display: flex;
  465. justify-content: space-between;
  466. align-items: center;
  467. }
  468. .plateNumber {
  469. color: #666666;
  470. font-size: 24rpx;
  471. margin-bottom: 20rpx;
  472. display: flex;
  473. }
  474. .itemLineBottom {
  475. display: flex;
  476. justify-content: flex-end;
  477. }
  478. .itemBtn1 {
  479. width: 150rpx;
  480. height: 56rpx;
  481. border-radius: 36rpx;
  482. border: 2rpx solid #DDDDDD;
  483. text-align: center;
  484. line-height: 56rpx;
  485. font-size: 28rpx;
  486. color: #3C3C3C;
  487. margin-left: 40rpx;
  488. }
  489. .itemBtn2 {
  490. width: 150rpx;
  491. height: 56rpx;
  492. border-radius: 36rpx;
  493. border: 2rpx solid #FF4F00;
  494. text-align: center;
  495. line-height: 56rpx;
  496. font-size: 28rpx;
  497. color: #FF4F00;
  498. margin-left: 40rpx;
  499. }
  500. .orderState {
  501. color: #F19D01;
  502. font-size: 24rpx;
  503. padding-left: 20rpx;
  504. }
  505. .renBox{
  506. color: #1A1A1A;
  507. background: #F7F7F7;
  508. border-radius: 10rpx;
  509. display: flex;
  510. padding: 20rpx;font-size: 24rpx;
  511. line-height: 30rpx;
  512. margin-top: 16rpx;
  513. }
  514. .renimg{
  515. width: 30rpx;height: 30rpx;
  516. }
  517. .renMobilePhone{
  518. padding-left: 13rpx;
  519. }
  520. .itemaddress{
  521. font-size: 24rpx;display: flex;
  522. color: #3C3C3C;padding-top: 16rpx;
  523. line-height: 33rpx;
  524. }
  525. .addressDD{
  526. width: 10rpx;
  527. height: 10rpx;
  528. background: #FF0000;
  529. border-radius: 50%;
  530. margin-top: 10rpx;
  531. margin-right: 5rpx;
  532. }
  533. .sschahao{
  534. width: 40rpx;
  535. height: 40rpx;
  536. padding-top: 16rpx;
  537. }
  538. .stars{
  539. color: #FF2400;
  540. }
  541. </style>