球星卡微信小程序
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.

715 lines
17 KiB

  1. <template>
  2. <view>
  3. <!-- tabs选项卡 -->
  4. <view class="lf-flex">
  5. <view style="width: 84%;">
  6. <u-tabs
  7. :current="tabIndex"
  8. :list="tabList"
  9. :lineWidth="34"
  10. :scrollable="false"
  11. :itemWidth="100 / tabList.length +'%'"
  12. lineColor="#E7A23F"
  13. @change="switchTab"
  14. >
  15. </u-tabs>
  16. </view>
  17. <view class="filter-icon">
  18. <image src="@/static/icon/filter.png" @click="showFilter = !showFilter"></image>
  19. </view>
  20. </view>
  21. <!-- 筛选 -->
  22. <view class="filter-box" v-if="showFilter">
  23. <view class="flex-col group_6" >
  24. <view class="flex-col section_5">
  25. <view class="flex-col">
  26. <text class="text_7">按收货确认时间</text>
  27. <view class="flex-col group_8">
  28. <view class="lf-flex lf-flex-wrap">
  29. <view class="filter-date-item" :class="{active: filterGather.date == item.value}" @click="selectReceivingTime(item)" v-for="(item, index) in receivingTimeList" :key="index">{{ item.label }}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="flex-col group_11">
  34. <text class="text_15">按送评信息</text>
  35. <view class="flex-row group_12">
  36. <view class="flex-col items-center text-wrapper_2">
  37. <u-input v-model="filterGather.name" placeholder="输入送评人姓名或手机号"></u-input>
  38. </view>
  39. <view class="flex-col items-start text-wrapper_3">
  40. <u-input v-model="filterGather.label" placeholder="输入标签"></u-input>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="flex-col group_13">
  45. <text class="text_18">按送评信息</text>
  46. <view class="flex-col items-start text-wrapper_4">
  47. <u-input v-model="filterGather.order_num" placeholder="输入评级编号" class="text-wrapper_4-input" ></u-input>
  48. </view>
  49. </view>
  50. <view class="flex-row group_14">
  51. <view class="flex-col items-center text-wrapper_5" @click="reset">
  52. <text>重置</text>
  53. </view>
  54. <view class="flex-col items-center text-wrapper_6" @click="confirm">
  55. <text>确认</text>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="flex-col items-center group_15" @click="showFilter = false">
  60. <view class="section_7"> </view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 页面主体滚动区域 -->
  65. <swiper :current="tabIndex" :style="{height: swiperContentHeight}" @change="swiperChange">
  66. <swiper-item v-for="(tabItem, idx) in tabList" :key="idx" :item-id="tabItem.ident">
  67. <scroll-view
  68. :style="{height: swiperContentHeight, 'padding-top': '30rpx'}"
  69. :scroll-y="true"
  70. :refresher-enabled="true"
  71. :refresher-triggered="tabItem.isRefresher"
  72. @scrolltolower="scrolltolower"
  73. @refresherrefresh="refresherrefresh"
  74. >
  75. <view class="item-box" v-for="(item, index) in tabItem.data" :key="index" @click="$url('/packages/sonpingDetail/sonpingDetail?id='+ item.id)">
  76. <view class="flex-col section_5">
  77. <view class="justify-between">
  78. <view class="flex-row group_8">
  79. <image
  80. src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497798740970822.png"
  81. class="image_7"
  82. />
  83. <text class="text_7">在线送评 todo</text>
  84. </view>
  85. <text class="text_8">{{ ['','待确认','评级中','待付款','待收货'][item.status] }}</text>
  86. </view>
  87. <view class="justify-between group_9">
  88. <view class="flex-row">
  89. <text>{{ item.owner }}</text>
  90. <text class="text_10">{{ item.tel }}</text>
  91. </view>
  92. <text>{{ item.num }}</text>
  93. </view>
  94. <view class="justify-between group_11">
  95. <!-- <text class="text_12">更多</text> -->
  96. <text class="text_12"></text>
  97. <view class="flex-row" v-if="item.status == 1">
  98. <view class="flex-col items-center text-wrapper" @click.stop="orderCancel">
  99. <text>取消</text>
  100. </view>
  101. <view class="flex-col items-center text-wrapper_1" @click.stop="orderSend">
  102. <text>寄送藏品</text>
  103. </view>
  104. </view>
  105. <view class="flex-row" v-else-if="item.status == 2">
  106. <view class="flex-col items-center text-wrapper" @click.stop="orderAddressChange">
  107. <text>更改地址</text>
  108. </view>
  109. </view>
  110. <view class="flex-row" v-else-if="item.status == 3">
  111. <view class="flex-col items-center text-wrapper_1" style="border-color: #EA2B2B; color: #EA2B2B;" @click.stop="orderPay">
  112. <text>付款</text>
  113. </view>
  114. </view>
  115. <view class="flex-row" v-else-if="item.status == 4">
  116. <view class="flex-col items-center text-wrapper_1" @click.stop="orderConfirm">
  117. <text>确认收货</text>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. <!-- 当前tab下没有数据且无分页数据时显示系统剪辑中 -->
  124. <view class="nomore-box" v-if="tabItem.data.length <= 0 && !tabItem.isPage">
  125. <image src="@/static/images/nomore.png"></image>
  126. <view>暂无订单记录</view>
  127. </view>
  128. <!-- 加载中和暂无更多显示 -->
  129. <u-loadmore :status="tabItem.status" margin-bottom="20" marginTop="20" v-else></u-loadmore>
  130. <!-- 底部修饰解决部分机型底部被挡住且padding和margin都不生效的BUG -->
  131. <view class="additional"></view>
  132. </scroll-view>
  133. </swiper-item>
  134. </swiper>
  135. <!-- 轻提示 -->
  136. <u-toast ref="uToast"></u-toast>
  137. </view>
  138. </template>
  139. <script>
  140. import { orderList } from '@/service/order.js';
  141. export default {
  142. data(){
  143. let publicKey = {
  144. page: 1,
  145. pageSize: 10,
  146. isPage: true,
  147. status: 'loading', // loading加载,nomore没有更多了
  148. isRefresher: false, // 下拉刷新状态,默认没有开启下拉
  149. }
  150. return {
  151. showFilter: false,
  152. tabList: [{
  153. name: '全部',
  154. ident: 'all',
  155. type: 0,
  156. data: [],
  157. badge: {isDot: false},
  158. requestFunction: 'getList',
  159. ...publicKey
  160. },{
  161. name: '待确认',
  162. ident: 'waitconfirm',
  163. type: 1,
  164. data: [],
  165. badge: {isDot: false},
  166. requestFunction: 'getList',
  167. ...publicKey
  168. },{
  169. name: '评级中',
  170. ident: 'gradeing',
  171. type: 2,
  172. data: [],
  173. badge: {isDot: false},
  174. requestFunction: 'getList',
  175. ...publicKey
  176. },{
  177. name: '待付款',
  178. ident: 'waitpay',
  179. type: 3,
  180. data: [],
  181. badge: {isDot: false},
  182. requestFunction: 'getList',
  183. ...publicKey
  184. },{
  185. name: '待收货',
  186. ident: 'waitreceiv',
  187. type: 4,
  188. data: [],
  189. badge: {isDot: false},
  190. requestFunction: 'getList',
  191. ...publicKey
  192. }],
  193. tabIndex: 0,
  194. receivingTimeList: [{
  195. label: '1个月内',
  196. value: '1'
  197. },{
  198. label: '3个月内',
  199. value: '2'
  200. },{
  201. label: '6个月内',
  202. value: '3'
  203. },{
  204. label: '今年',
  205. value: '4'
  206. },{
  207. label: '2021年',
  208. value: '5'
  209. },{
  210. label: '2020年',
  211. value: '6'
  212. },{
  213. label: '2019年',
  214. value: '7'
  215. }],
  216. filterGather: {
  217. date: '',
  218. name: '',
  219. label: '',
  220. order_num: ''
  221. }
  222. }
  223. },
  224. computed: {
  225. // 传入对应tab的ident值,在当前tabIndex下是否匹配,匹配上返回true,否则返回false,调用matchTabIdent(par1, par2, ...)
  226. matchTabIdent(){
  227. let that = this;
  228. return function(){
  229. let identList = Array.from(arguments);
  230. let hasKey = identList.some(item => that.tabList[that.tabIndex].ident === item);
  231. return hasKey;
  232. }
  233. },
  234. // 计算获得swiper内容区域剩余高度
  235. swiperContentHeight(){
  236. return `calc(100vh - 80rpx - 10rpx)`;
  237. }
  238. },
  239. onLoad(options){
  240. this.tabIndex = Number(options.current || this.tabIndex);
  241. this[ this.tabList[this.tabIndex].requestFunction ](); // 获取当前tab下的数据列表
  242. },
  243. methods: {
  244. // 获取数据
  245. getList(options = {}){
  246. let tabItem = this.tabList[this.tabIndex];
  247. let filterGather = this.filterGather;
  248. let data = {
  249. type: tabItem.type,
  250. page: tabItem.page,
  251. pageSize: tabItem.pageSize
  252. };
  253. if(filterGather.date){
  254. data.confirm_type = filterGather.date;
  255. }
  256. if(filterGather.name){
  257. data.name_phone = filterGather.name;
  258. }
  259. if(filterGather.label){
  260. data.label = filterGather.label;
  261. }
  262. if(filterGather.order_num){
  263. data.order_num = filterGather.order_num;
  264. }
  265. orderList(data).then(res => {
  266. let datas = res.data.datas;
  267. let isPage = this.$isRight(datas.next_page_url);
  268. if(!isPage){
  269. tabItem.isPage = isPage;
  270. tabItem.status = 'nomore';
  271. }
  272. if(tabItem.page == 1){
  273. tabItem.data = datas.data;
  274. }else{
  275. tabItem.data.push(...datas.data);
  276. }
  277. if(options.refresher){
  278. this.$refs.uToast.show({
  279. message: '刷新成功',
  280. type: 'success'
  281. });
  282. tabItem.isRefresher = false;
  283. }
  284. })
  285. },
  286. // 筛选
  287. confirm(){
  288. let tabItem = this.tabList[this.tabIndex];
  289. tabItem.page = 1;
  290. tabItem.isPage = true;
  291. tabItem.status = 'loading';
  292. tabItem.data = [];
  293. this[tabItem.requestFunction]();
  294. this.showFilter = false;
  295. },
  296. // 重置筛选条件
  297. reset(){
  298. this.filterGather = this.$options.data().filterGather;
  299. this.$refs.uToast.show({
  300. message: '内容已重置',
  301. type: 'success'
  302. });
  303. },
  304. // 选择确认收货时间
  305. selectReceivingTime(item){
  306. if(this.filterGather.date == item.value){
  307. this.filterGather.date = "";
  308. }else{
  309. this.filterGather.date = item.value;
  310. }
  311. },
  312. // 取消订单 todo
  313. orderCancel(){
  314. console.log("++++++++++")
  315. },
  316. // 寄送藏品 todo
  317. orderSend(){
  318. },
  319. // 更改地址 todo
  320. orderAddressChange(){
  321. },
  322. // 订单付款 todo
  323. orderPay(){
  324. },
  325. // 确认收货 todo
  326. orderConfirm(){
  327. },
  328. // 切换tab
  329. switchTab(item){
  330. this.tabIndex = item.index;
  331. // 判断所切换到的tab下是否有数据并且isPage为true,如果没有再请求,否则啥也不干
  332. let tabItem = this.tabList[this.tabIndex];
  333. if(tabItem.data.length === 0 && tabItem.isPage){
  334. this[ tabItem.requestFunction ]();
  335. }
  336. },
  337. // swiper滑动响应事件
  338. swiperChange(event){
  339. // 事件触发类型为触摸时才做处理,否则是因为switchTab方法执行导致的事件回调
  340. if(event.detail.source === 'touch'){
  341. this.tabIndex = event.detail.current;
  342. // 判断所切换到的tab下是否有数据并且isPage为true,如果没有再请求,否则啥也不干
  343. let tabItem = this.tabList[this.tabIndex];
  344. if(tabItem.data.length === 0 && tabItem.isPage){
  345. this[ tabItem.requestFunction ]();
  346. }
  347. }
  348. },
  349. // 下拉刷新,重新获取页面数据,将状态置回初始值再请求
  350. refresherrefresh(){
  351. let tabItem = this.tabList[this.tabIndex];
  352. tabItem.isRefresher = true;
  353. tabItem.page = 1;
  354. tabItem.isPage = true;
  355. tabItem.status = 'loading';
  356. tabItem.data = [];
  357. this[tabItem.requestFunction]({refresher: true});
  358. },
  359. // 滚动到底部
  360. scrolltolower(){
  361. let tabItem = this.tabList[this.tabIndex];
  362. if(tabItem.isPage){
  363. tabItem.page++;
  364. this[tabItem.requestFunction]();
  365. }
  366. }
  367. }
  368. }
  369. </script>
  370. <style>
  371. /* 修复ios页面左右漂浮BUG */
  372. page{
  373. overflow: hidden;
  374. }
  375. </style>
  376. <style scoped lang="scss">
  377. .filter-icon{
  378. width: 16%;
  379. height: 34rpx;
  380. display: flex;
  381. justify-content: center;
  382. align-items: center;
  383. border-left: 2rpx solid #F6F6F6;
  384. image{
  385. width: 36rpx;
  386. height: 32rpx;
  387. }
  388. }
  389. .filter-box{
  390. position: absolute;
  391. z-index: 9999;
  392. width: 750rpx;
  393. .text-wrapper_1 {
  394. margin-left: 16rpx;
  395. flex: 1 1 160rpx;
  396. color: rgb(51, 51, 51);
  397. font-size: 28rpx;
  398. font-weight: 500;
  399. line-height: 40rpx;
  400. white-space: nowrap;
  401. padding: 14rpx 0;
  402. background-color: rgb(246, 246, 246);
  403. border-radius: 10rpx;
  404. height: 68rpx;
  405. }
  406. .left-text-wrapper {
  407. padding: 14rpx 0;
  408. background-color: rgb(246, 246, 246);
  409. border-radius: 10rpx;
  410. width: 160rpx;
  411. height: 68rpx;
  412. }
  413. .group_6 {
  414. padding-top: 2rpx;
  415. }
  416. .section_5 {
  417. padding: 40rpx 32rpx 50rpx;
  418. background-color: rgb(255, 255, 255);
  419. }
  420. .group_15 {
  421. padding: 506rpx 0 16rpx;
  422. position: relative;
  423. }
  424. .group_11 {
  425. margin-top: 50rpx;
  426. }
  427. .group_13 {
  428. margin-top: 50rpx;
  429. }
  430. .group_14 {
  431. margin-top: 50rpx;
  432. }
  433. .section_7 {
  434. background-color: rgba(0, 0, 0, 0.5);
  435. width: 750rpx;
  436. height: 528rpx;
  437. top: 0;
  438. right: 0;
  439. bottom: 0;
  440. left: 0;
  441. position: absolute;
  442. }
  443. .text_7 {
  444. color: rgb(51, 51, 51);
  445. font-size: 32rpx;
  446. font-weight: 500;
  447. line-height: 44rpx;
  448. white-space: nowrap;
  449. }
  450. .group_8 {
  451. margin-top: 20rpx;
  452. }
  453. .text_15 {
  454. color: rgb(51, 51, 51);
  455. font-size: 32rpx;
  456. font-weight: 500;
  457. line-height: 44rpx;
  458. white-space: nowrap;
  459. }
  460. .group_12 {
  461. margin-top: 20rpx;
  462. color: rgb(195, 195, 195);
  463. font-size: 28rpx;
  464. font-weight: 500;
  465. line-height: 40rpx;
  466. white-space: nowrap;
  467. }
  468. .text_18 {
  469. color: rgb(51, 51, 51);
  470. font-size: 32rpx;
  471. font-weight: 500;
  472. line-height: 44rpx;
  473. white-space: nowrap;
  474. }
  475. .text-wrapper_4 {
  476. margin-top: 18rpx;
  477. // padding: 12rpx 0;
  478. color: rgb(195, 195, 195);
  479. font-size: 28rpx;
  480. font-weight: 500;
  481. line-height: 40rpx;
  482. white-space: nowrap;
  483. border-radius: 10rpx;
  484. border: solid 2rpx rgb(195, 195, 195);
  485. /deep/.u-input{
  486. width: 100%;
  487. }
  488. }
  489. .text-wrapper_5 {
  490. padding: 24rpx 0;
  491. flex: 1 1 330rpx;
  492. color: rgb(195, 195, 195);
  493. font-size: 32rpx;
  494. font-weight: 600;
  495. line-height: 44rpx;
  496. white-space: nowrap;
  497. border-radius: 10rpx;
  498. height: 96rpx;
  499. border: solid 2rpx rgb(195, 195, 195);
  500. }
  501. .text-wrapper_6 {
  502. margin-left: 26rpx;
  503. padding: 26rpx 0;
  504. flex: 1 1 330rpx;
  505. color: rgb(255, 255, 255);
  506. font-size: 32rpx;
  507. font-weight: 600;
  508. line-height: 44rpx;
  509. white-space: nowrap;
  510. background-color: rgb(231, 162, 63);
  511. border-radius: 10rpx;
  512. height: 96rpx;
  513. }
  514. .group_10 {
  515. margin-top: 20rpx;
  516. color: rgb(51, 51, 51);
  517. font-size: 28rpx;
  518. font-weight: 500;
  519. line-height: 40rpx;
  520. white-space: nowrap;
  521. }
  522. .text-wrapper_2 {
  523. // padding: 12rpx 0;
  524. flex: 1 1 auto;
  525. border-radius: 10rpx;
  526. height: 68rpx;
  527. border: solid 2rpx rgb(195, 195, 195);
  528. }
  529. .text-wrapper_3 {
  530. margin-left: 28rpx;
  531. // padding: 12rpx 0;
  532. border-radius: 10rpx;
  533. width: 308rpx;
  534. height: 68rpx;
  535. border: solid 2rpx rgb(195, 195, 195);
  536. }
  537. .text_19 {
  538. margin-left: 18rpx;
  539. }
  540. .text-wrapper {
  541. padding: 14rpx 0;
  542. flex: 1 1 160rpx;
  543. color: rgb(255, 255, 255);
  544. font-size: 28rpx;
  545. font-weight: 500;
  546. line-height: 40rpx;
  547. white-space: nowrap;
  548. background-color: rgb(231, 162, 63);
  549. border-radius: 10rpx;
  550. height: 68rpx;
  551. }
  552. .view_3 {
  553. margin-left: 14rpx;
  554. }
  555. .view_6 {
  556. margin-left: 16rpx;
  557. }
  558. .view_7 {
  559. margin-left: 14rpx;
  560. }
  561. .text_17 {
  562. margin-left: 18rpx;
  563. }
  564. }
  565. .item-box{
  566. width: 686rpx;
  567. // height: 300rpx;
  568. margin: 0 auto;
  569. background-color: #f6f6f6;
  570. &:nth-child(n+2){
  571. margin-top: 20rpx;
  572. }
  573. .section_5 {
  574. padding: 40rpx 32rpx 0;
  575. background-color: rgb(255, 255, 255);
  576. }
  577. .group_9 {
  578. margin-top: 30rpx;
  579. color: rgb(51, 51, 51);
  580. font-size: 32rpx;
  581. font-weight: 500;
  582. line-height: 44rpx;
  583. white-space: nowrap;
  584. }
  585. .group_11 {
  586. margin-top: 26rpx;
  587. padding: 32rpx 0 28rpx;
  588. border-top: solid 2rpx rgb(239, 239, 239);
  589. }
  590. .group_8 {
  591. color: rgb(153, 153, 153);
  592. font-size: 28rpx;
  593. line-height: 40rpx;
  594. white-space: nowrap;
  595. }
  596. .text_8 {
  597. color: rgb(43, 102, 234);
  598. font-size: 28rpx;
  599. font-weight: 500;
  600. line-height: 40rpx;
  601. white-space: nowrap;
  602. }
  603. .text_12 {
  604. align-self: center;
  605. color: rgb(153, 153, 153);
  606. font-size: 28rpx;
  607. line-height: 40rpx;
  608. white-space: nowrap;
  609. }
  610. .image_7 {
  611. width: 40rpx;
  612. height: 40rpx;
  613. }
  614. .text_7 {
  615. margin-left: 12rpx;
  616. }
  617. .text_10 {
  618. margin-left: 21rpx;
  619. }
  620. .text-wrapper {
  621. padding: 10rpx 0;
  622. color: rgb(153, 153, 153);
  623. font-size: 28rpx;
  624. font-weight: 500;
  625. line-height: 40rpx;
  626. white-space: nowrap;
  627. border-radius: 32rpx;
  628. width: 160rpx;
  629. height: 64rpx;
  630. border: solid 2rpx rgb(153, 153, 153);
  631. }
  632. .text-wrapper_1 {
  633. margin-left: 18rpx;
  634. padding: 10rpx 0;
  635. color: rgb(231, 162, 63);
  636. font-size: 28rpx;
  637. font-weight: 500;
  638. line-height: 40rpx;
  639. white-space: nowrap;
  640. border-radius: 32rpx;
  641. width: 160rpx;
  642. height: 64rpx;
  643. border: solid 2rpx rgb(231, 162, 63);
  644. }
  645. }
  646. .nomore-box{
  647. width: 686rpx;
  648. height: 500rpx;
  649. margin: 0 auto;
  650. display: flex;
  651. flex-direction: column;
  652. justify-content: center;
  653. align-items: center;
  654. image{
  655. width: 434rpx;
  656. height: 260rpx;
  657. }
  658. view{
  659. text-align: center;
  660. color: #777777;
  661. margin-top: 40rpx;
  662. }
  663. }
  664. // 解决scroll-view底部padding和margin都不生效贴边的BUG
  665. .additional{
  666. height: calc( env(safe-area-inset-bottom) + 20rpx );
  667. height: calc( constant(safe-area-inset-bottom) + 20rpx );
  668. }
  669. .filter-date-item{
  670. width: 160rpx;
  671. height: 68rpx;
  672. background: #F6F6F6;
  673. border-radius: 10rpx;
  674. font-size: 28rpx;
  675. color: #333333;
  676. margin-right: 16rpx;
  677. display: flex;
  678. justify-content: center;
  679. align-items: center;
  680. &:nth-child(4n){
  681. margin-right: 0rpx;
  682. }
  683. &:nth-child(n+5){
  684. margin-top: 16rpx;
  685. }
  686. &.active{
  687. color: #FFFFFF;
  688. background-color: #E7A23F;
  689. }
  690. }
  691. </style>