confirmRescue.vue 14 KB

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