confirmRescue.vue 13 KB

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