confirmRescue.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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>
  51. <view class="kkline">
  52. <view class="kklineLeft2">
  53. <span class="stars">*</span> <span>救援场景</span>
  54. </view>
  55. <view class="kklineRight2">
  56. <view class="jyKK " :class="{jyKKActive:jykkNum==1}" @click="jykk(1)">地面</view>
  57. <view class="jyKK" :class="{jyKKActive:jykkNum==2}" @click="jykk(2)">车库</view>
  58. <view class="jyKK" :class="{jyKKActive:jykkNum==3}" @click="jykk(3)">其他</view>
  59. </view>
  60. </view>
  61. <view class="kkline">
  62. <view class="kklineLeft">
  63. <span class="stars">*</span> <span>车牌号</span>
  64. </view>
  65. <view class="kklineRight3" @click="goCarlist">
  66. <span>{{carInfo.plateNumber?carInfo.plateNumber:'请选择'}}</span>
  67. <img src="../../static/img/big_rightArrow.png" alt="" class="rightJt">
  68. </view>
  69. </view>
  70. <view class="kkline">
  71. <view class="kklineLeft">
  72. <span class="stars">*</span> <span>车型</span>
  73. </view>
  74. <view class="kklineRight3" @click="goCarlist">
  75. <span>{{carInfo.plateNumber?carInfo.plateNumber:'请选择'}}</span>
  76. <img src="../../static/img/big_rightArrow.png" alt="" class="rightJt">
  77. </view>
  78. </view>
  79. <view class="kkline">
  80. <view class="kklineLeft">
  81. <span class="stars">*</span><span>救援联系人</span>
  82. </view>
  83. <view class="kklineRight">
  84. <input type="text" placeholder="请输入">
  85. </view>
  86. </view>
  87. <view class="kkline">
  88. <view class="kklineLeft">
  89. <span class="stars">*</span><span>手机号</span>
  90. </view>
  91. <view class="kklineRight"><input type="text" placeholder="请输入"></view>
  92. </view>
  93. </view>
  94. <view style="height: 120rpx;"></view>
  95. <view class="bottom-container">
  96. <view class="heji">
  97. <span>合计</span> <span style="font-size: 22rpx;color: #FF0000;">¥</span> <span style="font-size: 32rpx;color: #FF0000;" >759</span>
  98. </view>
  99. <view class="newyyBotbutton" :style="{background:'#'+themeColor}" @click="yuyue">提交订单</view>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import QQMapWX from '@/utils/qqmap-wx-jssdk.js'
  105. export default {
  106. components: {
  107. },
  108. data() {
  109. return {
  110. comment:'',
  111. totalPrice:99,
  112. userInfo:'',
  113. timedata:'',
  114. billDate:'',
  115. yuyueData:'',
  116. carInfo:'',
  117. yyshopInfo:'',
  118. themeColor:'',
  119. shopName:'',
  120. opt:'',
  121. distance:'',
  122. jykkNum:1,
  123. }
  124. },
  125. onLoad(opt) {
  126. this.themeColor = uni.getStorageSync("themeColor");
  127. this.userInfo = uni.getStorageSync("userInfo");
  128. this.shopName=opt.shopName;
  129. this.opt=opt;
  130. if(this.opt.type==2){
  131. this.calculateDistance()
  132. }
  133. console.log(opt)
  134. },
  135. onShow() {
  136. this.carInfo=this.$store.state.carInfo;
  137. },
  138. methods: {
  139. jykk(num){
  140. this.jykkNum=num;
  141. },
  142. goCarlist(){
  143. uni.navigateTo({
  144. url:'../user/addCar/cailist'
  145. })
  146. },
  147. yuyue(){
  148. if(!this.billDate){
  149. uni.showToast({
  150. title: '请选择预约时间',
  151. icon: 'none',
  152. duration: 3000
  153. });
  154. return false;
  155. }
  156. this.$http('openreservation/saveOrderSheet', {
  157. billDate: this.billDate,
  158. comment: this.comment,
  159. carID: this.carInfo.id,
  160. orderItem: this.yuyueData.map(item => item.ID).join(),
  161. shopId: this.yyshopInfo.id,
  162. unionId: this.userInfo.unionId
  163. },'POST').then(res => {
  164. var id=res.data
  165. if(res.code==0){
  166. uni.showModal({
  167. title: '提示',
  168. content: '预约成功',
  169. confirmText:'返回首页',
  170. cancelText:'查看订单',
  171. success: function (res) {
  172. if (res.confirm) {
  173. // console.log('用户点击确定');
  174. uni.switchTab({
  175. url:'index'
  176. })
  177. } else if (res.cancel) {
  178. // console.log('用户点击取消');
  179. // uni.reLaunch({
  180. // url:'../user/bespeakDetail?id='+id
  181. // })
  182. uni.redirectTo({
  183. url:'../user/bespeakDetail?id='+id
  184. })
  185. }
  186. }
  187. });
  188. }else{
  189. uni.showToast({
  190. title: res.msg,
  191. icon: 'none',
  192. duration: 3000
  193. });
  194. }
  195. })
  196. },
  197. changeTime(data){
  198. console.log(data)
  199. this.billDate=data
  200. },
  201. cktime(){
  202. this.$refs.timeSelect.open();
  203. },
  204. //计算距离
  205. calculateDistance(){
  206. //调用距离计算接口
  207. var that=this;
  208. const tMap = new QQMapWX({
  209. key: 'L2GBZ-CIS6J-HRFFV-K5LO6-QROT7-BQFXZ' //开发者密钥 //这里要换成自己的key
  210. });
  211. tMap.calculateDistance({
  212. mode: 'driving',//可选值:'driving'(驾车)、'walking'(步行),不填默认:'walking',可不填
  213. //from参数不填默认当前地址
  214. //获取表单提交的经纬度并设置from和to参数(示例为string格式)
  215. from: {
  216. latitude: that.opt.lat,
  217. longitude: that.opt.lng,
  218. }, //若起点有数据则采用起点坐标,若为空默认当前地址
  219. to:[
  220. {
  221. latitude: that.opt.endLat,
  222. longitude: that.opt.endLng
  223. }
  224. ] , //终点坐标
  225. success: function(res) {//成功后的回调
  226. console.log(res);
  227. that.distance=res.result.elements[0].distance/1000; //that.distance=that.distance.tofixed(2)
  228. },
  229. });
  230. },
  231. }
  232. }
  233. </script>
  234. <style scoped lang="less">
  235. .topTis{
  236. font-weight: 400;
  237. color: #FFFFFF;
  238. font-size: 26rpx;
  239. text-align: center;
  240. padding-top: 24rpx;
  241. }
  242. .tcBox{
  243. width: 702rpx;
  244. margin-top: 20rpx;
  245. margin-left: 24rpx;
  246. background: #FFFFFF;
  247. border-radius: 10rpx;
  248. display: flex;
  249. }
  250. .heji{
  251. font-weight: 500;
  252. color: #666666;
  253. padding-left: 30rpx;
  254. line-height: 120rpx;
  255. }
  256. .rightJt{
  257. width: 30rpx;
  258. height: 30rpx;
  259. margin-top: 4rpx;
  260. }
  261. .kklineRight3{
  262. display: flex;
  263. color: #3c3c3c;
  264. font-size: 28rpx;
  265. }
  266. .kklineRight2{
  267. display: flex;
  268. }
  269. .jyKK{
  270. width: 108rpx;
  271. height: 56rpx;
  272. border-radius: 6rpx;
  273. border: 2rpx solid #CCCCCC;
  274. color: #666666;
  275. font-size: 24rpx;
  276. text-align: center;
  277. line-height: 56rpx;
  278. margin-left: 20rpx;
  279. }
  280. .jyKKActive{
  281. background: #FF0000;
  282. border: none;
  283. height: 60rpx;
  284. color: #FFFFFF;
  285. }
  286. .kklineLeft2{
  287. line-height: 60rpx;
  288. }
  289. .contBox{
  290. width: 662rpx;
  291. margin-top: 20rpx;
  292. margin-left: 24rpx;
  293. background: #FFFFFF;
  294. border-radius: 10rpx;
  295. padding: 0 20rpx;
  296. }
  297. .stars{
  298. color: #FF2400;
  299. }
  300. .tcLeft{
  301. width: 524rpx;padding-left: 20rpx;
  302. }
  303. .tcStartTxt2{
  304. width: 550rpx;
  305. }
  306. .tcLeft2{
  307. padding-left: 13rpx;
  308. }
  309. .tcStart{
  310. border-bottom: 1px solid #EEEEEE;
  311. display: flex;
  312. padding: 29rpx 0;
  313. font-size: 28rpx;
  314. color: #333333;
  315. line-height: 40rpx;
  316. }
  317. .tcEnd{
  318. display: flex;
  319. padding: 29rpx 0;
  320. font-size: 28rpx;
  321. color: #333333;
  322. line-height: 40rpx;
  323. }
  324. .tcStartYq{
  325. width: 14rpx;
  326. height: 14rpx;
  327. background: #3F90F7;
  328. margin-top: 13rpx;
  329. border-radius: 50%;
  330. }
  331. .tcStartTxt{
  332. width: 396rpx;
  333. }
  334. .tcEndYq{
  335. width: 14rpx;
  336. height: 14rpx;
  337. background: #FF0000;
  338. margin-top: 13rpx;
  339. border-radius: 50%;
  340. }
  341. .tcStartTitle{
  342. color: #666666;
  343. padding: 0 30rpx 0 20rpx;
  344. }
  345. .tcRight{
  346. color: #FF0000;
  347. line-height: 33rpx;
  348. font-size: 24rpx;
  349. padding-top: 30rpx;
  350. padding-left: 10rpx;
  351. display: flex;
  352. align-items: center;
  353. }
  354. .kkline{
  355. display: flex;
  356. padding: 30rpx 0;
  357. border-bottom: 1px solid #EEEEEE;
  358. color: #666666;
  359. font-size: 28rpx;
  360. justify-content: space-between;
  361. }
  362. .kkline2{
  363. display: flex;
  364. justify-content: space-between;
  365. padding: 30rpx 0;
  366. border-bottom: 1px solid #EEEEEE;
  367. color: #666666;
  368. font-size: 28rpx;
  369. }
  370. .kklineRight{
  371. color: #3c3c3c;
  372. font-size: 28rpx;
  373. width: 450rpx;
  374. text-align: right;
  375. }
  376. .kklineLeft {
  377. width: 200rpx;
  378. }
  379. .box{
  380. background: #F4F5F7;
  381. min-height: 100vh;
  382. }
  383. .topTime{
  384. width: 702rpx;
  385. margin-left: 24rpx;
  386. background: #FFFFFF;
  387. border-radius: 10rpx;
  388. display: flex;
  389. justify-content: center;
  390. padding: 37rpx 0;
  391. margin-top: -70rpx;
  392. }
  393. .topTimeImg{
  394. width: 36rpx;
  395. height: 36rpx;
  396. }
  397. .topTimeNum{
  398. font-weight: 500;
  399. font-size: 32rpx;
  400. line-height: 36rpx;
  401. color: #333333;
  402. padding-left: 18rpx;
  403. }
  404. .top-box{
  405. width: 750rpx;
  406. height: 164rpx;
  407. background: #FF0000;
  408. border-radius: 0 0 10% 10%;
  409. }
  410. .bottom-container{
  411. width: 750rpx;
  412. height: 120rpx;
  413. background: #FFFFFF;
  414. box-shadow: 0px -2px 10px 0px rgba(153,153,153,0.1000);
  415. position: fixed;
  416. left: 0;
  417. bottom: 0;
  418. display: flex;
  419. justify-content: space-between;
  420. }
  421. .newyyBotbutton{
  422. width: 204rpx;
  423. height: 74rpx;
  424. background: #D53533;
  425. border-radius: 37rpx;
  426. font-weight: 500;
  427. color: #FFFFFF;
  428. line-height: 74rpx;
  429. text-align: center;
  430. margin-right: 30rpx;
  431. margin-top: 23rpx;
  432. }
  433. .bottom-container-price{
  434. color: #FF0000;
  435. padding-top: 30rpx;
  436. padding-left: 30rpx;
  437. font-size: 32rpx;
  438. }
  439. .qianhaospan{
  440. font-size: 22rpx;
  441. }
  442. .ckj{
  443. color: #999999;font-size: 24rpx;
  444. padding-left: 30rpx;
  445. }
  446. </style>