index.vue 9.6 KB

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