confirmRescue.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. <template>
  2. <view class="box">
  3. <view class="top-box" :style="{background:'#'+themeColor}">
  4. <view class="topTis"><!-- 需提前2小时取消订单,不足2小时需联系门 --></view>
  5. </view>
  6. <view class="topTime">
  7. <img src="../../static/timg/icon_shijian.png" alt="" class="topTimeImg">
  8. <view class="topTimeNum">{{opt.time}}</view>
  9. </view>
  10. <!-- 救援拖车框 -->
  11. <view class="tcBox" v-if="opt.type==2">
  12. <view class="tcLeft">
  13. <view class="tcStart">
  14. <view class="tcStartYq"></view>
  15. <view class="tcStartTitle">起点</view>
  16. <view class="tcStartTxt">{{opt.currentAddress}}</view>
  17. </view>
  18. <view class="tcEnd">
  19. <view class="tcEndYq"></view>
  20. <view class="tcStartTitle">终点</view>
  21. <view class="tcStartTxt">{{opt.endAddress}}</view>
  22. </view>
  23. </view>
  24. <view class="tcRight">约{{distance}}km</view>
  25. </view>
  26. <view class="tcBox" v-else>
  27. <view class="tcLeft2">
  28. <view class="tcStart">
  29. <view class="tcStartYq"></view>
  30. <view class="tcStartTitle">位置</view>
  31. <view class="tcStartTxt2">{{opt.currentAddress}}</view>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- 救援拖车框 -->
  36. <view class="contBox">
  37. <view class="kkline">
  38. <view class="kklineLeft">
  39. <span>服务门店</span>
  40. </view>
  41. <view class="kklineRight">{{shopName}}</view>
  42. </view>
  43. <view class="kkline">
  44. <view class="kklineLeft">
  45. <span>救援项目</span>
  46. </view>
  47. <view class="kklineRight" v-if="opt.type==1">搭电</view>
  48. <view class="kklineRight" v-if="opt.type==2">拖车</view>
  49. <view class="kklineRight" v-if="opt.type==3">换胎</view>
  50. <view class="kklineRight" v-if="opt.type==4">未知原因</view>
  51. </view>
  52. <view class="kkline">
  53. <view class="kklineLeft2">
  54. <span class="stars">*</span> <span>救援场景</span>
  55. </view>
  56. <view class="kklineRight2">
  57. <view class="jyKK " :class="{jyKKActive:jykkNum==1}" @click="jykk(1)">地面</view>
  58. <view class="jyKK" :class="{jyKKActive:jykkNum==2}" @click="jykk(2)">车库</view>
  59. <view class="jyKK" :class="{jyKKActive:jykkNum==3}" @click="jykk(3)">其他</view>
  60. </view>
  61. </view>
  62. <!-- <view class="kkline" >
  63. <view class="kklineLeft">
  64. <span class="stars">*</span> <span>车牌号</span>
  65. </view>
  66. <view class="kklineRight3" @click="goCarlist">
  67. <span>{{carInfo.plateNumber?carInfo.plateNumber:'请选择'}}</span>
  68. <img src="../../static/img/big_rightArrow.png" alt="" class="rightJt">
  69. </view>
  70. </view>
  71. <view class="kkline" >
  72. <view class="kklineLeft">
  73. <span class="stars">*</span> <span>车型</span>
  74. </view>
  75. <view class="kklineRight3" @click="goCarlist">
  76. <span>{{carInfo.carModel?carInfo.carModel:'请选择'}}</span>
  77. <img src="../../static/img/big_rightArrow.png" alt="" class="rightJt">
  78. </view>
  79. </view>
  80. <view class="kkline" >
  81. <view class="kklineLeft">
  82. <span class="stars">*</span><span>救援联系人</span>
  83. </view>
  84. <view class="kklineRight">
  85. <input type="text" placeholder="请输入" v-model="customerName">
  86. </view>
  87. </view> -->
  88. <view class="kkline">
  89. <view class="kklineLeft">
  90. <span class="stars">*</span><span>联系人手机号</span>
  91. </view>
  92. <view class="kklineRight"><input type="text" placeholder="请输入" v-model="mobilePhone"></view>
  93. </view>
  94. </view>
  95. <view style="height: 120rpx;"></view>
  96. <view class="bottom-container">
  97. <view class="heji">
  98. <!-- <span>合计</span> <span style="font-size: 22rpx;color: #FF0000;">¥</span> <span style="font-size: 32rpx;color: #FF0000;" >759</span> -->
  99. </view>
  100. <view class="newyyBotbutton" :style="{background:'#'+themeColor}" @click="submitOrder">提交订单</view>
  101. <!-- yuyue 老预约-->
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import QQMapWX from '@/utils/qqmap-wx-jssdk.js'
  107. export default {
  108. components: {
  109. },
  110. data() {
  111. return {
  112. comment:'',
  113. totalPrice:99,
  114. userInfo:'',
  115. timedata:'',
  116. billDate:'',
  117. yuyueData:'',
  118. carInfo:'',
  119. yyshopInfo:'',
  120. themeColor:'',
  121. shopName:'',
  122. opt:'',
  123. distance:'',
  124. jykkNum:1,
  125. customerName:'',
  126. mobilePhone:'',
  127. isGoing:false,
  128. orderId:'',
  129. ext:'',
  130. }
  131. },
  132. onLoad(opt) {
  133. this.themeColor = uni.getStorageSync("themeColor");
  134. //this.userInfo = uni.getStorageSync("userInfo");
  135. this.ext=this.$common.getExtStoreId();
  136. this.shopName=opt.shopName;
  137. this.opt=opt;
  138. if(this.opt.type==2){
  139. this.calculateDistance()
  140. }
  141. this.userInfo = this.$store.state.userInfo;
  142. console.log("this.userInfo")
  143. console.log(this.userInfo)
  144. if(this.userInfo){
  145. //var customerInfo=uni.getStorageSync("wxOpenData").loginInfo.customerInfo;
  146. var customerInfo=this.$store.state.wxOpenData.loginInfo.customerInfo
  147. this.customerName=customerInfo.customerName;
  148. this.mobilePhone=customerInfo.mobilePhone;
  149. }
  150. },
  151. onShow() {
  152. this.carInfo=this.$store.state.carInfo;
  153. console.log(this.carInfo)
  154. },
  155. methods: {
  156. jykk(num){
  157. this.jykkNum=num;
  158. },
  159. goCarlist(){
  160. uni.navigateTo({
  161. url:'../user/addCar/cailist'
  162. })
  163. },
  164. submitOrder(){
  165. if(this.isGoing){
  166. return false;
  167. }
  168. /* if(!this.carInfo.carModel){
  169. uni.showToast({
  170. title: '请输选择车型',
  171. icon: 'none',
  172. duration: 3000
  173. });
  174. return false;
  175. } */
  176. /* if(!this.customerName){
  177. uni.showToast({
  178. title: '请输入救援联系人',
  179. icon: 'none',
  180. duration: 3000
  181. });
  182. return false;
  183. } */
  184. var reg = /^1[3|4|5|7|8][0-9]\d{8}$/;
  185. if(reg.test(this.mobilePhone) == false ){
  186. console.log("手机号码格式不正确");
  187. uni.showToast({
  188. title: '请输入正确的手机号',
  189. icon: 'none',
  190. duration: 3000
  191. });
  192. return false;
  193. }
  194. if(!this.mobilePhone){
  195. uni.showToast({
  196. title: '请输入手机号',
  197. icon: 'none',
  198. duration: 3000
  199. });
  200. return false;
  201. }
  202. this.isGoing=true;
  203. uni.showLoading({
  204. title: '加载中'
  205. });
  206. this.$http('openShopHelpSheetOrder/submitOrder', {
  207. helpType:this.opt.type,
  208. //customerName: this.customerName,
  209. mobilePhone: this.mobilePhone,
  210. //orderItem: this.yuyueData.map(item => item.ID).join(),
  211. shopID: this.opt.shopId,
  212. //plateNumber: this.carInfo ? this.carInfo.plateNumber :'',
  213. // carModel:this.carInfo?.carModel||'',
  214. hEndAddress:this.opt.endAddress,
  215. hStartAddress:this.opt.currentAddress,
  216. orderType:this.opt.orderType,
  217. hTime:this.opt.time,
  218. hscene:this.jykkNum,
  219. startLng:this.opt.lng,
  220. startLat:this.opt.lat,
  221. endLng:this.opt.endLng,
  222. endLat:this.opt.endLat,
  223. },'POST').then(res => {
  224. uni.hideLoading();
  225. var id=res.data
  226. console.log(id)
  227. if(res.code==0){
  228. if(this.userInfo){
  229. uni.showModal({
  230. title: '提示',
  231. content: '救援信息提交成功',
  232. confirmText:'返回首页',
  233. cancelText:'查看订单',
  234. success: function (res) {
  235. this.isGoing=false;
  236. if (res.confirm) {
  237. // console.log('用户点击确定');
  238. uni.switchTab({
  239. url:'index'
  240. })
  241. } else if (res.cancel) {
  242. // uni.hideLoading();
  243. uni.redirectTo({
  244. url:'../subPack/rescueOrderOrderDetail?id='+id
  245. })
  246. }
  247. }
  248. });
  249. }else{
  250. uni.showModal({
  251. title: '提示',
  252. content: '救援信息提交成功',
  253. confirmText:'返回首页',
  254. showCancel:false,
  255. success: function (res) {
  256. this.isGoing=false;
  257. if (res.confirm) {
  258. // console.log('用户点击确定');
  259. uni.switchTab({
  260. url:'index'
  261. })
  262. } else if (res.cancel) {
  263. // uni.hideLoading();
  264. uni.redirectTo({
  265. url:'../subPack/rescueOrderOrderDetail?id='+id
  266. })
  267. }
  268. }
  269. });
  270. }
  271. }else{
  272. this.isGoing=false;
  273. }
  274. })
  275. },
  276. yuyue(){
  277. var that=this;
  278. if(!this.billDate){
  279. uni.showToast({
  280. title: '请选择预约时间',
  281. icon: 'none',
  282. duration: 3000
  283. });
  284. return false;
  285. }
  286. if(!this.isGoing){
  287. return false;
  288. }
  289. this.isGoing=true;
  290. this.$http('openreservation/saveOrderSheet', {
  291. billDate: this.billDate,
  292. comment: this.comment,
  293. carID: this.carInfo.id,
  294. orderItem: this.yuyueData.map(item => item.ID).join(),
  295. shopId: this.yyshopInfo.id,
  296. unionId: this.userInfo.unionId
  297. },'POST').then(res => {
  298. console.log(res)
  299. console.log(res.data)
  300. that.orderId=res.data
  301. this.isGoing=false;
  302. if(res.code==0){
  303. if(this.userInfo){
  304. uni.showModal({
  305. title: '提示',
  306. content: '预约成功',
  307. confirmText:'返回首页',
  308. success: function (res) {
  309. if (res.confirm) {
  310. // console.log('用户点击确定');
  311. uni.switchTab({
  312. url:'index'
  313. })
  314. } else if (res.cancel) {
  315. // console.log('用户点击取消');
  316. // uni.reLaunch({
  317. // url:'../user/bespeakDetail?id='+id
  318. // })
  319. uni.redirectTo({
  320. url:'../subPack/rescueOrderOrderDetail?id='+that.orderId
  321. })
  322. }
  323. }
  324. });
  325. }else{
  326. uni.showModal({
  327. title: '提示',
  328. content: '预约成功',
  329. confirmText:'返回首页',
  330. showCancel:false,
  331. success: function (res) {
  332. if (res.confirm) {
  333. // console.log('用户点击确定');
  334. uni.switchTab({
  335. url:'index'
  336. })
  337. } else if (res.cancel) {
  338. // console.log('用户点击取消');
  339. // uni.reLaunch({
  340. // url:'../user/bespeakDetail?id='+id
  341. // })
  342. uni.redirectTo({
  343. url:'../subPack/rescueOrderOrderDetail?id='+that.orderId
  344. })
  345. }
  346. }
  347. });
  348. }
  349. }else{
  350. uni.showToast({
  351. title: res.msg,
  352. icon: 'none',
  353. duration: 3000
  354. });
  355. }
  356. })
  357. },
  358. changeTime(data){
  359. console.log(data)
  360. this.billDate=data
  361. },
  362. cktime(){
  363. this.$refs.timeSelect.open();
  364. },
  365. //计算距离
  366. calculateDistance(){
  367. //调用距离计算接口
  368. var that=this;
  369. const tMap = new QQMapWX({
  370. key: 'L2GBZ-CIS6J-HRFFV-K5LO6-QROT7-BQFXZ' //开发者密钥 //这里要换成自己的key
  371. });
  372. tMap.calculateDistance({
  373. mode: 'driving',//可选值:'driving'(驾车)、'walking'(步行),不填默认:'walking',可不填
  374. //from参数不填默认当前地址
  375. //获取表单提交的经纬度并设置from和to参数(示例为string格式)
  376. from: {
  377. latitude: that.opt.lat,
  378. longitude: that.opt.lng,
  379. }, //若起点有数据则采用起点坐标,若为空默认当前地址
  380. to:[
  381. {
  382. latitude: that.opt.endLat,
  383. longitude: that.opt.endLng
  384. }
  385. ] , //终点坐标
  386. success: function(res) {//成功后的回调
  387. console.log(res);
  388. that.distance=res.result.elements[0].distance/1000;
  389. //that.distance=that.distance.tofixed(2)
  390. },
  391. });
  392. },
  393. }
  394. }
  395. </script>
  396. <style scoped lang="less">
  397. .topTis{
  398. font-weight: 400;
  399. color: #FFFFFF;
  400. font-size: 26rpx;
  401. text-align: center;
  402. padding-top: 24rpx;
  403. }
  404. .tcBox{
  405. width: 702rpx;
  406. margin-top: 20rpx;
  407. margin-left: 24rpx;
  408. background: #FFFFFF;
  409. border-radius: 10rpx;
  410. display: flex;
  411. }
  412. .heji{
  413. font-weight: 500;
  414. color: #666666;
  415. padding-left: 30rpx;
  416. line-height: 120rpx;
  417. }
  418. .rightJt{
  419. width: 30rpx;
  420. height: 30rpx;
  421. margin-top: 4rpx;
  422. }
  423. .kklineRight3{
  424. display: flex;
  425. color: #3c3c3c;
  426. font-size: 28rpx;
  427. }
  428. .kklineRight2{
  429. display: flex;
  430. }
  431. .jyKK{
  432. width: 108rpx;
  433. height: 56rpx;
  434. border-radius: 6rpx;
  435. border: 2rpx solid #CCCCCC;
  436. color: #666666;
  437. font-size: 24rpx;
  438. text-align: center;
  439. line-height: 56rpx;
  440. margin-left: 20rpx;
  441. }
  442. .jyKKActive{
  443. background: #FF0000;
  444. border: none;
  445. height: 60rpx;
  446. color: #FFFFFF;
  447. }
  448. .kklineLeft2{
  449. line-height: 60rpx;
  450. }
  451. .contBox{
  452. width: 662rpx;
  453. margin-top: 20rpx;
  454. margin-left: 24rpx;
  455. background: #FFFFFF;
  456. border-radius: 10rpx;
  457. padding: 0 20rpx;
  458. }
  459. .stars{
  460. color: #FF2400;
  461. }
  462. .tcLeft{
  463. width: 524rpx;padding-left: 20rpx;
  464. }
  465. .tcStartTxt2{
  466. width: 550rpx;
  467. }
  468. .tcLeft2{
  469. padding-left: 13rpx;
  470. }
  471. .tcStart{
  472. border-bottom: 1px solid #EEEEEE;
  473. display: flex;
  474. padding: 29rpx 0;
  475. font-size: 28rpx;
  476. color: #333333;
  477. line-height: 40rpx;
  478. }
  479. .tcEnd{
  480. display: flex;
  481. padding: 29rpx 0;
  482. font-size: 28rpx;
  483. color: #333333;
  484. line-height: 40rpx;
  485. }
  486. .tcStartYq{
  487. width: 14rpx;
  488. height: 14rpx;
  489. background: #3F90F7;
  490. margin-top: 13rpx;
  491. border-radius: 50%;
  492. }
  493. .tcStartTxt{
  494. width: 396rpx;
  495. }
  496. .tcEndYq{
  497. width: 14rpx;
  498. height: 14rpx;
  499. background: #FF0000;
  500. margin-top: 13rpx;
  501. border-radius: 50%;
  502. }
  503. .tcStartTitle{
  504. color: #666666;
  505. padding: 0 30rpx 0 20rpx;
  506. }
  507. .tcRight{
  508. color: #FF0000;
  509. line-height: 33rpx;
  510. font-size: 24rpx;
  511. padding-top: 30rpx;
  512. padding-left: 10rpx;
  513. display: flex;
  514. align-items: center;
  515. }
  516. .kkline{
  517. display: flex;
  518. padding: 30rpx 0;
  519. border-bottom: 1px solid #EEEEEE;
  520. color: #666666;
  521. font-size: 28rpx;
  522. justify-content: space-between;
  523. }
  524. .kkline2{
  525. display: flex;
  526. justify-content: space-between;
  527. padding: 30rpx 0;
  528. border-bottom: 1px solid #EEEEEE;
  529. color: #666666;
  530. font-size: 28rpx;
  531. }
  532. .kklineRight{
  533. color: #3c3c3c;
  534. font-size: 28rpx;
  535. width: 450rpx;
  536. text-align: right;
  537. }
  538. .kklineLeft {
  539. width: 200rpx;
  540. }
  541. .box{
  542. background: #F4F5F7;
  543. min-height: 100vh;
  544. }
  545. .topTime{
  546. width: 702rpx;
  547. margin-left: 24rpx;
  548. background: #FFFFFF;
  549. border-radius: 10rpx;
  550. display: flex;
  551. justify-content: center;
  552. padding: 37rpx 0;
  553. margin-top: -70rpx;
  554. }
  555. .topTimeImg{
  556. width: 36rpx;
  557. height: 36rpx;
  558. }
  559. .topTimeNum{
  560. font-weight: 500;
  561. font-size: 32rpx;
  562. line-height: 36rpx;
  563. color: #333333;
  564. padding-left: 18rpx;
  565. }
  566. .top-box{
  567. width: 750rpx;
  568. height: 164rpx;
  569. background: #FF0000;
  570. border-radius: 0 0 10% 10%;
  571. }
  572. .bottom-container{
  573. width: 750rpx;
  574. height: 120rpx;
  575. background: #FFFFFF;
  576. box-shadow: 0px -2px 10px 0px rgba(153,153,153,0.1000);
  577. position: fixed;
  578. left: 0;
  579. bottom: 0;
  580. display: flex;
  581. justify-content: space-between;
  582. }
  583. .newyyBotbutton{
  584. width: 204rpx;
  585. height: 74rpx;
  586. background: #D53533;
  587. border-radius: 37rpx;
  588. font-weight: 500;
  589. color: #FFFFFF;
  590. line-height: 74rpx;
  591. text-align: center;
  592. margin-right: 30rpx;
  593. margin-top: 23rpx;
  594. }
  595. .bottom-container-price{
  596. color: #FF0000;
  597. padding-top: 30rpx;
  598. padding-left: 30rpx;
  599. font-size: 32rpx;
  600. }
  601. .qianhaospan{
  602. font-size: 22rpx;
  603. }
  604. .ckj{
  605. color: #999999;font-size: 24rpx;
  606. padding-left: 30rpx;
  607. }
  608. </style>