index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="售后工单"
  4. @clickLeft="back">
  5. </uni-nav-bar>
  6. <view class="top-wrapper">
  7. <uni-section>
  8. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
  9. </uni-easyinput>
  10. </uni-section>
  11. <button class="search_btn" @click="doSearch">搜索</button>
  12. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  13. </view>
  14. <view class="">
  15. <view class="tab_box rx-sc">
  16. <view class="tab_item" v-for="(item,index) in tabList" :key="index"
  17. :class="{active: pickTabIndex == item.value}">
  18. <view @click="changeChartsTab(item.value)">
  19. {{item.label}}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="wrapper">
  25. <u-list @scrolltolower="scrolltolower" class="listContent" style="height: auto;">
  26. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  27. <myCard @addSpareItems="addSpareItems(item.id)" @report="edit('report',item.id)"
  28. @edit="edit('edit',item.id)" @details="edit('view',item.id)"
  29. @checkAndAccept="checkAndAccept(item)" @evaluate="evaluate(item)"
  30. :item="item" :index="index+1" :columns="columns" :btnList="btnList">
  31. </myCard>
  32. </view>
  33. </u-list>
  34. </view>
  35. <CheckAndAccept ref="acceptRef" @getList='doSearch' />
  36. <Evaluate ref="evaluateRef" @getList='doSearch' />
  37. <u-toast ref="uToast"></u-toast>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. getSalesWorkOrder,
  43. } from '@/api/salesServiceManagement/workOrder/index.js'
  44. import myCard from '@/pages/saleManage/components/myCard.vue'
  45. import CheckAndAccept from './components/forWork/checkAndAccept.vue'
  46. import Evaluate from './components/forWork/evaluate.vue'
  47. export default {
  48. components: {
  49. myCard,
  50. CheckAndAccept,
  51. Evaluate
  52. },
  53. data() {
  54. return {
  55. tabList: [{
  56. value: 'all',
  57. label: '全部',
  58. },
  59. {
  60. value: '0',
  61. label: '待执行',
  62. },
  63. {
  64. value: '1',
  65. label: '执行中',
  66. },
  67. {
  68. value: '3',
  69. label: '待验收',
  70. },
  71. {
  72. value: '5',
  73. label: '已完成',
  74. },
  75. ],
  76. workOrderStatus: [
  77. // { code: 0, label: '待接收' },
  78. {
  79. code: 0,
  80. label: '待执行'
  81. },
  82. {
  83. code: 1,
  84. label: '已接收'
  85. },
  86. {
  87. code: 2,
  88. label: '执行中'
  89. },
  90. {
  91. code: 3,
  92. label: '待验收'
  93. },
  94. {
  95. code: 4,
  96. label: '待评价'
  97. },
  98. {
  99. code: 5,
  100. label: '已完成'
  101. },
  102. {
  103. code: 6,
  104. label: '验收不通过'
  105. }
  106. ],
  107. pickTabIndex: 'all',
  108. searchVal: '',
  109. isEnd: false,
  110. page: 1,
  111. size: 10,
  112. tableList: [],
  113. columns: [
  114. [{
  115. label: '工单编号:',
  116. prop: 'code',
  117. type: 'title',
  118. className: 'perce100',
  119. }],
  120. [{
  121. label: '计划单号:',
  122. prop: 'planCode'
  123. }, ],
  124. [{
  125. label: '计划名称:',
  126. prop: 'planName',
  127. }],
  128. [{
  129. label: '报工人:',
  130. prop: 'executeUserName'
  131. }, {
  132. label: '验收人:',
  133. prop: 'accepterUserName',
  134. }],
  135. [{
  136. label: '故障等级:',
  137. prop: 'faultLevel'
  138. }, {
  139. label: '客户名称:',
  140. prop: 'contactName',
  141. }],
  142. [{
  143. label: '设备名称:',
  144. prop: 'categoryName',
  145. formatter: (row) => {
  146. if (!row.deviceDetails) return '';
  147. let str = '';
  148. row.deviceDetails.map((el, idx) => {
  149. if (idx + 1 == row.deviceDetails.length) {
  150. str += el.categoryName;
  151. } else {
  152. str = str + '' + el.categoryName + ',';
  153. }
  154. });
  155. return str;
  156. }
  157. }],
  158. [{
  159. label: '验收时间:',
  160. prop: 'accepterTime'
  161. }, {
  162. label: '开始时间:',
  163. prop: 'acceptTime',
  164. }],
  165. [{
  166. label: '结束时间:',
  167. prop: 'finishTime'
  168. }, {
  169. label: '计划完成时间:',
  170. prop: 'planFinishTime',
  171. }],
  172. [{
  173. label: '实际售后时长:',
  174. prop: 'inFactDuration',
  175. formatter: (row) => {
  176. if (row.inFactDuration || row.inFactDuration == 0) {
  177. let str = ((row.inFactDuration - 0) / 60).toFixed(1);
  178. return str + ' 小时';
  179. }
  180. }
  181. }, {
  182. label: '状态:',
  183. prop: 'orderStatus',
  184. formatter: (row) => {
  185. return this.workOrderStatus.find(
  186. (item) => item.code == row.orderStatus
  187. )?.label;
  188. }
  189. }],
  190. [{
  191. label: '操作:',
  192. prop: 'action',
  193. type: 'action',
  194. className: 'perce100',
  195. }],
  196. ],
  197. btnList: [{
  198. name: '详情',
  199. apiName: 'details',
  200. btnType: 'primary',
  201. type: '2',
  202. pageUrl: '',
  203. }, {
  204. name: '修改',
  205. apiName: 'edit',
  206. btnType: 'primary',
  207. type: '2',
  208. pageUrl: '',
  209. judge: [{
  210. authorities: '',
  211. }, {
  212. key: 'orderStatus',
  213. value: [1, 6],
  214. }],
  215. },
  216. {
  217. name: '报工',
  218. apiName: 'report',
  219. btnType: 'error ',
  220. type: '2',
  221. pageUrl: '',
  222. judge: [{
  223. authorities: '',
  224. }, {
  225. key: 'orderStatus',
  226. value: [1, 6],
  227. }],
  228. }, {
  229. name: '转派',
  230. apiName: 'handleAudit',
  231. btnType: 'primary',
  232. type: '2',
  233. pageUrl: '',
  234. judge: [{
  235. authorities: '',
  236. }, {
  237. key: 'orderStatus',
  238. value: [0, 1],
  239. }],
  240. },
  241. {
  242. name: '验收',
  243. apiName: 'checkAndAccept',
  244. btnType: 'primary',
  245. type: '2',
  246. pageUrl: '',
  247. judge: [{
  248. authorities: '',
  249. }, {
  250. key: 'orderStatus',
  251. value: [3, 6],
  252. }],
  253. },
  254. {
  255. name: '评价',
  256. apiName: 'evaluate',
  257. btnType: 'primary',
  258. type: '2',
  259. pageUrl: '',
  260. judge: [{
  261. authorities: '',
  262. }, {
  263. key: 'orderStatus',
  264. value: [4],
  265. }],
  266. },
  267. {
  268. name: '申请配件',
  269. apiName: 'addSpareItems',
  270. btnType: 'primary',
  271. type: '2',
  272. pageUrl: '',
  273. judge: [{
  274. authorities: '',
  275. }, {
  276. key: 'orderStatus',
  277. value: [1, 2],
  278. }],
  279. },
  280. ],
  281. }
  282. },
  283. computed: {},
  284. onShow() {
  285. this.isEnd = false
  286. this.page = 1
  287. this.getList()
  288. },
  289. methods: {
  290. changeChartsTab(value) {
  291. this.pickTabIndex = value;
  292. this.doSearch();
  293. },
  294. doSearch() {
  295. this.isEnd = false
  296. this.page = 1
  297. this.getList()
  298. },
  299. //获取列表信息
  300. getList() {
  301. if (this.isEnd) {
  302. return
  303. }
  304. uni.showLoading({
  305. title: '加载中'
  306. })
  307. let data = {
  308. pageNum: this.page,
  309. size: this.size,
  310. }
  311. if (this.pickTabIndex != 'all') {
  312. data.orderStatus = this.pickTabIndex;
  313. }
  314. getSalesWorkOrder(data).then(res => {
  315. if (this.page === 1) {
  316. this.tableList = res.list
  317. } else {
  318. this.tableList.push(...res.list)
  319. }
  320. this.page += 1
  321. this.isEnd = this.tableList.length >= res.count;
  322. uni.hideLoading();
  323. }).catch((e) => {
  324. uni.hideLoading();
  325. })
  326. },
  327. scrolltolower() {
  328. if (this.isEnd) {
  329. return
  330. }
  331. this.getList();
  332. },
  333. // 申请配件
  334. addSpareItems(id) {
  335. uni.navigateTo({
  336. url: `/pages/salesServiceManagement/workOrder/components/accessory?id=${id}`
  337. })
  338. },
  339. // 验收
  340. checkAndAccept(item){
  341. this.$refs.acceptRef.open(item.id);
  342. },
  343. // 评价
  344. evaluate(item){
  345. this.$refs.evaluateRef.open(item.id);
  346. },
  347. edit(type, id) {
  348. console.log(type, 'type');
  349. uni.navigateTo({
  350. url: `/pages/salesServiceManagement/workOrder/components/editPlan?type=${type}&id=${id}`
  351. })
  352. }
  353. }
  354. }
  355. </script>
  356. <style lang="scss" scoped>
  357. .top-wrapper {
  358. background-color: #fff;
  359. display: flex;
  360. width: 750rpx;
  361. height: 88rpx;
  362. padding: 16rpx 32rpx;
  363. align-items: center;
  364. gap: 16rpx;
  365. /deep/.uni-section {
  366. margin-top: 0px;
  367. }
  368. /deep/.uni-section-header {
  369. padding: 0px;
  370. }
  371. .search_btn {
  372. width: 120rpx;
  373. height: 70rpx;
  374. line-height: 70rpx;
  375. padding: 0 24rpx;
  376. background: $theme-color;
  377. font-size: 32rpx;
  378. color: #fff;
  379. margin: 0;
  380. margin-left: 26rpx;
  381. }
  382. .menu_icon {
  383. width: 44rpx;
  384. height: 44rpx;
  385. margin-left: 14rpx;
  386. }
  387. }
  388. .tab_box {
  389. width: 100%;
  390. height: 68rpx;
  391. border-bottom: 1rpx solid #E1E1E1;
  392. .tab_item {
  393. height: 68rpx;
  394. line-height: 68rpx;
  395. padding: 0 20rpx;
  396. font-size: 32rpx;
  397. color: #979C9E;
  398. }
  399. .active {
  400. box-sizing: border-box;
  401. border-bottom: 6rpx solid $theme-color;
  402. color: $theme-color;
  403. }
  404. }
  405. </style>