Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

order.vue 14KB

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