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

620 lines
18 KiB

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