index.uvue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. <template>
  2. <uni-navbar-lite :showLeft=false title="工单"></uni-navbar-lite>
  3. <view class="list-page">
  4. <!-- 搜索栏 -->
  5. <view class="search-bar">
  6. <view class="search-box">
  7. <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
  8. <input class="search-input" type="text" placeholder="搜索工单编码、风机编号" v-model="keyword" @confirm="handleSearch" @blur="handleSearch" />
  9. <text v-if="keyword.length > 0" class="clear-icon" @click="clearSearch">✕</text>
  10. </view>
  11. </view>
  12. <view class="status-bar">
  13. <scroll-view class="scroll-view_H" direction="horizontal" show-scrollbar="false">
  14. <view class="scroll-view-item_H uni-bg-red">
  15. <text class="status-txt" :class="{'stauts-sel': currentStatus === 'all'}" @click="switchStatus('all')">全部</text>
  16. </view>
  17. <!-- <view class="scroll-view-item_H uni-bg-green" v-if="checkPermi(['gxt:maintenance:order:edit','gxt:repairOrder:edit']) && !dealLoad">
  18. <text class="status-txt" :class="{'stauts-sel': currentStatus === 'to_issue,accept_return'}" @click="switchStatus('to_issue,accept_return')">待下发</text>
  19. </view> -->
  20. <view class="scroll-view-item_H uni-bg-green" v-if="checkPermi(['gxt:maintenance:order:accept','gxt:repairOrder:accept']) && !dealLoad">
  21. <text class="status-txt" :class="{'stauts-sel': currentStatus === 'assigned'}" @click="switchStatus('assigned')">待接单</text>
  22. </view>
  23. <view class="scroll-view-item_H" v-if="checkPermi(['gxt:maintenance:order:suspend','gxt:repairOrder:suspend']) && !dealLoad">
  24. <text class="status-txt" :class="{'stauts-sel': currentStatus === 'to_finish'}" @click="switchStatus('to_finish')">待结单</text>
  25. </view>
  26. <view class="scroll-view-item_H" v-if="checkPermi(['gxt:maintenance:order:approve','gxt:repairOrder:approve']) && !dealLoad">
  27. <text class="status-txt" :class="{'stauts-sel': currentStatus === 'to_approve'}" @click="switchStatus('to_approve')">待审批</text>
  28. </view>
  29. <view class="scroll-view-item_H" v-if="checkPermi(['gxt:maintenance:order:resume','gxt:repairOrder:resume']) && !dealLoad">
  30. <text class="status-txt" :class="{'stauts-sel': currentStatus === 'suspended'}" @click="switchStatus('suspended')">已挂起</text>
  31. </view>
  32. <view class="scroll-view-item_H" v-if="checkPermi(['gxt:maintenance:order:restart','gxt:repairOrder:restart']) && !dealLoad">
  33. <text class="status-txt" :class="{'stauts-sel': currentStatus === 'completed'}" @click="switchStatus('completed')">已完成</text>
  34. </view>
  35. <view class="scroll-view-item_H" v-if="dealLoad">
  36. <text class="status-txt" :class="{'stauts-sel': currentStatus === 'pending'}" @click="switchStatus('pending')">待处理</text>
  37. </view>
  38. </scroll-view>
  39. </view>
  40. <!-- 列表内容 -->
  41. <common-list
  42. :dataList="dataList"
  43. :loading="loading"
  44. :refreshing="refreshing"
  45. :hasMore="hasMore"
  46. @refresh="handleRefresh"
  47. @loadMore="loadMore"
  48. @itemClick="handleItemClick"
  49. >
  50. <template #default="{ item, index }">
  51. <view class="list-item">
  52. <view class="item-container">
  53. <view class="item-header">
  54. <!-- <image class="location-icon" src="/static/images/workbench/list/2.png" mode="aspectFit"></image>
  55. <text class="item-title">{{ getOrderType(item) }}</text>
  56. <text class="detail-link">类型 ›</text> -->
  57. <text class="item-title">{{ getWorkOrderProjectNo(item) }}-{{ getPcsDeviceName(item) }}{{ getOrderType(item) }}</text>
  58. <text class="status-tag" :class="getStatusClass(item)">{{ getWorkOrderStatus(item) }}</text>
  59. </view>
  60. <view class="info-row">
  61. <view class="info-label">
  62. <text class="text-gray">{{ getDisplayTime(item) }}</text>
  63. </view>
  64. <view class="info-value">
  65. <button
  66. v-if="getOrderStatus(item) == 'assigned' && canHandleOrder(item)"
  67. class="btn-primary info-value"
  68. @click.stop="handleItemClick(item)"
  69. >
  70. 接单
  71. </button>
  72. <button
  73. v-else-if="getOrderStatus(item) == 'to_approve' && canHandleOrder(item)"
  74. class="btn-primary info-value"
  75. @click.stop="handleItemClick(item)"
  76. >
  77. 审批
  78. </button>
  79. <button
  80. v-else-if="getOrderStatus(item) == 'to_finish' && canHandleOrder(item)"
  81. class="btn-primary info-value"
  82. @click.stop="handleItemClick(item)"
  83. >
  84. 挂起
  85. </button>
  86. <button
  87. v-else-if="getOrderStatus(item) == 'suspended' && canHandleOrder(item)"
  88. class="btn-primary info-value"
  89. @click.stop="handleItemClick(item)"
  90. >
  91. 恢复
  92. </button>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. </common-list>
  99. <custom-tabbar :current="1" />
  100. </view>
  101. </template>
  102. <script setup lang="uts">
  103. import { ref, onBeforeUnmount, onMounted } from 'vue'
  104. import type { acceptOrderInfo } from '../../types/order'
  105. import type { SysDictData, DictDataResponse } from '../../types/dict'
  106. import { getOrderList } from '../../api/order/list'
  107. import { getDictDataByType } from '../../api/dict/index'
  108. import {checkPermi} from '../../utils/storage'
  109. // 列表数据
  110. const dataList = ref<acceptOrderInfo[]>([])
  111. let keyword = ref<string>("")
  112. const page = ref<number>(1)
  113. const pageSize: number = 10
  114. const hasMore = ref<boolean>(true)
  115. const loading = ref<boolean>(false)
  116. const refreshing = ref<boolean>(false)
  117. const total = ref<number>(0)
  118. let currentStatus = ref<string>('') // 添加状态管理
  119. const statusDictList = ref<SysDictData[]>([]) // 工单状态字典列表
  120. // 添加字典加载状态
  121. const dictLoaded = ref<boolean>(false)
  122. // 待处理工单加载
  123. const dealLoad = ref<boolean>(false)
  124. type StatusItem = {
  125. key: string,
  126. permis: string[],
  127. condition: () => boolean
  128. }
  129. const statusConfig: StatusItem[] = [
  130. { key: 'all', permis: ['gxt:order:all'], condition: () => !dealLoad.value },
  131. { key: 'assigned', permis: ['gxt:maintenance:order:accept','gxt:repairOrder:accept'], condition: () => !dealLoad.value },
  132. { key: 'to_finish', permis: ['gxt:maintenance:order:suspend','gxt:repairOrder:suspend'], condition: () => !dealLoad.value },
  133. { key: 'to_approve', permis: ['gxt:maintenance:order:approve','gxt:repairOrder:approve'], condition: () => !dealLoad.value },
  134. { key: 'suspended', permis: ['gxt:maintenance:order:resume','gxt:repairOrder:resume'], condition: () => !dealLoad.value },
  135. { key: 'completed', permis: ['gxt:maintenance:order:restart','gxt:repairOrder:restart'], condition: () => !dealLoad.value }
  136. ]
  137. const getOrderStatus = (item: any | null): string => {
  138. if (item == null) return ''
  139. const orderItem = item as acceptOrderInfo
  140. return orderItem.workOrderStatus ?? ''
  141. }
  142. // 获取工单状态字典列表
  143. const loadStatusDictList = async (): Promise<void> => {
  144. try {
  145. const result = await getDictDataByType('gxt_work_order_status')
  146. const resultObj = result as UTSJSONObject
  147. if (resultObj['code'] == 200) {
  148. const data = resultObj['data'] as any[]
  149. const dictData: SysDictData[] = []
  150. if (data.length > 0) {
  151. for (let i = 0; i < data.length; i++) {
  152. const item = data[i] as UTSJSONObject
  153. // 只提取需要的字段
  154. const dictItem: SysDictData = {
  155. dictValue: item['dictValue'] as string | null,
  156. dictLabel: item['dictLabel'] as string | null,
  157. dictCode: null,
  158. dictSort: null,
  159. dictType: null,
  160. cssClass: null,
  161. listClass: null,
  162. isDefault: null,
  163. status: null,
  164. default: null,
  165. createTime: null,
  166. remark: null
  167. }
  168. dictData.push(dictItem)
  169. }
  170. }
  171. statusDictList.value = dictData
  172. dictLoaded.value = true
  173. }
  174. } catch (e: any) {
  175. console.error('获取工单状态字典失败:', e.message)
  176. dictLoaded.value = true
  177. }
  178. }
  179. const getFirstVisibleStatus = (): string => {
  180. for (const item of statusConfig) {
  181. const hasPerm = item.permis.length === 0 || checkPermi(item.permis)
  182. const meetsCondition = item.condition()
  183. if (hasPerm && meetsCondition) {
  184. // if (hasPerm) {
  185. return item.key as string
  186. }
  187. }
  188. return 'all' // fallback,理论上不会走到这里
  189. }
  190. let loadCount = 0
  191. // 加载列表数据
  192. const loadData = async (isRefresh: boolean | null): Promise<void> => {
  193. const id = ++loadCount
  194. console.log(`【loadData #${id}】开始, isRefresh=${isRefresh}`)
  195. if (loading.value) {
  196. // 如果正在加载,直接重置刷新状态
  197. refreshing.value = false
  198. return
  199. }
  200. try {
  201. loading.value = true
  202. // 处理默认值
  203. const shouldRefresh = isRefresh != null ? isRefresh : false
  204. if (shouldRefresh) {
  205. page.value = 1
  206. }
  207. // 调用 API,传递关键字参数
  208. const searchKeyword = keyword.value.length > 0 ? keyword.value : null
  209. const result = await getOrderList(page.value, pageSize, searchKeyword, currentStatus.value)
  210. // 提取响应数据
  211. const resultObj = result as UTSJSONObject
  212. const code = resultObj['code'] as number
  213. const responseData = resultObj['rows'] as any[]
  214. const responseTotal = resultObj['total'] as number
  215. if (code == 200) {
  216. // 将 any[] 转换为 acceptOrderInfo[]
  217. const newData: acceptOrderInfo[] = []
  218. for (let i = 0; i < responseData.length; i++) {
  219. const item = responseData[i] as UTSJSONObject
  220. const orderItem: acceptOrderInfo = {
  221. orderType: item['orderType'] as Number,
  222. id: item['id'] as Number,
  223. teamLeaderId: item['teamLeaderId'] != null ? (item['teamLeaderId'] as Number) : 0,
  224. acceptUserId: item['acceptUserId'] != null ? (item['acceptUserId'] as Number) : 0,
  225. teamLeaderName: item['teamLeaderName'] as string | null,
  226. acceptUserName: item['acceptUserName'] as string | null,
  227. acceptTime: item['acceptTime'] as string | null,
  228. assignTime: item['assignTime'] as string | null,
  229. assignUserName: item['assignUserName'] as string | null,
  230. status: (item['status']==null)?0:item['status'] as Number,
  231. workOrderProjectNo: item['workOrderProjectNo'] as string | null,
  232. workOrderStatus: item['workOrderStatus'] as string | null,
  233. gxtCenterId: item['gxtCenterId'] as Number | 0,
  234. gxtCenter: item['gxtCenter'] as string | null,
  235. pcsStationId: item['pcsStationId'] as Number | 0,
  236. pcsStationName: item['pcsStationName'] as string | null,
  237. pcsDeviceId: item['pcsDeviceId'] as Number | 0,
  238. pcsDeviceName: item['pcsDeviceName'] as string | null,
  239. brand: item['brand'] as string | null,
  240. model: item['model'] as string | null,
  241. createTime: item['createTime'] as string | null,
  242. suspendReason: item['suspendReason'] as string | null,
  243. rejectionReason: item['rejectionReason'] as string | null,
  244. updateTime: item['updateTime'] as string | null, // 新增字段
  245. workEndTime: item['workEndTime'] as string | null // 新增字段
  246. }
  247. newData.push(orderItem)
  248. }
  249. // 不再在前端过滤,直接使用API返回的数据
  250. if (shouldRefresh) {
  251. dataList.value = newData
  252. } else {
  253. dataList.value = [...dataList.value, ...newData]
  254. }
  255. total.value = responseTotal
  256. hasMore.value = dataList.value.length < responseTotal
  257. // 通知首页更新待接单数量
  258. if (currentStatus.value === 'assigned') {
  259. uni.$emit('refreshAssignedCount')
  260. }
  261. } else {
  262. const msg = resultObj['msg'] as string | null
  263. uni.showToast({
  264. title: msg ?? '加载失败',
  265. icon: 'none'
  266. })
  267. }
  268. } catch (e: any) {
  269. uni.showToast({
  270. title: e.message ?? '加载失败',
  271. icon: 'none'
  272. })
  273. } finally {
  274. loading.value = false
  275. // #ifdef WEB
  276. // Web 平台立即重置
  277. refreshing.value = false
  278. // #endif
  279. // #ifndef WEB
  280. // App 平台延迟重置刷新状态,确保 UI 更新
  281. setTimeout(() => {
  282. refreshing.value = false
  283. }, 100)
  284. // #endif
  285. }
  286. // #ifdef WEB
  287. // Web 平台额外确保重置
  288. refreshing.value = false
  289. // #endif
  290. }
  291. // 辅助函数:从 any 类型提取属性
  292. const getOrderType = (item: any | null): string => {
  293. if (item == null) return ''
  294. const orderInfoItem = item as acceptOrderInfo
  295. return orderInfoItem.orderType == 1?"维修工单":"维保工单";
  296. }
  297. const getWorkOrderProjectNo = (item: any | null): string | null => {
  298. if (item == null) return ''
  299. const orderInfoItem = item as acceptOrderInfo
  300. return orderInfoItem.workOrderProjectNo
  301. }
  302. const getPcsStationName = (item: any | null): string | null=> {
  303. if (item == null) return ''
  304. const orderInfoItem = item as acceptOrderInfo
  305. return orderInfoItem.pcsStationName
  306. }
  307. const getPcsDeviceName = (item: any | null): string | null=> {
  308. if (item == null) return ''
  309. const orderInfoItem = item as acceptOrderInfo
  310. return orderInfoItem.pcsDeviceName
  311. }
  312. const getAssignTime = (item: any | null): string|null => {
  313. if (item == null) return null
  314. const orderInfoItem = item as acceptOrderInfo
  315. return orderInfoItem.assignTime
  316. }
  317. const getAcceptTime = (item: any | null): string|null => {
  318. if (item == null) return null
  319. const orderInfoItem = item as acceptOrderInfo
  320. return orderInfoItem.acceptTime
  321. }
  322. const getCreateTime = (item: any | null): string|null => {
  323. if (item == null) return null
  324. const orderInfoItem = item as acceptOrderInfo
  325. return orderInfoItem.createTime
  326. }
  327. // 根据状态显示不同的时间
  328. const getDisplayTime = (item: any | null): string|null => {
  329. if (item == null) return null
  330. const orderInfoItem = item as acceptOrderInfo
  331. // 如果是"待接单"状态,显示派单时间
  332. if (orderInfoItem.workOrderStatus == 'assigned') {
  333. return '下发时间:' + orderInfoItem.assignTime
  334. } else if(orderInfoItem.workOrderStatus == 'to_finish') {
  335. if(orderInfoItem.workEndTime != null) {
  336. return '结束时间:' + orderInfoItem.workEndTime
  337. }
  338. return '接单时间:' + orderInfoItem.acceptTime
  339. } else if(orderInfoItem.workOrderStatus == 'to_approve') {
  340. return '申请挂起时间:' + orderInfoItem.updateTime
  341. } else if(orderInfoItem.workOrderStatus == 'suspended') {
  342. return '审批通过时间:' + orderInfoItem.updateTime
  343. } else if(orderInfoItem.workOrderStatus == 'return' || orderInfoItem.workOrderStatus == 'accept_return') {
  344. return '退回时间:' + orderInfoItem.updateTime
  345. } else if(orderInfoItem.workOrderStatus == 'completed') {
  346. return '结单时间:' + orderInfoItem.updateTime
  347. } else if(orderInfoItem.workOrderStatus == 'archived') {
  348. return '归档时间:' + orderInfoItem.updateTime
  349. }
  350. // 默认显示创建时间
  351. return '创建时间:' + orderInfoItem.createTime
  352. }
  353. const getWorkOrderStatus = (item: any | null): string | null => {
  354. if (item == null) return ''
  355. const orderInfoItem = item as acceptOrderInfo
  356. const rawStatus = orderInfoItem.workOrderStatus
  357. if (rawStatus==null) return ''
  358. // 如果字典尚未加载,返回原始值
  359. if (!dictLoaded.value) {
  360. return rawStatus
  361. }
  362. // 查找字典中对应的标签
  363. const dictItem = statusDictList.value.find(dict => dict.dictValue == rawStatus)
  364. return dictItem!=null ? dictItem.dictLabel : rawStatus
  365. }
  366. const getStatusClass = (item: any | null): string => {
  367. if (item == null) return ''
  368. const orderInfoItem = item as acceptOrderInfo
  369. const rawStatus = orderInfoItem.workOrderStatus
  370. if (rawStatus==null) return ''
  371. // const status = rawStatus
  372. // 返回对应的状态类名
  373. return `status-${rawStatus}`
  374. }
  375. // 切换状态
  376. const switchStatus = (status: string): void => {
  377. currentStatus.value = status
  378. page.value = 1
  379. loadData(true)
  380. }
  381. // 下拉刷新
  382. const handleRefresh = async (): Promise<void> => {
  383. refreshing.value = true
  384. await loadData(true as boolean | null)
  385. }
  386. // 加载更多
  387. const loadMore = (): void => {
  388. if (!hasMore.value || loading.value) {
  389. return
  390. }
  391. page.value++
  392. loadData(false as boolean | null)
  393. }
  394. // 搜索
  395. const handleSearch = (): void => {
  396. page.value = 1
  397. loadData(true as boolean | null)
  398. }
  399. const handleSearchOnBlur = (): void => {
  400. handleSearch()
  401. }
  402. // 方法:判断当前工单是否显示操作按钮(基于 orderType)
  403. const canHandleOrder = (item: any | null): boolean => {
  404. if (item == null) return false
  405. let permit: string[] = []
  406. const orderItem = item as acceptOrderInfo
  407. if(orderItem.workOrderStatus == 'assigned') {
  408. // 接单
  409. permit = orderItem.orderType == 2 ? ['gxt:maintenance:order:accept'] : ['gxt:repairOrder:accept']
  410. } else if(orderItem.workOrderStatus == 'to_finish') {
  411. // 挂起
  412. permit = orderItem.orderType == 2 ? ['gxt:maintenance:order:suspend'] : ['gxt:repairOrder:suspend']
  413. } else if(orderItem.workOrderStatus == 'to_approve') {
  414. // 审批
  415. permit = orderItem.orderType == 2 ? ['gxt:maintenance:order:approve'] : ['gxt:repairOrder:approve']
  416. } else if(orderItem.workOrderStatus == 'suspended') {
  417. // 恢复
  418. permit = orderItem.orderType == 2 ? ['gxt:maintenance:order:resume'] : ['gxt:repairOrder:resume']
  419. } else {
  420. return false
  421. }
  422. // const orderType = (item as acceptOrderInfo).orderType
  423. return checkPermi(permit)
  424. }
  425. // 点击列表项
  426. const handleItemClick = (item: any | null): void => {
  427. if (item == null) return
  428. const orderItem = item as acceptOrderInfo
  429. // if(currentStatus.value === '' || currentStatus.value === 'completed' || currentStatus.value === 'all') {
  430. // // 传递orderType参数以便详情页决定调用哪个API
  431. // uni.navigateTo({
  432. // url: `/pages/order/detail/index?id=${orderItem.id}&orderType=${orderItem.orderType}`
  433. // })
  434. // } else
  435. if(orderItem.workOrderStatus == 'assigned') {
  436. // 跳转到接单页面
  437. uni.navigateTo({
  438. url: `/pages/order/detail/acceptIndex?id=${orderItem.id}&orderType=${orderItem.orderType}`
  439. })
  440. } else if(orderItem.workOrderStatus == 'to_finish') {
  441. // 跳转到待结单页面
  442. uni.navigateTo({
  443. url: `/pages/order/detail/suspendIndex?id=${orderItem.id}&orderType=${orderItem.orderType}`
  444. })
  445. } else if(orderItem.workOrderStatus == 'to_approve') {
  446. // 跳转到待审批页面
  447. uni.navigateTo({
  448. url: `/pages/order/detail/approveIndex?id=${orderItem.id}&orderType=${orderItem.orderType}`
  449. })
  450. } else if(orderItem.workOrderStatus == 'suspended') {
  451. // 跳转到恢复页面
  452. uni.navigateTo({
  453. url: `/pages/order/detail/resumeIndex?id=${orderItem.id}&orderType=${orderItem.orderType}`
  454. })
  455. } else {
  456. uni.navigateTo({
  457. url: `/pages/order/detail/index?id=${orderItem.id}&orderType=${orderItem.orderType}`
  458. })
  459. }
  460. }
  461. // 查看工单详情
  462. const showWorkOrderDetail = (item: any | null): void => {
  463. if (item == null) return
  464. const orderItem = item as acceptOrderInfo
  465. uni.navigateTo({
  466. url: `/pages/workbench/detail/index?id=${orderItem.id}`
  467. })
  468. }
  469. // 清空搜索
  470. const clearSearch = (): void => {
  471. keyword.value = ""
  472. page.value = 1
  473. loadData(true)
  474. }
  475. // 初始化
  476. // onMounted(() => {
  477. onLoad((options: any) => {
  478. const params = options as UTSJSONObject
  479. const isDeal = params['isDeal'] as string | null
  480. if(isDeal != null) {
  481. dealLoad.value = true;
  482. }
  483. loadStatusDictList()
  484. // 自动选中第一个可显示的状态
  485. // currentStatus.value = getFirstVisibleStatus()
  486. currentStatus.value = 'all'
  487. loadData(true as boolean | null)
  488. // 监听首页切换状态事件
  489. uni.$on('switchOrderStatus', (status: string) => {
  490. switchStatus(status)
  491. })
  492. // 监听接单成功的事件,刷新列表
  493. uni.$on('refreshOrderList', () => {
  494. page.value = 1
  495. loadData(true)
  496. })
  497. })
  498. // 组件卸载前清理事件监听
  499. onBeforeUnmount(() => {
  500. refreshing.value = false
  501. loading.value = false
  502. // 移除事件监听
  503. uni.$off('refreshOrderList',{})
  504. uni.$off('switchOrderStatus',{})
  505. })
  506. </script>
  507. <style lang="scss">
  508. .list-page {
  509. flex: 1;
  510. background-color: #e8f0f9;
  511. }
  512. .search-bar {
  513. padding: 20rpx 30rpx;
  514. background-color: #d7eafe;
  515. }
  516. .search-box {
  517. flex-direction: row;
  518. align-items: center;
  519. height: 72rpx;
  520. padding: 0 24rpx;
  521. background-color: #f5f5f5;
  522. border-radius: 36rpx;
  523. .search-icon {
  524. width: 32rpx;
  525. height: 32rpx;
  526. margin-right: 12rpx;
  527. }
  528. .search-input {
  529. flex: 1;
  530. font-size: 28rpx;
  531. color: #333333;
  532. }
  533. .clear-icon {
  534. margin-left: 12rpx;
  535. font-size: 28rpx;
  536. color: #999999;
  537. }
  538. }
  539. .status-bar{
  540. padding-bottom: 10px;
  541. padding-left:30rpx;
  542. background-color: #d7eafe;
  543. }
  544. .status-box {
  545. flex-direction: row;
  546. align-items: center;
  547. height: 72rpx;
  548. flex: 1;
  549. .status-txt{
  550. padding: 8px 12px;
  551. text-align: center;
  552. margin-right: 12rpx;
  553. border-radius: 36rpx;
  554. background-color: #fff;
  555. font-size: 28rpx;
  556. // cursor: pointer;
  557. }
  558. .stauts-sel{
  559. background-color: #007AFF;
  560. color: #fff;
  561. }
  562. }
  563. .list-item {
  564. margin: 24rpx 30rpx;
  565. background-color: #ffffff;
  566. border-radius: 16rpx;
  567. }
  568. .item-container {
  569. padding: 30rpx;
  570. }
  571. .item-header {
  572. flex-direction: row;
  573. align-items: center;
  574. margin-bottom: 16rpx;
  575. .location-icon {
  576. width: 32rpx;
  577. height: 32rpx;
  578. margin-right: 8rpx;
  579. }
  580. .item-title {
  581. flex: 1;
  582. font-size: 32rpx;
  583. color: #333333;
  584. font-weight: bold;
  585. }
  586. .detail-link {
  587. font-size: 28rpx;
  588. color: #999999;
  589. }
  590. }
  591. .item-address {
  592. font-size: 26rpx;
  593. color: #999999;
  594. margin-bottom: 20rpx;
  595. line-height: 40rpx;
  596. }
  597. .btn-primary {
  598. z-index: 999;
  599. border-radius: 10rpx;
  600. font-size: 24rpx;
  601. white-space: nowrap;
  602. margin-left: 20rpx;
  603. background-color: #165DFF;
  604. line-height: 45rpx;
  605. color: #ffffff;
  606. }
  607. .item-header {
  608. flex-direction: row;
  609. align-items: flex-start;
  610. margin-bottom: 16rpx;
  611. .item-title {
  612. font-size: 30rpx;
  613. color: #333333;
  614. font-weight: bold;
  615. flex-wrap: wrap;
  616. flex: 0 1 80%;
  617. min-width: 0;
  618. }
  619. .info-value {
  620. font-size: 28rpx;
  621. color: #999999;
  622. margin-left: auto;
  623. flex: 0 0 auto;
  624. white-space: nowrap;
  625. }
  626. }
  627. .info-row {
  628. flex-direction: row;
  629. justify-content: space-between;
  630. align-items: center;
  631. .info-label {
  632. font-size: 26rpx;
  633. color: #666;
  634. }
  635. .info-value {
  636. font-size: 26rpx;
  637. // color: #666;
  638. }
  639. }
  640. .text-gray{
  641. font-size: 26rpx;
  642. color: #666;
  643. }
  644. .status-tag {
  645. padding: 8rpx 20rpx;
  646. border-radius: 20rpx;
  647. font-size: 24rpx;
  648. white-space: nowrap;
  649. margin-left: 50rpx;
  650. border: 1rpx solid;
  651. }
  652. /* 待接单 */
  653. .status-assigned {
  654. background-color: #ebf5ff;
  655. color: #409eff;
  656. border-color: #d8ebff;
  657. }
  658. /* 待结单 */
  659. .status-to_finish {
  660. background-color: #fff7e6;
  661. color: #fa8c16;
  662. border-color: #ffd591;
  663. }
  664. /* 待审批 */
  665. .status-to_approve {
  666. background-color: #fff7e6;
  667. color: #fa8c16;
  668. border-color: #ffd591;
  669. }
  670. /* 已挂起 */
  671. .status-suspended {
  672. background-color: #fff2f0;
  673. color: #ff4d4f;
  674. border-color: #ffccc7;
  675. }
  676. /* 已完成 */
  677. .status-completed {
  678. background-color: #f0f9eb;
  679. color: #5cb87a;
  680. border-color: #c2e7b0;
  681. }
  682. /* 待下发 */
  683. .status-to_issue {
  684. background-color: #f4f4f5;
  685. color: #909399;
  686. border-color: #e9e9eb;
  687. }
  688. /* 已归档 */
  689. .status-archived {
  690. background-color: #f0f9eb;
  691. color: #5cb87a;
  692. border-color: #c2e7b0;
  693. }
  694. /* 退回 */
  695. .status-return {
  696. background-color: #fff2f0;
  697. color: #ff4d4f;
  698. border-color: #ffccc7;
  699. }
  700. /* 退回 */
  701. .status-accept_return {
  702. background-color: #fff2f0;
  703. color: #ff4d4f;
  704. border-color: #ffccc7;
  705. }
  706. /* 作废 */
  707. .status-invalid {
  708. background-color: #fff2f0;
  709. color: #ff4d4f;
  710. border-color: #ffccc7;
  711. }
  712. .scroll-view_H {
  713. width: 100%;
  714. flex-direction: row;
  715. }
  716. .scroll-view-item_H {
  717. justify-content: center;
  718. align-items: center;
  719. .status-txt{
  720. padding: 8px 12px;
  721. text-align: center;
  722. margin-right: 12rpx;
  723. border-radius: 36rpx;
  724. background-color: #fff;
  725. font-size: 28rpx;
  726. }
  727. .stauts-sel{
  728. background-color: #007AFF;
  729. color: #fff;
  730. }
  731. }
  732. </style>