You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

order.vue 14KB

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