confirmRescue.vue 13 KB

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