confirmRescue.vue 12 KB

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