order.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <template>
  2. <view class="page-content">
  3. <view class="page-search-container">
  4. <u-input type="select" class="page-search-text" :select-open="show" placeholder="请选择换电站" v-model="formData.name" @click="show = true"/>
  5. <view class="searchType-top-container">
  6. <view :class="current == 1 ? 'searchType-top-left-active' : 'searchType-top-left'" @click="tabsChange(1)">
  7. {{"待处理(" + pending + ")"}}
  8. </view>
  9. <view :class="current == 0 ? 'searchType-top-left-active' : 'searchType-top-left'" @click="tabsChange(0)">
  10. {{"未处理(" + notProcessed + ")"}}
  11. </view>
  12. <view :class="current == 2 ? 'searchType-top-left-active' : 'searchType-top-left'" @click="tabsChange(2)">
  13. {{"已完结(" + closed + ")"}}
  14. </view>
  15. </view>
  16. <!-- <u-tabs-swiper ref="tabs" :list="tabsList" :current="current" :is-scroll="false" bar-height="6" bar-width="40" active-color="#2979ff" @change="tabsChange" ></u-tabs-swiper> -->
  17. </view>
  18. <view class="swiper-group">
  19. <scroll-view class="scroll-content-container" :style="{height:scrollerHeight}" scroll-y @scrolltolower="onreachBottom">
  20. <view class="order-container" v-for="(order,i) in orderlist" :key="i" @click="gotoDetail(order)">
  21. <view class="order-title-container">
  22. <view class="order-title-text">
  23. {{order.problemTitle || '-'}}
  24. </view>
  25. <view class="order-status">
  26. {{order.status == 0 ? '未处理' : (order.status == 1 ? '待处理' : '已完结')}}
  27. </view>
  28. </view>
  29. <view class="order-time">
  30. {{order.occurrenceTime || '-'}}
  31. </view>
  32. <view class="order-site">
  33. {{order.stationName || '-'}}
  34. </view>
  35. <view class="order-reason">
  36. {{order.deviceProblem || '-'}}
  37. </view>
  38. </view>
  39. <view v-if="noMore" class="more-data">
  40. {{textInfo}}
  41. </view>
  42. </scroll-view>
  43. <view v-if="!orderlist.length">
  44. <view class="yoshop-notcont">
  45. <text class="cont">暂无工单</text>
  46. </view>
  47. </view>
  48. </view>
  49. <u-select :list="siteList" v-model="show" value-name="stationCode" label-name="stationName" @confirm="siteSelectCallback"> </u-select>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. //当前下标
  57. current: 0,
  58. swiperCurrent: 0,
  59. scrollerHeight: 0,
  60. swiperContentHeight: 0,
  61. //查询条件
  62. formData: {
  63. name: '全部站点',
  64. stationCode: '',
  65. pageIndex: 1,
  66. pageSize: 10,
  67. orderStatus: null,
  68. },
  69. //是否显示站点
  70. show: false,
  71. //站点列表
  72. siteList: [],
  73. //是否更多
  74. noMore: false,
  75. //工单列表
  76. orderlist: [],
  77. //总条数
  78. pageTotal: 0,
  79. //提示
  80. textInfo: '',
  81. //待处理
  82. pending: 0,
  83. //已完结
  84. closed: 0,
  85. //未处理
  86. notProcessed: 0,
  87. }
  88. },
  89. //第一次加载
  90. onLoad(e) {
  91. this.swiperCurrent = e.type;
  92. this.current = e.type;
  93. this.formData.orderStatus = Number(e.type);
  94. },
  95. onReady() {
  96. let that = this
  97. uni.getSystemInfo({
  98. success: function (res) {
  99. let windowHeight= res.windowHeight;
  100. that.swiperContentHeight = (windowHeight-158) + 'px';
  101. that.scrollerHeight = (windowHeight - 60) + 'px'; // 给5px的底部间距
  102. }
  103. });
  104. },
  105. //页面显示
  106. onShow() {
  107. },
  108. mounted() {
  109. this.getSites();
  110. this.getDataList();
  111. this.getIndexOptionData();
  112. },
  113. methods: {
  114. // tabs通知swiper切换
  115. tabsChange(index) {
  116. this.current = index;
  117. this.formData.pageIndex = 1;
  118. this.formData.orderStatus = index;
  119. this.getDataList();
  120. },
  121. // scroll-view到底部加载更多
  122. onreachBottom() {
  123. this.noMore = true;
  124. this.textInfo = '向上拉加载更多';
  125. if(this.pageTotal > this.formData.pageIndex * this.formData.pageSize) {
  126. this.textInfo = '加载中...'
  127. this.formData.pageIndex += 1;
  128. this.getDataList();
  129. } else {
  130. this.textInfo = '我是有底线的';
  131. setTimeout(() => {
  132. this.noMore = false;
  133. }, 1000);
  134. }
  135. },
  136. //获取工单信息数据
  137. getIndexOptionData() {
  138. const _that = this;
  139. _that.dataInfo = {};
  140. uni.showLoading({
  141. title: '搜索中...',
  142. })
  143. _that.$http.getOpsOrderOverview(_that.formData.stationCode).then(res => {
  144. uni.hideLoading();
  145. if(res.code == 200) {
  146. let {pending, closed, notProcessed} = res.data
  147. _that.pending = pending;
  148. _that.closed = closed;
  149. _that.notProcessed = notProcessed;
  150. } else {
  151. _that.$utils.msg(res.msg);
  152. }
  153. })
  154. },
  155. //站点选择
  156. siteSelectCallback(data) {
  157. uni.hideKeyboard();
  158. this.formData.name = data[0].label;
  159. this.formData.stationCode = data[0].value;
  160. this.getDataList();
  161. this.getIndexOptionData();
  162. },
  163. //跳转详情页面
  164. gotoDetail(item) {
  165. uni.navigateTo({
  166. url: '/pages/index/orderDetail?id=' + item.id
  167. })
  168. },
  169. //获取权限内所有站点列表
  170. getSites() {
  171. this.siteList = [];
  172. let siteList = [{stationName: '全部站点', stationCode: ''}];
  173. let _that = this;
  174. _that.$http.getHasStationCodeAndName().then(res => {
  175. uni.hideLoading();
  176. if(res.code == 200) {
  177. siteList = siteList.concat(res.data);
  178. _that.siteList = siteList
  179. } else {
  180. _that.$utils.msg(res.msg);
  181. }
  182. })
  183. },
  184. //获取列表数据
  185. getDataList() {
  186. uni.showLoading({
  187. title: '搜索中...',
  188. })
  189. let _that = this;
  190. _that.$http.getOrderList(_that.formData).then(res => {
  191. if(res.code == 200) {
  192. if (_that.formData.pageIndex == 1) _that.orderlist = [];
  193. _that.pageTotal = res.data.total;
  194. _that.orderlist = _that.orderlist.concat(res.data.list);
  195. _that.noMore = false;
  196. } else {
  197. _that.$utils.msg(res.msg);
  198. }
  199. uni.hideLoading();
  200. })
  201. }
  202. }
  203. }
  204. </script>
  205. <style lang="scss" scoped>
  206. .page-content {
  207. height: 100vh;
  208. position: relative;
  209. box-sizing: border-box;
  210. background: $uni-bg-color;
  211. padding-bottom: env(safe-area-inset-bottom);
  212. overflow: hidden;
  213. .page-search-container {
  214. display: flex;
  215. background: #FFFFFF;
  216. .page-search-text {
  217. margin-left: 30rpx;
  218. width: 30%;
  219. }
  220. .searchType-top-container {
  221. display: flex;
  222. width: 70%;
  223. height: 80rpx;
  224. margin-left: 40rpx;
  225. .searchType-top-left {
  226. width: 33%;
  227. text-align: center;
  228. font-size: 28rpx;
  229. font-family: PingFang SC-Medium, PingFang SC;
  230. font-weight: 500;
  231. color: #131212;
  232. line-height: 80rpx;
  233. }
  234. .searchType-top-left-active {
  235. width: 33%;
  236. text-align: center;
  237. font-size: 28rpx;
  238. font-family: PingFang SC-Medium, PingFang SC;
  239. font-weight: 500;
  240. color: #3F8CFF;
  241. line-height: 80rpx;
  242. border-bottom: 1rpx solid #3F8CFF;
  243. }
  244. }
  245. }
  246. .swiper-group {
  247. padding: 0 32rpx 40rpx 32rpx;
  248. .order-container {
  249. height: 270rpx;
  250. background: #FFFFFF;
  251. border-radius: 16rpx;
  252. margin-top: 10rpx;
  253. padding: 32rpx;
  254. .order-title-container {
  255. display: flex;
  256. .order-title-text {
  257. height: 44rpx;
  258. font-size: 32rpx;
  259. font-family: PingFang SC-Medium, PingFang SC;
  260. font-weight: 500;
  261. color: #1D2129;
  262. line-height: 44rpx;
  263. width: calc(100% - 154rpx);
  264. overflow: hidden;
  265. white-space: nowrap;
  266. text-overflow: ellipsis;
  267. }
  268. .order-status {
  269. height: 44rpx;
  270. font-size: 22rpx;
  271. font-family: PingFang SC-Regular, PingFang SC;
  272. font-weight: 400;
  273. color: #3F8CFF;
  274. line-height: 44rpx;
  275. width: 80rpx;
  276. text-align: center;
  277. background: #e8F1FF;
  278. border-radius: 16rpx;
  279. margin-left: 10rpx;
  280. }
  281. }
  282. .order-time {
  283. font-size: 22rpx;
  284. font-family: PingFang SC-Regular, PingFang SC;
  285. font-weight: 400;
  286. color: #86909C;
  287. line-height: 40rpx;
  288. margin-top: 16rpx;
  289. }
  290. .order-site {
  291. font-size: 28rpx;
  292. font-family: PingFang SC-Regular, PingFang SC;
  293. font-weight: 400;
  294. color: #4E5969;
  295. line-height: 40rpx;
  296. margin-top: 16rpx;
  297. }
  298. .order-reason {
  299. font-size: 28rpx;
  300. font-family: PingFang SC-Regular, PingFang SC;
  301. font-weight: 400;
  302. color: #4E5969;
  303. line-height: 40rpx;
  304. overflow: hidden;
  305. white-space: nowrap;
  306. text-overflow: ellipsis;
  307. margin-top: 16rpx;
  308. }
  309. }
  310. }
  311. .more-data {
  312. background: #FFFFFF;
  313. margin-top: 10rpx;
  314. line-height: 60rpx;
  315. text-align: center;
  316. font-size: 28rpx;
  317. font-family: PingFang SC-Regular, PingFang SC;
  318. font-weight: 400;
  319. color: #989796;
  320. }
  321. .yoshop-notcont {
  322. position: fixed;
  323. top: 50%;
  324. left: 50%;
  325. transform: translate(-50%, -30%);
  326. .cont {
  327. font-size: 28rpx;
  328. font-family: PingFang SC-Regular, PingFang SC;
  329. font-weight: 400;
  330. color: #4E5969;
  331. line-height: 40rpx;
  332. }
  333. }
  334. }
  335. </style>