orderList.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="orderList">
  3. <!-- 头部筛选 -->
  4. <view class="orderList_header">
  5. <view class="orderList_header_item">
  6. <text class="orderList_header_itemText">全部</text>
  7. <text class="pda pda-xiala"></text>
  8. </view>
  9. <view class="orderList_header_item">
  10. <text class="orderList_header_itemText">全部</text>
  11. <text class="pda pda-xiala"></text>
  12. </view>
  13. </view>
  14. <!-- 列表 -->
  15. <view class="orderList_list">
  16. <view class="orderList_listItem" v-for="newOrder in newOrderList" :key="newOrder.id">
  17. <view class="orderList_listItem_header">
  18. <view class="orderList_listItem_header_title">
  19. <view class="associationType_icon"> 标 </view>
  20. 半程陪检-张三
  21. </view>
  22. <text class="orderList_listItem_header_more">待接单</text>
  23. </view>
  24. <view class="orderList_listItem_item">
  25. <view class="orderList_listItem_item_content">
  26. <text class="orderList_listItem_item_name">李四-6322285</text>
  27. <text class="orderList_listItem_item_time">10:20</text>
  28. </view>
  29. <view class="orderList_listItem_item_btns">
  30. <button type="primary" class="btn">撤销</button>
  31. <button type="primary" class="btn">加急</button>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <seiminFooterNav></seiminFooterNav>
  37. <seiminModel ref="seiminModel"></seiminModel>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. mapState
  43. } from "vuex";
  44. import {
  45. reqFetchDataList
  46. } from "../../request/api.js";
  47. import {
  48. GDSTATE
  49. } from "../../utils/enum.gdstate.js";
  50. export default {
  51. name: 'orderList',
  52. data() {
  53. return {
  54. newOrderList: [], //工单列表
  55. idx: 0, //页码
  56. };
  57. },
  58. computed: {
  59. ...mapState("user", ["loginInfo"]),
  60. },
  61. methods: {
  62. // 获取页面数据
  63. init() {
  64. uni.showLoading({
  65. title: "加载中",
  66. mask: true,
  67. });
  68. Promise.all([
  69. this.queryWorkOrdersRequest(), //查询最新工单列表
  70. ]).then((values) => {
  71. uni.hideLoading();
  72. uni.stopPullDownRefresh();
  73. this.queryWorkOrdersResponse(values[0]);
  74. });
  75. },
  76. // 查询最新工单列表(上拉)
  77. reachBottom() {
  78. uni.showLoading({
  79. title: "加载中",
  80. mask: true,
  81. });
  82. Promise.all([
  83. this.queryWorkOrdersRequest(true), //查询最新工单列表
  84. ]).then((values) => {
  85. uni.hideLoading();
  86. uni.stopPullDownRefresh();
  87. this.queryWorkOrdersResponse(values[0], true);
  88. });
  89. },
  90. // 查询最新工单列表
  91. queryWorkOrdersRequest(idxPlus = false) {
  92. if (idxPlus) {
  93. //累加
  94. ++this.idx;
  95. } else {
  96. this.idx = 0;
  97. }
  98. return reqFetchDataList("nurse", "workOrder", {
  99. workOrder: {
  100. createDept: this.loginInfo.user.dept.id,
  101. platform: 2,
  102. searchDays: 2,
  103. },
  104. idx: this.idx,
  105. sum: 10,
  106. });
  107. },
  108. // 查询最新工单列表
  109. queryWorkOrdersResponse(res, idxPlus = false) {
  110. if (res.status == 200) {
  111. res.list = res.list || [];
  112. let newOrderList = res.list.map((v) => {
  113. if (v.gdState) {
  114. if (
  115. v.gdState.value == GDSTATE["待接单"] ||
  116. v.gdState.value == GDSTATE["待抢单"]
  117. ) {
  118. v.stateTextClass = "red";
  119. } else if (
  120. v.gdState.value == GDSTATE["待评价"] ||
  121. v.gdState.value == GDSTATE["已完成"]
  122. ) {
  123. v.stateTextClass = "green";
  124. } else {
  125. v.stateTextClass = "yellow";
  126. }
  127. }
  128. return v;
  129. });
  130. if (idxPlus) {
  131. //累加
  132. this.newOrderList.push(newOrderList)
  133. } else {
  134. this.newOrderList = newOrderList;
  135. }
  136. } else {
  137. this.$refs.seiminModel.showChangeDept({
  138. skin: "toast",
  139. icon: "error",
  140. content: res.msg || "获取数据失败",
  141. });
  142. throw new Error(res.msg || '获取数据失败');
  143. }
  144. },
  145. },
  146. mounted() {
  147. this.init();
  148. },
  149. onPullDownRefresh() {
  150. this.init();
  151. },
  152. onReachBottom() {
  153. this.reachBottom();
  154. }
  155. }
  156. </script>
  157. <style lang="scss" scoped>
  158. .orderList {
  159. padding-top: 88rpx;
  160. padding-bottom: 108rpx;
  161. // 头部筛选
  162. .orderList_header {
  163. height: 88rpx;
  164. background-color: #fff;
  165. border-bottom: 1px solid #E5E9ED;
  166. position: fixed;
  167. top: 88rpx;
  168. left: 0;
  169. z-index: 99;
  170. width: 100%;
  171. @include flex(center, center);
  172. .orderList_header_item {
  173. flex: 1;
  174. height: 100%;
  175. padding: 0 50rpx;
  176. border-right: 1px solid #E5E9ED;
  177. @include flex(space-between, center);
  178. &:last-of-type {
  179. border-right: none;
  180. }
  181. .orderList_header_itemText {
  182. color: #333;
  183. font-size: 38rpx;
  184. }
  185. .pda-xiala {
  186. color: #DDE1E5;
  187. }
  188. }
  189. }
  190. // 列表
  191. .orderList_list {
  192. padding: 0 24rpx;
  193. .orderList_listItem {
  194. width: 702rpx;
  195. min-height: 320rpx;
  196. background-color: #fff;
  197. margin-top: 8rpx;
  198. border-radius: 8rpx;
  199. border: 2rpx solid #e5e9ed;
  200. position: relative;
  201. padding: 0 15rpx;
  202. font-size: 32rpx;
  203. @include semicircle(#f9fafb, 82rpx);
  204. @include flex(flex-start, stretch, column);
  205. .orderList_listItem_header {
  206. height: 86rpx;
  207. border-bottom: 1px dashed #e5e9ed;
  208. @include flex(space-between, center);
  209. .orderList_listItem_header_title {
  210. color: #333;
  211. @include flex(flex-start, center);
  212. .associationType_icon {
  213. width: 48rpx;
  214. height: 48rpx;
  215. border-radius: 50%;
  216. background-color: rgba(57, 177, 153, 0.3);
  217. border: 1px solid #39b199;
  218. font-size: 24rpx;
  219. color: #39b199;
  220. margin-right: 8rpx;
  221. @include flex(center, center);
  222. }
  223. }
  224. .orderList_listItem_header_more {
  225. color: #666;
  226. }
  227. }
  228. .orderList_listItem_item {
  229. height: 88rpx;
  230. border-bottom: 1px solid #e5e9ed;
  231. color: #333;
  232. font-size: 30rpx;
  233. flex: 1;
  234. @include flex(flex-start, stretch, column);
  235. &:last-of-type {
  236. border-bottom: none;
  237. }
  238. .orderList_listItem_item_content {
  239. min-height: 143rpx;
  240. flex: 1;
  241. @include flex(space-between, center);
  242. .orderList_listItem_item_name {
  243. font-size: 38rpx;
  244. font-weight: bold;
  245. }
  246. .orderList_listItem_item_time {
  247. color: #666;
  248. font-size: 28rpx;
  249. }
  250. }
  251. .orderList_listItem_item_btns {
  252. position: relative;
  253. left: -14rpx;
  254. width: 698rpx;
  255. height: 88rpx;
  256. @include btn_background;
  257. @include flex;
  258. .btn {
  259. flex: 1;
  260. background-color: transparent;
  261. border-right: 2rpx solid #fff;
  262. &:last-of-type {
  263. border-right: none;
  264. }
  265. &::after {
  266. border: none;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. }
  273. }
  274. </style>