您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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