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

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