index.vue 12 KB

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