fix: 新功能增加,原有功能优化。
This commit is contained in:
236
src/pages/work/bill/creditCardBill/addEdit.vue
Normal file
236
src/pages/work/bill/creditCardBill/addEdit.vue
Normal file
@@ -0,0 +1,236 @@
|
||||
<template>
|
||||
<view class="container" style="paddingBottom:1rpx;">
|
||||
<u-navbar
|
||||
leftIconSize="40rpx"
|
||||
leftIconColor="#333333"
|
||||
title="信用卡账单"
|
||||
>
|
||||
</u-navbar>
|
||||
<view class="section">
|
||||
<view class="section-title">{{ title}}</view>
|
||||
<view class="form-view">
|
||||
<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" label-width="auto"
|
||||
:labelStyle="{ color: '#333333', fontSize: '30rpx' }">
|
||||
<u-form-item label="信用卡" prop="creditCardName" required @click="handleCreditCard">
|
||||
<u--input v-model="form.creditCardName" disabled disabledColor="#ffffff" placeholder="请选择信用卡"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
<u-icon slot="right" name="arrow-down"></u-icon>
|
||||
</u-form-item>
|
||||
<u-form-item label="账单日" prop="billDate" required @click="selectDate()">
|
||||
<u--input v-model="form.billDate" disabled disabledColor="#ffffff" placeholder="请选择账单日" inputAlign="right" border="none"></u--input>
|
||||
<u-icon slot="right" name="arrow-right"></u-icon>
|
||||
</u-form-item>
|
||||
<u-form-item label="账单金额" prop="billAmount" required >
|
||||
<u--input v-model="form.billAmount" placeholder="请填写账单金额"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="账单状态" prop="billStateName" required @click="handleShowTeam">
|
||||
<u--input v-model="form.billStateName" disabled disabledColor="#ffffff" placeholder="请选择账单状态"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
<u-icon slot="right" name="arrow-down"></u-icon>
|
||||
</u-form-item>
|
||||
<u-form-item label="备注" prop="remark" required labelPosition="top">
|
||||
<u--textarea v-model="form.remark" placeholder="请填写备注" border="none" autoHeight inputAlign="right" count
|
||||
maxlength="20000" style="padding:18rpx 0;"></u--textarea>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
<view class="form-btn">
|
||||
<u-button type="primary" text="提交" @click="submit"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<u-picker itemHeight="88" :show="showTeam" :columns="billStateList" keyName="dictLabel" @cancel="handleCancel"
|
||||
@confirm="handleConfirm"></u-picker>
|
||||
<u-datetime-picker
|
||||
:show="datePickShow"
|
||||
mode="date"
|
||||
ref="createTimeRef"
|
||||
@cancel="datePickShow=false"
|
||||
@confirm="datePickConfirm"
|
||||
itemHeight="88"
|
||||
></u-datetime-picker>
|
||||
<u-picker itemHeight="88" :show="showCreditCard" :columns="bankCardLendList" keyName="nameCodeAvailableLimit" @cancel="handleCreditCardCancel"
|
||||
@confirm="handleCreditCardConfirm"></u-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {getCreditCardBill, addCreditCardBill, updateCreditCardBill } from '@/api/invest/creditCardBill'
|
||||
import { getDicts } from '@/api/system/dict/data.js'
|
||||
import { listAccounts } from '@/api/invest/accounts'
|
||||
const { proxy } = getCurrentInstance()
|
||||
import dayjs from 'dayjs'
|
||||
import {onLoad,onReady} from "@dcloudio/uni-app";
|
||||
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
|
||||
import {reactive ,toRefs,ref,computed ,getCurrentInstance }from "vue";
|
||||
const datePickShow = ref(false)
|
||||
const showTeam = ref(false)
|
||||
const showCreditCard = ref(false)
|
||||
const title = ref("信用卡账单")
|
||||
const bankCardLendList = ref([])
|
||||
const billStateList = ref([])
|
||||
const data = reactive({
|
||||
form: {
|
||||
id: null,
|
||||
name: null,
|
||||
billDate: null,
|
||||
creditCardId: null,
|
||||
billDatePeriod: null,
|
||||
billAmount: 0,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
billState: null,
|
||||
remark: null,
|
||||
delFlag: null
|
||||
},
|
||||
queryBankCardLendParams: {
|
||||
pageNum: 1,
|
||||
type: '2',
|
||||
state: '1',
|
||||
pageSize: 1000
|
||||
},
|
||||
rules: {
|
||||
creditCardName: [{ type: 'string', required: true, message: '信用卡不能为空', trigger: ['change', 'blur'] }],
|
||||
billDate: [{ type: 'string', required: true, message: '账单日不能为空', trigger: ['change', 'blur'] }],
|
||||
billStateName: [{ type: 'string', required: true, message: '账单状态不能为空', trigger: ['change', 'blur'] }],
|
||||
billAmount: [{ type: 'string', required: true, message: '账单金额不能为空', trigger: ['change', 'blur'] }],
|
||||
}
|
||||
})
|
||||
const { form, queryBankCardLendParams, rules} = toRefs(data)
|
||||
|
||||
onLoad((option) => {
|
||||
form.value.id = option.id
|
||||
if(form.value.id!=null){
|
||||
title.value="信用卡账单-修改"
|
||||
}else{
|
||||
title.value="信用卡账单-新增"
|
||||
}
|
||||
getDict()
|
||||
})
|
||||
onReady(() => {
|
||||
form.value.billDate = dayjs(new Date().getTime()).format("YYYY-MM-DD")
|
||||
})
|
||||
function getDict() {
|
||||
// 账单状态
|
||||
getDicts('bill_state').then(res => {
|
||||
billStateList.value =[res.data]
|
||||
})
|
||||
listAccounts(queryBankCardLendParams.value).then((response) => {
|
||||
bankCardLendList.value = [response.rows]
|
||||
})
|
||||
if(form.value.id!=null){
|
||||
getCreditCardBill(form.value.id).then(res => {
|
||||
form.value = res.data
|
||||
form.value.creditCardName = res.data.bankNameCode
|
||||
// 类型
|
||||
getDicts('bill_state').then(result => {
|
||||
form.value.billStateName=dictStr(form.value.billState, result.data)
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
function dictStr(val, arr) {
|
||||
let str = ''
|
||||
arr.map(item => {
|
||||
if (item.dictValue === val) {
|
||||
str = item.dictLabel
|
||||
}
|
||||
})
|
||||
return str
|
||||
}
|
||||
|
||||
function handleShowTeam() {
|
||||
if (billStateList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '账单状态为空 ', type: 'warning'
|
||||
})
|
||||
} else {
|
||||
showTeam.value = true
|
||||
}
|
||||
}
|
||||
function handleConfirm(e) {
|
||||
form.value.billStateName = e.value[0].dictLabel
|
||||
form.value.billState = e.value[0].dictValue
|
||||
showTeam.value = false
|
||||
}
|
||||
function handleCancel() {
|
||||
showTeam.value = false
|
||||
}
|
||||
function handleCreditCard() {
|
||||
if (bankCardLendList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '信用卡为空 ', type: 'warning'
|
||||
})
|
||||
} else {
|
||||
showCreditCard.value = true
|
||||
}
|
||||
}
|
||||
function handleCreditCardConfirm(e) {
|
||||
form.value.creditCardName = e.value[0].nameCodeAvailableLimit
|
||||
form.value.creditCardId= e.value[0].id
|
||||
showCreditCard.value = false
|
||||
}
|
||||
function handleCreditCardCancel() {
|
||||
showCreditCard.value = false
|
||||
}
|
||||
|
||||
function selectDate() {
|
||||
datePickShow.value = true
|
||||
proxy.$refs['createTimeRef'].innerValue = new Date().getTime()
|
||||
}
|
||||
function datePickConfirm(e) {
|
||||
form.value.createTime = dayjs(e.value).format("YYYY-MM-DD")
|
||||
datePickShow.value = false
|
||||
}
|
||||
function submit() {
|
||||
proxy.$refs['uForm'].validate().then(() => {
|
||||
if (form.value.id != null) {
|
||||
updateCreditCardBill(form.value).then(res => {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '修改成功', complete() {
|
||||
uni.navigateTo({ url: `/pages/work/bill/creditCardBill//list` })
|
||||
}
|
||||
})
|
||||
})
|
||||
}else {
|
||||
addCreditCardBill(form.value).then(res => {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '新增成功', complete() {
|
||||
uni.navigateTo({ url: `/pages/work/bill/creditCardBill//list` })
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.section {
|
||||
margin: 24rpx;
|
||||
padding: 16rpx 24rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.section-title {
|
||||
width: 360rpx;
|
||||
color: #333333;
|
||||
line-height: 44rpx;
|
||||
font-size: 30rpx;
|
||||
border-left: 6rpx solid #2681FF;
|
||||
padding-left: 26rpx;
|
||||
}
|
||||
|
||||
.form-view {
|
||||
padding: 20rpx 0rpx 0 10rpx;
|
||||
|
||||
.form-btn {
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
425
src/pages/work/bill/creditCardBill/details.vue
Normal file
425
src/pages/work/bill/creditCardBill/details.vue
Normal file
@@ -0,0 +1,425 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<u-sticky offsetTop="8rpx" customNavHeight="8rpx">
|
||||
<view class="search-view">
|
||||
<u--input v-model="queryParams.time" border="false" disabled placeholder="请输入时间" class="search-input"
|
||||
@blur="searchBlur" suffixIcon="search" suffixIconStyle="color: #909399">
|
||||
</u--input>
|
||||
<u-icon :name="filterPanel ? 'arrow-up-fill' : 'arrow-down-fill'" color="#666666" size="28" label="筛选"
|
||||
labelPos="left" labelSize="32rpx" labelColor="#666666" @click="filterPanel = !filterPanel"></u-icon>
|
||||
<u-transition :show="filterPanel" mode="fade">
|
||||
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
|
||||
<view class="filter-panel-content">
|
||||
<view class="filter-title">交易类别</view>
|
||||
<view class="state-list">
|
||||
<view v-for="item in dealCategoryList" :key="item.id" class="state-item"
|
||||
:class="item.selected ? 'active' : ''" @click="selectDealCategory(item)">{{ item.dictLabel }}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<u-button text="重置" style="margin-right:20rpx" @click="resetQuery()"></u-button>
|
||||
<u-button type="primary" text="确定" @click="searchSubmit()"></u-button>
|
||||
</view>
|
||||
<u-datetime-picker
|
||||
:closeOnClickOverlay="true"
|
||||
:show="timeShow"
|
||||
v-model="time"
|
||||
mode="datetime"
|
||||
@close="openOrCloseDate"
|
||||
@cancel="openOrCloseDate"
|
||||
@confirm="confirm"
|
||||
></u-datetime-picker>
|
||||
</view>
|
||||
</u-transition>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<u-list @scrolltolower="loadmore" :spaceHeight="116" lowerThreshold="100">
|
||||
<u-list-item v-for="(item, index) in listData" :key="index">
|
||||
<view class="list-item">
|
||||
<view class="item-header" @click="enterDetails(item)">
|
||||
<u--text suffixIcon="arrow-right" lines="1" iconStyle="font-size: 18px; color: #333333; font-weight:bold"
|
||||
:text="item.accountName+'交易金额:'+item.amount" size="30rpx" color="#333333" :bold="true"></u--text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">记账类型:</text>
|
||||
<text class="row-value">{{ dictStr(item.type, accountTypeList) }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">交易时间:</text>
|
||||
<text class="row-value">{{ item.createTime }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">交易金额:</text>
|
||||
<text class="row-value">{{ item.amount }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">当前余额:</text>
|
||||
<text class="row-value">{{ item.currentBalance }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">交易类型:</text>
|
||||
<text class="row-value">{{ dictStr(item.dealType, dealTypeList) }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">交易类别:</text>
|
||||
<text class="row-value">{{ dictStr(item.dealCategory, dealCategoryList) }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">备注:</text>
|
||||
<text class="row-value">{{ item.remark }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</u-list-item>
|
||||
<view>
|
||||
</view>
|
||||
<u-loadmore :status="status" loadingIcon="semicircle" height="88" fontSize="32rpx" @loadmore="loadmore" />
|
||||
</u-list>
|
||||
<u-picker itemHeight="88" :show="settingPickShow" :columns="settingColumns" keyName="settingName"
|
||||
@confirm="settingConfirm" @cancel="settingCancel"></u-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
listAccountDealRecord,
|
||||
} from '@/api/invest/accountDealRecord'
|
||||
import { getDicts } from '@/api/system/dict/data.js'
|
||||
import { timeHandler } from '@/utils/common.ts'
|
||||
import {onLoad,onShow} from "@dcloudio/uni-app";
|
||||
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
|
||||
import {reactive ,toRefs,ref,computed }from "vue";
|
||||
const pageNum = ref(1)
|
||||
const listData = ref([])
|
||||
const isShow = ref(false)
|
||||
const status = ref('loadmore')
|
||||
const accountTypeList = ref([])
|
||||
const dealTypeList = ref([])
|
||||
const dealCategoryList = ref([])
|
||||
const settingPickShow = ref(false)
|
||||
const settingColumns = ref([])
|
||||
const timeShow= ref(false)
|
||||
const flag= ref(true)
|
||||
const time =ref( Number(new Date()))
|
||||
const data = reactive({
|
||||
filterPanel: false,
|
||||
queryParams: {
|
||||
name: null,
|
||||
type: null,
|
||||
time: '',
|
||||
accountId: null,
|
||||
dealType: null,
|
||||
dealCategory: null
|
||||
}
|
||||
})
|
||||
const { filterPanel, queryParams} = toRefs(data)
|
||||
const windowHeight = computed(() => {
|
||||
uni.getSystemInfoSync().windowHeight - 50
|
||||
})
|
||||
onLoad((option) => {
|
||||
queryParams.value.accountId = option.id
|
||||
queryParams.value.time = option.billDatePeriod
|
||||
queryParams.value.startTime = option.billDatePeriod.split('~')[0]
|
||||
queryParams.value.endTime = option.billDatePeriod.split('~')[1]
|
||||
getDict()
|
||||
getList()
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
if (isShow.value) {
|
||||
getList()
|
||||
isShow.value = false
|
||||
}
|
||||
});
|
||||
function openOrCloseDate(data) {
|
||||
timeShow.value = !timeShow.value
|
||||
flag.value = data
|
||||
}
|
||||
function loadmore() {
|
||||
pageNum.value += 1
|
||||
if (status.value == 'loadmore') {
|
||||
getList()
|
||||
}
|
||||
}
|
||||
function getList() {
|
||||
status.value = 'loading'
|
||||
listAccountDealRecord({ pageSize: 10, pageNum: pageNum.value, ...queryParams.value }).then(res => {
|
||||
listData.value = listData.value.concat(res.rows)
|
||||
if (listData.value.length < res.total) {
|
||||
status.value = 'loadmore'
|
||||
} else {
|
||||
status.value = 'nomore'
|
||||
}
|
||||
}).catch(() => {
|
||||
status.value = 'nomore'
|
||||
})
|
||||
}
|
||||
function confirm(e) {
|
||||
const date = timeHandler(new Date(e.value), '-', ':')
|
||||
if (flag.value) {
|
||||
queryParams.value.startTime = date
|
||||
} else {
|
||||
queryParams.value.endTime = date
|
||||
}
|
||||
timeShow.value = false
|
||||
}
|
||||
function getDict() {
|
||||
// 记账类型类型
|
||||
getDicts('account_type').then(res => {
|
||||
accountTypeList.value = res.data
|
||||
})
|
||||
// 交易类型
|
||||
getDicts('deal_type').then(res => {
|
||||
dealTypeList.value = res.data
|
||||
})
|
||||
// 交易类别
|
||||
getDicts('deal_category').then(res => {
|
||||
dealCategoryList.value = res.data
|
||||
})
|
||||
}
|
||||
function settingConfirm(e) {
|
||||
queryParams.value.settingId = e.value[0].settingId
|
||||
queryParams.value.settingName = e.value[0].settingName
|
||||
settingPickShow.value = false
|
||||
}
|
||||
function settingCancel() {
|
||||
settingPickShow.value = false
|
||||
}
|
||||
function dictStr(val, arr) {
|
||||
let str = ''
|
||||
arr.map(item => {
|
||||
if (item.dictValue === val) {
|
||||
str = item.dictLabel
|
||||
}
|
||||
})
|
||||
return str
|
||||
}
|
||||
function selectDealType(item) {
|
||||
queryParams.value.dealType = item.dictValue
|
||||
dealTypeList.value.map(ele => {
|
||||
if (ele.dictValue == item.dictValue) {
|
||||
ele.selected = true
|
||||
Reflect.set(ele, 'selected', true)
|
||||
} else {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
}
|
||||
})
|
||||
}
|
||||
function selectDealCategory(item) {
|
||||
queryParams.value.dealCategory = item.dictValue
|
||||
dealCategoryList.value.map(ele => {
|
||||
if (ele.dictValue == item.dictValue) {
|
||||
ele.selected = true
|
||||
Reflect.set(ele, 'selected', true)
|
||||
} else {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
}
|
||||
})
|
||||
}
|
||||
function searchSubmit() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
filterPanel.value = false
|
||||
}
|
||||
function searchBlur() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
function resetQuery() {
|
||||
queryParams.value.name = ''
|
||||
queryParams.value.type = ''
|
||||
queryParams.value.dealType = ''
|
||||
queryParams.value.startTime = ''
|
||||
queryParams.value.endTime = ''
|
||||
queryParams.value.dealCategory = ''
|
||||
accountTypeList.value.map(ele => {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
})
|
||||
dealTypeList.value.map(ele => {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
})
|
||||
dealCategoryList.value.map(ele => {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
})
|
||||
}
|
||||
function enterDetails(item) {
|
||||
uni.navigateTo({ url: `/pages/work/accounts/accountDealRecord/details?id=${item.id}` })
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.btnAdd {
|
||||
width: 146rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
border-radius: 8rpx;
|
||||
display:float;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-view {
|
||||
padding: 12rpx 32rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.search-input {
|
||||
background: #F5F5F5;
|
||||
color: #333333;
|
||||
margin-right: 36rpx;
|
||||
}
|
||||
|
||||
.filter-panel {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 96rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
|
||||
.filter-panel-content {
|
||||
background-color: #ffff;
|
||||
padding: 0 30rpx 30rpx;
|
||||
|
||||
.filter-title {
|
||||
color: #000000;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.state-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
|
||||
.state-item {
|
||||
width: 210rpx;
|
||||
height: 72rpx;
|
||||
border: 1rpx solid rgba(0, 0, 0, 0.25);
|
||||
border-radius: 72rpx;
|
||||
text-align: center;
|
||||
line-height: 72rpx;
|
||||
margin: 0 20rpx 20rpx 0;
|
||||
font-size: 28rpx;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: rgba(222, 241, 255, 1);
|
||||
border: 1rpx solid rgba(22, 119, 255, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
display: flex;
|
||||
padding: 24rpx 30rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 0rpx -10rpx 20rpx #EEEEEE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-item {
|
||||
margin: 0 24rpx 24rpx;
|
||||
padding: 32rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 16rpx;
|
||||
|
||||
.status {
|
||||
.status-item {
|
||||
width: 120rpx;
|
||||
height: 44rpx;
|
||||
text-align: center;
|
||||
line-height: 44rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.status1 {
|
||||
background: #F0F0F0;
|
||||
color: #8C8C8C;
|
||||
}
|
||||
|
||||
.status2 {
|
||||
background: rgba(38, 129, 255, 0.2);
|
||||
color: #2681FF;
|
||||
}
|
||||
|
||||
.status3 {
|
||||
background: #F7F7F7;
|
||||
color: #2681FF;
|
||||
}
|
||||
|
||||
.status4 {
|
||||
background: rgba(255, 85, 51, 0.2);
|
||||
color: #FF5533;
|
||||
}
|
||||
|
||||
.status5 {
|
||||
background: #F7F7F7;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.status7 {
|
||||
background: rgba(255, 129, 51, 0.2);
|
||||
color: #FF8133;
|
||||
}
|
||||
|
||||
.status8 {
|
||||
background: rgba(65, 217, 165, 0.2);
|
||||
color: #41D9A5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-row {
|
||||
padding: 16rpx 0;
|
||||
|
||||
.row-label {
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.row-value {
|
||||
color: rgba(0, 0, 0, 0.85)
|
||||
}
|
||||
}
|
||||
|
||||
.operate {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
.btn {
|
||||
width: 146rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
border-radius: 8rpx;
|
||||
margin-left: 5rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.circulation {
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
margin-right: 24rpx;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.filling {
|
||||
background: #2681FF;
|
||||
border-radius: 8rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
417
src/pages/work/bill/creditCardBill/list.vue
Normal file
417
src/pages/work/bill/creditCardBill/list.vue
Normal file
@@ -0,0 +1,417 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<u-sticky offsetTop="8rpx" customNavHeight="8rpx">
|
||||
<view class="search-view">
|
||||
<u-input v-model="queryParams.creditCardName" border="false" type="select" @click="handleCreditCard" placeholder="请选择信用卡" suffixIcon="search"
|
||||
suffixIconStyle="color: #909399" class="search-input">
|
||||
</u-input>
|
||||
<u-icon :name="filterPanel ? 'arrow-up-fill' : 'arrow-down-fill'" color="#666666" size="28" label="筛选"
|
||||
labelPos="left" labelSize="32rpx" labelColor="#666666" @click="filterPanel = !filterPanel"></u-icon>
|
||||
<u-icon name="plus-circle-fill" color="#666666" size="28" style="margin-left:10px" label="新增"
|
||||
labelPos="left" labelSize="32rpx" labelColor="#666666" @click="handleAdd()"></u-icon>
|
||||
<u-transition :show="filterPanel" mode="fade">
|
||||
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
|
||||
<view class="filter-panel-content">
|
||||
<view class="filter-title">账单状态</view>
|
||||
<view class="state-list">
|
||||
<view v-for="item in billStateList" :key="item.id" class="state-item"
|
||||
:class="item.selected ? 'active' : ''" @click="selectStatus(item)">{{ item.dictLabel }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<u-button text="重置" style="margin-right:20rpx" @click="resetQuery()"></u-button>
|
||||
<u-button type="primary" text="确定" @click="searchSubmit()"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-transition>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<u-list @scrolltolower="loadmore" :spaceHeight="116" lowerThreshold="100">
|
||||
<u-list-item v-for="(item, index) in listData" :key="index">
|
||||
<view class="list-item">
|
||||
<view class="item-header" @click="enterDetails(item)">
|
||||
<u--text suffixIcon="arrow-right" lines="1" iconStyle="font-size: 18px; color: #333333; font-weight:bold"
|
||||
:text="item.bankNameCode" size="30rpx" color="#333333" :bold="true"></u--text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">账单名称:</text>
|
||||
<text class="row-value">{{ item.name }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">账单状态:</text>
|
||||
<text class="row-value">{{ dictStr(item.billState, billStateList) }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">账单日:</text>
|
||||
<text class="row-value">{{ item.billDate }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">账单周期:</text>
|
||||
<text class="row-value">{{ item.billDatePeriod }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="row-label">账单金额:</text>
|
||||
<text class="row-value">{{ item.billAmount }}</text>
|
||||
</view>
|
||||
<view class="operate" >
|
||||
<view class="btn filling" @click="enterDetails(item)">账单明细</view >
|
||||
<view class="btn filling" @click="handleEdit(item)">修改</view>
|
||||
<view class="btn filling" @click="handleDelete(item)">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-list-item>
|
||||
<view>
|
||||
</view>
|
||||
<u-loadmore :status="status" loadingIcon="semicircle" height="88" fontSize="32rpx" @loadmore="loadmore" />
|
||||
</u-list>
|
||||
<u-picker itemHeight="88" :show="settingPickShow" :columns="settingColumns" keyName="settingName"
|
||||
@confirm="settingConfirm" @cancel="settingCancel"></u-picker>
|
||||
<u-picker itemHeight="88" :show="showCreditCard" :columns="bankCardLendList" keyName="nameCode" @cancel="handleCreditCardCancel"
|
||||
@confirm="handleCreditCardConfirm"></u-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listCreditCardBill, delCreditCardBill } from '@/api/invest/creditCardBill'
|
||||
import { getDicts } from '@/api/system/dict/data.js'
|
||||
import { listAccounts } from '@/api/invest/accounts'
|
||||
import {onLoad,onShow} from "@dcloudio/uni-app";
|
||||
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
|
||||
import {reactive ,toRefs,ref,computed }from "vue";
|
||||
const pageNum = ref(1)
|
||||
const listData = ref([])
|
||||
const isShow = ref(false)
|
||||
const status = ref('loadmore')
|
||||
const billStateList = ref([])
|
||||
const settingPickShow = ref(false)
|
||||
const settingColumns = ref([])
|
||||
const showCreditCard = ref(false)
|
||||
const bankCardLendList = ref([])
|
||||
const data = reactive({
|
||||
filterPanel: false,
|
||||
queryBankCardLendParams: {
|
||||
pageNum: 1,
|
||||
type: '2',
|
||||
state: '1',
|
||||
pageSize: 100
|
||||
},
|
||||
queryParams: {
|
||||
creditCardId: null,
|
||||
name: '',
|
||||
type: '',
|
||||
}
|
||||
})
|
||||
const { filterPanel, queryBankCardLendParams, queryParams} = toRefs(data)
|
||||
const windowHeight = computed(() => {
|
||||
uni.getSystemInfoSync().windowHeight - 50
|
||||
})
|
||||
onLoad(() => {
|
||||
getDict()
|
||||
getList()
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
if (isShow.value) {
|
||||
getList()
|
||||
isShow.value = false
|
||||
}
|
||||
});
|
||||
|
||||
function loadmore() {
|
||||
pageNum.value += 1
|
||||
if (status.value == 'loadmore') {
|
||||
getList()
|
||||
}
|
||||
}
|
||||
function getList() {
|
||||
status.value = 'loading'
|
||||
listCreditCardBill({ pageSize: 10, pageNum: pageNum.value, ...queryParams.value }).then(res => {
|
||||
listData.value = listData.value.concat(res.rows)
|
||||
if (listData.value.length < res.total) {
|
||||
status.value = 'loadmore'
|
||||
} else {
|
||||
status.value = 'nomore'
|
||||
}
|
||||
}).catch(() => {
|
||||
status.value = 'nomore'
|
||||
})
|
||||
}
|
||||
function getDict() {
|
||||
listAccounts(queryBankCardLendParams.value).then((response) => {
|
||||
bankCardLendList.value = [response.rows]
|
||||
})
|
||||
// 账单状态
|
||||
getDicts('bill_state').then(res => {
|
||||
billStateList.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
function settingConfirm(e) {
|
||||
queryParams.value.settingId = e.value[0].settingId
|
||||
queryParams.value.settingName = e.value[0].settingName
|
||||
settingPickShow.value = false
|
||||
}
|
||||
function settingCancel() {
|
||||
settingPickShow.value = false
|
||||
}
|
||||
function dictStr(val, arr) {
|
||||
let str = ''
|
||||
arr.map(item => {
|
||||
if (item.dictValue === val) {
|
||||
str = item.dictLabel
|
||||
}
|
||||
})
|
||||
return str
|
||||
}
|
||||
function selectStatus(item) {
|
||||
queryParams.value.billState = item.dictValue
|
||||
billStateList.value.map(ele => {
|
||||
if (ele.dictValue == item.dictValue) {
|
||||
ele.selected = true
|
||||
Reflect.set(ele, 'selected', true)
|
||||
} else {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
}
|
||||
})
|
||||
}
|
||||
function handleCreditCard() {
|
||||
if (bankCardLendList.value[0].length === 0) {
|
||||
proxy.$refs['uToast'].show({
|
||||
message: '信用卡为空 ', type: 'warning'
|
||||
})
|
||||
} else {
|
||||
showCreditCard.value = true
|
||||
}
|
||||
}
|
||||
function handleCreditCardConfirm(e) {
|
||||
queryParams.value.creditCardName = e.value[0].nameCode
|
||||
queryParams.value.creditCardId= e.value[0].id
|
||||
showCreditCard.value = false
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
function handleCreditCardCancel() {
|
||||
showCreditCard.value = false
|
||||
}
|
||||
function searchSubmit() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
filterPanel.value = false
|
||||
}
|
||||
function searchBlur() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
function resetQuery() {
|
||||
queryParams.value.name = '',
|
||||
queryParams.value.creditCardName = '',
|
||||
queryParams.value.creditCardId= '',
|
||||
queryParams.value.type = ''
|
||||
billStateList.value.map(ele => {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
})
|
||||
}
|
||||
function enterDetails(item) {
|
||||
uni.navigateTo({ url: `/pages/work/bill/creditCardBill/details?id=${item.creditCardId}&billDatePeriod=${item.billDatePeriod}` })
|
||||
}
|
||||
function handleEdit(item) {
|
||||
uni.navigateTo({ url: `/pages/work/bill/creditCardBill/addEdit?id=${item.id}` })
|
||||
isShow.value = true
|
||||
}
|
||||
function handleAdd() {
|
||||
uni.navigateTo({ url: `/pages/work/bill/creditCardBill/addEdit` })
|
||||
isShow.value = true
|
||||
}
|
||||
function handleDelete(item) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '你确定要删除吗',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
delCreditCardBill(item.id)
|
||||
uni.navigateTo({ url: `/pages/work/bill/creditCardBill/list` })
|
||||
} else if (res.cancel) {
|
||||
console.log('取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.btnAdd {
|
||||
width: 146rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
border-radius: 8rpx;
|
||||
display:float;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-view {
|
||||
padding: 12rpx 32rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.search-input {
|
||||
background: #F5F5F5;
|
||||
color: #333333;
|
||||
margin-right: 36rpx;
|
||||
}
|
||||
|
||||
.filter-panel {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 96rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
|
||||
.filter-panel-content {
|
||||
background-color: #ffff;
|
||||
padding: 0 30rpx 30rpx;
|
||||
|
||||
.filter-title {
|
||||
color: #000000;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.state-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
|
||||
.state-item {
|
||||
width: 210rpx;
|
||||
height: 72rpx;
|
||||
border: 1rpx solid rgba(0, 0, 0, 0.25);
|
||||
border-radius: 72rpx;
|
||||
text-align: center;
|
||||
line-height: 72rpx;
|
||||
margin: 0 20rpx 20rpx 0;
|
||||
font-size: 28rpx;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: rgba(222, 241, 255, 1);
|
||||
border: 1rpx solid rgba(22, 119, 255, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
display: flex;
|
||||
padding: 24rpx 30rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 0rpx -10rpx 20rpx #EEEEEE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-item {
|
||||
margin: 0 24rpx 24rpx;
|
||||
padding: 32rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 16rpx;
|
||||
|
||||
.status {
|
||||
.status-item {
|
||||
width: 120rpx;
|
||||
height: 44rpx;
|
||||
text-align: center;
|
||||
line-height: 44rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.status1 {
|
||||
background: #F0F0F0;
|
||||
color: #8C8C8C;
|
||||
}
|
||||
|
||||
.status2 {
|
||||
background: rgba(38, 129, 255, 0.2);
|
||||
color: #2681FF;
|
||||
}
|
||||
|
||||
.status3 {
|
||||
background: #F7F7F7;
|
||||
color: #2681FF;
|
||||
}
|
||||
|
||||
.status4 {
|
||||
background: rgba(255, 85, 51, 0.2);
|
||||
color: #FF5533;
|
||||
}
|
||||
|
||||
.status5 {
|
||||
background: #F7F7F7;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.status7 {
|
||||
background: rgba(255, 129, 51, 0.2);
|
||||
color: #FF8133;
|
||||
}
|
||||
|
||||
.status8 {
|
||||
background: rgba(65, 217, 165, 0.2);
|
||||
color: #41D9A5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-row {
|
||||
padding: 16rpx 0;
|
||||
|
||||
.row-label {
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.row-value {
|
||||
color: rgba(0, 0, 0, 0.85)
|
||||
}
|
||||
}
|
||||
|
||||
.operate {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
.btn {
|
||||
width: 146rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
border-radius: 8rpx;
|
||||
margin-left: 5rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.circulation {
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
margin-right: 24rpx;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.filling {
|
||||
background: #2681FF;
|
||||
border-radius: 8rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user