apply.vue 12 KB

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