confirmRescue.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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.length!=11){
  195. uni.showToast({
  196. title: '请输入正确的手机号',
  197. icon: 'none',
  198. duration: 3000
  199. });
  200. return false;
  201. }
  202. if(!this.mobilePhone){
  203. uni.showToast({
  204. title: '请输入手机号',
  205. icon: 'none',
  206. duration: 3000
  207. });
  208. return false;
  209. }
  210. this.isGoing=true;
  211. uni.showLoading({
  212. title: '加载中'
  213. });
  214. this.$http('openShopHelpSheetOrder/submitOrder', {
  215. helpType:this.opt.type,
  216. //customerName: this.customerName,
  217. mobilePhone: this.mobilePhone,
  218. //orderItem: this.yuyueData.map(item => item.ID).join(),
  219. shopID: this.opt.shopId,
  220. //plateNumber: this.carInfo ? this.carInfo.plateNumber :'',
  221. // carModel:this.carInfo?.carModel||'',
  222. hEndAddress:this.opt.endAddress,
  223. hStartAddress:this.opt.currentAddress,
  224. orderType:this.opt.orderType,
  225. hTime:this.opt.time,
  226. hscene:this.jykkNum,
  227. startLng:this.opt.lng,
  228. startLat:this.opt.lat,
  229. endLng:this.opt.endLng,
  230. endLat:this.opt.endLat,
  231. },'POST').then(res => {
  232. uni.hideLoading();
  233. var id=res.data
  234. console.log(id)
  235. if(res.code==0){
  236. if(this.userInfo){
  237. uni.showModal({
  238. title: '提示',
  239. content: '救援信息提交成功',
  240. confirmText:'返回首页',
  241. cancelText:'查看订单',
  242. success: function (res) {
  243. this.isGoing=false;
  244. if (res.confirm) {
  245. // console.log('用户点击确定');
  246. uni.switchTab({
  247. url:'index'
  248. })
  249. } else if (res.cancel) {
  250. // uni.hideLoading();
  251. uni.redirectTo({
  252. url:'../subPack/rescueOrderOrderDetail?id='+id
  253. })
  254. }
  255. }
  256. });
  257. }else{
  258. uni.showModal({
  259. title: '提示',
  260. content: '救援信息提交成功',
  261. confirmText:'返回首页',
  262. showCancel:false,
  263. success: function (res) {
  264. this.isGoing=false;
  265. if (res.confirm) {
  266. // console.log('用户点击确定');
  267. uni.switchTab({
  268. url:'index'
  269. })
  270. } else if (res.cancel) {
  271. // uni.hideLoading();
  272. uni.redirectTo({
  273. url:'../subPack/rescueOrderOrderDetail?id='+id
  274. })
  275. }
  276. }
  277. });
  278. }
  279. }else{
  280. this.isGoing=false;
  281. }
  282. })
  283. },
  284. yuyue(){
  285. var that=this;
  286. if(!this.billDate){
  287. uni.showToast({
  288. title: '请选择预约时间',
  289. icon: 'none',
  290. duration: 3000
  291. });
  292. return false;
  293. }
  294. if(!this.isGoing){
  295. return false;
  296. }
  297. this.isGoing=true;
  298. this.$http('openreservation/saveOrderSheet', {
  299. billDate: this.billDate,
  300. comment: this.comment,
  301. carID: this.carInfo.id,
  302. orderItem: this.yuyueData.map(item => item.ID).join(),
  303. shopId: this.yyshopInfo.id,
  304. unionId: this.userInfo.unionId
  305. },'POST').then(res => {
  306. console.log(res)
  307. console.log(res.data)
  308. that.orderId=res.data
  309. this.isGoing=false;
  310. if(res.code==0){
  311. if(this.userInfo){
  312. uni.showModal({
  313. title: '提示',
  314. content: '预约成功',
  315. confirmText:'返回首页',
  316. success: function (res) {
  317. if (res.confirm) {
  318. // console.log('用户点击确定');
  319. uni.switchTab({
  320. url:'index'
  321. })
  322. } else if (res.cancel) {
  323. // console.log('用户点击取消');
  324. // uni.reLaunch({
  325. // url:'../user/bespeakDetail?id='+id
  326. // })
  327. uni.redirectTo({
  328. url:'../subPack/rescueOrderOrderDetail?id='+that.orderId
  329. })
  330. }
  331. }
  332. });
  333. }else{
  334. uni.showModal({
  335. title: '提示',
  336. content: '预约成功',
  337. confirmText:'返回首页',
  338. showCancel:false,
  339. success: function (res) {
  340. if (res.confirm) {
  341. // console.log('用户点击确定');
  342. uni.switchTab({
  343. url:'index'
  344. })
  345. } else if (res.cancel) {
  346. // console.log('用户点击取消');
  347. // uni.reLaunch({
  348. // url:'../user/bespeakDetail?id='+id
  349. // })
  350. uni.redirectTo({
  351. url:'../subPack/rescueOrderOrderDetail?id='+that.orderId
  352. })
  353. }
  354. }
  355. });
  356. }
  357. }else{
  358. uni.showToast({
  359. title: res.msg,
  360. icon: 'none',
  361. duration: 3000
  362. });
  363. }
  364. })
  365. },
  366. changeTime(data){
  367. console.log(data)
  368. this.billDate=data
  369. },
  370. cktime(){
  371. this.$refs.timeSelect.open();
  372. },
  373. //计算距离
  374. calculateDistance(){
  375. //调用距离计算接口
  376. var that=this;
  377. const tMap = new QQMapWX({
  378. key: 'L2GBZ-CIS6J-HRFFV-K5LO6-QROT7-BQFXZ' //开发者密钥 //这里要换成自己的key
  379. });
  380. tMap.calculateDistance({
  381. mode: 'driving',//可选值:'driving'(驾车)、'walking'(步行),不填默认:'walking',可不填
  382. //from参数不填默认当前地址
  383. //获取表单提交的经纬度并设置from和to参数(示例为string格式)
  384. from: {
  385. latitude: that.opt.lat,
  386. longitude: that.opt.lng,
  387. }, //若起点有数据则采用起点坐标,若为空默认当前地址
  388. to:[
  389. {
  390. latitude: that.opt.endLat,
  391. longitude: that.opt.endLng
  392. }
  393. ] , //终点坐标
  394. success: function(res) {//成功后的回调
  395. console.log(res);
  396. that.distance=res.result.elements[0].distance/1000;
  397. //that.distance=that.distance.tofixed(2)
  398. },
  399. });
  400. },
  401. }
  402. }
  403. </script>
  404. <style scoped lang="less">
  405. .topTis{
  406. font-weight: 400;
  407. color: #FFFFFF;
  408. font-size: 26rpx;
  409. text-align: center;
  410. padding-top: 24rpx;
  411. }
  412. .tcBox{
  413. width: 702rpx;
  414. margin-top: 20rpx;
  415. margin-left: 24rpx;
  416. background: #FFFFFF;
  417. border-radius: 10rpx;
  418. display: flex;
  419. }
  420. .heji{
  421. font-weight: 500;
  422. color: #666666;
  423. padding-left: 30rpx;
  424. line-height: 120rpx;
  425. }
  426. .rightJt{
  427. width: 30rpx;
  428. height: 30rpx;
  429. margin-top: 4rpx;
  430. }
  431. .kklineRight3{
  432. display: flex;
  433. color: #3c3c3c;
  434. font-size: 28rpx;
  435. }
  436. .kklineRight2{
  437. display: flex;
  438. }
  439. .jyKK{
  440. width: 108rpx;
  441. height: 56rpx;
  442. border-radius: 6rpx;
  443. border: 2rpx solid #CCCCCC;
  444. color: #666666;
  445. font-size: 24rpx;
  446. text-align: center;
  447. line-height: 56rpx;
  448. margin-left: 20rpx;
  449. }
  450. .jyKKActive{
  451. background: #FF0000;
  452. border: none;
  453. height: 60rpx;
  454. color: #FFFFFF;
  455. }
  456. .kklineLeft2{
  457. line-height: 60rpx;
  458. }
  459. .contBox{
  460. width: 662rpx;
  461. margin-top: 20rpx;
  462. margin-left: 24rpx;
  463. background: #FFFFFF;
  464. border-radius: 10rpx;
  465. padding: 0 20rpx;
  466. }
  467. .stars{
  468. color: #FF2400;
  469. }
  470. .tcLeft{
  471. width: 524rpx;padding-left: 20rpx;
  472. }
  473. .tcStartTxt2{
  474. width: 550rpx;
  475. }
  476. .tcLeft2{
  477. padding-left: 13rpx;
  478. }
  479. .tcStart{
  480. border-bottom: 1px solid #EEEEEE;
  481. display: flex;
  482. padding: 29rpx 0;
  483. font-size: 28rpx;
  484. color: #333333;
  485. line-height: 40rpx;
  486. }
  487. .tcEnd{
  488. display: flex;
  489. padding: 29rpx 0;
  490. font-size: 28rpx;
  491. color: #333333;
  492. line-height: 40rpx;
  493. }
  494. .tcStartYq{
  495. width: 14rpx;
  496. height: 14rpx;
  497. background: #3F90F7;
  498. margin-top: 13rpx;
  499. border-radius: 50%;
  500. }
  501. .tcStartTxt{
  502. width: 396rpx;
  503. }
  504. .tcEndYq{
  505. width: 14rpx;
  506. height: 14rpx;
  507. background: #FF0000;
  508. margin-top: 13rpx;
  509. border-radius: 50%;
  510. }
  511. .tcStartTitle{
  512. color: #666666;
  513. padding: 0 30rpx 0 20rpx;
  514. }
  515. .tcRight{
  516. color: #FF0000;
  517. line-height: 33rpx;
  518. font-size: 24rpx;
  519. padding-top: 30rpx;
  520. padding-left: 10rpx;
  521. display: flex;
  522. align-items: center;
  523. }
  524. .kkline{
  525. display: flex;
  526. padding: 30rpx 0;
  527. border-bottom: 1px solid #EEEEEE;
  528. color: #666666;
  529. font-size: 28rpx;
  530. justify-content: space-between;
  531. }
  532. .kkline2{
  533. display: flex;
  534. justify-content: space-between;
  535. padding: 30rpx 0;
  536. border-bottom: 1px solid #EEEEEE;
  537. color: #666666;
  538. font-size: 28rpx;
  539. }
  540. .kklineRight{
  541. color: #3c3c3c;
  542. font-size: 28rpx;
  543. width: 450rpx;
  544. text-align: right;
  545. }
  546. .kklineLeft {
  547. width: 200rpx;
  548. }
  549. .box{
  550. background: #F4F5F7;
  551. min-height: 100vh;
  552. }
  553. .topTime{
  554. width: 702rpx;
  555. margin-left: 24rpx;
  556. background: #FFFFFF;
  557. border-radius: 10rpx;
  558. display: flex;
  559. justify-content: center;
  560. padding: 37rpx 0;
  561. margin-top: -70rpx;
  562. }
  563. .topTimeImg{
  564. width: 36rpx;
  565. height: 36rpx;
  566. }
  567. .topTimeNum{
  568. font-weight: 500;
  569. font-size: 32rpx;
  570. line-height: 36rpx;
  571. color: #333333;
  572. padding-left: 18rpx;
  573. }
  574. .top-box{
  575. width: 750rpx;
  576. height: 164rpx;
  577. background: #FF0000;
  578. border-radius: 0 0 10% 10%;
  579. }
  580. .bottom-container{
  581. width: 750rpx;
  582. height: 120rpx;
  583. background: #FFFFFF;
  584. box-shadow: 0px -2px 10px 0px rgba(153,153,153,0.1000);
  585. position: fixed;
  586. left: 0;
  587. bottom: 0;
  588. display: flex;
  589. justify-content: space-between;
  590. }
  591. .newyyBotbutton{
  592. width: 204rpx;
  593. height: 74rpx;
  594. background: #D53533;
  595. border-radius: 37rpx;
  596. font-weight: 500;
  597. color: #FFFFFF;
  598. line-height: 74rpx;
  599. text-align: center;
  600. margin-right: 30rpx;
  601. margin-top: 23rpx;
  602. }
  603. .bottom-container-price{
  604. color: #FF0000;
  605. padding-top: 30rpx;
  606. padding-left: 30rpx;
  607. font-size: 32rpx;
  608. }
  609. .qianhaospan{
  610. font-size: 22rpx;
  611. }
  612. .ckj{
  613. color: #999999;font-size: 24rpx;
  614. padding-left: 30rpx;
  615. }
  616. </style>