workOrder.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view class="page">
  3. <view class="allArea">
  4. <view class="area1">
  5. <text class="arear-text" @click="tanKuang">{{list[curVal].text}}</text>
  6. <image src="../../static/down.png" mode=""></image>
  7. </view>
  8. </view>
  9. <view class="tabbar">
  10. <view @click="select(0)" :class="tabIndex==0 ? 'active' : ''">
  11. <text>未认领</text>
  12. </view>
  13. <view @click="select(1)" :class="tabIndex==1 ? 'active' : ''">
  14. <text>处理中</text>
  15. </view>
  16. <view @click="select(2)" :class="tabIndex==2 ? 'active' : ''">
  17. <text>已处理</text>
  18. </view>
  19. <view @click="select(3)" :class="tabIndex==3 ? 'active' : ''">
  20. <text>已完成</text>
  21. </view>
  22. </view>
  23. <view class="content">
  24. <view class="list" v-for="(item,index1) in workList" :key="index1" @click="wordDetail(item.id)">
  25. <view class="reason">{{item.reason?item.reason:item.type_name}}</view>
  26. <view class="type " v-if="item.type_name=='充电工单'" style="background: linear-gradient(163deg, #68e9ce 0%, #18d5b9 100%);">
  27. {{item.type_name}}({{item.times}}次)
  28. </view>
  29. <view class="type" v-if="item.type_name=='断电工单'" style="background: linear-gradient(163deg, #ff6477 0%, #ff7a69 100%);">
  30. {{item.type_name}}({{item.times}}次)
  31. </view>
  32. <view class="type" v-if="item.type_name=='组长工单'" style="background: linear-gradient(163deg, #41b8fd 0%, #0ee7fe 100%);">
  33. {{item.type_name}}({{item.times}}次)
  34. </view>
  35. <view class="type" v-if="item.type_name=='偷盗工单'" style="background: linear-gradient(163deg, #ff8b66 0%, #fe5722 100%);">
  36. {{item.type_name}}({{item.times}}次)
  37. </view>
  38. <view class="type" v-if="item.type_name=='离线工单'" style="background: linear-gradient(163deg, #FF8CC7 0%, #F232A3 100%);">
  39. {{item.type_name}}({{item.times}}次)
  40. </view>
  41. <view class="type" v-if="item.type_name=='救援工单'" style="background: linear-gradient(163deg, #9382f4 0%, #a297fb 100%);">
  42. {{item.type_name}}({{item.times}}次)
  43. </view>
  44. <view class="type" v-if="item.type_name=='断电工单'" style="background: linear-gradient(163deg, #ff6477 0%, #ff7a69 100%);">
  45. {{item.type_name}}({{item.times}}次)
  46. </view>
  47. <view class="type" v-if="item.type_name=='警报工单'" style="background: linear-gradient(163deg, #FF9854 0%, #FFC573 100%);">
  48. {{item.type_name}}({{item.times}}次)
  49. </view>
  50. <view class="type" v-if="item.type_name=='故障工单'" style="background: linear-gradient(163deg, #D684DD 0%, #F7A7EC 100%);">
  51. {{item.type_name}}({{item.times}}次)
  52. </view>
  53. <view class="type" v-if="item.type_name=='其他工单'" style="background: linear-gradient(163deg, #47DDA8 0%, #61F79C 100%);">
  54. {{item.type_name}}({{item.times}}次)
  55. </view>
  56. <view class="type" v-if="item.type_name=='查看工单'" style="background: linear-gradient(163deg, #88B9E1 0%, #004FB6 100%);">
  57. {{item.type_name}}({{item.times}}次)
  58. </view>
  59. <view class="flexB" style="margin-top:0;">
  60. <view>
  61. <view>车辆编号:{{item.bike_no}}</view>
  62. <view>更新时间:{{item.updated_at}}</view>
  63. <!-- <view>次数:20</view> -->
  64. </view>
  65. <view style="margin-right:50upx;">
  66. <view>进度:{{item.planned}}</view>
  67. <view>来源:{{item.source}}</view>
  68. <!-- <view>查看详情</view> -->
  69. </view>
  70. </view>
  71. </view>
  72. <view class="noData" v-if="workList.length == 0">
  73. <image src="http://resource.bike.hanyiyun.com/none.png"></image>
  74. <view>暂无相关数据~</view>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. var app = getApp();
  81. let touchDotX = 0; //X按下时坐标
  82. let touchDotY = 0; //y按下时坐标
  83. let interval; //计时器
  84. let time = 0;
  85. export default {
  86. data() {
  87. return {
  88. active: 0,
  89. workList: [], //工单列表
  90. page: 1,
  91. current: 4,
  92. option1: [], //区域选择
  93. value1: 0, //第一个显示什么
  94. areaID: '',
  95. url: '',
  96. screenHeight: '', //屏幕可视高度
  97. tabIndex: 0,
  98. list: [{ //所有区域选项
  99. areaID: '',
  100. text: '全部区域',
  101. value: -1,
  102. }], //骑行区域选择列表
  103. curVal: uni.getStorageSync('curVal') ? uni.getStorageSync('curVal') : 0, //骑行区与第一个下标
  104. }
  105. },
  106. methods: {
  107. select: function(e) {
  108. console.log(e)
  109. this.tabIndex = e;
  110. this.workList = '';
  111. this.page = 1;
  112. this.getWork();
  113. this.goTop();
  114. },
  115. tanKuang: function() {
  116. var that = this;
  117. var arr = []
  118. for (let i = 0; i<this.list.length; i++) {
  119. arr = arr.concat(this.list[i].text)
  120. }
  121. console.log(arr)
  122. uni.showActionSheet({
  123. itemList: arr,
  124. success: function(res) {
  125. let index = res.tapIndex
  126. that.areaID = that.list[index].areaID;
  127. that.curVal = res.tapIndex
  128. console.log(that.list[index].areaID, "66666");
  129. console.log('选中了第' + res.tapIndex + '个按钮');
  130. that.getWork();
  131. that.goTop();
  132. // that.allData()
  133. // that.tabList()
  134. },
  135. fail: function(res) {}
  136. })
  137. },
  138. scanCode: function() {
  139. uni.redirectTo({
  140. url: '/pages/logs/logs?scan=' + 1,
  141. })
  142. },
  143. getWork: function() {
  144. uni.showLoading({
  145. title: '加载中',
  146. })
  147. let that = this;
  148. let planned = '';
  149. let url = "";
  150. let data = '&&put_area_id=' + that.areaID
  151. if (this.tabIndex == 0) {
  152. planned = 1
  153. url = "work_order/list?planned=" + planned + data
  154. } else if (this.tabIndex == 1) {
  155. planned = 2
  156. url = "work_order/myWorkOrderList?planned=" + planned + data
  157. } else if (this.tabIndex == 2) {
  158. planned = 3
  159. url = "work_order/myWorkOrderList?planned=" + planned + data
  160. } else if (this.tabIndex == 3) {
  161. planned = 4
  162. url = "work_order/myWorkOrderList?planned=" + planned + data
  163. }
  164. app.request(url, '', 'GET').then(res => {
  165. console.log(res, '工单')
  166. console.log(url)
  167. uni.hideLoading();
  168. this.workList = res.data.data
  169. })
  170. },
  171. //回到顶部
  172. goTop: function(e) { // 一键回到顶部
  173. if (uni.pageScrollTo) {
  174. uni.pageScrollTo({
  175. scrollTop: 0
  176. })
  177. }
  178. },
  179. wordDetail: function(e) {
  180. //工单详情
  181. console.log(e)
  182. uni.navigateTo({
  183. url: '/pages/manage/workDetail?id=' + e,
  184. })
  185. },
  186. },
  187. onLoad: function(options) {
  188. let that = this;
  189. var arr = uni.getStorageSync('allArea');
  190. this.list = this.list.concat(arr);
  191. that.option1 = uni.getStorageSync('allArea')
  192. let curVal = uni.getStorageSync('curVal')
  193. if (curVal) {
  194. that.value1 = curVal
  195. }
  196. let areaID = uni.getStorageSync('curId')
  197. if (areaID) {
  198. that.areaID = areaID
  199. } else {
  200. let id = that.option1[0].areaID
  201. that.areaID = id;
  202. }
  203. that.getWork();
  204. },
  205. onPullDownRefresh: function() {
  206. uni.showNavigationBarLoading();
  207. this.getWork(), uni.hideNavigationBarLoading(), uni.stopPullDownRefresh();
  208. },
  209. onReachBottom: function() {
  210. var that = this;
  211. uni.showLoading({
  212. title: '加载中',
  213. })
  214. let planned = '';
  215. var page = that.page + 1
  216. if (that.tabIndex == 0) {
  217. planned = 1
  218. } else if (that.tabIndex == 1) {
  219. planned = 2
  220. } else if (that.tabIndex == 2) {
  221. planned = 3
  222. } else if (that.tabIndex == 3) {
  223. planned = 4
  224. }
  225. let url = 'work_order/list?planned=' + planned + '&&put_area_id=' + that.areaID + '&&page=' + page
  226. app.request(url, '', 'GET').then(res => {
  227. console.log(res)
  228. uni.hideLoading()
  229. if (res.statusCode == 200) {
  230. if (res.data.data.length > 0) {
  231. that.workList = that.workList.concat(res.data.data);
  232. that.page = page;
  233. } else {
  234. uni.showToast({
  235. title: '没有更多了~',
  236. icon: 'none'
  237. })
  238. }
  239. }
  240. })
  241. },
  242. onShareAppMessage: function() {
  243. return {
  244. title: '轻松出行,方便你我',
  245. path: '/pages/login/login',
  246. success: function(res) {}
  247. }
  248. }
  249. }
  250. </script>
  251. <style>
  252. .page {
  253. width: 100%;
  254. height: 100%;
  255. position: relative;
  256. z-index: 888;
  257. background: #fff;
  258. }
  259. .content {
  260. margin-top: 220upx !important;
  261. display: flex;
  262. flex-direction: column;
  263. align-items: center;
  264. }
  265. .list {
  266. width: 92%;
  267. margin: 20upx auto;
  268. border: 2upx solid #d8d8d8;
  269. border-radius: 10upx;
  270. padding: 20upx;
  271. position: relative;
  272. box-shadow: 0 0 6upx 0 rgba(216, 216, 216, 1);
  273. box-sizing: border-box;
  274. }
  275. .list view {
  276. font-size: 24upx;
  277. color: #4d4d4d;
  278. margin-top: 15upx;
  279. }
  280. .list .reason {
  281. font-size: 28upx;
  282. color: #282828;
  283. }
  284. .list .type {
  285. /* width: 168upx; */
  286. padding: 0 10upx;
  287. height: 42upx;
  288. color: #fff;
  289. font-size: 22upx;
  290. text-align: center;
  291. position: absolute;
  292. top: -15upx;
  293. right: 0;
  294. border-radius: 0 2upx 0 20upx;
  295. display: flex;
  296. justify-content: center;
  297. align-items: center;
  298. }
  299. .tabbar {
  300. width: 100%;
  301. display: flex;
  302. align-items: center;
  303. position: fixed;
  304. top: 120upx;
  305. left: 0;
  306. height: 100upx;
  307. background: #FFFFFF;
  308. z-index: 999;
  309. color: #000000;
  310. }
  311. .tabbar view {
  312. width: 25%;
  313. display: flex;
  314. align-items: center;
  315. justify-content: center;
  316. height: 100%;
  317. font-size: 28upx;
  318. }
  319. .active {
  320. color: #FF0000 !important;
  321. }
  322. .noData {
  323. position: fixed;
  324. top: 50%;
  325. left: 50%;
  326. transform: translate(-50%, -50%);
  327. }
  328. .noData image {
  329. width: 200upx;
  330. height: 200upx;
  331. }
  332. .noData view {
  333. width: 100%;
  334. text-align: center;
  335. font-size: 28upx;
  336. margin-top: 20upx;
  337. }
  338. .allArea {
  339. display: inline-block;
  340. position: fixed;
  341. padding-left: 35upx;
  342. height: 120upx;
  343. font-size: 34upx;
  344. line-height: 150upx;
  345. background-color: #FFFFFF;
  346. top: 0upx;
  347. z-index: 1000;
  348. width: 100%;
  349. }
  350. .allArea image {
  351. display: inline-block;
  352. vertical-align: middle;
  353. margin-left: 20upx;
  354. height: 40upx;
  355. width: 40upx;
  356. }
  357. </style>