preengagedListDetails.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <view>
  3. <u-navbar title="预约单详情">
  4. </u-navbar>
  5. <u-alert-tips type="warning" v-if="detail.chargingAppointment.status == '0'" :description="description"></u-alert-tips>
  6. <view class="reverse-time">
  7. <view class="time" v-if="detail.chargingAppointment.status == '0'">
  8. 预留{{detail.chargingAppointment.reserveMinutes}}分钟
  9. </view>
  10. <view class="time" v-if="detail.chargingAppointment.status == '1'">
  11. 预留{{detail.chargingAppointment.reserveMinutes}}分钟
  12. <view class="img-box">
  13. <img src="../../assets/img/finished.png" alt="">
  14. </view>
  15. </view>
  16. <view class="time" v-if="detail.chargingAppointment.status == '3'">
  17. 预留{{detail.chargingAppointment.reserveMinutes}}分钟
  18. <view class="img-box">
  19. <img src="../../assets/img/canc.png" alt="">
  20. </view>
  21. </view>
  22. <view class="time" v-if="detail.chargingAppointment.status == '2'">
  23. 预留{{detail.chargingAppointment.reserveMinutes}}分钟
  24. <view class="img-box">
  25. <img src="../../assets/img/f.png" alt="">
  26. </view>
  27. </view>
  28. <view class="time refused" v-if="detail.chargingAppointment.status == '4'">
  29. {{detail.chargingAppointment.statusText}}
  30. </view>
  31. <view class="time refused" v-if="detail.chargingAppointment.status == '9'">
  32. {{detail.chargingAppointment.statusText}}
  33. </view>
  34. <view class="details-item">
  35. <view class="item">
  36. <view class="item-name">
  37. 预约单号
  38. </view>
  39. <view class="item-content">
  40. {{detail.chargingAppointment.flowNo}}
  41. </view>
  42. </view>
  43. <view class="item">
  44. <view class="item-name">
  45. 预计开始充电
  46. </view>
  47. <view class="item-content">
  48. {{detail.chargingAppointment.endTime}}
  49. </view>
  50. </view>
  51. <view class="item">
  52. <view class="item-name">
  53. 预计充电时长
  54. </view>
  55. <view class="item-content">
  56. {{(detail.chargingAppointment.estimateMinutes/60).toFixed(2)}}
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <!-- 充电桩详情 -->
  62. <view class="charge-pile">
  63. <view class="box">
  64. <view class="name ellipsis">
  65. {{detail.chargingDevice.stationName}}/{{detail.chargingDevice.name}}
  66. </view>
  67. <view class="address ellipsis">
  68. {{detail.chargingDevice.address}}
  69. </view>
  70. <text class="iconfont more">
  71. &#xe600;
  72. </text>
  73. </view>
  74. <view class="tel" @click="phoneClick(detail.chargingAppointment)">
  75. <view class="tel-text">
  76. 联系电话
  77. </view>
  78. <view class="tel-num">
  79. {{detail.chargingAppointment.regUserName.slice(0,1)+'先生'}}{{" "}}{{detail.chargingAppointment.phone}}
  80. <text class="iconfont more2">
  81. &#xe600;
  82. </text>
  83. </view>
  84. </view>
  85. <view class="details-item">
  86. <view class="item">
  87. <view class="item-name">
  88. 预约单生成时间
  89. </view>
  90. <view class="item-content">
  91. {{detail.chargingAppointment.createTime}}
  92. </view>
  93. </view>
  94. <view class="item">
  95. <view class="item-name">
  96. 电费单价
  97. </view>
  98. <view class="item-content">
  99. {{detail.price.electricityPrice }}元/度
  100. </view>
  101. </view>
  102. <view class="item">
  103. <view class="item-name">
  104. 充电服务费
  105. </view>
  106. <view class="item-content">
  107. {{detail.price.servicePrice }}元/度
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <!-- 底部按钮 -->
  113. <view class="bottom">
  114. <u-button shape='circle' class="refuse-btn" v-if="detail.chargingAppointment.status == '0'" @click="refuseClick(detail.chargingAppointment)">拒绝</u-button>
  115. <u-button type="success" shape='circle' v-if="detail.chargingAppointment.status == '0'" @click="sureClick(detail.chargingAppointment)">确认</u-button>
  116. <!-- <u-button shape='circle' class="cancel-btn" v-if="detail.chargingAppointment.status == '4' || detail.chargingAppointment.status == '9'">删除订单</u-button> -->
  117. </view>
  118. </view>
  119. </template>
  120. <script>
  121. import * as myApi from '@/apis/my.js'
  122. import {
  123. hourDistanceArr,
  124. currentTimeStamp,
  125. parseUnixTime
  126. } from '@/utils'
  127. export default {
  128. data() {
  129. return {
  130. description: '等待桩主确认预约单,剩余时间04:59:59',
  131. id: '',
  132. detail: {},
  133. estimateMinutes: '',
  134. }
  135. },
  136. onLoad(op) {
  137. if(op.id) {
  138. this.id = op.id;
  139. this.getAppointmentDetail();
  140. }
  141. },
  142. methods: {
  143. getAppointmentDetail() {
  144. uni.showLoading({
  145. title: "加载中",
  146. mask: true,
  147. })
  148. myApi.merchantAppointmentDetail(this.id).then((res) => {
  149. uni.hideLoading();
  150. this.detail = res.data;
  151. if(this.detail.chargingAppointment.status=="0"){
  152. //this.description= '等待桩主确认预约单,剩余时间'
  153. var data=new Date(this.detail.chargingAppointment.createTime).getTime()
  154. var c=hourDistanceArr(new Date(),new Date(data+5*60*1000))
  155. this.description= '等待桩主确认预约单,剩余时间'+c[1]+'分'+c[2]+"秒";
  156. setTimeout(()=>{
  157. this.getInfo(true);
  158. },2000)
  159. }
  160. }).catch(error => {
  161. uni.showToast({
  162. title: error,
  163. icon: "none"
  164. })
  165. })
  166. },
  167. phoneClick(item) {
  168. uni.makePhoneCall({
  169. phoneNumber: item.phone
  170. });
  171. },
  172. sureClick(item) {
  173. uni.showLoading({
  174. title: "加载中",
  175. mask: true,
  176. })
  177. myApi.merchantChangeStatus({
  178. id: item.id,
  179. status: '1'
  180. }).then((res) => {
  181. uni.hideLoading();
  182. this.getAppointmentList(true);
  183. }).catch(error => {
  184. uni.showToast({
  185. title: error,
  186. icon: "none"
  187. })
  188. })
  189. },
  190. refuseClick(item) {
  191. uni.showLoading({
  192. title: "加载中",
  193. mask: true,
  194. })
  195. myApi.merchantChangeStatus({
  196. id: item.id,
  197. status: '4'
  198. }).then((res) => {
  199. uni.hideLoading();
  200. this.getAppointmentList(true);
  201. }).catch(error => {
  202. uni.showToast({
  203. title: error,
  204. icon: "none"
  205. })
  206. })
  207. },
  208. },
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. page{
  213. padding-bottom: 151px;
  214. }
  215. .tittle-font {
  216. font-size: 24px;
  217. position: fixed;
  218. top: 12px;
  219. right: 16px;
  220. z-index: 99999;
  221. }
  222. /deep/.u-alert-desc {
  223. width: 100vw;
  224. text-align: center;
  225. color: #ff5a00;
  226. }
  227. .reverse-time {
  228. background-color: #fff;
  229. padding: 36px 12px 16px 28px;
  230. .time {
  231. height: 36px;
  232. color: rgba(0, 185, 98, 100);
  233. font-size: 36px;
  234. text-align: center;
  235. position: relative;
  236. .img-box{
  237. width: 72px;
  238. height: 72px;
  239. img{
  240. width: 72px;
  241. height: 72px;
  242. position: absolute;
  243. top: -12px;
  244. right: -2px;
  245. }
  246. }
  247. }
  248. .refused{
  249. color: #666666;
  250. }
  251. }
  252. .details-item {
  253. margin-top: 40px;
  254. padding-right: 16px;
  255. padding-bottom: 12px;
  256. .item {
  257. display: flex;
  258. justify-content: space-between;
  259. margin-top: 8px;
  260. }
  261. }
  262. // 充电桩详情
  263. .charge-pile {
  264. background-color: #fff;
  265. margin-top: 12px;
  266. padding: 0 0 12px 16px;
  267. .box {
  268. position: relative;
  269. height: 66px;
  270. padding: 12px 0;
  271. .more {
  272. position: absolute;
  273. top: 19px;
  274. right: 12px;
  275. font-size: 24px;
  276. color: #b3b3b3;
  277. }
  278. }
  279. .name {
  280. width: 90%;
  281. line-height: 18px;
  282. color: rgba(16, 16, 16, 100);
  283. font-size: 18px;
  284. font-weight: 600;
  285. }
  286. .ellipsis{
  287. white-space: nowrap;
  288. text-overflow: ellipsis;
  289. overflow: hidden;
  290. }
  291. .address {
  292. width: 90%;
  293. line-height: 20px;
  294. color: rgba(51, 51, 51, 100);
  295. margin-top: 4px;
  296. }
  297. // 联系电话
  298. .tel {
  299. line-height: 48px;
  300. display: flex;
  301. justify-content: space-between;
  302. border: 1px solid #eef2f0;
  303. border-left: none;
  304. position: relative;
  305. .tel-num {
  306. width: 50%;
  307. }
  308. .more2 {
  309. display: inline-block;
  310. font-size: 24px;
  311. color: #b3b3b3;
  312. height: 48px;
  313. position: absolute;
  314. top: 1px;
  315. right: 12px;
  316. }
  317. }
  318. .item {
  319. margin-top: 20px;
  320. }
  321. }
  322. // 按钮
  323. .bottom{
  324. width: 100%;
  325. height: 56px;
  326. position: fixed;
  327. bottom: 0;
  328. background-color: #fff;
  329. display: flex;
  330. .refuse-btn{
  331. background-color: #DBDBDB;
  332. }
  333. .u-btn{
  334. width: 44%;
  335. height: 40px;
  336. margin: auto;
  337. font-size: 18px;
  338. }
  339. .cancel-btn{
  340. width: 91.4%;
  341. background-color: #dbdbdb;
  342. color: #666666
  343. }
  344. }
  345. </style>