work-order.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <view>
  3. <!-- <view class="border-bottom">
  4. <u-tabs
  5. class="p-fixed left0 right0 zIndex"
  6. :list="list"
  7. :is-scroll="false"
  8. :current="current"
  9. @change="change"
  10. ></u-tabs>
  11. </view> -->
  12. <view>
  13. <template v-if="listData.length > 0">
  14. <view
  15. class="mx3 my2 p3 bg-color-white box p-relative"
  16. v-for="(item, index) in listData"
  17. :key="index"
  18. @tap="handleDetail(item)"
  19. @longpress="showMask(item.id, $event)"
  20. >
  21. <common-mask
  22. :item="item"
  23. :maskId="maskId"
  24. @hide="maskId = 0"
  25. @del="handleDel(item.id)"
  26. />
  27. <view class="d-flex j-between border-bottom pb-2 a-center">
  28. <view class="text-color-b f-size-26">{{
  29. item.no
  30. }}</view>
  31. <view class="f-size-24 state-orange">{{
  32. statusMap[item.status]
  33. }}</view>
  34. </view>
  35. <view class="mt-2 d-flex j-between">
  36. <view class="text-color-3 f-size-32 f-weight-bold">{{
  37. item.sbName
  38. }}</view>
  39. </view>
  40. <view class="f-size-26 text-color-6 f-weight-4 mt-2">{{
  41. item.applyTime
  42. }}</view>
  43. <view class="d-flex j-end edit-box">
  44. <view
  45. class="text-color-3 f-size-32 edit"
  46. v-if="
  47. item.status ===
  48. $DictCache.VALUE
  49. .REPAIR_APPLICATION_FORM_STATUS.REBACK
  50. "
  51. >
  52. <view @click.stop="handleDealEdit(item)">接收</view>
  53. </view>
  54. <view
  55. class="text-color-3 f-size-32 edit"
  56. v-if="
  57. item.status ===
  58. $DictCache.VALUE
  59. .REPAIR_APPLICATION_FORM_STATUS.REBACK
  60. "
  61. >
  62. <view
  63. @click.stop="handleDispatching(item)"
  64. >转派</view
  65. >
  66. </view>
  67. <view
  68. class="text-color-3 f-size-32 edit"
  69. v-if="
  70. [
  71. $DictCache.VALUE
  72. .REPAIR_APPLICATION_FORM_STATUS
  73. .PROCESSING,
  74. $DictCache.VALUE
  75. .REPAIR_APPLICATION_FORM_STATUS.RETURN,
  76. ].includes(item.status)
  77. "
  78. >
  79. <view @click.stop="handleEdit(item)">维修</view>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="py3">
  84. <u-loadmore :status="status" />
  85. </view>
  86. </template>
  87. <template v-else>
  88. <view class="empty">
  89. <u-empty text="暂无数据" mode="list"></u-empty>
  90. </view>
  91. </template>
  92. </view>
  93. <u-tabbar
  94. :list="tabbar"
  95. :mid-button="true"
  96. active-color="#0082ff"
  97. ></u-tabbar>
  98. </view>
  99. </template>
  100. <script>
  101. export default {
  102. data() {
  103. return {
  104. list: [
  105. {
  106. name: '全部'
  107. },
  108. {
  109. name: '待接单'
  110. },
  111. {
  112. name: '维修中'
  113. },
  114. {
  115. name: '待验收'
  116. },
  117. {
  118. name: '已完成'
  119. }
  120. ],
  121. current: 0,
  122. // 加载更多
  123. status: 'loadmore',
  124. page: 1,
  125. limit: 10,
  126. type: '',
  127. loadMore: true,
  128. listData: [],
  129. statusMap: {},
  130. sourceMap: {},
  131. maskId: 0,
  132. tabbar: [
  133. {
  134. iconPath: '/static/tabars/home.png',
  135. pagePath: '/pages/home/home',
  136. selectedIconPath: '/static/tabars/home_s.png',
  137. text: '首页'
  138. },
  139. {
  140. iconPath: '/static/tabars/tiding.png',
  141. pagePath: '/pages/tidings/tidings',
  142. selectedIconPath: '/static/tabars/tiding_s.png',
  143. text: '消息'
  144. },
  145. {
  146. iconPath: '/static/tabars/publish.png',
  147. pagePath: '/pages/middle/middle',
  148. selectedIconPath: '/static/tabars/publish.png',
  149. text: '报修',
  150. midButton: true
  151. },
  152. {
  153. iconPath: '/static/tabars/order.png',
  154. pagePath: '/pages/work-order/work-order',
  155. selectedIconPath: '/static/tabars/order_s.png',
  156. text: '工单'
  157. },
  158. {
  159. iconPath: '/static/tabars/mine.png',
  160. pagePath: '/pages/my/my',
  161. selectedIconPath: '/static/tabars/mine_s.png',
  162. text: '我的'
  163. }
  164. ]
  165. };
  166. },
  167. onPullDownRefresh() {
  168. // 请求结束取消刷新
  169. this.page = 1;
  170. this.loadMore = true;
  171. this.listData = [];
  172. this.initData();
  173. uni.stopPullDownRefresh();
  174. },
  175. onReachBottom() {
  176. if (this.loadMore) {
  177. this.page++;
  178. this.initData();
  179. }
  180. },
  181. onLoad() {
  182. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  183. this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS
  184. );
  185. this.sourceMap = this.$DictCache.getLabelByValueMapByType(
  186. this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE
  187. );
  188. },
  189. onShow() {
  190. this.page = 1;
  191. this.loadMore = true;
  192. this.listData = [];
  193. this.initData();
  194. },
  195. onHide() {
  196. this.maskId = 0;
  197. },
  198. methods: {
  199. showMask(id, e) {
  200. this.maskId = id;
  201. // #ifdef H5
  202. e.preventDefault();
  203. // #endif
  204. },
  205. handleDel(id) {
  206. const that = this;
  207. const params = [];
  208. params.push(id);
  209. uni.showModal({
  210. title: '提示',
  211. content: '您确认删除吗?',
  212. success: (res) => {
  213. if (res.confirm) {
  214. this.$Http.deleteRepairForms(params).then((res) => {
  215. uni.showToast({ title: '删除成功' });
  216. this.page = 1;
  217. this.loadMore = true;
  218. this.listData = [];
  219. this.initData();
  220. });
  221. } else if (res.cancel) {
  222. }
  223. }
  224. });
  225. },
  226. handleDealEdit(item) {
  227. const that = this;
  228. uni.showModal({
  229. title: '提示',
  230. content: '确认接收该维修任务?',
  231. success: function (res) {
  232. if (res.confirm) {
  233. that.$Http.repairFormDeal(item).then((res) => {
  234. that.page = 1;
  235. that.loadMore = true;
  236. that.listData = [];
  237. that.initData();
  238. });
  239. }
  240. }
  241. });
  242. },
  243. handleDispatching(item) {
  244. uni.showModal({
  245. title: '提示',
  246. content: '确认转派?',
  247. success: function (res) {
  248. if (res.confirm) {
  249. console.log('用户点击确定');
  250. uni.navigateTo({
  251. url: '/pages/deliver-add/deliver-add?id=' + item.id
  252. });
  253. } else if (res.cancel) {
  254. console.log('用户点击取消');
  255. }
  256. }
  257. });
  258. },
  259. handleEdit(item) {
  260. uni.navigateTo({
  261. url: '/pages/service-add/service-add?id=' + item.id
  262. });
  263. },
  264. // tab
  265. change(index) {
  266. this.current = index;
  267. // type 做相应改变
  268. this.type = index;
  269. this.page = 1;
  270. this.loadMore = true;
  271. this.listData = [];
  272. this.initData();
  273. },
  274. // 跳转详情
  275. handleDetail(item) {
  276. // if (index == 0) {
  277. // uni.navigateTo({
  278. // url: '../service-add/service-add'
  279. // });
  280. // } else {
  281. // uni.navigateTo({
  282. // url: '../service-detail/service-detail'
  283. // });
  284. // }
  285. if (this.maskId != 0) return (this.maskId = 0);
  286. uni.navigateTo({
  287. url: '/pages/service-detail/service-detail?id=' + item.id
  288. });
  289. },
  290. initData() {
  291. const that = this;
  292. that.status = 'loading';
  293. this.$Http
  294. .getRepairApplicationFormPage({
  295. pageNum: this.page,
  296. pageSize: this.limit,
  297. filter: 0,
  298. searchType: 2,
  299. dataScope: {
  300. sortBy: 'desc',
  301. sortName: 'update_time'
  302. }
  303. })
  304. .then((res) => {
  305. const data = res.data.rows;
  306. console.log(res);
  307. if (data && data.length > 0 && data.length < that.limit) {
  308. that.status = 'nomore';
  309. that.loadMore = false;
  310. } else if (data.length == that.limit) {
  311. that.status = 'loadmore';
  312. } else {
  313. that.status = 'nomore';
  314. }
  315. that.listData = [...that.listData, ...data];
  316. });
  317. }
  318. }
  319. };
  320. </script>
  321. <style lang="scss">
  322. page {
  323. background-color: #f4f4f4;
  324. }
  325. .box {
  326. padding-right: 0;
  327. border-radius: 20rpx;
  328. }
  329. .edit-box {
  330. padding: 0 30rpx;
  331. margin-top: 40rpx;
  332. .edit {
  333. padding: 8rpx 40rpx;
  334. border: 1px solid #ddd;
  335. border-radius: 20rpx;
  336. font-size: 26rpx;
  337. color: #666;
  338. margin-left: 30rpx;
  339. }
  340. }
  341. </style>