apply.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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][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){
  140. uni.showToast({
  141. title: '请输入手机号',
  142. icon: 'none',
  143. duration: 3000
  144. });
  145. return false;
  146. }
  147. if(this.imgListArr.length==0){
  148. uni.showToast({
  149. title: '请上传图片',
  150. icon: 'none',
  151. duration: 3000
  152. });
  153. return false;
  154. }
  155. uni.showLoading({
  156. title: '加载中'
  157. });
  158. this.isload = false;
  159. this.$http('api/online-apply/add', {
  160. customerName:this.customerName,
  161. mobilePhone:this.mobilePhone,
  162. plateNumber:this.plateNumber,
  163. carmodelType:this.carmodelType,
  164. //shopID:this.shopID,
  165. //shopName:this.shopName,
  166. sourceUserID:this.uid,
  167. //sourceName:this.sourceName,
  168. imgs:this.imgListArr.join(','),
  169. }, 'POST').then(res => {
  170. uni.hideLoading();
  171. this.isload = true;
  172. if(res.code==0){
  173. uni.navigateTo({
  174. url:'/pages/wyCar/success'
  175. })
  176. }else{
  177. uni.showToast({
  178. title: '二维码链接已过期,请重新生成二维码',
  179. icon:'none',
  180. duration: 3000,
  181. });
  182. }
  183. })
  184. },
  185. convertToUpperCase(text) {
  186. return text.replace(/[a-z]/g, function(match) {
  187. return String.fromCharCode(match.charCodeAt(0) - 32);
  188. });
  189. },
  190. carmodel(num){
  191. this.carmodelType=num
  192. },
  193. delimg(index){
  194. this.imgListArr.splice(index, 1)
  195. },
  196. previewImage(img){
  197. var arr=[]
  198. arr.push(img)
  199. uni.previewImage({
  200. urls: arr,
  201. longPressActions: {
  202. itemList: ['发送给朋友', '保存图片',],
  203. success: function(data) {},
  204. fail: function(err) {}
  205. }
  206. });
  207. },
  208. upimg(){
  209. var that = this;
  210. uni.chooseImage({
  211. sourceType: ['album','camera'],
  212. count:9,
  213. sizeType:['compressed'],
  214. success: (chooseImageRes) => {
  215. const tempFilePaths = chooseImageRes.tempFilePaths;
  216. //console.log(tempFilePaths)
  217. that.file=tempFilePaths
  218. that.$refs.wCompress.start(that.file, {
  219. pixels: 600000, // 最大分辨率,默认二百万
  220. quality: 0.9, // 压缩质量,默认0.8
  221. type: 'png', // 图片类型,默认jpg
  222. base64: true, // 是否返回base64,默认false,非H5有效
  223. }).then(resxx => {
  224. // console.log(resxx)
  225. resxx.forEach(item=>{
  226. uni.uploadFile({
  227. url: that.$request.baseUrl+'api/online-apply/uploadFile', //仅为示例,非真实的接口地址
  228. filePath: item,
  229. name: 'file',
  230. formData: {
  231. 'user': 'test'
  232. },
  233. success: (uploadFileRes) => {
  234. that.imgListArr=that.imgListArr.concat(JSON.parse(uploadFileRes.data).data)
  235. }
  236. });
  237. })
  238. }).catch(e => {
  239. })
  240. }
  241. });
  242. },
  243. goback(){
  244. //app交互
  245. var standalone = window.navigator.standalone
  246. var userAgent = window.navigator.userAgent.toLowerCase()
  247. var safari = /safari/.test(userAgent)
  248. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  249. var android = /android/.test(userAgent)
  250. if (ios) {
  251. if ( true) {//!standalone&& !safari
  252. window.webkit.messageHandlers.goMyNav.postMessage(null)
  253. }
  254. } else if (android) {
  255. window.android.postMessage()
  256. }
  257. },
  258. }
  259. }
  260. </script>
  261. <style scoped>
  262. .box{
  263. padding: 0 24rpx;
  264. }
  265. .submit{
  266. width: 493rpx;
  267. height: 74rpx;
  268. background: #FF8130;
  269. border-radius: 37rpx;
  270. font-weight: 500;
  271. color: #FFFFFF;
  272. font-size: 30rpx;
  273. line-height: 74rpx;
  274. text-align: center;
  275. margin: 0 auto;
  276. margin-top: 40rpx;
  277. }
  278. .cont{
  279. background: #FFFFFF;border-radius: 10rpx;
  280. padding: 0 20rpx;
  281. }
  282. .cxBox{
  283. display: flex;line-height: 28rpx;
  284. padding-top: 6rpx;
  285. }
  286. .cxBox span{
  287. color: #3C3C3C;padding-left: 8rpx;
  288. }
  289. .cxIcon{
  290. width: 28rpx;
  291. height: 28rpx;
  292. }
  293. .lineImgBOx{
  294. display: flex;
  295. flex-wrap: wrap;
  296. width: 540rpx;
  297. }
  298. .lineimghz{
  299. margin-right: 24rpx;
  300. position: relative;
  301. margin-bottom: 24rpx;
  302. }
  303. .lineimg{
  304. width: 150rpx;
  305. height: 150rpx;
  306. border-radius: 6rpx;
  307. }
  308. .lineimgdel{
  309. width: 37rpx;
  310. height: 37rpx;
  311. position: absolute;
  312. top: -18rpx;
  313. right: -18rpx;
  314. }
  315. .lineRight2{
  316. display: flex;
  317. }
  318. .line{
  319. display: flex;font-size: 28rpx;
  320. color: #666666;padding: 29rpx 0;
  321. border-bottom: 1px solid #EEEEEE;
  322. }
  323. .lineLeft{
  324. width: 130rpx;
  325. }
  326. .lineInput{
  327. font-size: 28rpx; color: #3c3c3c;
  328. }
  329. .top{
  330. color: #666666;font-size: 28rpx;
  331. line-height: 40rpx;padding: 20rpx 44rpx;
  332. }
  333. .content{
  334. min-height: 100vh;
  335. background: #F6F6F6;
  336. }
  337. .zdyNavBox {
  338. width: 100vw;
  339. background: #FFFFFF;
  340. position: fixed;
  341. top: 0;
  342. left: 0;
  343. z-index: 99;
  344. }
  345. .zdyNav {
  346. height: 44px;
  347. display: flex;
  348. justify-content: space-between;
  349. align-items: center;
  350. }
  351. .backImg {
  352. width: 44rpx;
  353. height: 44rpx;
  354. margin-left: 10rpx;
  355. margin-right: 20rpx;
  356. }
  357. .homeImg {
  358. width: 44rpx;
  359. height: 44rpx;
  360. }
  361. .zdyNavLeft {
  362. display: flex;
  363. align-items: center;
  364. }
  365. .zdyNavTitle {
  366. height: 44px;
  367. background: #FFFFFF;
  368. text-align: center;
  369. font-size: 34rpx;
  370. line-height: 44px;
  371. }
  372. .tab {
  373. background: #FFFFFF;
  374. display: flex;
  375. justify-content: space-between;
  376. line-height: 92rpx;
  377. /* position: fixed; */
  378. width: calc(100vw - 100rpx);
  379. padding-left: 50rpx;
  380. padding-right: 50rpx;
  381. height: 92rpx;
  382. z-index: 11;
  383. border-top: 1px solid #EEEEEE;
  384. }
  385. .tabLine {
  386. font-size: 28rpx;
  387. color: #333333;
  388. text-align: center;
  389. }
  390. .tabActive {
  391. color: #FF0000;
  392. font-weight: bold;
  393. border-bottom: 4rpx solid #FF0000;
  394. }
  395. .main {
  396. padding-top: 260rpx;
  397. padding-bottom: 20rpx;
  398. background-color: #F4F5F7;
  399. }
  400. .itemBg {
  401. margin: 20rpx 24rpx;
  402. background-color: #FFFFFF;
  403. border-radius: 10rpx;
  404. padding: 20rpx;
  405. }
  406. .itemTop {
  407. display: flex;
  408. justify-content: space-between;
  409. }
  410. .itemType {
  411. color: #999999;
  412. font-size: 24rpx;
  413. }
  414. .itemSheetState {
  415. font-size: 24rpx;
  416. color: #999999
  417. }
  418. .redColor {
  419. color: #FF0000;
  420. }
  421. .orangeColor {
  422. color: #F19D01;
  423. }
  424. .greenColor {
  425. color: #00A040;
  426. }
  427. .itemShopBg {
  428. display: flex;
  429. justify-content: space-between;
  430. margin-top: 20rpx;
  431. }
  432. .shopName {
  433. color: #333333;
  434. font-size: 30rpx;
  435. font-weight: bold;
  436. /* 隐藏文字显示 ...不换行 */
  437. overflow: hidden;
  438. text-overflow: ellipsis;
  439. white-space: nowrap;
  440. }
  441. .price {
  442. color: #333333;
  443. font-weight: bold;
  444. font-size: 32rpx;
  445. }
  446. .itemName {
  447. color: #666666;
  448. font-size: 24rpx;
  449. padding-top: 16rpx;
  450. height: 30rpx;
  451. overflow: hidden;
  452. text-overflow: ellipsis;
  453. white-space: nowrap;
  454. }
  455. .plateBg {
  456. display: flex;
  457. justify-content: space-between;
  458. align-items: center;
  459. }
  460. .plateNumber {
  461. color: #666666;
  462. font-size: 24rpx;
  463. margin-bottom: 20rpx;
  464. display: flex;
  465. }
  466. .itemLineBottom {
  467. display: flex;
  468. justify-content: flex-end;
  469. }
  470. .itemBtn1 {
  471. width: 150rpx;
  472. height: 56rpx;
  473. border-radius: 36rpx;
  474. border: 2rpx solid #DDDDDD;
  475. text-align: center;
  476. line-height: 56rpx;
  477. font-size: 28rpx;
  478. color: #3C3C3C;
  479. margin-left: 40rpx;
  480. }
  481. .itemBtn2 {
  482. width: 150rpx;
  483. height: 56rpx;
  484. border-radius: 36rpx;
  485. border: 2rpx solid #FF4F00;
  486. text-align: center;
  487. line-height: 56rpx;
  488. font-size: 28rpx;
  489. color: #FF4F00;
  490. margin-left: 40rpx;
  491. }
  492. .orderState {
  493. color: #F19D01;
  494. font-size: 24rpx;
  495. padding-left: 20rpx;
  496. }
  497. .renBox{
  498. color: #1A1A1A;
  499. background: #F7F7F7;
  500. border-radius: 10rpx;
  501. display: flex;
  502. padding: 20rpx;font-size: 24rpx;
  503. line-height: 30rpx;
  504. margin-top: 16rpx;
  505. }
  506. .renimg{
  507. width: 30rpx;height: 30rpx;
  508. }
  509. .renMobilePhone{
  510. padding-left: 13rpx;
  511. }
  512. .itemaddress{
  513. font-size: 24rpx;display: flex;
  514. color: #3C3C3C;padding-top: 16rpx;
  515. line-height: 33rpx;
  516. }
  517. .addressDD{
  518. width: 10rpx;
  519. height: 10rpx;
  520. background: #FF0000;
  521. border-radius: 50%;
  522. margin-top: 10rpx;
  523. margin-right: 5rpx;
  524. }
  525. .sschahao{
  526. width: 40rpx;
  527. height: 40rpx;
  528. padding-top: 16rpx;
  529. }
  530. .stars{
  531. color: #FF2400;
  532. }
  533. </style>