index.vue 12 KB

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