金诚优选前端代码
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.

600 lines
17 KiB

  1. <template>
  2. <view>
  3. <lf-nav :spreadOut="true" :showIcon="true" bgColor="white" title="在线商城订单" @changeHeight="e => nav_height = e"></lf-nav>
  4. <view class="lf-row-between lf-bg-white" style="padding: 0 32rpx;">
  5. <view class="online-tab" :class="online_tab==0?'online-active':''" @click="changeTab(0)">线上订单</view>
  6. <view class="online-tab" :class="online_tab==1?'online-active':''" @click="changeTab(1)">线下订单</view>
  7. </view>
  8. <view v-if="online_tab == 0">
  9. <view class="special_tab">
  10. <u-tabs :list="tab_list" active-color="#15716E" inactive-color='#777777' :is-scroll="true" :current="current" @change="tabChange"></u-tabs>
  11. </view>
  12. <view class="lf-p-30 lf-flex lf-w-100 lf-bg-white lf-m-b-30">
  13. <!-- <u-icon name="search" class="search-icon"></u-icon>
  14. <input class="rom-search" type="text" placeholder="请输入商品名称" /> -->
  15. <u-search placeholder="请输入商品名称" bg-color="#F4F8F8" :show-action="false" style="width: 100%;"></u-search>
  16. </view>
  17. <swiper :style="{height: autoHeight, width: '750rpx'}" :current="current" @change="swiperChange">
  18. <swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
  19. <scroll-view :style="{height: autoHeight}" class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="tabItem.isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
  20. <view v-for="(item2,index2) of tabItem.list" :key="index2" class="online-card" @click="goDetails(item2.pick_self,item2.order_no)">
  21. <view class="lf-font-24 lf-color-777">
  22. 订单编号{{item2.order_no}}
  23. </view>
  24. <view class="lf-m-t-30">
  25. <text class="lf-iconfont icon-Group- lf-font-28"></text>
  26. <text class="lf-color-black lf-font-28 lf-font-bold lf-m-l-10">{{item2.from}}</text>
  27. <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10"></text>
  28. </view>
  29. <view v-for="(i,index3) of item2.items" :key="index3">
  30. <view class="lf-m-t-30" style="display: flex;">
  31. <image class="content-img" :src="i.item_meta.image" mode="aspectFill"></image>
  32. <view class="lf-m-l-15">
  33. <view class="lf-color-333 lf-font-26 lf-line-2" style="max-width: 480rpx;">{{i.item_name}}</view>
  34. <view class="lf-font-24 lf-color-777 lf-m-t-14 lf-row-between">
  35. <view>{{i.item_meta.specs_text}}</view>
  36. <view class="lf-font-32 lf-color-price">{{item2.items_total_yuan}}</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="lf-row-between lf-m-t-30 lf-m-b-50">
  41. <view class="lf-font-24 lf-color-777">{{item2.status_text}}</view>
  42. <!-- <view class="lf-color-price lf-font-24">删除订单</view> -->
  43. </view>
  44. </view>
  45. </view>
  46. <view class="loading-more lf-m-b-10">
  47. <text :class="{'loading-more-text': tabItem.loadingClass}" v-if="tabItem.list.length">{{tabItem.loadingText}}</text>
  48. <lf-nocontent v-else></lf-nocontent>
  49. <!-- <view>
  50. {{tabItem.list.length}}
  51. </view> -->
  52. </view>
  53. </scroll-view>
  54. </swiper-item>
  55. </swiper>
  56. </view>
  57. <view v-else>
  58. <!-- <view class="special_tab">
  59. <u-tabs :list="tab_list" active-color="#15716E" inactive-color='#777777' :is-scroll="true" :current="current" @change="tabChange"></u-tabs>
  60. </view> -->
  61. <scroll-view :style="{height: autoHeightTwo}" class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
  62. <view class="item" v-for="(item, index) in list" :key="index">
  63. <view class="lf-row-between">
  64. <text class="lf-font-36 lf-color-black lf-font-bold lf-color-price">{{item.balance.balance}}</text>
  65. <text class="lf-font-24 lf-color-555">{{item.balance.note}}</text>
  66. </view>
  67. <view class="lf-row-between lf-m-t-20">
  68. <text class="lf-font-24 lf-color-555">¥{{item.balance.current}}</text>
  69. <text class="lf-font-24 lf-color-777">{{item.created_at}}</text>
  70. </view>
  71. </view>
  72. <view class="loading-more lf-m-b-10">
  73. <text :class="{'loading-more-text': loadingClass}" v-if="list.length">{{loadingText}}</text>
  74. <lf-nocontent v-else></lf-nocontent>
  75. </view>
  76. </scroll-view>
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. export default {
  82. data() {
  83. return {
  84. online_tab: 0,
  85. tab_list: [
  86. {
  87. id: 1,
  88. name: '全部',
  89. type: '',
  90. list: [],
  91. isRefresher: false,
  92. loadingClass: false,
  93. loadingText: '正在加载中',
  94. page: 1,
  95. isPage: true
  96. },
  97. {
  98. id: 2,
  99. name: '代付款',
  100. type: 1,
  101. list: [],
  102. isRefresher: false,
  103. loadingClass: true,
  104. loadingText: '正在加载中',
  105. page: 1,
  106. isPage: true
  107. },
  108. {
  109. id: 3,
  110. name: '待发货',
  111. type: 2,
  112. list: [],
  113. isRefresher: false,
  114. loadingClass: true,
  115. loadingText: '正在加载中',
  116. page: 1,
  117. isPage: true
  118. },
  119. {
  120. id: 4,
  121. name: '待收货',
  122. type: 3,
  123. list: [],
  124. isRefresher: false,
  125. loadingClass: true,
  126. loadingText: '正在加载中',
  127. page: 1,
  128. isPage: true
  129. },
  130. {
  131. id: 5,
  132. name: '已完成',
  133. type: 4,
  134. list: [],
  135. isRefresher: false,
  136. loadingClass: true,
  137. loadingText: '正在加载中',
  138. page: 1,
  139. isPage: true
  140. }
  141. ],
  142. list: [],
  143. current: 0,
  144. windowHeight: 0,
  145. loadingClass: false,
  146. loadingText: '没有更多数据啦~',
  147. scrollH: '',
  148. nav_height: '',
  149. isRefresher: false,
  150. page: 1
  151. }
  152. },
  153. computed: {
  154. autoHeight(){
  155. return `calc(${this.scrollH}px - ${this.nav_height}px - 86rpx - 120rpx - 120rpx)`;
  156. },
  157. autoHeightTwo(){
  158. return `calc(${this.scrollH}px - ${this.nav_height}px - 90rpx)`;
  159. }
  160. },
  161. onLoad(){
  162. let info = uni.getSystemInfoSync();
  163. this.scrollH = info.screenHeight;
  164. this.getData()
  165. },
  166. methods: {
  167. goDetails(type,id) {
  168. if(type==0) {
  169. this.$url('/pages/order/newdetail/newdetail?pick_type=0&order_id='+id)
  170. }else {
  171. this.$url('/pages/order/newdetail/newdetail?pick_type=1&order_id='+id)
  172. }
  173. },
  174. changeTab(index) {
  175. this.online_tab = index
  176. if(this.online_tab == 0) {
  177. this.getData();
  178. }else {
  179. this.getUploadList();
  180. }
  181. },
  182. getUploadList(options={}) {
  183. this.$http
  184. .post({
  185. api: 'api/offline/order',
  186. data:{
  187. page:this.page
  188. },
  189. header: { Authorization: this.$cookieStorage.get('user_token')
  190. },
  191. })
  192. .then(res => {
  193. if (res.data.status) {
  194. let isPage = res.data.per_page == 15?true:false;
  195. this.isPage = isPage;
  196. if(!isPage) {
  197. this.loadingClass = false;
  198. this.loadingText = '没有更多数据啦~';
  199. }
  200. if(options.type == 'pageRefresh') {
  201. uni.stopPullDownRefresh();
  202. }else if(options.type == 'scrollRefresh') {
  203. this.isRefresher = false;
  204. }
  205. if(this.page == 1) {
  206. this.list = res.data.data.data;
  207. }else {
  208. this.list.push(...res.data.data.data);
  209. }
  210. console.log('数组列表',this.list)
  211. } else {
  212. wx.showModal({
  213. content: res.message || '请下拉页面刷新重试',
  214. showCancel: false
  215. });
  216. }
  217. wx.hideLoading();
  218. })
  219. .catch(() => {
  220. wx.hideLoading();
  221. wx.showModal({
  222. content: '请求失败',
  223. showCancel: false
  224. });
  225. });
  226. },
  227. tabChange(index){
  228. this.current = index;
  229. this.getData();
  230. },
  231. getData(options ={}) {
  232. let tab_item = this.tab_list[this.current];
  233. console.log('=====adada===',tab_item)
  234. this.$http
  235. .get({
  236. api: 'api/order/list',
  237. data:{
  238. status: tab_item.type,
  239. page: tab_item.page,
  240. type: 0,
  241. channel: ''
  242. },
  243. header: {
  244. Authorization: this.$cookieStorage.get('user_token')
  245. },
  246. })
  247. .then(res => {
  248. if (res.data.status) {
  249. let isPage = tab_item.page < res.data.meta.pagination.total_pages?true:false;
  250. tab_item.isPage = isPage;
  251. if(!isPage) {
  252. tab_item.loadingClass = false;
  253. tab_item.loadingText = '没有更多数据啦~';
  254. }
  255. if(options.type == 'pageRefresh') {
  256. uni.stopPullDownRefresh();
  257. }else if(options.type == 'scrollRefresh') {
  258. tab_item.isRefresher = false;
  259. }
  260. if(tab_item.page == 1) {
  261. tab_item.list = res.data.data;
  262. }else {
  263. tab_item.list.push(...res.data.data);
  264. }
  265. console.log('数组列表',tab_item.list)
  266. } else {
  267. wx.showModal({
  268. content: res.message || '请下拉页面刷新重试',
  269. showCancel: false
  270. });
  271. }
  272. wx.hideLoading();
  273. })
  274. .catch(() => {
  275. wx.hideLoading();
  276. wx.showModal({
  277. content: '请求失败',
  278. showCancel: false
  279. });
  280. });
  281. },
  282. // 滑块下标值变化
  283. swiperChange(event){
  284. this.current = event.detail.current;
  285. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  286. this.getData();
  287. },
  288. // 页面触底,加载下一页
  289. onScrolltolower(){
  290. let tab_item = this.tab_list[this.current];
  291. if(tab_item.isPage){
  292. tab_item.page = tab_item.page + 1;
  293. this.getData();
  294. }
  295. if(this.isPage) {
  296. this.page = this.page + 1;
  297. this.getUploadList()
  298. }
  299. },
  300. // scroll-view 下拉刷新
  301. onRefresherrefresh(){
  302. this.$u.throttle(() => {
  303. this.refreshFn({type: 'scrollRefresh'});
  304. }, 200);
  305. },
  306. // 下拉刷新处理
  307. refreshFn(options){
  308. let tab_item = this.tab_list[this.current];
  309. tab_item.page = 1;
  310. tab_item.isPage = true;
  311. tab_item.loadingClass = true;
  312. tab_item.list = [];
  313. tab_item.isRefresher = true;
  314. tab_item.loadingText = '正在加载中';
  315. this.getData(options);
  316. this.page = 1;
  317. this.isPage = true;
  318. this.loadingClass = true;
  319. this.list = [];
  320. this.isRefresher = true;
  321. this.loadingText = '正在加载中';
  322. this.getUploadList(options);
  323. },
  324. }
  325. }
  326. </script>
  327. <style>
  328. page {
  329. background-color: #F8F8F8;
  330. }
  331. </style>
  332. <style scoped lang="scss">
  333. .content-img {
  334. width: 130rpx;
  335. height: 130rpx;
  336. border-radius: 5rpx;
  337. }
  338. .online-card {
  339. width: 686rpx;
  340. height: auto;
  341. background: #FFFFFF;
  342. border-radius: 20rpx;
  343. margin-bottom: 30rpx;
  344. padding: 30rpx;
  345. }
  346. .online-tab {
  347. width: 375rpx;
  348. height: 90rpx;
  349. display: flex;
  350. align-items: center;
  351. justify-content: center;
  352. color: #555555;
  353. font-size: 32rpx;
  354. }
  355. .online-active {
  356. background: #15716E;
  357. color: #FFFFFF;
  358. border-radius: 45rpx 45rpx 0rpx 0rpx;
  359. }
  360. //tab相关
  361. .search-icon {
  362. position: relative;
  363. bottom: 0;
  364. left: 54rpx;
  365. }
  366. /deep/.input-placeholder{
  367. color: #777;
  368. font-size: 28rpx;
  369. }
  370. .rom-search {
  371. width: 686rpx;
  372. height: 60rpx;
  373. background: #F4F8F8;
  374. border-radius: 30rpx;
  375. padding-left: 74rpx;
  376. font-size: 28rpx;
  377. }
  378. .goods-rom {
  379. border-radius: 20rpx;
  380. width: 333rpx;
  381. height: 497rpx;
  382. background-color: white;
  383. box-shadow: 0px 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  384. &:nth-child(2n) {
  385. margin-right: 0;
  386. }
  387. &:nth-child(n + 3) {
  388. margin-top: 20rpx;
  389. }
  390. }
  391. .introduct {
  392. padding: 0 0 30rpx 32rpx;
  393. }
  394. .com{
  395. width: 100%;
  396. height: 100%;
  397. box-sizing: border-box;
  398. padding: 0rpx 28rpx;
  399. }
  400. .shop-head {
  401. width: 100%;
  402. height: 400rpx;
  403. position: relative;
  404. }
  405. .shop-flex {
  406. display: flex;
  407. padding: 30rpx;
  408. }
  409. .shop-title {
  410. width: 686rpx;
  411. height: 274rpx;
  412. border-radius: 20rpx;
  413. background-color: white;
  414. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  415. margin: 0 auto;
  416. position: relative;
  417. top: -32rpx;
  418. }
  419. .shop-img {
  420. width: 90rpx;
  421. height: 90rpx;
  422. margin-right: 15rpx;
  423. }
  424. .shop-function {
  425. width: 80rpx;
  426. height: 80rpx;
  427. border-radius: 50%;
  428. font-size: 40rpx;
  429. }
  430. .function-total {
  431. display: flex;
  432. justify-content: space-between;
  433. padding: 0 65rpx 0 65rpx;
  434. }
  435. .item{
  436. width: 686rpx;
  437. height: max-content;
  438. background: #F4F8F8;
  439. border-radius: 10rpx;
  440. // margin-bottom: 30rpx;
  441. margin-top: 30rpx;
  442. padding: 30rpx;
  443. box-sizing: border-box;
  444. line-height: 1;
  445. }
  446. /deep/.u-scroll-box {
  447. display: flex;
  448. justify-content: center;
  449. align-items: center;
  450. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  451. }
  452. /deep/.special_tab .u-tabs .u-scroll-box .u-tab-bar {
  453. background-color: #15716E!important;
  454. width: 80rpx!important;
  455. position: absolute;
  456. height: 10rpx;
  457. left: 0;
  458. border-radius: 8rpx 8rpx 0px 0px!important;
  459. bottom: -12rpx;
  460. }
  461. /deep/ .u-tab-item {
  462. font-size: 28rpx!important;
  463. }
  464. //价格筛选伪类
  465. // /deep/.special_tab .u-tab-item:nth-child(4n) ::after{
  466. // font-size: 48rpx!important;
  467. // content: '';
  468. // color: red;
  469. // }
  470. // loading加载
  471. .loading-more {
  472. align-items: center;
  473. justify-content: center;
  474. padding-top: 10px;
  475. padding-bottom: 10px;
  476. text-align: center;
  477. font-size: 28rpx;
  478. color: #999;
  479. }
  480. .loading-more-text::before {
  481. content: '';
  482. width: 20px;
  483. height: 20px;
  484. display: inline-block;
  485. vertical-align: middle;
  486. -webkit-animation: weuiLoading 1s steps(12, end) infinite;
  487. animation: weuiLoading 1s steps(12, end) infinite;
  488. background-repeat: no-repeat;
  489. background-image: url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E9E9E9' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23989697' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%239B999A' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23A3A1A2' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23ABA9AA' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23B2B2B2' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23BAB8B9' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23C2C0C1' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23CBCBCB' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23D2D2D2' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23DADADA' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E2E2E2' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E");
  490. background-size: 100%;
  491. }
  492. @keyframes weuiLoading {
  493. 0% {
  494. transform: rotate3d(0, 0, 1, 0deg);
  495. }
  496. 100% {
  497. transform: rotate3d(0, 0, 1, 360deg);
  498. }
  499. }
  500. .list-warter {
  501. border-radius: 20rpx;
  502. margin: 10px 5px;
  503. margin-top: 0px;
  504. background-color: #ffffff;
  505. // padding: 8px;
  506. position: relative;
  507. overflow: hidden;
  508. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  509. }
  510. .u-close {
  511. position: absolute;
  512. top: 32rpx;
  513. right: 32rpx;
  514. }
  515. .list-image {
  516. width: 100%;
  517. border-radius: 4px;
  518. }
  519. .list-title {
  520. font-size: 28rpx;
  521. font-weight: bold;
  522. color: $u-main-color;
  523. }
  524. .list-label{
  525. position: absolute;
  526. bottom: 0;
  527. right: 0;
  528. background-color: rgba(0,0,0,0.5);
  529. width: 140rpx;
  530. height: 48rpx;
  531. border-radius: 20rpx 0rpx 0rpx 0rpx;
  532. font-size: 22rpx;
  533. color: #FFFFFF;
  534. line-height: 48rpx;
  535. text-align: center;
  536. }
  537. .list-tag {
  538. display: flex;
  539. margin-top: 5px;
  540. }
  541. .list-tag-owner {
  542. background-color: $u-type-error;
  543. color: #FFFFFF;
  544. display: flex;
  545. align-items: center;
  546. padding: 4rpx 14rpx;
  547. border-radius: 50rpx;
  548. font-size: 20rpx;
  549. line-height: 1;
  550. }
  551. .list-tag-text {
  552. border: 1px solid $u-type-primary;
  553. color: $u-type-primary;
  554. margin-left: 10px;
  555. border-radius: 50rpx;
  556. line-height: 1;
  557. padding: 4rpx 14rpx;
  558. display: flex;
  559. align-items: center;
  560. border-radius: 50rpx;
  561. font-size: 20rpx;
  562. }
  563. .list-price {
  564. font-size: 30rpx;
  565. color: $u-type-error;
  566. margin-top: 5px;
  567. display: flex;
  568. align-items: center;
  569. }
  570. </style>