preengaged.vue 8.0 KB

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