123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <template>
- <view class="container">
- <mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ native: true }" @down="downCallback"
- :up="upOption" @up="upCallback">
-
- <u-tabs :list="tabs" :is-scroll="false" :current="curTab" active-color="#FA2209" :duration="0.2"
- @change="onChangeTab" />
-
- <view class="widget-list">
- <view class="widget-detail" v-for="(item, index) in list.content" :key="index">
- <view class="row-block dis-flex flex-y-center">
- <view class="flex-box">{{ item.createTime }}</view>
- <view class="flex-box t-r">
- <text class="mobile">{{ item.mobile.substr(0, 3) + '****' + item.mobile.substr(7) }}</text>
- </view>
- </view>
- <view class="detail-goods row-block dis-flex">
- <view class="goods-right flex-box">
- <view class="goods-name">
- <text class="twolist-hidden">{{ item.couponNames }}</text>
- </view>
- <view class="goods-props clearfix">
- <view class="goods-props-item">
- <text>¥{{ item.money }}</text>
- </view>
- </view>
- <view class="goods-num t-r">
- <text class="f-26 col-8">×{{ item.num }}</text>
- </view>
- </view>
- </view>
- <view class="detail-order row-block">
- <view class="item dis-flex flex-x-end flex-y-center">
- <text class="">转赠总金额:</text>
- <text class="col-m">¥{{ item.money * item.num }}</text>
- </view>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
- import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue'
- import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins'
- import Empty from '@/components/empty'
- import { getEmptyPaginateObj, getMoreListData } from '@/utils/app'
- import * as giveApi from '@/api/give'
-
- const pageSize = 15
-
- const tabs = [{
- name: '收到',
- value: 'gived'
- }, {
- name: '赠出',
- value: 'give'
- }]
- export default {
- components: {
- MescrollBody,
- Empty
- },
- mixins: [MescrollMixin],
- data() {
- return {
-
- list: getEmptyPaginateObj(),
-
- isLoading: false,
-
- tabs,
-
- curTab: 0,
-
- upOption: {
-
- auto: true,
-
- page: { size: pageSize },
-
- noMoreSize: 2,
-
- empty: {
- tip: '亲,暂无转赠记录'
- }
- },
-
- canReset: false,
- }
- },
-
- onLoad(options) {
-
- },
-
- onShow() {
- this.canReset && this.onRefreshList()
- this.canReset = true
- },
- methods: {
-
- upCallback(page) {
- const app = this
-
- app.getGiveLogList(page.num)
- .then(list => {
- const curPageLen = list.content.length
- const totalSize = list.totalElements
- app.mescroll.endBySize(curPageLen, totalSize)
- })
- .catch(() => app.mescroll.endErr())
- },
-
- getGiveLogList(pageNo = 1) {
- const app = this
- return new Promise((resolve, reject) => {
- giveApi.giveLog({ type: app.getTabValue(), page: pageNo }, { load: false })
- .then(result => {
-
- const newList = result.data
- app.list.content = getMoreListData(newList, app.list, pageNo)
- resolve(newList)
- })
- })
- },
-
- onChangeTab(index) {
- const app = this
-
- app.curTab = index
-
- app.onRefreshList()
- },
-
- onRefreshList() {
- this.list = getEmptyPaginateObj()
- setTimeout(() => {
- this.mescroll.resetUpScroll()
- }, 120)
- },
-
- getTabValue() {
- return this.tabs[this.curTab].value
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .widget-detail {
- box-sizing: border-box;
- background: #fff;
- margin-bottom: 10rpx;
- border: solid 2px #f5f5f5;
- padding: 30rpx;
- .row-block {
- padding: 0 20rpx;
- min-height: 50rpx;
- }
- .detail-goods {
- padding: 20rpx;
- .goods-right {
- padding: 15rpx 0;
- }
- .mobile {
- color: #888888;
- }
- .goods-name {
- margin-bottom: 10rpx;
- font-size: 34rpx;
- }
- .goods-props {
- margin-top: 14rpx;
- height: 40rpx;
- color: #ababab;
- font-size: 24rpx;
- overflow: hidden;
- .goods-props-item {
- display: inline-block;
- margin-right: 14rpx;
- padding: 4rpx 16rpx;
- border-radius: 12rpx;
- background-color: #F5F5F5;
- width: auto;
- }
- }
- }
- .detail-operate {
- padding-bottom: 20rpx;
- .detail-btn {
- border-radius: 4px;
- border: 1rpx solid #ccc;
- padding: 8rpx 20rpx;
- font-size: 28rpx;
- color: #555;
- margin-left: 10rpx;
- }
- }
- .detail-order {
- padding: 10rpx 20rpx;
- font-size: 26rpx;
- line-height: 50rpx;
- height: 50rpx;
- .item {
- margin-bottom: 10rpx;
- &:last-child {
- margin-bottom: 0;
- }
- }
- }
- }
- // 空数据按钮
- .empty-ipt {
- width: 220rpx;
- margin: 10px auto;
- font-size: 28rpx;
- height: 64rpx;
- line-height: 64rpx;
- text-align: center;
- color: #fff;
- border-radius: 5rpx;
- background: linear-gradient(to right, $fuint-theme, $fuint-theme);
- }
- </style>
|