Files
cashier_wx/pages/user/member/billDetails.vue

350 lines
7.6 KiB
Vue

<template>
<!-- 账单明细 -->
<view style="padding-bottom: 40rpx;">
<up-navbar bgColor="transparent" title="明细" @leftClick="back"></up-navbar>
<view class="bild">
<view class="bg">
<image class="image" src="/static/czzx_header_bg.png" mode=""></image>
</view>
<view class="bildLeft">
<text>我的余额</text>
<view>{{shopUserInfo.amount||0}}</view>
</view>
<view class="bildRight">
<text>我的积分</text>
<view>{{shopUserInfo.pointsUser?shopUserInfo.pointsUser.pointBalance:0}}</view>
</view>
</view>
<view class="bottom">
<view class="navTop">
<view @click="clickEvent(1)" :class="[formData.active==1?'fonts':'']">
余额明细
<view :class="[formData.active==1?'xian':'']" style="left: 36rpx;"> </view>
</view>
<view @click="clickEvent(2)" :class="[formData.active==2?'fonts':'']">
积分明细
<view :class="[formData.active==2?'xian':'']" style="left: 36rpx;"> </view>
</view>
</view>
<view class="listStyle " v-for="(item,i) in formData.list" :key="i">
<view class="flex-start">
<view class="color-333 font-16 font-700 u-m-b-16">
<view v-if="formData.active == 1">
<text v-if="item.bizCode == 'cashIn'">
现金充值
</text>
<text v-if="item.bizCode == 'wechatIn'">
微信小程序充值
</text>
<text v-if="item.bizCode == 'alipayIn'">
支付宝小程序充值
</text>
<text v-if="item.bizCode == 'awardIn'">
充值奖励
</text>
<text v-if="item.bizCode == 'rechargeRefund'">
充值退款
</text>
<text v-if="item.bizCode == 'orderPay'">
订单消费
</text>
<text v-if="item.bizCode == 'orderRefund'">
订单退款
</text>
<text v-if="item.bizCode == 'adminIn'">
管理员充值
</text>
<text v-if="item.bizCode == 'adminOut'">
管理员消费
</text>
<text v-if="item.bizCode == 'cashback'">
消费返现
</text>
<text v-if="item.bizCode == 'cashback_refund'">
消费返现扣减
</text>
<text v-if="item.bizCode == 'freeIn'">
霸王餐充值
</text>
<text v-if="item.bizCode == 'rechargeRedemption'">
兑换券充值
</text>
</view>
<view v-else>
{{item.content}}
</view>
</view>
<view class="listStyle_left">
<view class="listrigth color-333 font-14">
<view>{{item.shopName||'门店名称'}}</view>
<view v-if="formData.active == 1" :class="{colorStyle: (item.bizCode == 'cashIn' || item.bizCode == 'wechatIn' ||
item.bizCode == 'alipayIn'|| item.bizCode == 'awardIn'|| item.bizCode == 'rechargeRefund')}">
{{ item.amount }}
</view>
<view v-else :class="{colorStyle: (item.floatPoint>0)}">
{{item.floatPoints}}
</view>
</view>
</view>
<view class=" listrigth2">
<view>{{item.createTime}}
</view>
<view v-if="formData.active == 1">余额:{{item.balance}}</view>
</view>
</view>
</view>
<view v-if="formData.list.length <= 0" style="text-align: center;">
<image style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png" mode="aspectFill"></image>
</view>
<up-loadmore :status="formData.form.status" fontSize="14" color="#999" iconSize="14" />
</view>
</view>
</template>
<script setup>
import {
ref,
reactive,
onMounted
} from 'vue'
import {
onReachBottom,
onLoad
} from '@dcloudio/uni-app'
import {
APIshopUsermoneyRecord,
APIshopUserpointsRecord
} from '@/common/api/member.js'
import {
APIusershopInfodetail,
APIshopUserInfo
} from '@/common/api/member.js'
function back() {
uni.navigateBack()
}
const formData = reactive({
active: 1,
list: [],
form: {
page: 1,
size: 10,
status: 'loadmore',
},
info: {
amount: '',
accountPoints: ''
},
shopId: null
})
const getlist = async () => {
let res = null
if (formData.active == 1) {
res = await APIshopUsermoneyRecord({
page: formData.form.page,
size: formData.form.size,
// status: formData.status,
shopId: formData.shopId
})
} else {
res = await APIshopUserpointsRecord({
page: formData.form.page,
size: formData.form.size,
// status: formData.form.status,
shopId: formData.shopId,
id: formData.id||''
})
}
if (res.totalPage == 0 || res.totalPage == 1 && res.totalRow <= 10) {
formData.form.status = 'nomore'
formData.list = res.records
if (formData.form.page == 1 && res.records.length == 0) {
formData.records = []
formData.is_end = true
}
return false;
} else {
formData.form.status = 'loading';
if (formData.form.page == 1) {
formData.list = res.records
} else {
formData.list = [...formData.list, ...res.records];
}
formData.form.page = ++formData.form.page;
if (formData.form.page > res.totalPage) {
formData.form.status = 'nomore';
} else {
formData.form.status = 'loading';
}
}
}
// 检测是否包含In
const checkIn = (str) => {
let reg = RegExp(/In/)
return str.match(reg)
}
const clickEvent = (i) => {
formData.active = i;
formData.form.page = 1;
formData.is_end = false
formData.form.page = 1
formData.form.size = 10
formData.form.status = 'loadmore'
getlist()
}
onReachBottom(() => {
getlist()
})
const shopUserInfo = reactive({})
async function getShopUserInfo() {
const res = await APIshopUserInfo({
shopId: options.shopId
})
if (res) {
Object.assign(shopUserInfo, res)
formData.id =res.pointsUser?res.pointsUser.id:''
formData.shopId =res.pointsUser?res.pointsUser.shopId:''
}
}
const options = reactive({})
onLoad(async (opt) => {
Object.assign(options, opt)
console.log('options', options);
formData.shopId = options.shopId
formData.active = options.type
formData.id = options.id || ''
console.log(formData.info)
await getShopUserInfo()
getlist()
})
</script>
<style scoped lang="less">
.bild {
height: 500rpx;
background-size: cover;
display: flex;
justify-content: space-around;
align-items: center;
position: relative;
.bg {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: -1;
.image {
width: 100%;
height: 100%;
}
}
.bildLeft,
.bildRight {
font-weight: 400;
font-size: 32rpx;
>view,
>text {
text-align: center;
color: #333;
}
>view {
margin-top: 34rpx;
font-weight: bold;
}
}
}
.bottom {
background-color: rgba(255, 255, 255, .3);
padding: 40rpx 28rpx 0 28rpx;
transform: translateY(-140rpx);
border-radius: 74rpx 74rpx 0 0;
}
.navTop {
display: flex;
justify-content: space-around;
align-items: center;
color: #333;
font-size: 28rpx;
.fonts {
font-size: 32rpx;
}
>view {
position: relative;
.xian {
width: 58rpx;
height: 6rpx;
background: #FFAA62;
border-radius: 2rpx 2rpx 2rpx 2rpx;
position: absolute;
bottom: -16rpx;
}
}
}
.listStyle {
padding: 28rpx;
padding-top: 50rpx;
width: 100%;
.listrigth,
.listrigth2 {
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
// padding-left: 32rpx;
}
.listrigth {
.colorStyle {
color: #FF7127;
}
}
.listStyle_left {
width: 100%;
display: flex;
align-items: center;
}
.head_img {
border-radius: 50%;
margin-right: 32rpx;
}
.listrigth2 {
margin-top: 4rpx;
>view {
font-weight: 500;
font-size: 24rpx;
color: #666666;
}
}
}
</style>