index.vue 7.5 KB

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