confirmRescue.vue 10 KB

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