confirmRescue.vue 14 KB

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