search.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <template>
  2. <zj-page-layout
  3. :isScroll="true"
  4. :refresherTriggered="refresherTriggered"
  5. @refresherrefresh="refresherrefresh"
  6. @scrolltolower="scrolltolower"
  7. >
  8. <template slot="header">
  9. <view class="search-container">
  10. <u-search
  11. shape="round"
  12. :showAction="false"
  13. placeholder="输入工单单号进行搜索"
  14. showAction
  15. actionText="搜索"
  16. v-model="keyword"
  17. @search="searchSubmit"
  18. @custom="searchSubmit"
  19. @clear="searchSubmit"
  20. >
  21. </u-search>
  22. </view>
  23. </template>
  24. <view class="order-list-container">
  25. <view class="item" v-for="(item, index) in dataList" :key="index" @tap="toDetail(item.id)">
  26. <view class="item-top">
  27. <view class="left">
  28. <view class="title" :class="item.orderTypeText" v-if="item.orderTypeText">
  29. {{ item.orderTypeText.slice(0, 2) }}
  30. </view>
  31. <view class="tags">
  32. <view class="tag red" v-for="(it, idx) in item.orderFlags" :key="idx">{{ it.tagName }}</view>
  33. </view>
  34. </view>
  35. <view class="status">{{ item.orderStatusText }}</view>
  36. </view>
  37. <view class="item-main">
  38. <view class="row">
  39. <view class="label">服务单号</view>
  40. <view class="value">
  41. <view class="val">{{ item.id }}</view>
  42. </view>
  43. </view>
  44. <view class="row" v-if="item.appointmentTime">
  45. <view class="label">预约时间</view>
  46. <view class="value">
  47. <view class="val">{{ item.appointmentTime }}</view>
  48. </view>
  49. </view>
  50. <view class="row">
  51. <view class="label">服务项目</view>
  52. <view class="value">
  53. <view class="val">{{ item.id }}</view>
  54. </view>
  55. </view>
  56. <view class="row" @tap.stop="$callPhone(item.userMobile)">
  57. <view class="label">客户姓名</view>
  58. <view class="value">
  59. <view class="val">{{ item.userName }} {{ item.userMobile }}</view>
  60. <view class="num" v-if="item.customerTotalNum > 0">
  61. (共<text>{{ item.customerSortNum || 0 }}</text
  62. >/{{ item.customerTotalNum || 0 }}单)</view
  63. >
  64. <view class="fun">
  65. <text class="iconfont icon-call"></text>
  66. <view class="text">联系Ta</view>
  67. </view>
  68. </view>
  69. </view>
  70. <view
  71. class="row address-row"
  72. @tap.stop="
  73. $openLocation({
  74. lat: item.lat,
  75. lng: item.lng,
  76. name: item.userName,
  77. address: item.address || item.gpsAddress
  78. })
  79. "
  80. >
  81. <view class="label">服务地址</view>
  82. <view class="value">
  83. <view class="val address ellipsis-3">{{ item.address || item.gpsAddress }}</view>
  84. <view class="fun">
  85. <text class="iconfont icon-daohang"></text>
  86. <view class="text">导航</view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="item-btn" @tap.stop>
  92. <!-- 接单 ok-->
  93. <u-button v-if="JIEDAN(item, userInfo)" type="primary" text="接单" @tap="actionReceive(item)"></u-button>
  94. <!-- 待抢单 ok-->
  95. <u-button v-if="QIANGDAN(item, userInfo)" type="primary" text="抢单" @tap="qdOrder(item)"></u-button>
  96. <!-- 配件申请 -->
  97. <u-button
  98. v-if="PEIJIANSHENQING(item, userInfo)"
  99. plain
  100. type="primary"
  101. text="配件申请"
  102. @tap="toPartsApply(item.id)"
  103. ></u-button>
  104. <!-- 变更小工 -->
  105. <u-button
  106. v-if="BIANGENGXIAOGONG(item, userInfo)"
  107. plain
  108. type="primary"
  109. text="变更小工"
  110. @tap="biangengxiaogong(item)"
  111. ></u-button>
  112. <!-- 辅材收费 ok-->
  113. <u-button
  114. plain
  115. type="primary"
  116. text="辅材收费"
  117. @tap="toCharge(item.id, 'M')"
  118. v-if="FUCAISHOUFEI(item, userInfo)"
  119. ></u-button>
  120. <!-- 配件收费 -->
  121. <u-button
  122. v-if="PEIJIANSHOUFEI(item, userInfo)"
  123. plain
  124. type="primary"
  125. text="配件收费"
  126. @tap="toCharge(item.id, 'P')"
  127. ></u-button>
  128. <!-- 过程反馈 -->
  129. <u-button
  130. v-if="GUOCHENFANKUI(item, userInfo)"
  131. type="primary"
  132. text="过程反馈"
  133. @tap="toFeedback(item.id)"
  134. ></u-button>
  135. </view>
  136. </view>
  137. </view>
  138. <Loading :loadStatus="loadStatus" :dataList="dataList" />
  139. <selectionWorkers
  140. v-if="item"
  141. :title="title"
  142. :detail="item"
  143. :type="selectionWorkersType"
  144. :callback="callback"
  145. @close="
  146. () => {
  147. item = null
  148. selectionWorkersType = null
  149. callback = null
  150. }
  151. "
  152. />
  153. </zj-page-layout>
  154. </template>
  155. <script>
  156. import orderBtnsShow from './mixins/orderBtnsShow.js'
  157. import { getStorage } from '@/common/utils/storage.js'
  158. import selectionWorkers from '@/components/selectionWorkers.vue'
  159. export default {
  160. mixins: [orderBtnsShow],
  161. components: {
  162. selectionWorkers
  163. },
  164. data() {
  165. return {
  166. keyword: '',
  167. dataList: [],
  168. pageNum: 1,
  169. loadStatus: 0,
  170. refresherTriggered: false,
  171. selectionWorkersType: '',
  172. item: null,
  173. callback: null,
  174. title: ''
  175. }
  176. },
  177. onLoad({ keyword }) {
  178. this.keyword = keyword
  179. if (keyword) {
  180. this.getList()
  181. }
  182. // this.getList();
  183. },
  184. computed: {
  185. userInfo() {
  186. return getStorage('user')
  187. }
  188. },
  189. methods: {
  190. // 变更小工
  191. biangengxiaogong(item) {
  192. this.title = '更换小工'
  193. this.selectionWorkersType = 3
  194. this.item = { ...item }
  195. this.callback = () => {
  196. this.$successToast()
  197. this.refreshList()
  198. this.toDetail(item.id)
  199. this.$nextTick(() => {
  200. this.item = null
  201. this.selectionWorkersType = null
  202. this.callback = null
  203. this.title = null
  204. })
  205. }
  206. },
  207. orderStatus_v(orderStatus, item) {
  208. if (item?.isImportExcel && item?.isMeet === false) {
  209. return 'DJD'
  210. }
  211. if (['DYY'].includes(orderStatus)) {
  212. // 待预约
  213. return 'DYY'
  214. } else if (['DQD'].includes(orderStatus)) {
  215. // 待抢单
  216. return 'DQD'
  217. } else if (
  218. [
  219. 'DSHPG',
  220. 'CJ',
  221. 'YPD',
  222. 'DXSPD',
  223. 'DZBPG',
  224. 'DWDSPGP',
  225. 'DXSSPGP',
  226. 'DTJXSSPGP',
  227. 'DZBSPGP',
  228. 'DFZXPD',
  229. 'DFZXSPGP',
  230. 'XSBH',
  231. 'TJXSBH',
  232. 'ZBBH',
  233. 'FZXBH',
  234. 'FL'
  235. ].includes(orderStatus)
  236. ) {
  237. // 待商户派工
  238. return 'DSHPG'
  239. } else if (['DWDPG', 'DWDPD', 'WDBH'].includes(orderStatus)) {
  240. // 待网点派工
  241. return 'DWDPG'
  242. } else if (['DJD', 'DSM', 'YZP'].includes(orderStatus)) {
  243. // 待接单
  244. return 'DJD'
  245. } else if (['FWZ', 'GCSZT', 'BFWG'].includes(orderStatus)) {
  246. // 服务中
  247. return 'FWZ'
  248. } else if (['YCD'].includes(orderStatus)) {
  249. // 异常单
  250. return 'YCD'
  251. } else if (['YWG', 'GCSZX', 'WDWG', 'YWGO'].includes(orderStatus)) {
  252. // 已完工待结算
  253. return 'YWG'
  254. } else if (['YJS', 'LRCD'].includes(orderStatus)) {
  255. // 已结算
  256. return 'YJS'
  257. } else if (['YQX', 'FWZT', 'YCGB', 'FWQX'].includes(orderStatus)) {
  258. // 已取消
  259. return 'YQX'
  260. }
  261. return ''
  262. },
  263. getList() {
  264. this.loadStatus = 1
  265. this.$api
  266. .post('/pg/order/base/list', {
  267. pageNum: this.pageNum,
  268. pageSize: 5,
  269. keyword: this.keyword
  270. })
  271. .then(res => {
  272. this.loadStatus = 0
  273. let list = res.data.records
  274. if (list.length < 10) {
  275. this.loadStatus = 2
  276. }
  277. this.dataList = this.dataList.concat(list)
  278. })
  279. .catch(() => {
  280. this.loadStatus = 2
  281. })
  282. .finally(res => {
  283. this.refresherTriggered = false
  284. })
  285. },
  286. searchSubmit() {
  287. this.refreshList()
  288. },
  289. refreshList() {
  290. this.dataList = []
  291. this.pageNum = 1
  292. this.getList()
  293. },
  294. // 滚动到底部
  295. scrolltolower(e) {
  296. if (this.loadStatus === 0) {
  297. this.pageNum++
  298. this.getList()
  299. }
  300. },
  301. // 触发下拉刷新
  302. refresherrefresh(e) {
  303. this.refresherTriggered = true
  304. this.refreshList()
  305. },
  306. // 加急
  307. actionUrgent(id, flag) {
  308. this.$modal({
  309. title: '加急操作',
  310. content: '加急操作,会消息通知所有订单相关人员,请谨慎操作。'
  311. })
  312. .then(() => {
  313. this.$api
  314. .post('/pg/order/base/flag', {
  315. orderBaseId: id,
  316. orderFlagEnum: 'JIA_JI',
  317. flag: flag
  318. })
  319. .then(res => {
  320. this.$successToast()
  321. this.refreshList()
  322. })
  323. })
  324. .catch(() => {})
  325. },
  326. // 接单
  327. actionReceive(id) {
  328. this.$modal({
  329. title: '接单确认',
  330. content: '确认接单?'
  331. })
  332. .then(() => {
  333. this.$api
  334. .post('/pg/order/base/rece', {
  335. orderBaseId: id
  336. })
  337. .then(res => {
  338. this.$successToast()
  339. this.refreshList()
  340. })
  341. })
  342. .catch(() => {})
  343. },
  344. // 去收费
  345. toCharge(id, type) {
  346. if (type == 'M') {
  347. this.$navToPage({
  348. url: `/packageMaterial/pages/sale/index?type=${type}`
  349. })
  350. } else if (type == 'P') {
  351. this.$navToPage({
  352. url: `/packageMaterial/pages/newSale/index?type=${type}`
  353. })
  354. }
  355. },
  356. // 去过程反馈
  357. toFeedback(id) {
  358. this.$navToPage({
  359. url: `/packageWorkorder/pages/processFeedback?id=${id}`
  360. })
  361. },
  362. toDetail(id) {
  363. this.$navToPage({
  364. url: `/packageWorkorder/pages/orderDetail?id=${id}`
  365. })
  366. }
  367. }
  368. }
  369. </script>
  370. <style lang="scss" scoped>
  371. .search-container {
  372. background: #ffffff;
  373. padding: 0 20rpx 20rpx;
  374. }
  375. .order-list-container {
  376. padding: 30rpx 30rpx 0;
  377. .item {
  378. @include zj-card;
  379. background: #ffffff;
  380. border-radius: 20rpx;
  381. margin-bottom: 30rpx;
  382. padding: 0 30rpx;
  383. &:last-child {
  384. margin-bottom: 0;
  385. }
  386. .item-top {
  387. display: flex;
  388. justify-content: space-between;
  389. align-items: flex-start;
  390. border-bottom: 1px solid #d6e0f2;
  391. padding: 30rpx 0 20rpx;
  392. .left {
  393. flex: 1;
  394. width: 0;
  395. display: flex;
  396. align-items: center;
  397. flex-wrap: wrap;
  398. .title {
  399. font-size: 40rpx;
  400. font-weight: 600;
  401. color: $theme-color;
  402. margin-right: 12rpx;
  403. }
  404. .text {
  405. line-height: 48rpx;
  406. padding: 0 16rpx;
  407. background: #f4f5f9;
  408. border-radius: 8rpx;
  409. margin-right: 12rpx;
  410. text {
  411. color: $assist-color;
  412. }
  413. }
  414. .tags {
  415. display: flex;
  416. align-items: center;
  417. margin-bottom: 10rpx;
  418. .tag {
  419. margin-top: 10rpx;
  420. flex-shrink: 0;
  421. height: 36rpx;
  422. line-height: 36rpx;
  423. border-radius: 8rpx;
  424. border: 1px solid $theme-color;
  425. color: $theme-color;
  426. font-size: 24rpx;
  427. padding: 0 10rpx;
  428. box-sizing: border-box;
  429. font-weight: 500;
  430. margin-right: 10rpx;
  431. &:last-child {
  432. margin-right: 0;
  433. }
  434. &.red {
  435. border: 1px solid $minor-color;
  436. color: $minor-color;
  437. }
  438. &.red_solid {
  439. border: 1px solid $minor-color;
  440. color: #ffffff;
  441. background: $minor-color;
  442. }
  443. &.orange {
  444. border: 1px solid $assist-color;
  445. color: $assist-color;
  446. }
  447. &.green {
  448. border: 1px solid $success-color;
  449. color: $success-color;
  450. }
  451. }
  452. }
  453. }
  454. .right {
  455. float: right;
  456. flex-shrink: 0;
  457. height: 56rpx;
  458. display: flex;
  459. align-items: center;
  460. .iconfont {
  461. color: $minor-color;
  462. }
  463. .time {
  464. color: $minor-color;
  465. margin-left: 4rpx;
  466. }
  467. }
  468. .status {
  469. color: $minor-color;
  470. line-height: 56rpx;
  471. }
  472. }
  473. .item-main {
  474. .row {
  475. display: flex;
  476. align-items: center;
  477. margin-top: 20rpx;
  478. &.address-row {
  479. align-items: flex-start;
  480. .value {
  481. align-items: flex-start;
  482. }
  483. }
  484. .label {
  485. color: $sec-font;
  486. flex-shrink: 0;
  487. margin-right: 20rpx;
  488. line-height: 36rpx;
  489. }
  490. .value {
  491. flex: 1;
  492. display: flex;
  493. align-items: center;
  494. .val {
  495. line-height: 32rpx;
  496. }
  497. .num {
  498. margin-left: 4rpx;
  499. text {
  500. color: $theme-color;
  501. }
  502. }
  503. .tag {
  504. height: 36rpx;
  505. padding: 0 10rpx;
  506. border-radius: 4rpx;
  507. background: #ecf5ff;
  508. color: $theme-color;
  509. font-size: 20rpx;
  510. font-weight: 500;
  511. margin-left: 10rpx;
  512. line-height: 36rpx;
  513. box-sizing: border-box;
  514. }
  515. .fun {
  516. flex-shrink: 0;
  517. display: flex;
  518. align-items: center;
  519. padding: 0 20rpx;
  520. .iconfont {
  521. color: $theme-color;
  522. margin-right: 6rpx;
  523. }
  524. .text {
  525. color: $theme-color;
  526. }
  527. }
  528. }
  529. }
  530. }
  531. .item-btn {
  532. display: flex;
  533. align-items: center;
  534. justify-content: flex-end;
  535. padding: 30rpx 0;
  536. ::v-deep .u-button {
  537. width: 160rpx;
  538. margin: 0;
  539. margin-left: 20rpx;
  540. }
  541. }
  542. }
  543. }
  544. </style>