orderList.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. <template>
  2. <view>
  3. <zj-page-layout
  4. :hasFooter="false"
  5. :isScroll="true"
  6. :refresherTriggered="refresherTriggered"
  7. @refresherrefresh="refresherrefresh"
  8. @scrolltolower="scrolltolower"
  9. >
  10. <template slot="header">
  11. <view class="top-container">
  12. <scroll-view class="tab-scroll-view" scroll-x scroll-with-animation :scroll-left="scrollLeft">
  13. <view class="left-nav">
  14. <view
  15. class="item"
  16. v-for="(item, index) in mainTabs"
  17. :key="index"
  18. :class="[curMainTab === item.value ? 'active' : '', 'tab-item-' + index]"
  19. @tap="changeMainTab(item.value)"
  20. >
  21. <view class="name">{{ item.name }}</view>
  22. <view class="num">{{ item.num || '' }}</view>
  23. </view>
  24. </view>
  25. </scroll-view>
  26. <view class="right-search">
  27. <u-icon name="search" color="#ffffff" size="28" @tap="toSearchPage()"></u-icon>
  28. </view>
  29. </view>
  30. </template>
  31. <view>
  32. <view class="status-container">
  33. <u-tabs
  34. :list="smallTabs"
  35. @change="changeSmallTab"
  36. :current="curSmallTabIndex"
  37. lineWidth="0"
  38. lineHeight="0"
  39. activeStyle="height: 68rpx; display: flex; align-items: center; justify-content: center; padding: 0 24rpx; border-radius: 24rpx; background: #E7EFFF; color: #3D8FFD; border: 1px solid #3D8FFD; box-sizing: border-box;"
  40. inactiveStyle="height: 68rpx; display: flex; align-items: center; justify-content: center; padding: 0 24rpx; border-radius: 24rpx; border: 1px solid #eaeaea; box-sizing: border-box;"
  41. itemStyle="padding: 0; border-radius: 24rpx; color: #999999; margin-right: 16rpx; font-size: 28rpx;"
  42. >
  43. </u-tabs>
  44. <view class="date" :class="startDate ? 'active' : ''" @tap="isShowDatePicker = true">
  45. <view class="text">按日期</view>
  46. <text class="iconfont icon-jinru"></text>
  47. </view>
  48. </view>
  49. <view class="order-list-container">
  50. <view class="item" v-for="(item, index) in dataList" :key="index" @tap="toDetail(item.id)">
  51. <view class="item-top">
  52. <view class="left">
  53. <view class="title" v-if="item.orderSmallTypeText">
  54. {{ item.orderSmallTypeText.slice(0, 2) }}
  55. </view>
  56. <view class="tags">
  57. <view class="tag red_solid" v-for="(it, idx) in item.orderFlags" :key="idx">{{ it.tagName }}</view>
  58. </view>
  59. </view>
  60. <view class="status">{{ item.orderStatusText }}</view>
  61. </view>
  62. <view class="item-main">
  63. <view class="row">
  64. <view class="label">服务单号</view>
  65. <view class="value" style="position: relative">
  66. <view class="val">{{ item.id }}</view>
  67. <view
  68. class="num"
  69. style="position: absolute; right: 0; color: #3d8ffd"
  70. @click.stop="
  71. () => {
  72. $copy(item.id)
  73. }
  74. "
  75. >复制</view
  76. >
  77. </view>
  78. </view>
  79. <view class="row" v-if="item.appointmentTime">
  80. <view class="label">预约时间</view>
  81. <view class="value">
  82. <view class="val">{{ item.appointmentTime.slice(0, 10) }}</view>
  83. </view>
  84. </view>
  85. <view class="row">
  86. <view class="label">服务项目</view>
  87. <view class="value">
  88. <view class="val">{{
  89. item.pgOrderProducts.map(o => `${o.mainName || ''}${item.orderSmallTypeText}x${o.num}`).join(',')
  90. }}</view>
  91. </view>
  92. </view>
  93. <view class="row">
  94. <view class="label">客户姓名</view>
  95. <view class="value">
  96. <view class="val">{{ item.userName }} {{ item.userMobile }}</view>
  97. <view class="num" v-if="item.customerTotalNum > 0">
  98. (共<text>{{ item.customerSortNum || 0 }}</text
  99. >/{{ item.customerTotalNum || 0 }}单)</view
  100. >
  101. <view
  102. class="fun"
  103. v-if="orderStatus_v(item.orderStatus, item) !== 'DQD'"
  104. @tap.stop="$callPhone(item.userMobile)"
  105. >
  106. <text class="iconfont icon-call"></text>
  107. <view class="text">联系Ta</view>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="row address-row">
  112. <!-- // name: item.userName, -->
  113. <view class="label">服务地址</view>
  114. <view class="value">
  115. <view class="val address ellipsis-3">{{ item.address || item.gpsAddress }}</view>
  116. <view
  117. class="fun"
  118. v-if="orderStatus_v(item.orderStatus, item) !== 'DQD'"
  119. @tap.stop="
  120. $openLocation({
  121. lat: item.lat,
  122. lng: item.lng,
  123. address: item.address || item.gpsAddress
  124. })
  125. "
  126. >
  127. <text class="iconfont icon-daohang"></text>
  128. <view class="text">导航</view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <view class="item-btn" @tap.stop>
  134. <!-- 接单 ok-->
  135. <u-button
  136. v-if="
  137. // ---------------
  138. (item.isImportExcel &&
  139. !item.isMeet &&
  140. item.attr == 'SELF' &&
  141. (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
  142. // ---------------
  143. (item.isImportExcel && !item.isMeet && item.attr != 'SELF') ||
  144. // ---------------
  145. (!item.isImportExcel &&
  146. item.attr == 'SELF' &&
  147. ['DYY', 'DJD'].includes(orderStatus_v(item.orderStatus, item)) &&
  148. (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
  149. // ---------------
  150. (!item.isImportExcel &&
  151. item.attr != 'SELF' &&
  152. (['DYY'].includes(orderStatus_v(item.orderStatus, item)) ||
  153. (['DJD'].includes(orderStatus_v(item.orderStatus, item))
  154. ? item.orderType == 'INSTALL'
  155. ? !!userInfo.workerNumber
  156. : true
  157. : false)))
  158. "
  159. type="primary"
  160. text="接单"
  161. @tap="actionReceive(item)"
  162. ></u-button>
  163. <!-- 待抢单 ok-->
  164. <u-button
  165. v-if="
  166. // ---------------
  167. (!item.isImportExcel &&
  168. item.attr == 'SELF' &&
  169. ['DQD'].includes(orderStatus_v(item.orderStatus, item)) &&
  170. (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
  171. // ---------------
  172. (!item.isImportExcel &&
  173. item.attr != 'SELF' &&
  174. ['DQD'].includes(orderStatus_v(item.orderStatus, item)))
  175. "
  176. type="primary"
  177. text="抢单"
  178. @tap="qdOrder(item)"
  179. ></u-button>
  180. <!-- 配件申请 -->
  181. <u-button
  182. v-if="
  183. // ---------------
  184. ((item.isImportExcel &&
  185. item.orderType != 'INSTALL' &&
  186. (['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) ||
  187. (['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
  188. !userInfo.workerNumber))) ||
  189. // ---------------
  190. (item.isImportExcel &&
  191. item.orderType != 'INSTALL' &&
  192. ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
  193. isTodayOrYesterday(item.overTime)) ||
  194. // ---------------
  195. (!item.isImportExcel && ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)))) &&
  196. (item.isImportExcel ? item.isMeet : true)
  197. "
  198. plain
  199. type="primary"
  200. text="配件申请"
  201. @tap="toPartsApply(item.id)"
  202. ></u-button>
  203. <!-- 变更小工 -->
  204. <u-button
  205. v-if="
  206. // ---------------
  207. ((item.isImportExcel &&
  208. ['DYY', 'FWZ', 'YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
  209. (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
  210. // ---------------
  211. (item.isImportExcel &&
  212. ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
  213. item.orderType != 'INSTALL' &&
  214. !userInfo.workerNumber) ||
  215. // ---------------
  216. (!item.isImportExcel &&
  217. ['DYY', 'FWZ', 'YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
  218. (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true))) &&
  219. (item.isImportExcel ? item.isMeet : true)
  220. "
  221. plain
  222. type="primary"
  223. text="变更小工"
  224. @tap="biangengxiaogong(item)"
  225. ></u-button>
  226. <!-- 辅材收费 ok-->
  227. <u-button
  228. plain
  229. type="primary"
  230. text="辅材收费"
  231. @tap="toCharge(item.id, 'M')"
  232. v-if="
  233. ((item.isImportExcel &&
  234. ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) &&
  235. (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
  236. //----------
  237. (item.isImportExcel &&
  238. ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
  239. item.orderType != 'INSTALL' &&
  240. !userInfo.workerNumber) ||
  241. //----------
  242. (!item.isImportExcel &&
  243. ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) &&
  244. !!userInfo.workerNumber) ||
  245. //----------
  246. (((item.isImportExcel &&
  247. ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
  248. (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
  249. (!item.isImportExcel &&
  250. ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
  251. !!userInfo.workerNumber)) &&
  252. isTodayOrYesterday(item.overTime))) &&
  253. (item.isImportExcel ? item.isMeet : true)
  254. "
  255. ></u-button>
  256. <!-- 配件收费 -->
  257. <u-button
  258. v-if="
  259. ((item.isImportExcel &&
  260. item.orderType != 'INSTALL' &&
  261. (['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) ||
  262. (['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
  263. !userInfo.workerNumber))) ||
  264. //----------
  265. (!item.isImportExcel &&
  266. item.orderType != 'INSTALL' &&
  267. ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) &&
  268. !!userInfo.workerNumber) ||
  269. //----------
  270. (((item.isImportExcel &&
  271. item.orderType != 'INSTALL' &&
  272. ['YWG'].includes(orderStatus_v(item.orderStatus, item))) ||
  273. (!item.isImportExcel &&
  274. item.orderType != 'INSTALL' &&
  275. ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
  276. !!userInfo.workerNumber)) &&
  277. isTodayOrYesterday(item.overTime))) &&
  278. (item.isImportExcel ? item.isMeet : true)
  279. "
  280. plain
  281. type="primary"
  282. text="配件收费"
  283. @tap="toCharge(item.id, 'P')"
  284. ></u-button>
  285. <!-- 过程反馈 -->
  286. <u-button
  287. v-if="
  288. (['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) ||
  289. (item.isImportExcel &&
  290. item.orderType != 'INSTALL' &&
  291. !userInfo.workerNumber &&
  292. ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)))) &&
  293. (item.isImportExcel ? item.isMeet : true)
  294. "
  295. type="primary"
  296. text="过程反馈"
  297. @tap="toFeedback(item.id)"
  298. ></u-button>
  299. <!-- ------------------------------------ -->
  300. <!-- <block v-if="orderStatus_v(item.orderStatus,item) == 'DJD'">
  301. <u-button
  302. plain
  303. type="primary"
  304. text="取消加急"
  305. @tap="actionUrgent(item.id, false)"
  306. v-if="item.orderFlags && item.orderFlags.some(o => o.tag == 'JIA_JI')"
  307. ></u-button>
  308. <u-button plain type="primary" text="加急" @tap="actionUrgent(item.id, true)" v-else></u-button>
  309. </block> -->
  310. </view>
  311. </view>
  312. </view>
  313. <Loading :loadStatus="loadStatus" :dataList="dataList" />
  314. </view>
  315. </zj-page-layout>
  316. <zj-dialog-dateRangePicker v-model="isShowDatePicker" @confirm="confirmDate"></zj-dialog-dateRangePicker>
  317. <selectionWorkers
  318. v-if="item"
  319. :title="title"
  320. :detail="item"
  321. :type="selectionWorkersType"
  322. :callback="callback"
  323. @close="
  324. () => {
  325. item = null
  326. selectionWorkersType = null
  327. callback = null
  328. }
  329. "
  330. />
  331. </view>
  332. </template>
  333. <script>
  334. import zjDialogDateRangePicker from '@/components/zj-dialog/zj-dialog-dateRangePicker.vue'
  335. import selectionWorkers from '@/components/selectionWorkers.vue'
  336. import { getStorage } from '@/common/utils/storage.js'
  337. export default {
  338. components: {
  339. selectionWorkers,
  340. zjDialogDateRangePicker
  341. },
  342. data() {
  343. return {
  344. mainTabs: [
  345. { name: '全部', value: '', num: 0 },
  346. { name: '待抢单', value: 'DQD', num: 0 },
  347. { name: '待接单', value: 'DJD', num: 0 },
  348. { name: '服务中', value: 'FWZ', num: 0 },
  349. { name: '已完工', value: 'YWG', num: 0 },
  350. { name: '异常待处理', value: 'YCD', num: 0 }
  351. ],
  352. curMainTab: '',
  353. curSmallTab: 0,
  354. curSmallTabIndex: 0,
  355. smallTabs: [
  356. { id: 0, name: '全部' },
  357. { id: 1, name: '今天' },
  358. { id: 2, name: '明天' },
  359. { id: 3, name: '其他' }
  360. ],
  361. curOrderType: '',
  362. isShowDatePicker: false,
  363. startDate: '',
  364. endDate: '',
  365. dataList: [],
  366. pageNum: 1,
  367. loadStatus: 0,
  368. refresherTriggered: false, // 下拉刷新状态
  369. scrollLeft: 0,
  370. scrollViewWidth: 0,
  371. tabsRect: {
  372. left: 0
  373. },
  374. isYb: false, // 是否延保单
  375. isWb: false, // 是否维保单
  376. selectionWorkersType: '',
  377. item: null,
  378. callback: null,
  379. title: ''
  380. }
  381. },
  382. onLoad({ tab, isYb, isWb, smallTab }) {
  383. this.crossPage.$on('refreshWorkorderList', data => {
  384. if (data && data.tab) {
  385. this.curMainTab = data.tab
  386. }
  387. if (data && data.smallTab) {
  388. this.curSmallTab = Number(data.smallTab)
  389. this.curSmallTabIndex = Number(data.smallTab)
  390. }
  391. this.refreshList()
  392. })
  393. if (isYb) {
  394. this.isYb = true
  395. }
  396. if (isWb) {
  397. this.isWb = true
  398. }
  399. this.getCount()
  400. this.curMainTab = tab || ''
  401. this.curSmallTab = smallTab ? Number(smallTab) : 0
  402. this.curSmallTabIndex = smallTab ? Number(smallTab) : 0
  403. this.refreshList()
  404. },
  405. onReady() {
  406. this.resize()
  407. },
  408. onUnload() {
  409. this.crossPage.$off('refreshWorkorderList')
  410. },
  411. computed: {
  412. userInfo() {
  413. return getStorage('user')
  414. }
  415. },
  416. methods: {
  417. isToday(dateString) {
  418. const inputDate = new Date(dateString)
  419. const today = new Date()
  420. return (
  421. inputDate.getFullYear() === today.getFullYear() &&
  422. inputDate.getMonth() === today.getMonth() &&
  423. inputDate.getDate() === today.getDate()
  424. )
  425. },
  426. orderStatus_v(orderStatus, item) {
  427. if (item?.isImportExcel && item?.isMeet === false) {
  428. return 'DJD'
  429. }
  430. if (['DYY'].includes(orderStatus)) {
  431. // 待预约
  432. return 'DYY'
  433. } else if (['DQD'].includes(orderStatus)) {
  434. // 待抢单
  435. return 'DQD'
  436. } else if (
  437. [
  438. 'DSHPG',
  439. 'CJ',
  440. 'YPD',
  441. 'DXSPD',
  442. 'DZBPG',
  443. 'DWDSPGP',
  444. 'DXSSPGP',
  445. 'DTJXSSPGP',
  446. 'DZBSPGP',
  447. 'DFZXPD',
  448. 'DFZXSPGP',
  449. 'XSBH',
  450. 'TJXSBH',
  451. 'ZBBH',
  452. 'FZXBH',
  453. 'FL'
  454. ].includes(orderStatus)
  455. ) {
  456. // 待商户派工
  457. return 'DSHPG'
  458. } else if (['DWDPG', 'DWDPD', 'WDBH'].includes(orderStatus)) {
  459. // 待网点派工
  460. return 'DWDPG'
  461. } else if (['DJD'].includes(orderStatus)) {
  462. // 待接单
  463. return 'DJD'
  464. } else if (['FWZ', 'GCSZT', 'BFWG', 'DSM', 'YZP'].includes(orderStatus)) {
  465. // 服务中
  466. return 'FWZ'
  467. } else if (['YCD'].includes(orderStatus)) {
  468. // 异常单
  469. return 'YCD'
  470. } else if (['YWG', 'GCSZX', 'WDWG', 'YWGO'].includes(orderStatus)) {
  471. // 已完工待结算
  472. return 'YWG'
  473. } else if (['YJS', 'LRCD'].includes(orderStatus)) {
  474. // 已结算
  475. return 'YJS'
  476. } else if (['YQX', 'FWZT', 'YCGB', 'FWQX'].includes(orderStatus)) {
  477. // 已取消
  478. return 'YQX'
  479. }
  480. return ''
  481. },
  482. // 触发下拉刷新
  483. async refresherrefresh(e) {
  484. this.refresherTriggered = true
  485. this.refreshList()
  486. },
  487. // 滚动到底部
  488. scrolltolower(e) {
  489. if (this.loadStatus === 0) {
  490. this.pageNum++
  491. this.getList()
  492. }
  493. },
  494. // 获取统计数量
  495. getCount() {
  496. this.$api
  497. .post('/pg/order/base/status/count', {
  498. isYb: this.isYb,
  499. isWb: this.isWb
  500. })
  501. .then(res => {
  502. if (!res.data) return false
  503. const data = res.data
  504. this.mainTabs[0].num = data.all || 0
  505. this.mainTabs[1].num = data.dqd || 0
  506. this.mainTabs[2].num = data.djd || 0
  507. this.mainTabs[3].num = data.fwz || 0
  508. this.mainTabs[4].num = data.ywg || 0
  509. this.mainTabs[5].num = data.ycd || 0
  510. })
  511. },
  512. // 获取列表
  513. getList() {
  514. this.loadStatus = 1
  515. this.$api
  516. .post('/pg/order/base/list', {
  517. pageNum: this.pageNum,
  518. pageSize: 5,
  519. keyword: '',
  520. orderBaseStatus: this.curMainTab,
  521. byDay: this.curSmallTab || '',
  522. startTime: this.startDate ? this.startDate + ' 00:00:00' : '',
  523. endTime: this.endDate ? this.endDate + ' 23:59:59' : '',
  524. isYb: this.isYb,
  525. isWb: this.isWb
  526. })
  527. .then(res => {
  528. this.loadStatus = 0
  529. let list = res.data.records
  530. if (list.length < 5) {
  531. this.loadStatus = 2
  532. }
  533. this.dataList = this.pageNum === 1 ? list : this.dataList.concat(list)
  534. })
  535. .catch(() => {
  536. this.loadStatus = 2
  537. })
  538. .finally(res => {
  539. this.refresherTriggered = false
  540. })
  541. },
  542. findMainTabIndex(val) {
  543. for (var i = 0; i < this.mainTabs.length; i++) {
  544. if (this.mainTabs[i]['value'] == val) {
  545. return i
  546. }
  547. }
  548. },
  549. setScrollLeft() {
  550. // 当前活动tab的布局信息,有tab菜单的width和left(为元素左边界到父元素左边界的距离)等信息
  551. const tabRect = this.mainTabs[this.findMainTabIndex(this.curMainTab)]
  552. // 累加得到当前item到左边的距离
  553. const offsetLeft = this.mainTabs.slice(0, this.findMainTabIndex(this.curMainTab)).reduce((total, curr) => {
  554. return total + curr.rect.width
  555. }, 0)
  556. // 此处为屏幕宽度
  557. const windowWidth = uni.$u.sys().windowWidth
  558. // 将活动的tabs-item移动到屏幕正中间,实际上是对scroll-view的移动
  559. let scrollLeft =
  560. offsetLeft -
  561. (this.tabsRect.width - tabRect.rect.width) / 2 -
  562. (windowWidth - this.tabsRect.right) / 2 +
  563. this.tabsRect.left / 2
  564. // 这里做一个限制,限制scrollLeft的最大值为整个scroll-view宽度减去tabs组件的宽度
  565. scrollLeft = Math.min(scrollLeft, this.scrollViewWidth)
  566. this.scrollLeft = Math.max(0, scrollLeft)
  567. },
  568. // 获取所有标签的尺寸
  569. resize() {
  570. if (this.mainTabs.length === 0) {
  571. return
  572. }
  573. Promise.all([this.getTabsRect(), this.getAllItemRect()]).then(([tabsRect, itemRect = []]) => {
  574. this.tabsRect = tabsRect
  575. this.scrollViewWidth = 0
  576. itemRect.map((item, index) => {
  577. // 计算scroll-view的宽度,这里
  578. this.scrollViewWidth += item.width
  579. // 另外计算每一个item的中心点X轴坐标
  580. this.mainTabs[index].rect = item
  581. })
  582. // 获取了tabs的尺寸之后,设置滑块的位置
  583. this.setScrollLeft()
  584. })
  585. },
  586. // 获取导航菜单的尺寸
  587. getTabsRect() {
  588. return new Promise(resolve => {
  589. this.queryRect('tab-scroll-view').then(size => resolve(size))
  590. })
  591. },
  592. // 获取所有标签的尺寸
  593. getAllItemRect() {
  594. return new Promise(resolve => {
  595. const promiseAllArr = this.mainTabs.map((item, index) => this.queryRect(`tab-item-${index}`, true))
  596. Promise.all(promiseAllArr).then(sizes => resolve(sizes))
  597. })
  598. },
  599. // 获取各个标签的尺寸
  600. queryRect(el, item) {
  601. return new Promise(resolve => {
  602. this.$uGetRect(`.${el}`).then(size => {
  603. resolve(size)
  604. })
  605. })
  606. },
  607. // 切换大状态
  608. changeMainTab(val) {
  609. this.curMainTab = val
  610. // this.curMainTab = val.value;
  611. if (this.startDate == '' || this.endDate == '') {
  612. this.curSmallTab = 0
  613. this.curSmallTabIndex = 0
  614. } else {
  615. this.curSmallTab = ''
  616. this.curSmallTabIndex = ''
  617. }
  618. this.refreshList()
  619. this.resize()
  620. },
  621. // 切换小状态
  622. changeSmallTab(item) {
  623. this.curSmallTab = item.id
  624. this.curSmallTabIndex = item.index
  625. this.startDate = ''
  626. this.endDate = ''
  627. this.refreshList()
  628. },
  629. // 选择日期
  630. confirmDate(item) {
  631. let [start, end] = item
  632. if (start == '' || end == '') {
  633. this.curSmallTab = 0
  634. this.curSmallTabIndex = 0
  635. this.startDate = ''
  636. this.endDate = ''
  637. return
  638. }
  639. this.curSmallTab = ''
  640. this.curSmallTabIndex = ''
  641. this.startDate = start
  642. this.endDate = end
  643. this.refreshList()
  644. },
  645. // 刷新列表
  646. refreshList() {
  647. this.dataList = []
  648. this.pageNum = 1
  649. this.getList()
  650. this.getCount()
  651. },
  652. // 去搜索页面
  653. toSearchPage() {
  654. this.$navToPage({
  655. url: '/packageWorkorder/pages/search'
  656. })
  657. },
  658. // 加急
  659. actionUrgent(id, flag) {
  660. this.$modal({
  661. title: '加急操作',
  662. content: '加急操作,会消息通知所有订单相关人员,请谨慎操作。'
  663. })
  664. .then(() => {
  665. this.$api
  666. .post('/pg/order/base/flag', {
  667. orderBaseId: id,
  668. orderFlagEnum: 'JIA_JI',
  669. flag: flag
  670. })
  671. .then(res => {
  672. this.$successToast()
  673. this.refreshList()
  674. })
  675. })
  676. .catch(() => {})
  677. },
  678. // 接单
  679. actionReceive(item) {
  680. this.title = '接收确认'
  681. this.selectionWorkersType = 1
  682. this.item = { ...item }
  683. this.callback = () => {
  684. this.$successToast()
  685. this.refreshList()
  686. this.toDetail(item.id)
  687. this.$nextTick(() => {
  688. this.item = null
  689. this.selectionWorkersType = null
  690. this.callback = null
  691. this.title = null
  692. })
  693. }
  694. },
  695. // 变更小工
  696. biangengxiaogong(item) {
  697. this.title = '更换小工'
  698. this.selectionWorkersType = 3
  699. this.item = { ...item }
  700. this.callback = () => {
  701. this.$successToast()
  702. this.refreshList()
  703. this.toDetail(item.id)
  704. this.$nextTick(() => {
  705. this.item = null
  706. this.selectionWorkersType = null
  707. this.callback = null
  708. this.title = null
  709. })
  710. }
  711. },
  712. // 抢单
  713. qdOrder(item) {
  714. // this.title = '接收确认'
  715. // this.selectionWorkersType = 2
  716. // this.item = { ...item }
  717. // this.callback = () => {
  718. // this.$successToast()
  719. // this.refreshList()
  720. // this.toDetail(item.id)
  721. // this.item = null
  722. // this.selectionWorkersType = null
  723. // this.callback = null
  724. // }
  725. this.$modal({
  726. title: '抢单确认',
  727. content: '确认抢单?'
  728. })
  729. .then(() => {
  730. this.$api
  731. .post('/pg/order/base/qd', {
  732. orderBaseId: item.id
  733. })
  734. .then(res => {
  735. this.$successToast()
  736. this.refreshList()
  737. this.toDetail(item.id)
  738. })
  739. })
  740. .catch(() => {})
  741. },
  742. // 去收费
  743. toCharge(id, type) {
  744. if (type == 'M') {
  745. this.$navToPage({
  746. url: `/packageMaterial/pages/sale/orderList?type=${type}&oid=${id}`
  747. })
  748. } else if (type == 'P') {
  749. this.$navToPage({
  750. url: `/packageMaterial/pages/newSale/orderList?type=${type}&oid=${id}`
  751. })
  752. }
  753. },
  754. // 去配件申请
  755. toPartsApply(id) {
  756. this.$navToPage({
  757. url: `/packageMaterial/pages/partsApply/form?id=${id}`
  758. })
  759. },
  760. // 去过程反馈
  761. toFeedback(id) {
  762. this.$navToPage({
  763. url: `/packageWorkorder/pages/processFeedback?id=${id}`
  764. })
  765. },
  766. toDetail(id) {
  767. this.$navToPage({
  768. url: `/packageWorkorder/pages/orderDetail?id=${id}`
  769. })
  770. }
  771. }
  772. }
  773. </script>
  774. <style lang="scss" scopeds>
  775. .all-container {
  776. width: 100%;
  777. height: 100vh;
  778. display: flex;
  779. flex-direction: column;
  780. .main-container {
  781. flex: 1;
  782. }
  783. }
  784. .top-container {
  785. display: flex;
  786. background: $theme-color;
  787. height: 100rpx;
  788. align-items: center;
  789. justify-content: space-between;
  790. padding: 0 30rpx 10rpx;
  791. position: relative;
  792. .left-nav {
  793. flex: 1;
  794. display: flex;
  795. align-items: flex-end;
  796. // overflow-x: scroll;
  797. // overflow-y: hidden;
  798. padding: 20rpx 0;
  799. .item {
  800. flex-shrink: 0;
  801. display: flex;
  802. margin-right: 32rpx;
  803. position: relative;
  804. // &:last-child {
  805. // margin-right: 0;
  806. // }
  807. .name {
  808. font-size: 30rpx;
  809. color: #ffffff;
  810. }
  811. .num {
  812. color: #ffffff;
  813. margin-top: -8rpx;
  814. margin-left: 2rpx;
  815. }
  816. &.active {
  817. &::after {
  818. content: '';
  819. width: 44rpx;
  820. height: 6rpx;
  821. background: #ffffff;
  822. border-radius: 6rpx;
  823. position: absolute;
  824. bottom: -16rpx;
  825. left: calc((100% - 44rpx) / 2);
  826. }
  827. .name {
  828. font-size: 40rpx;
  829. font-weight: bolder;
  830. position: relative;
  831. }
  832. }
  833. }
  834. }
  835. .right-search {
  836. margin-left: 30rpx;
  837. margin-top: 10rpx;
  838. .iconfont {
  839. font-size: 36rpx;
  840. color: #ffffff;
  841. }
  842. }
  843. }
  844. .status-container {
  845. display: flex;
  846. align-items: center;
  847. justify-content: space-between;
  848. padding: 20rpx;
  849. .date {
  850. height: 68rpx;
  851. display: flex;
  852. align-items: center;
  853. justify-content: center;
  854. padding: 0 24rpx;
  855. border-radius: 24rpx;
  856. border: 1px solid #eaeaea;
  857. box-sizing: border-box;
  858. .text {
  859. font-size: 28rpx;
  860. color: $reg-font;
  861. }
  862. .iconfont {
  863. font-size: 28rpx;
  864. color: $reg-font;
  865. }
  866. &.active {
  867. background: #e7efff;
  868. border: 1px solid #3d8ffd;
  869. .text {
  870. color: #3d8ffd;
  871. }
  872. .iconfont {
  873. color: #3d8ffd;
  874. }
  875. }
  876. }
  877. }
  878. .order-list-container {
  879. padding: 0 30rpx;
  880. .item {
  881. @include zj-card;
  882. background: #ffffff;
  883. border-radius: 20rpx;
  884. margin-bottom: 30rpx;
  885. padding: 0 30rpx;
  886. &:last-child {
  887. margin-bottom: 0;
  888. }
  889. .item-top {
  890. display: flex;
  891. justify-content: space-between;
  892. align-items: flex-start;
  893. border-bottom: 1px solid #d6e0f2;
  894. padding: 30rpx 0 20rpx;
  895. .left {
  896. flex: 1;
  897. width: 0;
  898. display: flex;
  899. align-items: center;
  900. flex-wrap: wrap;
  901. .title {
  902. font-size: 40rpx;
  903. font-weight: 600;
  904. color: $theme-color;
  905. margin-right: 12rpx;
  906. }
  907. .text {
  908. line-height: 48rpx;
  909. padding: 0 16rpx;
  910. background: #f4f5f9;
  911. border-radius: 8rpx;
  912. margin-right: 12rpx;
  913. text {
  914. color: $assist-color;
  915. }
  916. }
  917. .tags {
  918. display: flex;
  919. align-items: center;
  920. margin-bottom: 10rpx;
  921. .tag {
  922. margin-top: 10rpx;
  923. flex-shrink: 0;
  924. height: 36rpx;
  925. line-height: 36rpx;
  926. border-radius: 8rpx;
  927. border: 1px solid $theme-color;
  928. color: $theme-color;
  929. font-size: 24rpx;
  930. padding: 0 10rpx;
  931. box-sizing: border-box;
  932. font-weight: 500;
  933. margin-right: 10rpx;
  934. &:last-child {
  935. margin-right: 0;
  936. }
  937. &.red {
  938. border: 1px solid $minor-color;
  939. color: $minor-color;
  940. }
  941. &.red_solid {
  942. border: 1px solid $minor-color;
  943. color: #ffffff;
  944. background: $minor-color;
  945. }
  946. &.orange {
  947. border: 1px solid $assist-color;
  948. color: $assist-color;
  949. }
  950. &.green {
  951. border: 1px solid $success-color;
  952. color: $success-color;
  953. }
  954. }
  955. }
  956. }
  957. .right {
  958. float: right;
  959. flex-shrink: 0;
  960. height: 56rpx;
  961. display: flex;
  962. align-items: center;
  963. .iconfont {
  964. color: $minor-color;
  965. }
  966. .time {
  967. color: $minor-color;
  968. margin-left: 4rpx;
  969. }
  970. }
  971. .status {
  972. color: $minor-color;
  973. line-height: 56rpx;
  974. }
  975. }
  976. .item-main {
  977. .row {
  978. display: flex;
  979. align-items: center;
  980. margin-top: 20rpx;
  981. &.address-row {
  982. align-items: flex-start;
  983. .value {
  984. align-items: flex-start;
  985. }
  986. }
  987. .label {
  988. color: $sec-font;
  989. flex-shrink: 0;
  990. margin-right: 20rpx;
  991. line-height: 36rpx;
  992. font-size: 28rpx;
  993. }
  994. .value {
  995. flex: 1;
  996. display: flex;
  997. align-items: center;
  998. .val {
  999. line-height: 32rpx;
  1000. font-size: 28rpx;
  1001. }
  1002. .num {
  1003. margin-left: 4rpx;
  1004. text {
  1005. color: $theme-color;
  1006. }
  1007. }
  1008. .tag {
  1009. height: 36rpx;
  1010. padding: 0 10rpx;
  1011. border-radius: 4rpx;
  1012. background: #ecf5ff;
  1013. color: $theme-color;
  1014. font-size: 20rpx;
  1015. font-weight: 500;
  1016. margin-left: 10rpx;
  1017. line-height: 36rpx;
  1018. box-sizing: border-box;
  1019. }
  1020. .fun {
  1021. flex-shrink: 0;
  1022. display: flex;
  1023. align-items: center;
  1024. padding: 0 20rpx;
  1025. .iconfont {
  1026. color: $theme-color;
  1027. margin-right: 6rpx;
  1028. }
  1029. .text {
  1030. font-size: 28rpx;
  1031. color: $theme-color;
  1032. }
  1033. }
  1034. }
  1035. }
  1036. }
  1037. .item-btn {
  1038. box-sizing: border-box;
  1039. display: flex;
  1040. align-items: center;
  1041. justify-content: flex-end;
  1042. flex-wrap: wrap;
  1043. padding: 20rpx 20rpx 20rpx 0;
  1044. ::v-deep .u-button {
  1045. width: 175rpx;
  1046. box-sizing: border-box;
  1047. padding: 10rpx;
  1048. margin: 0;
  1049. margin-left: 10rpx;
  1050. margin-bottom: 10rpx;
  1051. }
  1052. }
  1053. }
  1054. }
  1055. </style>