| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
- <template>
- <view style="background: #F7F8FC;height:100vh">
- <cu-custom bgColor="bg-fff" :isBack="true">
- <block slot="content">{{ currentTab == 0 ? '代金券用户' : currentTab == 1 ? '满减券用户' : '折扣券用户' }}</block>
- </cu-custom>
- <view class="coupon-title"
- :style="currentTab == '0' ? 'background: #EFFFFE' : currentTab == '1' ? 'background: #F4FAFF;' : 'background: #FFF7F3;'">
- <image :src="`/static/coupon/userBg${Number(currentTab) + 1}.png`" mode="">
- </image>
- <text class="coupon-name">{{ name }}</text>
- </view>
- <view class="coupon-header">
- <view class="tab-bar flex justify-around items-center">
- <text v-for="(item, index) in staList" :key="index" class="tab-item"
- :class="{ active: statusType === index }" @click="onTabChange(index)">
- {{ item.label }} {{ item.value }}
- </text>
- </view>
- </view>
- <view class="coupon-item" v-for="val in couponList" :key="val.id">
- <view class="user-info">
- <image class="avatar" :src="val.userAvatar" mode="aspectFill"></image>
- <view class="name">{{ val.userName }}</view>
- <view class="status" style="color: #D56412;" v-if="val.consumerStatus == 1">未使用</view>
- <view class="status" v-if="val.consumerStatus == 2">已使用</view>
- <view class="status" style="color: #999999;" v-if="val.consumerStatus == 3">已失效</view>
- </view>
- <view class="date-info">
- <view class="valid-date">
- <text class="label">有效时间:</text>
- <text class="value">{{ val.beginTime }} - {{ val.endTime }}</text>
- </view>
- <view class="purchase-date">
- <text class="label" v-if="val.source==2">购买时间:</text>
- <text class="label" v-else>发放时间:</text>
- <text class="value">{{ val.payTime }}</text>
- </view>
- </view>
- <view class="product-info flex" v-if="val.consumerStatus == 2">
- <view class="product-title">
- <view>
- <text class="label">购买信息:</text>
- <text class="value">{{ val.productName }}</text>
- </view>
- <view class="product-detail">
- <text class="price">¥{{ val.soldPrice }}</text>
- <text class="quantity">1份</text>
- </view>
- </view>
- <image class="product-image" :src="val.productImage" mode="aspectFill"></image>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- staList: [{
- label:'全部',
- value:''
- },{
- label:'未使用',
- value:''
- },{
- label:'已使用',
- value:''
- },{
- label:'已失效',
- value:''
- }],
- productId: '',
- currentTab: '',
- couponList: [],
- statusType: 0,
- page: {
- pageNo: 1,
- pageSize: 10
- },
- name:'',
- }
- },
- methods: {
- onTabChange(index) {
- this.statusType = index
- this.getForm()
- },
- getForm() {
- this.$http.post('/merchant/localConsumerUserInfo/list', { status: this.statusType, consumerId: this.productId, ...this.page }).then(res => {
- if (res.data.success) {
- this.couponList = res.data.result.records
- }
- else {
- this.$tip.error(res.data.message);
- }
- })
- },
- },
- onLoad(options) {
- if (options) {
- this.productId = options.id
- this.currentTab = options.tab
- this.name=options.name
- }
- },
- onShow() {
- if (this.productId) {
- this.getForm()
- this.$http.get('/merchant/localConsumerUserInfo/getConsumerInfo', {params: {consumerId: this.productId} }).then(res => {
- if (res.data.success) {
- this.staList.forEach(e=>{
- if(e.label=='全部'){
- e.value=res.data.result.allNum
- }
- if(e.label=='已使用'){
- e.value=res.data.result.useNum
- }
- if(e.label=='未使用'){
- e.value=res.data.result.noUseNum
- }
- if(e.label=='已失效'){
- e.value=res.data.result.noNum
- }
- })
- }
- else {
- this.$tip.error(res.data.message);
- }
- })
-
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .coupon-header {
- background: #FFFFFF;
- padding: 18rpx;
- border-bottom: 1px solid #EEEEEE;
- }
- .coupon-title {
- background: #EFFFFE;
- padding: 20rpx 32rpx;
- border-top: 1px solid #EEEEEE;
- position: relative;
- image {
- width: 347rpx;
- height: 56rpx;
- }
- .coupon-name {
- position: absolute;
- color: #FFFFFF;
- left: 22rpx;
- width: 347rpx;
- height: 56rpx;
- line-height: 56rpx;
- text-align: center;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- padding: 0 16rpx;
- box-sizing: border-box;
- }
- }
- .tab-bar {
- position: relative;
- .tab-item {
- // padding: 12rpx 40rpx;
- // height: 60rpx;
- // line-height: 60rpx;
- text-align: center;
- padding: 10rpx 16rpx;
- font-size: 28rpx;
- color: #666;
- position: relative;
- border-radius: 8rpx;
- transition: all 0.3s;
- background: #F2F3F5;
- &.active {
- color: #2D88F4;
- background: #ECF5FF;
- font-weight: 500;
- }
- &:last-child {
- margin-right: 0;
- }
- }
- }
- .coupon-item {
- background: #FFFFFF;
- padding: 20rpx 40rpx;
- margin-bottom: 20rpx;
- }
- .user-info {
- display: flex;
- align-items: center;
- margin-bottom: 16rpx;
- .avatar {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- margin-right: 16rpx;
- }
- .name {
- font-size: 32rpx;
- color: #333333;
- flex: 1;
- }
- .status {
- font-size: 28rpx;
- color: #509B45;
- }
- }
- .date-info {
- margin-bottom: 16rpx;
- margin-left: 96rpx;
- font-size: 26rpx;
- color: #8A91A8;
- .valid-date,
- .purchase-date {
- margin-bottom: 8rpx;
- .label {
- margin-right: 8rpx;
- }
- }
- }
- .product-info {
- background: #F7F8FC;
- padding: 14rpx;
- border-radius: 8rpx;
- .product-title {
- width: 60%;
- margin-bottom: 16rpx;
- font-size: 26rpx;
- color: #666666;
- overflow: hidden;
- /* 隐藏溢出的内容 */
- white-space: nowrap;
- /* 防止文本换行 */
- text-overflow: ellipsis;
- /* 使用省略号表示溢出的内容 */
- }
- .product-image {
- width: 80rpx;
- height: 80rpx;
- border-radius: 8rpx;
- margin-left: 42rpx;
- }
- .product-detail {
- display: flex;
- align-items: center;
- color: #999999;
- font-size: 24rpx;
- .price {
- margin-right: 26rpx;
- }
- }
- }
- </style>
|