Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. <!-- 订单列表2 -->
  2. <template>
  3. <filter>
  4. <empty-view v-if="!data.login" mode="permission" content="请先登录再查看订单" btnTxt="立即登录"
  5. @btnClick="$util.navTo('/login/login')">
  6. </empty-view>
  7. <view class="list-wrapper" v-else>
  8. <view class="top-content">
  9. <view class="top-menu">
  10. <view :class="item == state.tabActive ? 'tab active' : 'tab'" v-for="item in state.flowPathTabList"
  11. :key="item" @click="flowPathTabHandle(item)">
  12. <view class="border"></view>{{ item }}
  13. </view>
  14. </view>
  15. <order-tabbar ref="tabbarRef" :tabs="data.tabsList" v-model:curIndex="data.tabIndex"
  16. v-if="data.tabsList.length > 0" @index="test"></order-tabbar>
  17. </view>
  18. <order-list-item v-if="state.tabActive=='小程序'" ref="mescrollItem" :index="data.tabIndex"
  19. :refresh="data.refresh">
  20. </order-list-item>
  21. <view v-else>
  22. <!-- 搜索框 -->
  23. <view class="as-layout-horizontal as-gravity-center-start search-layout">
  24. <view class="search-box">
  25. <image :src="`${$imgUrl}service/icon-search.png`" class="icon" mode="aspectFill"></image>
  26. <input class="search" placeholder="请输入车牌号" @input="onKeyInput" />
  27. </view>
  28. <!-- <view class="search-btn" @click="doSearch">搜索</view> -->
  29. </view>
  30. <!-- 数据为空 -->
  31. <empty-view :mode="config.emptyHint.mode" :content="config.emptyHint.hint"
  32. v-if="state.appOrdersList.length === 0" />
  33. <block v-for="(item,index) in state.appOrdersList" :key="index">
  34. <view :class="item.orderStatus == OrderStatus.已取消 ? 'item finished' : 'item'"
  35. @click.stop="gotoOrderDetails(item,2)">
  36. <view class="head">
  37. <view class="name">
  38. <image :src="`${$imgUrl}order/icon-star-green.png`" class="icon" mode="aspectFill">
  39. </image>
  40. <text class="title">{{item.productName ?item.productName: ''}}</text>
  41. </view>
  42. <view class="status text-orange" v-if="item.orderStatus == OrderStatus.已取消">已取消</view>
  43. <view class="status text-green" v-else
  44. :class="{'text-orange':item.orderStep == OrderStatus.已完成 || item.orderStep == OrderStatus.已结束
  45. || item.orderStep == OrderStatus['换货-设备已回收'] || item.orderStep == OrderStatus.退款成功 || item.orderStep == OrderStatus.退货成功}">
  46. {{getOrderStatusName(item.orderStep)}}
  47. </view>
  48. </view>
  49. <view class="detail">
  50. <view class="orders">
  51. <view class="order-text">
  52. <text class="type">新办单号:</text>
  53. <text class="value">{{item.orderId}}</text>
  54. </view>
  55. <view class="order-text odd">
  56. <text class="type">业务类型:</text>
  57. <text class="value">{{getOrderTypeName(item.orderType)}}</text>
  58. </view>
  59. <view class="order-text">
  60. <text class="type">订单车牌号:</text>
  61. <text class="value">{{item.vehiclePlate}}</text>
  62. </view>
  63. <view class="order-text odd">
  64. <text class="type">订单车牌颜色:</text>
  65. <text class="value">{{getVehiclePlateColor(item.vehiclePlateColor)}}</text>
  66. </view>
  67. </view>
  68. <view class="money"><text class="cny">¥</text>
  69. <text class="amount" v-if="item.amount">{{item.amount / 100}}</text>
  70. <text class="amount" v-else>0.00</text>
  71. </view>
  72. </view>
  73. <!-- 待激活 -->
  74. <view class="btns" v-if="item.orderStep == OrderStatus.待激活 && item.cardId && item.obuId">
  75. <view class="btn btn-primary" @click.stop="gotoActiveOrder(item)">去激活</view>
  76. </view>
  77. <!-- 已完成 -->
  78. <view class="btns" v-else-if="item.orderStep == OrderStatus.已完成">
  79. <view class="btn btn-normal" v-if="item.isStaff==1 && item.isProduct==1">
  80. 已评价
  81. </view>
  82. <view class='evaluation' v-else>
  83. <view class="btn btn-primary" @click.stop="gotoEvaluateSalesman(item)">去评价</view>
  84. </view>
  85. </view>
  86. </view>
  87. </block>
  88. <uni-load-more :status="params.status" iconType="snow" :icon-size="16" :content-text="config.contentTxt"
  89. v-if="state.appOrdersList.length > 0" />
  90. </view>
  91. </view>
  92. </filter>
  93. </template>
  94. <script setup lang="ts">
  95. import orderTabbar from "./components/order-tabbar.vue";
  96. import orderListItem from "./components/order-list-item";
  97. import useOrderList from "@/composables/order/useOrderList";
  98. import filter from '@/components/filter/filter.vue';
  99. import { onLoad, onReachBottom, onShow, onPullDownRefresh } from "@dcloudio/uni-app";
  100. import useOrderListItem from "@/composables/order/useOrderListItem";
  101. import useOrderSkip from "@/composables/order/useOrderSkip";
  102. import {
  103. getOrderStatusName,
  104. msg,
  105. getOrderTypeName,
  106. hasLogin, timesDiff
  107. } from "@/utils/utils";
  108. import {
  109. vehiclePlateColor
  110. } from "@/datas/vehiclePlateColor";
  111. import { getItem, StorageKeys, setItem } from "@/utils/storage";
  112. import { PageData } from "@/datas/enum";
  113. import {
  114. OrderStatus
  115. } from "@/datas/enum";
  116. import {
  117. reactive, watch, ref
  118. } from "vue";
  119. import { requestNew } from "@/utils/network/request.js";
  120. import { appPage } from "@/utils/network/api";
  121. import { log } from "console";
  122. const tools = require("../../static/etcUtil/tools.js");
  123. const state = reactive({
  124. tabActive: "小程序",
  125. flowPathTabList: ["小程序", "线下网点"],
  126. appOrdersList: [],
  127. index: 0
  128. })
  129. const {
  130. data,
  131. tabbarRef
  132. } = useOrderList();
  133. //办理订单按钮跳转业务逻辑
  134. const {
  135. gotoActiveOrder,
  136. gotoOrderDetails,
  137. gotoEvaluateSalesman
  138. } = useOrderSkip();
  139. //请求参数
  140. const params = reactive({
  141. pageNum: PageData.NUM,
  142. pageSize: PageData.SIZE,
  143. total: 0,
  144. status: 'more',
  145. reload: false,
  146. })
  147. function test(index) {
  148. console.log("test", index, data.tabIndex)
  149. state.index = index
  150. if (state.tabActive == '小程序') {
  151. changeTab(state.tabActive)
  152. } else {
  153. console.log("apppppppp",)
  154. getList()
  155. }
  156. }
  157. const props = defineProps({
  158. index: {
  159. type: Number,
  160. default() {
  161. return 0
  162. }
  163. },
  164. refresh: { //是否刷新列表
  165. type: Boolean,
  166. default: true
  167. }
  168. })
  169. const { changeTab, config, refreshList } = useOrderListItem(props);
  170. onLoad((option) => {
  171. // 一进来就调一遍
  172. changeTab(state.tabActive)
  173. })
  174. let searchKeyWords = '';
  175. //获取车牌颜色文字
  176. const getVehiclePlateColor = (id : number) => {
  177. const colors = vehiclePlateColor.filter(item => item.id == id);
  178. return colors[0].color
  179. }
  180. const flowPathTabHandle = (tab) => {
  181. console.log("tab", tab)
  182. state.tabActive = tab;
  183. if (state.tabActive == '小程序') {
  184. changeTab(state.tabActive)
  185. } else {
  186. console.log("apppppppp",)
  187. getList()
  188. }
  189. };
  190. //搜索
  191. const doSearch = () => {
  192. // #ifdef MP-WEIXIN
  193. if (!searchKeyWords) {
  194. msg('请输入需要搜索的车牌号!');
  195. return;
  196. }
  197. getList();
  198. // #endif
  199. // #ifdef MP-ALIPAY
  200. tools.showLoadingAlert("加载中");
  201. getList();
  202. tools.hideLoadingAlert();
  203. // #endif
  204. }
  205. //订单车牌号输入
  206. const onKeyInput = (event) => {
  207. searchKeyWords = event.target.value;
  208. if (searchKeyWords == '') {
  209. getList();
  210. }
  211. }
  212. const getList = async () => {
  213. if (!hasLogin()) {
  214. uni.stopPullDownRefresh();
  215. return;
  216. }
  217. const options = {
  218. type: 2,
  219. data: {
  220. "opId": getItem(StorageKeys.OpenId),
  221. "vehiclePlate": searchKeyWords,
  222. "tabIndex": state.index + '',
  223. "pageNo": params.pageNum,
  224. "pageSize": params.pageSize,
  225. },
  226. method: 'POST',
  227. showLoading: true
  228. }
  229. requestNew(appPage, options).then((res) => {
  230. uni.hideLoading()
  231. var data = res;
  232. console.log("state.appOrdersList", data)
  233. params.total = data.totalCount;
  234. if (params.pageNum === 1) {
  235. state.appOrdersList = [];
  236. }
  237. if (params.total > 0) {
  238. const curList = data.data || [];
  239. state.appOrdersList = params.reload ? curList : state.appOrdersList.concat(curList);
  240. params.reload = false;
  241. }
  242. if (params.total === state.appOrdersList.length) {
  243. params.reload = false;
  244. params.status = 'noMore';
  245. }
  246. if (params.pageNum === 1) {
  247. uni.stopPullDownRefresh();
  248. }
  249. // 订单发货后未激活 30天 以后 结束订单功能 insertTime >30 算出来距离今天是负数 updateTime<30(结束订单)
  250. for (var k = 0; k < state.appOrdersList.length; k++) {
  251. if (state.appOrdersList[k]['insertTime']) {
  252. if (timesDiff(state.appOrdersList[k]['insertTime'].replace("T", " ")).days > 30) {
  253. state.appOrdersList[k]['finishOrder'] = true //可以结束
  254. } else {
  255. state.appOrdersList[k]['finishOrder'] = false //不可以结束
  256. }
  257. }
  258. if (state.appOrdersList[k]['updateTime']) {
  259. if (timesDiff(state.appOrdersList[k]['updateTime'].replace("T", " ")).days <= 30) {
  260. state.appOrdersList[k]['isUseAgain'] = true //可以再次使用
  261. } else {
  262. state.appOrdersList[k]['isUseAgain'] = false //不可以再次使用
  263. }
  264. }
  265. }
  266. uni.$emit("refreshOrder");
  267. console.log("data.refresh===============", props.refresh, state.appOrdersList)
  268. })
  269. .catch((err) => {
  270. console.log(err);
  271. });
  272. }
  273. onReachBottom(() => {
  274. loadMore();
  275. });
  276. /* 加载更多 */
  277. const loadMore = () => {
  278. if (params.total > state.appOrdersList.length) {
  279. params.status = 'loading';
  280. params.pageNum++;
  281. getList();
  282. } else {
  283. params.status = 'noMore';
  284. }
  285. }
  286. onPullDownRefresh(() => {
  287. if (hasLogin()) {
  288. getList();
  289. }
  290. });
  291. </script>
  292. <style lang="scss">
  293. page {
  294. background: #eef7f7;
  295. }
  296. :deep(.u-mode-center-box) {
  297. border-radius: 20rpx;
  298. }
  299. </style>
  300. <style lang="scss" scoped>
  301. .top-content {
  302. position: fixed;
  303. left: 0;
  304. z-index: 99999;
  305. background-color: white;
  306. }
  307. .top-menu {
  308. display: flex;
  309. justify-content: space-around;
  310. }
  311. .top-menu .tab {
  312. font-size: 28rpx;
  313. padding: 30rpx 30rpx;
  314. color: #666666;
  315. position: relative;
  316. }
  317. .top-menu .active .border {
  318. position: absolute;
  319. width: 70%;
  320. height: 16rpx;
  321. background: #00b38b;
  322. opacity: 0.3;
  323. bottom: 28rpx;
  324. z-index: -99;
  325. left: 15%;
  326. border-radius: 6rpx;
  327. }
  328. .top-menu .active {
  329. font-weight: bold;
  330. font-size: 32rpx;
  331. color: #0d0f26;
  332. }
  333. .top-menu .active::before {
  334. width: 100%;
  335. height: 16rpx;
  336. background: #00b38b;
  337. opacity: 0.3;
  338. }
  339. .search-layout {
  340. padding-top: 180rpx;
  341. .search-box {
  342. margin: 30rpx 30rpx 0rpx 30rpx;
  343. height: 80rpx;
  344. background: #FFFFFF;
  345. border: 1px solid #DCDCDC;
  346. border-radius: 40rpx;
  347. display: flex;
  348. justify-content: center;
  349. align-items: center;
  350. box-sizing: border-box;
  351. flex: 1;
  352. }
  353. .search-box .icon {
  354. width: 48rpx;
  355. height: 48rpx;
  356. margin: 0 20rpx;
  357. }
  358. .search-box .search {
  359. flex: 1;
  360. margin-right: 20rpx;
  361. height: 100%;
  362. padding: 0 10rpx;
  363. font-size: 28rpx;
  364. color: #00b38b;
  365. }
  366. .search-btn {
  367. color: white;
  368. background-color: #00B38B;
  369. width: 140rpx;
  370. height: 75rpx;
  371. line-height: 75rpx;
  372. font-size: 32rpx;
  373. border-radius: 40rpx;
  374. text-align: center;
  375. margin-right: 30rpx;
  376. margin-top: 30rpx;
  377. }
  378. }
  379. .item .head {
  380. display: flex;
  381. justify-content: space-between;
  382. align-items: center;
  383. padding: 20rpx 28rpx;
  384. border-bottom: 1px solid #dcdcdc;
  385. }
  386. .item .head {
  387. .head-row {
  388. display: flex;
  389. width: 100%;
  390. justify-content: space-between;
  391. align-items: center;
  392. }
  393. .name {}
  394. .name>text {
  395. font-size: 26rpx;
  396. font-family: Noto Sans S Chinese;
  397. font-weight: 400;
  398. color: #999999;
  399. line-height: 36rpx;
  400. }
  401. }
  402. .item .head .icon {
  403. width: 48rpx;
  404. height: 48rpx;
  405. }
  406. .item .head .name {
  407. display: flex;
  408. align-items: center;
  409. }
  410. .text-green {
  411. font-size: 26rpx;
  412. color: #00b38b;
  413. }
  414. .text-orange {
  415. font-size: 26rpx;
  416. color: #ff8000;
  417. }
  418. .text-black {
  419. font-size: 28rpx;
  420. color: #333;
  421. font-weight: 500;
  422. }
  423. .title {
  424. font-size: 30rpx;
  425. color: #333;
  426. }
  427. .tag-green {
  428. font-size: 22rpx;
  429. height: 40rpx;
  430. line-height: 40rpx;
  431. padding: 0 12rpx;
  432. border-radius: 6rpx;
  433. background: #d9f4ee;
  434. color: #00b38b;
  435. }
  436. .tag-grey {
  437. font-size: 22rpx;
  438. height: 40rpx;
  439. line-height: 40rpx;
  440. padding: 0 12rpx;
  441. border-radius: 6rpx;
  442. background: #e8e8e8;
  443. color: #666;
  444. }
  445. .detail {
  446. display: flex;
  447. justify-content: space-between;
  448. align-items: center;
  449. padding: 30rpx 32rpx;
  450. }
  451. .detail .type {
  452. font-size: 26rpx;
  453. color: #999;
  454. }
  455. .detail .value {
  456. font-size: 26rpx;
  457. color: #333;
  458. }
  459. .finished .detail .value {
  460. color: #999;
  461. }
  462. .detail .odd {
  463. margin: 20rpx 0;
  464. }
  465. .cny {
  466. font-size: 26rpx;
  467. color: #333;
  468. }
  469. .finished .cny {
  470. color: #999;
  471. }
  472. .amount {
  473. font-size: 40rpx;
  474. font-weight: bold;
  475. }
  476. .bottom .amount {
  477. color: #ff8000;
  478. }
  479. .finished .amount {
  480. color: #999;
  481. }
  482. .btns {
  483. position: relative;
  484. display: flex;
  485. align-items: center;
  486. justify-content: flex-end;
  487. border-top: 1px solid #dcdcdc;
  488. margin: 0 30rpx;
  489. padding: 20rpx 0;
  490. }
  491. .bottom {
  492. display: flex;
  493. justify-content: space-between;
  494. align-items: center;
  495. border-top: 1px solid #dcdcdc;
  496. margin: 0 30rpx;
  497. padding: 20rpx 0;
  498. }
  499. .btn {
  500. height: 60rpx;
  501. line-height: 58rpx;
  502. border-radius: 30rpx;
  503. padding: 0 24rpx;
  504. font-size: 23rpx;
  505. box-sizing: border-box;
  506. margin-right: 12rpx;
  507. }
  508. .btns .btn:last-child {
  509. margin: 0;
  510. }
  511. .btns .state {
  512. position: absolute;
  513. left: 0;
  514. font-size: 26rpx;
  515. font-family: Noto Sans S Chinese;
  516. font-weight: 400;
  517. color: #999999;
  518. line-height: 58rpx;
  519. text {
  520. font-size: 26rpx;
  521. font-family: Noto Sans S Chinese;
  522. font-weight: 400;
  523. color: #00B38B;
  524. line-height: 58rpx;
  525. }
  526. }
  527. .btn-primary {
  528. border: 1px solid #00b38b;
  529. color: #00b38b;
  530. }
  531. .btn-disable {
  532. border: 1px solid #999;
  533. color: #999;
  534. }
  535. .btn-normal {
  536. border: 1px solid #dcdcdc;
  537. color: #333;
  538. }
  539. .evaluation {
  540. display: flex;
  541. }
  542. .finished .detail .value {
  543. color: #999;
  544. }
  545. .detail .odd {
  546. margin: 20rpx 0;
  547. }
  548. .cny {
  549. font-size: 26rpx;
  550. color: #333;
  551. }
  552. .finished .cny {
  553. color: #999;
  554. }
  555. .item {
  556. background: #ffffff;
  557. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  558. border-radius: 20rpx;
  559. box-sizing: border-box;
  560. display: flex;
  561. flex-direction: column;
  562. margin: 30rpx 30rpx 0rpx;
  563. }
  564. .bg-white .item {
  565. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  566. }
  567. .item .head {
  568. display: flex;
  569. justify-content: space-between;
  570. align-items: center;
  571. padding: 20rpx 28rpx;
  572. border-bottom: 1px solid #dcdcdc;
  573. }
  574. .item .head {
  575. .head-row {
  576. display: flex;
  577. width: 100%;
  578. justify-content: space-between;
  579. align-items: center;
  580. }
  581. .name {}
  582. .name>text {
  583. font-size: 26rpx;
  584. font-family: Noto Sans S Chinese;
  585. font-weight: 400;
  586. color: #999999;
  587. line-height: 36rpx;
  588. }
  589. }
  590. .item .head .icon {
  591. width: 48rpx;
  592. height: 48rpx;
  593. }
  594. .item .head .name {
  595. display: flex;
  596. align-items: center;
  597. }
  598. </style>