confirmRescue.vue 13 KB

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