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

593 lines
17 KiB

4 years ago
  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="$url('/pages/order/newdetail/newdetail?order_id='+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. changeTab(index) {
  168. this.online_tab = index
  169. if(this.online_tab == 0) {
  170. this.getData();
  171. }else {
  172. this.getUploadList();
  173. }
  174. },
  175. getUploadList(options={}) {
  176. this.$http
  177. .post({
  178. api: 'api/offline/order',
  179. data:{
  180. page:this.page
  181. },
  182. header: { Authorization: this.$cookieStorage.get('user_token')
  183. },
  184. })
  185. .then(res => {
  186. if (res.data.status) {
  187. let isPage = res.data.per_page == 15?true:false;
  188. this.isPage = isPage;
  189. if(!isPage) {
  190. this.loadingClass = false;
  191. this.loadingText = '没有更多数据啦~';
  192. }
  193. if(options.type == 'pageRefresh') {
  194. uni.stopPullDownRefresh();
  195. }else if(options.type == 'scrollRefresh') {
  196. this.isRefresher = false;
  197. }
  198. if(this.page == 1) {
  199. this.list = res.data.data.data;
  200. }else {
  201. this.list.push(...res.data.data.data);
  202. }
  203. console.log('数组列表',this.list)
  204. } else {
  205. wx.showModal({
  206. content: res.message || '请下拉页面刷新重试',
  207. showCancel: false
  208. });
  209. }
  210. wx.hideLoading();
  211. })
  212. .catch(() => {
  213. wx.hideLoading();
  214. wx.showModal({
  215. content: '请求失败',
  216. showCancel: false
  217. });
  218. });
  219. },
  220. tabChange(index){
  221. this.current = index;
  222. this.getData();
  223. },
  224. getData(options ={}) {
  225. let tab_item = this.tab_list[this.current];
  226. console.log('=====adada===',tab_item)
  227. this.$http
  228. .get({
  229. api: 'api/order/list',
  230. data:{
  231. status: tab_item.type,
  232. page: tab_item.page,
  233. type: 0,
  234. channel: ''
  235. },
  236. header: {
  237. Authorization: this.$cookieStorage.get('user_token')
  238. },
  239. })
  240. .then(res => {
  241. if (res.data.status) {
  242. let isPage = tab_item.page < res.data.meta.pagination.total_pages?true:false;
  243. tab_item.isPage = isPage;
  244. if(!isPage) {
  245. tab_item.loadingClass = false;
  246. tab_item.loadingText = '没有更多数据啦~';
  247. }
  248. if(options.type == 'pageRefresh') {
  249. uni.stopPullDownRefresh();
  250. }else if(options.type == 'scrollRefresh') {
  251. tab_item.isRefresher = false;
  252. }
  253. if(tab_item.page == 1) {
  254. tab_item.list = res.data.data;
  255. }else {
  256. tab_item.list.push(...res.data.data);
  257. }
  258. console.log('数组列表',tab_item.list)
  259. } else {
  260. wx.showModal({
  261. content: res.message || '请下拉页面刷新重试',
  262. showCancel: false
  263. });
  264. }
  265. wx.hideLoading();
  266. })
  267. .catch(() => {
  268. wx.hideLoading();
  269. wx.showModal({
  270. content: '请求失败',
  271. showCancel: false
  272. });
  273. });
  274. },
  275. // 滑块下标值变化
  276. swiperChange(event){
  277. this.current = event.detail.current;
  278. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  279. this.getData();
  280. },
  281. // 页面触底,加载下一页
  282. onScrolltolower(){
  283. let tab_item = this.tab_list[this.current];
  284. if(tab_item.isPage){
  285. tab_item.page = tab_item.page + 1;
  286. this.getData();
  287. }
  288. if(this.isPage) {
  289. this.page = this.page + 1;
  290. this.getUploadList()
  291. }
  292. },
  293. // scroll-view 下拉刷新
  294. onRefresherrefresh(){
  295. this.$u.throttle(() => {
  296. this.refreshFn({type: 'scrollRefresh'});
  297. }, 200);
  298. },
  299. // 下拉刷新处理
  300. refreshFn(options){
  301. let tab_item = this.tab_list[this.current];
  302. tab_item.page = 1;
  303. tab_item.isPage = true;
  304. tab_item.loadingClass = true;
  305. tab_item.list = [];
  306. tab_item.isRefresher = true;
  307. tab_item.loadingText = '正在加载中';
  308. this.getData(options);
  309. this.page = 1;
  310. this.isPage = true;
  311. this.loadingClass = true;
  312. this.list = [];
  313. this.isRefresher = true;
  314. this.loadingText = '正在加载中';
  315. this.getUploadList(options);
  316. },
  317. }
  318. }
  319. </script>
  320. <style>
  321. page {
  322. background-color: #F8F8F8;
  323. }
  324. </style>
  325. <style scoped lang="scss">
  326. .content-img {
  327. width: 130rpx;
  328. height: 130rpx;
  329. border-radius: 5rpx;
  330. }
  331. .online-card {
  332. width: 686rpx;
  333. height: auto;
  334. background: #FFFFFF;
  335. border-radius: 20rpx;
  336. margin-bottom: 30rpx;
  337. padding: 30rpx;
  338. }
  339. .online-tab {
  340. width: 375rpx;
  341. height: 90rpx;
  342. display: flex;
  343. align-items: center;
  344. justify-content: center;
  345. color: #555555;
  346. font-size: 32rpx;
  347. }
  348. .online-active {
  349. background: #15716E;
  350. color: #FFFFFF;
  351. border-radius: 45rpx 45rpx 0rpx 0rpx;
  352. }
  353. //tab相关
  354. .search-icon {
  355. position: relative;
  356. bottom: 0;
  357. left: 54rpx;
  358. }
  359. /deep/.input-placeholder{
  360. color: #777;
  361. font-size: 28rpx;
  362. }
  363. .rom-search {
  364. width: 686rpx;
  365. height: 60rpx;
  366. background: #F4F8F8;
  367. border-radius: 30rpx;
  368. padding-left: 74rpx;
  369. font-size: 28rpx;
  370. }
  371. .goods-rom {
  372. border-radius: 20rpx;
  373. width: 333rpx;
  374. height: 497rpx;
  375. background-color: white;
  376. box-shadow: 0px 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  377. &:nth-child(2n) {
  378. margin-right: 0;
  379. }
  380. &:nth-child(n + 3) {
  381. margin-top: 20rpx;
  382. }
  383. }
  384. .introduct {
  385. padding: 0 0 30rpx 32rpx;
  386. }
  387. .com{
  388. width: 100%;
  389. height: 100%;
  390. box-sizing: border-box;
  391. padding: 0rpx 28rpx;
  392. }
  393. .shop-head {
  394. width: 100%;
  395. height: 400rpx;
  396. position: relative;
  397. }
  398. .shop-flex {
  399. display: flex;
  400. padding: 30rpx;
  401. }
  402. .shop-title {
  403. width: 686rpx;
  404. height: 274rpx;
  405. border-radius: 20rpx;
  406. background-color: white;
  407. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  408. margin: 0 auto;
  409. position: relative;
  410. top: -32rpx;
  411. }
  412. .shop-img {
  413. width: 90rpx;
  414. height: 90rpx;
  415. margin-right: 15rpx;
  416. }
  417. .shop-function {
  418. width: 80rpx;
  419. height: 80rpx;
  420. border-radius: 50%;
  421. font-size: 40rpx;
  422. }
  423. .function-total {
  424. display: flex;
  425. justify-content: space-between;
  426. padding: 0 65rpx 0 65rpx;
  427. }
  428. .item{
  429. width: 686rpx;
  430. height: max-content;
  431. background: #F4F8F8;
  432. border-radius: 10rpx;
  433. // margin-bottom: 30rpx;
  434. margin-top: 30rpx;
  435. padding: 30rpx;
  436. box-sizing: border-box;
  437. line-height: 1;
  438. }
  439. /deep/.u-scroll-box {
  440. display: flex;
  441. justify-content: center;
  442. align-items: center;
  443. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  444. }
  445. /deep/.special_tab .u-tabs .u-scroll-box .u-tab-bar {
  446. background-color: #15716E!important;
  447. width: 80rpx!important;
  448. position: absolute;
  449. height: 10rpx;
  450. left: 0;
  451. border-radius: 8rpx 8rpx 0px 0px!important;
  452. bottom: -12rpx;
  453. }
  454. /deep/ .u-tab-item {
  455. font-size: 28rpx!important;
  456. }
  457. //价格筛选伪类
  458. // /deep/.special_tab .u-tab-item:nth-child(4n) ::after{
  459. // font-size: 48rpx!important;
  460. // content: '';
  461. // color: red;
  462. // }
  463. // loading加载
  464. .loading-more {
  465. align-items: center;
  466. justify-content: center;
  467. padding-top: 10px;
  468. padding-bottom: 10px;
  469. text-align: center;
  470. font-size: 28rpx;
  471. color: #999;
  472. }
  473. .loading-more-text::before {
  474. content: '';
  475. width: 20px;
  476. height: 20px;
  477. display: inline-block;
  478. vertical-align: middle;
  479. -webkit-animation: weuiLoading 1s steps(12, end) infinite;
  480. animation: weuiLoading 1s steps(12, end) infinite;
  481. background-repeat: no-repeat;
  482. 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");
  483. background-size: 100%;
  484. }
  485. @keyframes weuiLoading {
  486. 0% {
  487. transform: rotate3d(0, 0, 1, 0deg);
  488. }
  489. 100% {
  490. transform: rotate3d(0, 0, 1, 360deg);
  491. }
  492. }
  493. .list-warter {
  494. border-radius: 20rpx;
  495. margin: 10px 5px;
  496. margin-top: 0px;
  497. background-color: #ffffff;
  498. // padding: 8px;
  499. position: relative;
  500. overflow: hidden;
  501. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  502. }
  503. .u-close {
  504. position: absolute;
  505. top: 32rpx;
  506. right: 32rpx;
  507. }
  508. .list-image {
  509. width: 100%;
  510. border-radius: 4px;
  511. }
  512. .list-title {
  513. font-size: 28rpx;
  514. font-weight: bold;
  515. color: $u-main-color;
  516. }
  517. .list-label{
  518. position: absolute;
  519. bottom: 0;
  520. right: 0;
  521. background-color: rgba(0,0,0,0.5);
  522. width: 140rpx;
  523. height: 48rpx;
  524. border-radius: 20rpx 0rpx 0rpx 0rpx;
  525. font-size: 22rpx;
  526. color: #FFFFFF;
  527. line-height: 48rpx;
  528. text-align: center;
  529. }
  530. .list-tag {
  531. display: flex;
  532. margin-top: 5px;
  533. }
  534. .list-tag-owner {
  535. background-color: $u-type-error;
  536. color: #FFFFFF;
  537. display: flex;
  538. align-items: center;
  539. padding: 4rpx 14rpx;
  540. border-radius: 50rpx;
  541. font-size: 20rpx;
  542. line-height: 1;
  543. }
  544. .list-tag-text {
  545. border: 1px solid $u-type-primary;
  546. color: $u-type-primary;
  547. margin-left: 10px;
  548. border-radius: 50rpx;
  549. line-height: 1;
  550. padding: 4rpx 14rpx;
  551. display: flex;
  552. align-items: center;
  553. border-radius: 50rpx;
  554. font-size: 20rpx;
  555. }
  556. .list-price {
  557. font-size: 30rpx;
  558. color: $u-type-error;
  559. margin-top: 5px;
  560. display: flex;
  561. align-items: center;
  562. }
  563. </style>