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

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