preengaged.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <view>
  3. <u-navbar title="我被预约">
  4. <view class="screen" @click="screenClick">筛选</view>
  5. </u-navbar>
  6. <view>
  7. <view v-if="screenShow" class="preference" :style="screenShow ? 'z-index:1024;top:'+navBarHeight+'px;' : 'z-index:0'"
  8. style="width: 100%;">
  9. <view class="content-s">
  10. <view class="preference_group">
  11. <view class="preference_group_item" :class="statusClass == index ? 'active' : ''" v-for="(item,index) in statusList" :key="item.id" @click="statusClick(index,item)">{{item.name}}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <u-mask :show="screenShow" @click="screenShow = false" z-index="100"></u-mask>
  16. </view>
  17. <view class="reservation-items" v-for="(item,index) in appointmentList" :key="item.id" @click="gotoUrl('pagesFinance/preengaged/preengagedListDetails?id='+item.id)">
  18. <view class="station-name">
  19. 预约{{item.reserveMinutes}}分钟后充电
  20. <view class="toBe-confirmed btn" v-if="item.status == '0'">{{item.statusText}}</view>
  21. <view class="confirmed btn" v-if="item.status == '1'">{{item.statusText}}</view>
  22. <view class="canceled btn" v-if="item.status == '3'">{{item.statusText}}</view>
  23. <view class="have-expired btn" v-if="item.status == '9'">{{item.statusText}}</view>
  24. <view class="finished btn" v-if="item.status == '2'">{{item.statusText}}</view>
  25. <view class="refused btn" v-if="item.status == '4'">{{item.statusText}}</view>
  26. <view class="have-expired btn" v-if="item.status == '5'">{{item.statusText}}</view>
  27. <view class="have-expired btn" v-if="item.status == '6'">{{item.statusText}}</view>
  28. </view>
  29. <view class="details-items">
  30. <view class="items">
  31. <view class="items-name">
  32. 预留截止时间
  33. </view>
  34. <view class="items-content">
  35. {{item.endTime}}
  36. </view>
  37. </view>
  38. <view class="items">
  39. <view class="items-name">
  40. 预计充电时长
  41. </view>
  42. <view class="items-content">
  43. {{item.estimateMinutes != null ? (item.estimateMinutes/60).toFixed(1)+'小时' : '0'}}
  44. </view>
  45. </view>
  46. <view class="items">
  47. <view class="items-name">
  48. 预约站点
  49. </view>
  50. <view class="items-content">
  51. {{item.stationName}}
  52. </view>
  53. </view>
  54. <view class="items">
  55. <view class="items-name">
  56. 预约桩号
  57. </view>
  58. <view class="items-content">
  59. {{item.deviceName}}
  60. </view>
  61. </view>
  62. <view class="items">
  63. <view class="items-name">
  64. 充电桩类型
  65. </view>
  66. <view class="items-content">
  67. {{item.typeText}}
  68. </view>
  69. </view>
  70. </view>
  71. <view class="button" v-if="item.status == '0'">
  72. <u-button class="affirm" shape="circle" @click="sureClick(item)">确认</u-button>
  73. <u-button class="refuse" shape="circle" @click="refuseClick(item)">拒绝</u-button>
  74. </view>
  75. </view>
  76. <u-divider v-if="appointmentList.length == recordsTotal && recordsTotal != 0" style="margin-top: 10px;">已经到底了</u-divider>
  77. </view>
  78. </template>
  79. <script>
  80. import * as myApi from '@/apis/my.js'
  81. export default {
  82. data() {
  83. return {
  84. screenShow: false,
  85. navBarHeight:44,
  86. statusList: [
  87. {id:"",name:"全部预约单"},
  88. {id:"0",name:"待确认"},
  89. {id:"1",name:"已预约"},
  90. {id:"2",name:"已完成"},
  91. {id:"3",name:"已取消"},
  92. {id:"4",name:"已拒绝"},
  93. {id:"9",name:"已过期"},
  94. ],
  95. statusClass: '',
  96. pageIndex: 1,
  97. recordsTotal: 0,
  98. appointmentList: [],
  99. status: '',
  100. }
  101. },
  102. onShow() {
  103. this.getAppointmentList(true);
  104. },
  105. onReachBottom() {
  106. if (this.appointmentList.length < this.recordsTotal) {
  107. this.myLoadmore();
  108. }
  109. },
  110. methods: {
  111. screenClick() {
  112. this.screenShow = !this.screenShow;
  113. },
  114. statusClick(index,item) {
  115. this.statusClass = index;
  116. this.status = item.id;
  117. this.screenShow = false;
  118. this.getAppointmentList(true);
  119. },
  120. getAppointmentList(bl) {
  121. uni.showLoading({
  122. title: "加载中",
  123. mask: true,
  124. })
  125. if (bl) {
  126. this.appointmentList = [];
  127. this.pageIndex = 1;
  128. }
  129. myApi.merchantAppointmentList({
  130. pageIndex: this.pageIndex,
  131. status: this.status
  132. }).then((res) => {
  133. uni.hideLoading();
  134. this.appointmentList = [
  135. ...this.appointmentList,
  136. ...res.data.data
  137. ];
  138. this.recordsTotal = res.data.recordsTotal;
  139. }).catch(error => {
  140. uni.showToast({
  141. title: error,
  142. icon: "none"
  143. })
  144. })
  145. },
  146. myLoadmore() {
  147. this.pageIndex += 1;
  148. this.getAppointmentList()
  149. },
  150. sureClick(item) {
  151. uni.showLoading({
  152. title: "加载中",
  153. mask: true,
  154. })
  155. myApi.merchantChangeStatus({
  156. id: item.id,
  157. status: '1'
  158. }).then((res) => {
  159. uni.hideLoading();
  160. this.getAppointmentList(true);
  161. }).catch(error => {
  162. uni.showToast({
  163. title: error,
  164. icon: "none"
  165. })
  166. })
  167. },
  168. refuseClick(item) {
  169. uni.showLoading({
  170. title: "加载中",
  171. mask: true,
  172. })
  173. myApi.merchantChangeStatus({
  174. id: item.id,
  175. status: '4'
  176. }).then((res) => {
  177. uni.hideLoading();
  178. this.getAppointmentList(true);
  179. }).catch(error => {
  180. uni.showToast({
  181. title: error,
  182. icon: "none"
  183. })
  184. })
  185. },
  186. }
  187. }
  188. </script>
  189. <style lang="scss" scoped>
  190. .preference {
  191. background-color: #ffffff;
  192. left: 0rpx;
  193. position: absolute
  194. }
  195. .preference_group_item {
  196. padding: 15rpx;
  197. text-align: center;
  198. color: #777777;
  199. }
  200. .active {
  201. color: #00B962;
  202. }
  203. .preference_group {
  204. padding-bottom: 20rpx;
  205. }
  206. .content-s{
  207. height: 200px;
  208. overflow-y:scroll;
  209. }
  210. page{
  211. padding-bottom: 155px;
  212. }
  213. .screen {
  214. margin-left: 85.3%;
  215. color: rgba(119, 119, 119, 100);
  216. font-size: 12px
  217. }
  218. .btn {
  219. width: 60px;
  220. height: 24px;
  221. line-height: 20px;
  222. border-radius: 4px;
  223. background-color: rgba(255, 255, 255, 100);
  224. font-size: 14px;
  225. text-align: center;
  226. float: right;
  227. margin-right: 24px;
  228. margin-top: 12px;
  229. }
  230. // 待确认按钮
  231. .toBe-confirmed {
  232. color: rgba(78, 141, 246, 100);
  233. border: 1px solid rgba(78, 141, 246, 100);
  234. }
  235. // 已确认按钮
  236. .confirmed {
  237. border: 1px solid rgba(0, 185, 98, 100);
  238. color: rgba(0, 185, 98, 100);
  239. }
  240. // 已取消按钮
  241. .canceled {
  242. border: 1px solid rgba(153, 153, 153, 100);
  243. color: rgba(153, 153, 153, 100);
  244. ;
  245. }
  246. // 已过期/已完成按钮
  247. .have-expired,.finished{
  248. color: rgba(162, 169, 181, 100);
  249. border: 1px solid rgba(162, 169, 181, 100);
  250. }
  251. // 已拒绝
  252. .refused{
  253. color: rgba(255, 79, 63, 100);
  254. border: 1px solid rgba(255, 79, 63, 100);
  255. }
  256. .reservation-items {
  257. width: 100%;
  258. background-color: #fff;
  259. padding-left: 14px;
  260. margin-bottom: 12px;
  261. .station-name {
  262. line-height: 48px;
  263. color: rgba(16, 16, 16, 100);
  264. font-size: 20px
  265. }
  266. .details-items {
  267. border: 1px solid rgba(238, 242, 240, 100);
  268. border-left: none;
  269. padding-bottom: 13px;
  270. .items {
  271. display: flex;
  272. justify-content: space-between;
  273. padding: 12px 14px 0px 0;
  274. line-height: 20px;
  275. }
  276. }
  277. .button {
  278. height: 56px;
  279. padding: 12px 0;
  280. /deep/.u-btn {
  281. height: 32px;
  282. line-height: 32px;
  283. background-color: rgba(255, 255, 255, 100);
  284. color: rgba(153, 153, 153, 100);
  285. font-size: 16px;
  286. text-align: center;
  287. float: right;
  288. margin-right: 16px;
  289. }
  290. .refuse,.delete{
  291. color: #999999;
  292. }
  293. .contact,.affirm{
  294. color: #00b962;
  295. }
  296. }
  297. }
  298. </style>