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

615 lines
17 KiB

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