index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <template>
  2. <view class="orderDetail">
  3. <view class="orderHeader">
  4. <!-- 手机状态栏占位 -->
  5. <view class="statusBar" :style="{height:statusBarHeight+'rpx'}"></view>
  6. <!-- 导航栏 -->
  7. <view class="navigationBar" :style="{height:navigationBarHeight,paddingTop:statusBarHeight+'rpx'}">
  8. <view @tap="goBack">
  9. <image :src="require('../../../../static/backw.png')" alt="">
  10. </view>
  11. <view class="navigationTitle">
  12. 订单详情
  13. </view>
  14. </view>
  15. <view class="serveBody">
  16. <image :src="require('../../../../static/icon-fuwu.png')" alt="">
  17. <view class="serveTitle">
  18. {{orderData.status==1?'待支付':orderData.status==2?'待服务':orderData.status==3?'已完成':orderData.status==4?'已取消':'进行中'}}
  19. </view>
  20. </view>
  21. </view>
  22. <view class="orderBody">
  23. <view class="orderDetail">
  24. <view class="carView">
  25. <image :src="baseImagePath+orderData.carLogo" alt="">
  26. <view class="carBody">
  27. <view class="carTitle">
  28. <image :src="require('../../../../static/car.png')" alt="">
  29. <span>{{orderData.carNumber}}</span>
  30. <view class="border"></view>
  31. <span>{{orderData.carMadelLevel}}</span>
  32. <view class="border"></view>
  33. <span>{{orderData.upsName}}</span>
  34. </view>
  35. <view class="content">
  36. {{orderData.carTypeName}}
  37. </view>
  38. </view>
  39. </view>
  40. <view class="shop">
  41. <image :src="require('../../../../static/shop.png')" alt="">
  42. <view style="padding-left: 16rpx;">
  43. 门店:{{orderData.shopName}}
  44. </view>
  45. </view>
  46. <view class="times">
  47. <image :src="require('../../../../static/time.png')" alt="">
  48. <view style="padding-left: 16rpx;">
  49. 时间:{{orderData.time}}
  50. </view>
  51. </view>
  52. <view>
  53. <view class="buttomBtn">
  54. <view v-if="orderData.status==1" class="orderBtn" @click="plOrder">
  55. 立即支付
  56. </view>
  57. <view style="white-space: nowrap;">
  58. 实付:<span style="font-size: 26rpx;font-weight: bold;">¥ </span><span
  59. style="font-size: 40rpx;font-weight: bold;white-space: nowrap;">{{orderData.payMoney}}</span>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="explain">
  65. <view class="orders" v-if="orderData.orderNumber">
  66. 订单编号:{{orderData.orderNumber}}
  67. <view class="span" @click="copy(orderData.orderNumber)">复制</view>
  68. </view>
  69. <view class="orders" v-if="orderData.createTimeStr">
  70. 下单时间:{{orderData.createTimeStr}}
  71. </view>
  72. <view class="orders" v-if="orderData.payTimeStr">
  73. 支付时间:{{orderData.payTimeStr}}
  74. </view>
  75. <view class="orders" v-if="orderData.startTimeStr">
  76. 服务时间:{{orderData.startTimeStr}}
  77. </view>
  78. <view class="orders" v-if="orderData.accomplishTimeStr">
  79. 完成时间:{{orderData.accomplishTimeStr}}
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import {
  87. getUserCar
  88. } from "@/api/shop.js"
  89. import {
  90. carwashOrderDetail,
  91. carwashOrder
  92. } from "@/api/carWash.js"
  93. export default {
  94. components: {},
  95. data: function() {
  96. return {
  97. baseImagePath: this.baseImagePath,
  98. orderData: {},
  99. usercar:{},
  100. statusBarHeight: "",
  101. navigationBarHeight: "",
  102. navHeight: ""
  103. }
  104. },
  105. onLoad(options) {
  106. this.orderData = JSON.parse(decodeURIComponent(options.data));
  107. carwashOrderDetail({
  108. id: this.orderData.id
  109. }).then((res) => {
  110. console.log(res);
  111. this.orderData = res.data;
  112. })
  113. // 状态栏高度
  114. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
  115. // #ifdef MP-WEIXIN
  116. // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
  117. const custom = wx.getMenuButtonBoundingClientRect()
  118. // console.log(custom)
  119. // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
  120. this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
  121. // console.log("导航栏高度:"+this.globalData.navigationBarHeight)
  122. // 总体高度 = 状态栏高度 + 导航栏高度
  123. this.navHeight = (this.navigationBarHeight + this.statusBarHeight)
  124. this.navigationBarHeight = this.navigationBarHeight + 'px'
  125. this.statusBarHeight = this.statusBarHeight + 'px'
  126. this.navHeight = this.navHeight + 'px'
  127. // #endif
  128. },
  129. onShow(){
  130. getUserCar().then(res => {
  131. console.log(res.data);
  132. this.usercar = res.data
  133. console.log(this.usercar);
  134. console.log(this.usercar.id);
  135. })
  136. },
  137. methods: {
  138. plOrder() {
  139. let data = {}
  140. data.userCarId = this.usercar.id
  141. data.shopId = this.orderData.shopId
  142. data.shopServiceId = this.orderData.shopServiceId
  143. data.payType = this.orderData.payType
  144. data.reserveTime = this.orderData.reserveTime
  145. data.payMoney = this.orderData.payMoney
  146. data.serviceType = this.orderData.serviceType
  147. console.log(data);
  148. console.log(this.orderData);
  149. console.log(this.orderData.payMoney);
  150. carwashOrder(data).then(() => {
  151. uni.showToast({
  152. icon: 'none',
  153. title: '正在跳转收银台'
  154. })
  155. uni.navigateTo({
  156. url: '/pages/shop/cashierDesk/cashierDesk?page=carwash&params=' + JSON.stringify(data)
  157. })
  158. })
  159. },
  160. goBack() {
  161. uni.navigateBack({
  162. delta: 1
  163. })
  164. },
  165. copy(val) {
  166. uni.setClipboardData({
  167. data: val, // 要复制的文字
  168. success: function(res) {
  169. uni.getClipboardData({
  170. success: function(res) {
  171. uni.showToast({
  172. title: '复制成功'
  173. });
  174. }
  175. });
  176. }
  177. });
  178. },
  179. },
  180. }
  181. </script>
  182. <style lang="less">
  183. page {
  184. background: #F5F5F5;
  185. }
  186. .orderBody {
  187. position: absolute;
  188. top: 315rpx;
  189. //
  190. .orderDetail {
  191. width: 710rpx;
  192. height: 440rpx;
  193. background: #FFFFFF;
  194. border-radius: 10rpx;
  195. margin: 20rpx;
  196. .carView {
  197. display: flex;
  198. padding: 26rpx;
  199. image {
  200. width: 120rpx;
  201. height: 120rpx;
  202. background: #FFFFFF;
  203. border: 2rpx solid #F4F4F4;
  204. border-radius: 8rpx;
  205. padding-top: 14rpx;
  206. }
  207. .carBody {
  208. padding: 14rpx 29rpx 14rpx 29rpx;
  209. .carTitle {
  210. display: flex;
  211. image {
  212. width: 33rpx;
  213. height: 27rpx;
  214. padding-top: 0rpx;
  215. }
  216. .border {
  217. width: 1px;
  218. height: 20rpx;
  219. background: #DBDBDB;
  220. }
  221. span {
  222. font-size: 30rpx;
  223. font-family: PingFang SC;
  224. font-weight: bold;
  225. color: #333333;
  226. line-height: 31rpx;
  227. padding: 0 15rpx 0 15rpx;
  228. }
  229. }
  230. .content {
  231. font-size: 26rpx;
  232. font-family: PingFang SC;
  233. font-weight: 500;
  234. color: #666666;
  235. line-height: 34rpx;
  236. padding: 20rpx 60rpx 20rpx 0;
  237. }
  238. }
  239. }
  240. .shop {
  241. display: flex;
  242. align-items: center;
  243. font-size: 26rpx;
  244. font-family: PingFang SC;
  245. font-weight: 500;
  246. color: #333333;
  247. line-height: 34rpx;
  248. padding: 15rpx 30rpx 15rpx 30rpx;
  249. image {
  250. width: 30rpx;
  251. height: 26rpx;
  252. }
  253. }
  254. .times {
  255. display: flex;
  256. align-items: center;
  257. font-size: 26rpx;
  258. font-family: PingFang SC;
  259. font-weight: 500;
  260. color: #333333;
  261. line-height: 34rpx;
  262. margin-top: 16rpx;
  263. padding-bottom: 30rpx;
  264. padding: 0rpx 30rpx 15rpx 30rpx;
  265. image {
  266. width: 30rpx;
  267. height: 26rpx;
  268. }
  269. }
  270. .buttomBtn {
  271. height: 33rpx;
  272. font-size: 26rpx;
  273. font-family: PingFang SC;
  274. font-weight: 500;
  275. color: #333333;
  276. line-height: 34rpx;
  277. text-align: center;
  278. margin: 26rpx 31rpx 0 74%;
  279. .orderBtn {
  280. width: 156rpx;
  281. height: 56rpx;
  282. text-align: center;
  283. background: linear-gradient(0deg, #008EFF 0%, #0036FF 100%);
  284. border-radius: 28rpx;
  285. font-size: 26rpx;
  286. font-family: PingFang SC;
  287. font-weight: 500;
  288. color: #FFFFFF;
  289. line-height: 56rpx;
  290. }
  291. }
  292. }
  293. .explain {
  294. width: 710rpx;
  295. // height: 344rpx;
  296. background: #FFFFFF;
  297. border-radius: 10rpx;
  298. margin: 20rpx;
  299. padding-top: 11rpx;
  300. padding-bottom: 40rpx;
  301. .orders {
  302. display: flex;
  303. align-items: center;
  304. font-size: 26rpx;
  305. font-family: PingFang SC;
  306. font-weight: 500;
  307. color: #666666;
  308. line-height: 34rpx;
  309. padding: 33rpx 0 0 29rpx;
  310. .span {
  311. text-align: center;
  312. margin-left: 16rpx;
  313. width: 70rpx;
  314. height: 28rpx;
  315. border: 1px solid #999999;
  316. border-radius: 14rpx;
  317. font-size: 18rpx;
  318. font-family: PingFang SC;
  319. font-weight: 500;
  320. color: #666666;
  321. line-height: 28rpx;
  322. }
  323. }
  324. }
  325. }
  326. .orderHeader {
  327. width: 100%;
  328. height: 454rpx;
  329. background-image: url(../../../../static/cardbg.png);
  330. // background-image: url(../../../../static/bgcard.png);
  331. background-size: 100% 100%;
  332. .navigationBar {
  333. display: flex;
  334. align-items: center;
  335. text-align: center;
  336. image {
  337. padding-left: 17rpx;
  338. width: 44rpx;
  339. height: 44rpx;
  340. }
  341. .navigationTitle {
  342. padding-left: 242rpx;
  343. font-size: 36rpx;
  344. font-family: PingFang SC;
  345. font-weight: bold;
  346. color: #FFFFFF;
  347. line-height: 75rpx;
  348. }
  349. }
  350. .serveBody {
  351. display: flex;
  352. align-items: center;
  353. margin-top: 73rpx;
  354. margin-left: 38rpx;
  355. image {
  356. width: 37rpx;
  357. height: 39rpx;
  358. }
  359. .serveTitle {
  360. font-size: 36rpx;
  361. font-family: PingFang SC;
  362. font-weight: bold;
  363. color: #FFFFFF;
  364. line-height: 75rpx;
  365. padding-left: 20rpx;
  366. }
  367. }
  368. }
  369. </style>