Commit c1de575c authored by Facius's avatar Facius
parents 0ebdbb21 a38863b9
Pipeline #3203 canceled with stages
import request from "@/utils/request.js"
export function getList(data) {
return request({
url: `/rest/bookRecord/record/page`,
method: 'GET',
data,
noLoading:true
})
}
import request from "@/utils/request.js" import request from "@/utils/request.js"
export function getList(data) { export function getList(data) {
return request({ return request({
url: `/rest/user/bookClassification`, url: `/rest/bookRecordPlan/page`,
method: 'GET', method: 'GET',
data, data,
noLoading:true
})
}
export function getDetail(data) {
return request({
url: `/rest/bookRecordPlan/detail`,
method: 'GET',
data,
noLoading:true
}) })
} }
export function sortList(data) { // 启用
export function enable(data) {
return request({ return request({
url: `/rest/user/bookClassification/sort`, url: `/rest/bookRecordPlan/enable`,
method: 'POST', method: 'POST',
data data,
noLoading:true
})
}
// 禁用
export function close(data) {
return request({
url: `/rest/bookRecordPlan/close`,
method: 'POST',
data,
noLoading:true
}) })
} }
export function deleteById(data) { export function deleteById(data) {
return request({ return request({
url: `/rest/user/bookClassification`, url: `/rest/bookRecordPlan/delete`,
method: 'DELETE', method: 'POST',
data data
}) })
} }
export function update(data) { export function update(data) {
return request({ return request({
url: `/rest/user/bookClassification`, url: `/rest/bookRecordPlan/save`,
method: 'POST', method: 'POST',
data data
}) })
} }
\ No newline at end of file
...@@ -257,6 +257,10 @@ export default { ...@@ -257,6 +257,10 @@ export default {
title = item.message; title = item.message;
break; break;
} }
if (this.form.amount>=100000000) {
title = "金额不能超过千万位";
break;
}
} }
if (title) { if (title) {
this.showToast(title); this.showToast(title);
......
<template>
<view class="card-line" :style="{ height: height + 'rpx' }">
<view class="card-line-border" :style="{ borderColor: lineColor }"></view>
<view class="card-line-view card-line-up" :style="{ height: height + 'rpx', width: height + 'rpx', backgroundColor: dotColor }"></view>
<view class="card-line-view card-line-down" :style="{ height: height + 'rpx', width: height + 'rpx', backgroundColor: dotColor }"></view>
</view>
</template>
<script>
export default {
name: 'card-line',
props: {
height: {
type: Number | String,
default: '24'
},
dotColor: {
type: String,
default: '#02A074'
},
lineColor: {
type: String,
default: '#f6f7fa'
}
},
data() {
return {};
}
};
</script>
<style lang="scss" scoped>
.card-line {
width: 100%;
height: 24rpx;
position: relative;
overflow: hidden;
background-color: #ffffff;
margin-bottom: -1px;
margin-top: -1px;
&-view {
position: absolute;
width: 24rpx;
height: 24rpx;
border-radius: 50%;
background-color: $default-color;
top: 0;
z-index: 2;
}
&-border {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
z-index: 1;
height: 0px;
width: 100%;
border-bottom: 1px dashed #f6f7fa;
// &:before {
// content: ' ';
// position: absolute;
// left: 0;
// top: 0;
// width: 100%;
// height: 1px;
// border-top: 1px dashed #f6f7fa;
// color: #f6f7fa;
// -webkit-transform-origin: 0 0;
// transform-origin: 0 0;
// -webkit-transform: scaleY(0.5);
// transform: scaleY(0.5);
// }
}
&-up {
left: 0;
transform: translateX(-50%);
}
&-down {
right: 0;
transform: translateX(50%);
}
}
</style>
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
}, },
text: { text: {
type: String, type: String,
default: '维修记账', default: '记账收据',
}, },
icon: { icon: {
type: String, type: String,
......
...@@ -59,6 +59,7 @@ export default { ...@@ -59,6 +59,7 @@ export default {
.submit-button-box { .submit-button-box {
width: 100%; width: 100%;
position: fixed; position: fixed;
z-index: 99;
bottom: 0; bottom: 0;
left: 0; left: 0;
padding: 0 32rpx; padding: 0 32rpx;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
"style": { "style": {
"navigationBarTitleText": "账单", "navigationBarTitleText": "账单",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom",
"disableScroll": true "disableScroll": true
} }
...@@ -147,6 +146,15 @@ ...@@ -147,6 +146,15 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}
,{
"path" : "bill-statistics/bill-statistics",
"style" :
{
"navigationBarTitleText": "收入数据",
"enablePullDownRefresh": false
}
} }
] ]
}, { }, {
...@@ -270,6 +278,42 @@ ...@@ -270,6 +278,42 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}
,{
"path" : "timed/choose-type/choose-type",
"style" :
{
"navigationBarTitleText": "收支类型",
"enablePullDownRefresh": false
}
}
,{
"path" : "import-export/import-export",
"style" :
{
"navigationBarTitleText": "数据导出/导入",
"enablePullDownRefresh": false
}
}
,{
"path" : "import-export/export/export",
"style" :
{
"navigationBarTitleText": "账单导出",
"enablePullDownRefresh": false
}
}
,{
"path" : "import-export/import/import",
"style" :
{
"navigationBarTitleText": "数据导入",
"enablePullDownRefresh": false
}
} }
] ]
}, },
......
<template>
<!-- 账单 -->
<view class="bill footer">
<!-- -->
<!-- <view class="bill-head">
<picker mode="date" :value="defaultDate" fields="month" @change="chooseMonth">
<view class="bill-date">
<view class="bill-date-text">{{ form.date }}</view>
<u-icon name="arrow-down-fill" class="bill-date-icon"></u-icon>
</view>
</picker>
</view> -->
<view class="bill-view">
<view class="content-view"><scroll-box ref="scroll-box" :bookRecordType="bookRecordType" :classification="classification" :date="date"></scroll-box></view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import ScrollBox from './components/scroll-box.vue';
import { baseUrl } from '@/utils/config.js';
import { keepTwoDecimalFull, checkLoginAndVip, checkToken } from '@/utils/common.js';
import { getList } from '@/api/bill/bill-statistics.js';
export default {
components: {
ScrollBox
},
data() {
return {
date: [],
firstEnter: true,
bookRecordType: 'INCOME',
classification: ''
};
},
computed: {},
onLoad(options) {
this.initDate();
if (options) {
let { bookRecordType, classification, date } = options;
if (bookRecordType && classification && date) {
this.bookRecordType = bookRecordType;
this.classification = classification;
this.date = date;
}
}
this.setNavigateTitle()
console.log(this.date);
},
onReady() {
console.log("onReady");
setTimeout(()=>{
this.$refs['scroll-box'].reloadList();
},500)
this.firstEnter = false;
},
onShow() {},
methods: {
initDate() {
this.date[0] = this.parseTime(new Date(), '{y}-{m}-{d}') + ' 00:00:00';
this.date[1] = this.parseTime(new Date().getTime() + 24 * 60 * 60 * 1000, '{y}-{m}-{d}') + ' 23:59:59';
},
setNavigateTitle(){
uni.setNavigationBarTitle({
title:this.bookRecordType==="INCOME"?"收入数据":"支持数据"
})
},
async getMouthStatistics() {
try {
let res = await getStatistics({ month: this.defaultDate });
let { expense, income } = res.data;
let surplus = keepTwoDecimalFull(parseFloat(income) - parseFloat(expense));
this.statistics.expense = expense;
this.statistics.income = income;
this.statistics.surplus = surplus;
} catch (e) {
//TODO handle the exception
this.statistics = {
expense: 0,
income: 0,
surplus: 0
};
console.log(e);
}
},
chooseMonth(e) {
let { value } = e.detail;
this.defaultDate = value + '-01';
this.form.date = this.parseTime(value + '-01', '{y}年{m}月');
console.log(this.defaultDate);
this.$nextTick(() => {
// this.getMouthStatistics();
this.$refs['scroll-box'].reloadList();
});
}
}
};
</script>
<style lang="scss" scoped>
.bill {
width: 100%;
padding: 0 24upx;
padding-top: 32rpx;
height: 100vh;
display: flex;
flex-direction: column;
.bill-view {
flex: 1;
width: 100%;
overflow: hidden;
margin-bottom: -60rpx;
}
.content-view {
height: 100%;
width: 100%;
overflow: hidden;
}
&-date {
margin-bottom: 24rpx;
width: 210upx;
height: 48upx;
background: #ffffff;
border-radius: 8upx;
display: flex;
align-items: center;
justify-content: center;
font-size: 24upx;
color: $default-color;
padding: 0 16upx;
&-text {
flex: 1;
}
&-icon {
margin-left: 8upx;
}
}
}
</style>
<template>
<view class="count">
<view class="count-title">
<text>账单日期:</text>
<view class="count-title-date">{{date}}</view>
<text class="count-title-mid">至</text>
<view class="count-title-date">{{date}}</view>
</view>
<view class="bill-count">
<view class="bill-count-item" v-for="(item, index) in list" :key="index">
<view class="bill-count-item-value ellipsis">{{ detail[item.value] }}</view>
<view class="bill-count-item-label">{{ bookRecordType==="INCOME"?item.label:item.label2 }}</view>
<view class="bill-count-item-line" v-if="index !== list.length - 1"></view>
</view>
</view>
</view>
</template>
<script>
import { billCountOptions } from '@/utils/options/bill/bill-statistics.js';
export default {
props:{
date:{
type:Array|null,
default:[]
},
detail:{
type:Object,
default:()=>{}
},
bookRecordType: {
type: String | null,
default: 'INCOME'
},
},
data() {
return {
list: billCountOptions,
};
}
};
</script>
<style lang="scss" scoped>
.count{
background: #ffffff;
border-radius: 16upx;
margin-bottom: 24upx;
padding: 24rpx;
color: #333333;
&-title{
display: flex;
align-items: center;
line-height: 28rpx;
font-size: 24rpx;
&-date{
width: 136rpx;
}
&-mid{
margin: 0 12rpx;
}
}
}
.bill-count {
height: 140upx;
padding-top: 60rpx;
display: flex;
// padding: 32upx 0;
&-item {
width: 50%;
height: 100%;
padding: 0 24upx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
&-value {
width: 100%;
text-align: center;
margin-top: 0upx;
margin-bottom: 16upx;
line-height: 32upx;
font-size: 32upx;
font-weight: bold;
}
&-label {
font-size: 20upx;
color: #8d8d8d;
}
&-line{
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 2upx;
height: 60upx;
background: #F6F7FA;
}
}
}
</style>
<template>
<view class="bill-tabs left" :class="{ right: current === 2 }">
<view class="bill-tabs-item" :class="{ 'bill-tabs-active': item.value === current }" v-for="(item, index) in list" :key="index" @click="change(item.value)">
<view class="bill-tabs-item-label">{{ item.label }}</view>
<view class="bill-tabs-item-line" v-if="item.value === current"></view>
</view>
</view>
</template>
<script>
import { billTabsOptions } from '@/utils/options/bill/bill-statistics.js';
export default {
props: {
current: {
type: Number,
default: 1
},
date: {
type: Array | null,
default: []
},
detail: {
type: Object,
default: () => {}
}
},
data() {
return {
list: billTabsOptions
};
},
methods: {
change(index) {
this.$emit('change', index);
}
}
};
</script>
<style lang="scss" scoped>
.bill-tabs {
border-radius: 16rpx 16rpx 0 0;
margin-bottom: 24upx;
height: 72upx;
display: flex;
align-items: center;
background: #cbede4;
color: #ffffff;
font-size: 28rpx;
font-weight: bold;
overflow: hidden;
&-item {
width: 50%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
position: relative;
&-line {
position: absolute;
bottom: 10rpx;
left: 50%;
transform: translateX(-50%);
width: 40upx;
height: 4upx;
background: $default-color;
}
}
&-active {
color: $default-color;
padding-bottom: 10rpx;
}
}
.left {
background: linear-gradient(70deg, #ffffff 50%, #cbede4 0);
}
.right {
background: linear-gradient(110deg, #cbede4 50%, #ffffff 0);
}
</style>
<template>
<view class="cell-bill-list">
<view
class="content-view"
hover-class="u-hover-class"
@click.stop="$u.throttle(handleSelect, 500)"
>
<view class="left-view">
<view class="image-view">
<image :src="image"></image>
</view>
<view class="info-view">
<view class="name-view">{{ info.classification.name }} </view>
<view class="detail-view">
<view v-if="info.hasAttach" class="other-image-view">
<image :src="beizhutuImage"></image>
</view>
<view class="detail-text">{{ info.remark || '无' }}</view>
</view>
</view>
</view>
<view class="right-view">
<view class="count-view">
<text>{{typeText[info.type.code]}}</text>
<text>{{formatCount(info.amount)}}</text>
</view>
<view v-if="info.repairId" class="time-view">{{ happenTime }}</view>
</view>
</view>
<view v-if="!isLast" class="line-view"></view>
</view>
</template>
<script>
import { billStaticBaseUrl } from '@/utils/config.js'
import { formatCount } from '@/utils/common.js'
export default {
props: {
info: {
type: Object,
default() {
return {
classification: {},
}
},
},
isLast: {
type: Boolean,
default: false,
},
},
data() {
return {}
},
computed: {
image() {
return billStaticBaseUrl + (this.info.classification&&this.info.classification.bookIcon)
},
beizhutuImage() {
return process.uniEnv.qn_base_url + 'beizhutu-n@3x.png'
},
typeText() {
return {
INCOME: '+',
EXPENSE: '-',
}
},
happenTime() {
if (this.info.happenTime) {
var array = this.info.happenTime.split(' ')
if (array.length > 1) {
return array[1]
}
}
return ''
}
},
methods: {
handleSelect() {
this.$emit('select', this.info.id)
},
formatCount(count) {
return formatCount(count)
},
},
}
</script>
<style scoped lang="scss">
.cell-bill-list {
.content-view {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx 24rpx;
.left-view {
flex: 1;
display: flex;
align-items: center;
margin-right: 24rpx;
.image-view {
width: 72rpx;
height: 72rpx;
flex-shrink: 0;
border-radius: 50%;
overflow: hidden;
}
.info-view {
margin-left: 24rpx;
.name-view {
color: #333333;
font-weight: bold;
font-size: 28rpx;
margin-bottom: 2rpx;
}
.detail-view {
min-height: 34rpx;
font-size: 24rpx;
color: #8d8d8d;
display: flex;
align-items: center;
.detail-text {
max-width: 400rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.other-image-view {
margin-right: 8rpx;
width: 24rpx;
height: 24rpx;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
}
}
}
}
.right-view {
flex-shrink: 0;
text-align: right;
.count-view {
color: #333333;
font-weight: bold;
font-size: 28rpx;
margin-bottom: 2rpx;
}
.time-view {
font-size: 24rpx;
color: #8d8d8d;
}
}
}
.line-view {
height: 2rpx;
background-color: #f6f7fa;
margin: 0 24rpx;
}
}
</style>
<template>
<view class="content-view">
<scroll-view
scroll-y
style="height: 100%;width: 100%;"
@scrolltolower="reachBottom"
scroll-anchoring
refresher-enabled="true"
:refresher-triggered="triggered"
:refresher-threshold="100"
refresher-background="#F6F7FA"
@refresherrefresh="onRefresh"
@refresherrestore="onRestore"
@scroll="scroll"
enable-back-to-top
:scroll-top="scrollTop"
>
<view class="scroll-view">
<view class="bill-count"><bill-count ref="bill-count" :detail="count"></bill-count></view>
<view class="bill-list">
<bill-tabs :current="tabCurrent" :bookRecordType="bookRecordType" @change="tabChange"></bill-tabs>
<NoData v-if="noData" :text="noDataText" customStyle="margin-top: 0rpx;" :imageName="noDataImage" />
<view v-else>
<view class="item-view" v-for="(item, ind) in list" :key="ind">
<CellBill @select="handleSelectCell" :info="item" :isLast="ind + 1 >= list.length"></CellBill>
</view>
</view>
</view>
<view class="load-more-view" v-show="(current == 1 && loaded) || current > 1"><u-loadmore :status="loadStatus" bgColor="#F6F7FA"></u-loadmore></view>
<view class="loading-view" v-if="!loaded && !freshing"><u-loading mode="flower"></u-loading></view>
</view>
</scroll-view>
</view>
</template>
<script>
import BillList from '@/components/bill-list';
import CellBill from './cell-bill-list/index.vue';
import BillCount from './bill-count.vue';
import BillTabs from './bill-tabs.vue';
import NoData from '@/components/no-data';
import { getWeek, checkToken } from '@/utils/common.js';
import { getList } from '@/api/bill/bill-statistics.js';
export default {
components: {
BillCount,
BillTabs,
BillList,
CellBill,
NoData
},
props: {
date: {
type: Array | null,
default: () => []
},
bookRecordType: {
type: String | null,
default: 'INCOME'
},
classification: {
type: String | null,
default: '1551863926054977541'
}
},
data() {
return {
tabCurrent: 1,
list: [],
loaded: false,
scrollTop: 0,
current: 1,
size: 10,
loadStatus: 'loading',
lastLoadStatus: '',
triggered: true,
freshing: false,
noDataText: '当前暂无账单内容',
noDataImage: 'bill/wuzhangdanneirong@3x.png',
yesterday: '',
count: {
totalAmount: 0,
totalRecord: 0
}
};
},
computed: {
noData() {
return (this.list || []).length == 0 && this.loaded;
}
},
mounted() {
// this.reloadList();
this.freshing = false;
},
methods: {
tabChange(index) {
this.tabCurrent = index;
this.reloadList()
},
handleSelectCell(id) {
uni.navigateTo({
url: `/pages/bill/bill-detail/bill-detail?id=${id}`
});
},
scroll(e) {
let { scrollTop } = e.detail;
// this.scrollTop=scrollTop
},
reloadList() {
this.current = 1;
this.loadStatus = 'loading';
if (!checkToken()) {
this.list = [];
}
this.scrollTop = 0;
this.getList();
},
async getList() {
if (this.current === 1) {
this.loaded = false;
}
try {
let params = {
current: this.current,
size: this.size,
start: this.date[0],
end: this.date[1],
orderBy: this.tabCurrent,
bookRecordType: this.bookRecordType,
classification: this.classification
};
let res = await getList(params);
if (this.current === 1) {
this.list = [];
}
let { data, totalAmount,totalRecord } = res.data;
this.count.totalAmount=totalAmount
this.count.totalRecord=totalRecord
let total=+totalRecord
let records=data
if (records) {
this.list.push(...records);
// 更新底部加载状态
this.loadStatus = total > this.list.length ? 'loadmore' : 'nomore';
this.lastLoadStatus = this.loadStatus;
}
this.$nextTick(() => {
if (this.freshing) {
this.triggered = false;
this.freshing = false;
}
});
} catch (e) {
//TODO handle the exception
console.log('error', e);
this.$nextTick(() => {
if (this.freshing) {
this.triggered = false;
this.freshing = false;
}
});
this.loadStatus = this.lastLoadStatus;
}
this.loaded = true;
},
onRefresh() {
if (this.freshing) return;
this.freshing = true;
this.reloadList();
},
onRestore() {
this.triggered = 'restore'; // 需要重置
},
// 滚动底部
reachBottom(e) {
console.log('reachBottom');
if (this.loadStatus != 'loadmore') return;
this.current += 1;
this.loadStatus == 'loading';
this.getList();
}
}
};
</script>
<style lang="scss" scoped>
.content-view {
width: 100%;
height: 100%;
overflow: hidden;
.scroll-view {
width: 100%;
height: 100%;
padding-bottom: 40rpx;
}
.load-more-view {
margin-top: 24rpx;
padding-bottom: 60rpx;
}
.loading-view {
width: 100%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
.bill-list {
background-color: #fff;
}
}
</style>
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<swiper-item class="swiper-item" v-for="(listData, index) in list" :key="index"> <swiper-item class="swiper-item" v-for="(listData, index) in list" :key="index">
<scroll-view <scroll-view
scroll-y scroll-y
scroll-anchoring
style="height: 100%;width: 100%;" style="height: 100%;width: 100%;"
@scrolltolower="onreachBottom" @scrolltolower="onreachBottom"
@refresherrefresh="onRefresh" @refresherrefresh="onRefresh"
...@@ -39,10 +40,10 @@ ...@@ -39,10 +40,10 @@
<view class="scroll-view"> <view class="scroll-view">
<NoData v-if="noData(index)" :text="noDataText" customStyle="margin-top: 0rpx;" :imageName="noDataImage" /> <NoData v-if="noData(index)" :text="noDataText" customStyle="margin-top: 0rpx;" :imageName="noDataImage" />
<template v-else> <template v-else>
<view class="container"><debit-detail v-for="item in listData" :key="item.userid" :detail="item" @handleClick="toDetail"></debit-detail></view> <view class="container"><debit-detail v-for="item in listData" :key="item.userid" :detail="item"></debit-detail></view>
<view class="loading-view" v-if="!getCurrentPage(index).loaded && !getCurrentPage(index).freshing"><u-loading mode="flower"></u-loading></view> <view class="loading-view" v-if="!getCurrentPage(index).loaded && !getCurrentPage(index).freshing"><u-loading mode="flower"></u-loading></view>
<view v-show="(getCurrentPage(index).pageNumber === 0 && getCurrentPage(index).loaded) || getCurrentPage(index).pageNumber > 0"> <view v-show="(getCurrentPage(index).pageNumber === 1 && getCurrentPage(index).loaded) || getCurrentPage(index).pageNumber > 1">
<u-loadmore :status="getCurrentPage(index).loadStatus" /> <u-loadmore :status="getCurrentPage(index).loadStatus" />
</view> </view>
</template> </template>
...@@ -70,11 +71,7 @@ export default { ...@@ -70,11 +71,7 @@ export default {
form: { form: {
keyword: '' keyword: ''
}, },
list: [ list: [[], [], []],
[],
[],
[]
],
current: 0, // tabs组件的current值,表示当前活动的tab选项 current: 0, // tabs组件的current值,表示当前活动的tab选项
swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的 swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的
tabs: debitNoteTabs, tabs: debitNoteTabs,
...@@ -98,11 +95,6 @@ export default { ...@@ -98,11 +95,6 @@ export default {
this.init(); this.init();
}, },
methods: { methods: {
toDetail() {
// uni.navigateTo({
// url:``
// })
},
changeSearch() { changeSearch() {
this.onRefresh(); this.onRefresh();
}, },
...@@ -116,7 +108,7 @@ export default { ...@@ -116,7 +108,7 @@ export default {
this.onRefresh(); this.onRefresh();
}, },
async getData() { async getData() {
if (this.currentPage.pageNumber === 0) { if (this.currentPage.pageNumber === 1) {
this.currentPage.loaded = false; this.currentPage.loaded = false;
} }
var postData = { var postData = {
...@@ -128,8 +120,7 @@ export default { ...@@ -128,8 +120,7 @@ export default {
try { try {
let res = await getList(postData); let res = await getList(postData);
let { records, total } = res.data; let { records, total } = res.data;
console.log('searchUrl', res); if (this.currentPage.pageNumber === 1) {
if (this.currentPage.pageNumber === 0) {
// 下拉刷新或切换到新tab,清空对应数组 // 下拉刷新或切换到新tab,清空对应数组
this.list[this.current] = []; this.list[this.current] = [];
} }
...@@ -143,29 +134,16 @@ export default { ...@@ -143,29 +134,16 @@ export default {
// 更新底部加载状态 // 更新底部加载状态
} }
// 更新底部加载状态 // 更新底部加载状态
this.currentPage.isLoadMore = total > this.list[this.current].length;
this.currentPage.loadStatus = total > this.list[this.current].length ? 'loadmore' : 'nomore'; this.currentPage.loadStatus = total > this.list[this.current].length ? 'loadmore' : 'nomore';
this.$nextTick(() => {
if (this.currentPage.freshing) {
this.currentPage.triggered = false;
this.currentPage.freshing = false;
}
});
this.currentPage.loaded = true;
} catch (e) { } catch (e) {
console.log('error', e); console.log('error', e);
this.currentPage.triggered = false;
this.currentPage.freshing = false;
} }
this.currentPage.loaded = true; this.currentPage.loaded = true;
}, this.$nextTick(() => {
this.currentPage.triggered = false;
//点击当前账单 this.currentPage.freshing = false;
toDetail(item) { });
// uni.navigateTo({
// url: `/pages/user/user?id=${item.id}`
// });
}, },
// tabs通知swiper切换 // tabs通知swiper切换
tabsChange(index) { tabsChange(index) {
...@@ -192,18 +170,19 @@ export default { ...@@ -192,18 +170,19 @@ export default {
}, },
onRefresh() { onRefresh() {
if (this.currentPage.freshing) return; if (this.currentPage.freshing) return;
this.currentPage.triggered = true;
this.currentPage.freshing = true; this.currentPage.freshing = true;
this.currentPage.pageNumber = 0; this.currentPage.pageNumber = 1;
this.getData(); this.getData();
}, },
onRestore() { onRestore() {
this.currentPage.triggered = 'restore'; // 需要重置 // this.currentPage.triggered = 'restore'; // 需要重置
}, },
onreachBottom(e) { onreachBottom(e) {
//上拉触底函数 //上拉触底函数
if (!this.currentPage.isLoadMore) { if (this.currentPage.loadStatus === 'loadmore') {
//此处判断,上锁,防止重复请求 //此处判断,上锁,防止重复请求
this.currentPage.isLoadMore = true; this.currentPage.loadStatus == 'loading';
this.currentPage.pageNumber += 1; this.currentPage.pageNumber += 1;
this.getData(); this.getData();
} }
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
</template> </template>
<script> <script>
import NavbarRight from '@/components/navbar-right';
import PopExport from '@/components/pop-export-bill'; import PopExport from '@/components/pop-export-bill';
import MidPopup from '@/components/mid-popup/mid-popup.vue'; import MidPopup from '@/components/mid-popup/mid-popup.vue';
import ScrollBox from './components/scroll-box.vue'; import ScrollBox from './components/scroll-box.vue';
...@@ -51,7 +50,6 @@ import PopNormal from '@/components/pop-normal' ...@@ -51,7 +50,6 @@ import PopNormal from '@/components/pop-normal'
export default { export default {
components: { components: {
NavbarRight,
MidPopup, MidPopup,
ScrollBox, ScrollBox,
PopExport, PopExport,
...@@ -177,8 +175,8 @@ export default { ...@@ -177,8 +175,8 @@ export default {
}, },
handleClickConfirm(range) { handleClickConfirm(range) {
console.log(range); console.log(range);
let startTime = null; let startTime = "";
let endTime = null; let endTime = "";
if (range) { if (range) {
startTime = range[0] + ' 00:00:00'; startTime = range[0] + ' 00:00:00';
endTime = range[1] + ' 23:59:59'; endTime = range[1] + ' 23:59:59';
......
...@@ -243,8 +243,8 @@ export default { ...@@ -243,8 +243,8 @@ export default {
// 滚动底部 // 滚动底部
reachBottom(e) { reachBottom(e) {
console.log('reachBottom'); console.log('reachBottom');
this.current += 1;
if (this.loadStatus != 'loadmore') return; if (this.loadStatus != 'loadmore') return;
this.current += 1;
this.loadStatus == 'loading'; this.loadStatus == 'loading';
this.getList(); this.getList();
} }
......
This diff is collapsed.
...@@ -65,6 +65,7 @@ export default { ...@@ -65,6 +65,7 @@ export default {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.package-item { .package-item {
width: 120upx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
...@@ -78,8 +79,8 @@ export default { ...@@ -78,8 +79,8 @@ export default {
width: 120upx; width: 120upx;
} }
.package-item-icon { .package-item-icon {
width: 52upx; width: 48upx;
height: 52upx; height: 48upx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
......
<template> <template>
<view class="plan-view"> <view class="plan-view">
<view class="plan-view-head"> <view class="plan-view-head">
<view class="plan-view-head-title">代办计划</view> <view class="plan-view-head-title">待办事项</view>
<ab-button content="添加计划" :customStyle="customStyle" left-icon="plus" @click="toAdd"></ab-button> <ab-button content="添加" :customStyle="customStyle" left-icon="plus" @click="toAdd"></ab-button>
</view> </view>
<view class="time-line"> <view class="time-line">
<block v-if="list.length"><plan-step :list="list" @handleClick="handleClick" @handleRemind="handleRemind"></plan-step></block> <block v-if="list.length"><plan-step :list="list" @handleClick="handleClick" @handleRemind="handleRemind"></plan-step></block>
......
<template>
<u-popup v-model="show" border-radius="24" :custom-style="customStyle" mode="center">
<view class="receipt-preview">
<view class="head">
<view class="head-title">请根据流程选填信息,即可生成下方收据小票</view>
<view class="quoted-price-step">
<view class="quoted-price-step-value">
<view class="quoted-price-step-item" v-for="(item, index) in steps" :key="index">
<view class="quoted-price-step-item-num">{{ item.id }}</view>
<view class="quoted-price-step-item-title">{{ item.title }}</view>
<view class="quoted-price-step-item-arrow" v-if="index !== steps.length - 1"><image :src="arrowUrl" mode=""></image></view>
</view>
</view>
</view>
<view class="head-tips">以下为账单示意图,仅做参考</view>
</view>
<view class="preview"><u-image :src="previewImage" mode="widthFix" class="preview-image"></u-image></view>
</view>
</u-popup>
</template>
<script>
import { billBaseUrl } from '@/utils/config.js';
import { quotedPriceSteps } from '@/utils/options/maintain-bill/index.js';
export default {
name: 'receipt-preview',
data() {
return {
show: false,
arrowUrl: billBaseUrl + 'baojiashunxu@3x.png',
steps: quotedPriceSteps,
previewImage: billBaseUrl + 'weixiupreview.png',
customStyle:{
"margin-top":"60rpx",
"margin-bottom":"60rpx",
}
};
},
methods: {
open() {
this.show = true;
},
close() {
this.show = false;
}
}
};
</script>
<style lang="scss" scoped>
.receipt-preview {
margin-top: -12rpx;
position: relative;
background-color: #ffffff;
color: #333333;
.head {
width: 100%;
height: 240rpx;
padding: 0 24rpx;
background: linear-gradient(180deg, #f4fffc 0%, #ffffff 100%);
padding-top: 32rpx;
&-title {
line-height: 28rpx;
margin-top: 16rpx;
margin-bottom: 32rpx;
font-size: 28rpx;
font-weight: bold;
color: #191c27;
}
&-tips {
font-size: 24rpx;
color: #191c27;
line-height: 24rpx;
margin-top: 42rpx;
margin-bottom: 24rpx;
}
}
.preview {
padding: 0 24rpx;
width: 100%;
min-height: 800rpx;
&-image {
width: 100%;
}
}
.quoted-price-step {
display: flex;
align-items: center;
margin-bottom: 24upx;
font-size: 26upx;
&-value {
display: flex;
align-items: center;
font-weight: bold;
}
&-item {
display: flex;
align-items: center;
&-num {
width: 32upx;
height: 32upx;
display: flex;
align-items: center;
font-size: 24upx;
font-weight: bold;
color: #ffffff;
justify-content: center;
border-radius: 50%;
background-color: $default-color;
margin-right: 8upx;
}
&-arrow {
width: 24upx;
height: 22upx;
display: flex;
margin: 0 20upx;
}
}
}
}
</style>
<template>
<view class="required-tips">
<view class="required-tips-left">
<view class="required-tips-left-icon"><image :src="duihuanwentiImg" /></view>
<view class="">
<text>带</text>
<text class="asterisk">*</text>
<text>为必填项,其余选填</text>
</view>
</view>
<view class="required-tips-right" hover-class="u-hover-class" @click="handleClick">收据账单展示</view>
</view>
</template>
<script>
import { mineBaseUrl } from '@/utils/config.js';
export default {
data() {
return {
duihuanwentiImg: mineBaseUrl + 'duihuanwenti@3x.png'
};
},
methods: {
handleClick() {
this.$emit("preview")
}
}
};
</script>
<style lang="scss" scoped>
.required-tips {
width: 100%;
margin-bottom: 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 22rpx 24rpx;
background-color: #fff;
color: #333333;
font-size: 24rpx;
&-left {
display: flex;align-items: center;
&-icon {
width: 28rpx;
height: 28rpx;
display: flex;
margin-right: 12rpx;
}
.asterisk {
color: #FC524D;
margin: 0 8rpx;
}
}
&-right {
width: 168rpx;
height: 48rpx;
border-radius: 8rpx;
border: 2rpx solid $default-color;
font-size: 22rpx;
color: $default-color;
display: flex;
align-items: center;
justify-content: center;
}
}
</style>
This diff is collapsed.
...@@ -258,8 +258,8 @@ export default { ...@@ -258,8 +258,8 @@ export default {
}, },
handleClickConfirm(range) { handleClickConfirm(range) {
var param = { var param = {
end: null, end: "",
start: null start: ""
}; };
if (range) { if (range) {
param = { param = {
...@@ -276,9 +276,7 @@ export default { ...@@ -276,9 +276,7 @@ export default {
this.loading = false; this.loading = false;
}) })
.catch(res => { .catch(res => {
if (res) { this.showToast('下载错误');
this.saveFile(res);
}
this.loading = false; this.loading = false;
}); });
}, },
......
<template>
<view class="package">
<view class="my-car-title" v-if="title">{{ title }}</view>
<view class="package-box">
<view class="package-item" :class="{'package-item-3':list.length===3,'package-item-4':list.length===4}" v-for="(item, index) in list" :key="index" @click="itemClick(item)">
<view class="package-item-icon">
<image :src="item.icon" mode="" class="package-item-icon-image" v-if="item.icon"></image>
<!-- <u-icon :name="item.icon" v-if="item.icon" class="package-item-icon-font"></u-icon> -->
<text v-else>{{item.value||0}}</text>
</view>
<view class="package-item-title">{{ item.title }}</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
list: {
type: Array
},
title: {
type: String
},
},
data() {
return {
};
},
methods:{
itemClick(item) {
// this.$emit('hanldClick', item);
if(item.path){
uni.navigateTo({
url:item.path
})
}
}
}
};
</script>
<style lang="scss" scoped>
.package {
margin: 24upx 0;
padding: 30upx 24upx;
background: #ffffff;
border-radius: 16upx;
.my-car-title {
margin-bottom: 60upx;
font-size: 36upx;
font-weight: bold;
line-height: 50upx;
color: #323233;
}
.package-box {
width: 100%;
display: flex;
align-items: center;
.package-item {
width: 120upx;
margin-right: 56rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
position: relative;
&:last-child{
margin-right: 0;
}
}
.package-item-3{
width: 140upx;
}
.package-item-4{
width: 120upx;
}
.package-item-icon {
width: 48upx;
height: 48upx;
display: flex;
align-items: center;
justify-content: center;
&-font{
font-size: 38upx;
}
&-image{
width: 100%;
height: 100%;
}
}
.package-item-title {
margin-top: 16upx;
font-size: 24upx;
font-weight: 500;
line-height: 32upx;
color: #323233;
}
.package-item-circle {
width: 12upx;
height: 12upx;
border-radius: 50%;
background-color: #ff3b30;
position: absolute;
top: 0;
right: 20upx;
}
.package-item-share{
position: absolute;
width: 100%;
height: 100%;
opacity: 0;
top: 0;
left: 0;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="export">
<view class="pop-export-bill">
<view class="content-view">
<view class="content-view-time">
<view class="label-view">账单时间</view>
<view class="tabs-view" v-if="showAll">
<view
v-for="(item, index) in tabs"
:key="index"
:class="['item-view', { select: currentIndex == index }]"
hover-class="u-hover-class"
@click="handleChange(index)"
>
{{ item }}
</view>
</view>
</view>
<view :class="['date-view', { show: currentIndex == 1 }]">
<view class="label-view">选择时间</view>
<view class="value-view">
<DateRangePicker ref="date-range-picker" v-model="daterange" type="daterange" @change="handleClickChange">
<view class="select-view" hover-class="u-hover-class">
<text>{{ dateString }}</text>
<u-icon name="calendar" class="select-view-icon"></u-icon>
</view>
</DateRangePicker>
</view>
</view>
</view>
<view class="buttons-view">
<view class="right-view">
<u-button :custom-style="customConFirm" @click="handleClickConfirm" :loading="loading">
<view class="confirm-view">{{ confirmText }}</view>
</u-button>
</view>
</view>
</view>
</view>
</template>
<script>
import DateRangePicker from '@/components/date-range-picker/uni-datetime-picker.vue';
import { exportBill } from '@/api/bill/index.js';
import { repairExport } from '@/api/maintain/index.js';
import { downLoad } from '@/utils/download.js';
export default {
components: {
DateRangePicker
},
data() {
return {
type: 'bill',
confirmText: '导出',
showAll: true,
daterange: [],
currentIndex: 1,
loading: false
};
},
computed: {
tabs() {
return ['全部', '自定义'];
},
customConFirm() {
return {
color: 'transparent',
'background-color': this.isError ? '#FC524D' : '#02A074',
height: '96rpx'
};
},
dateString() {
return this.daterange.length > 0 && this.daterange[0] && this.daterange[1] ? `${this.daterange[0]} 至 ${this.daterange[1]}` : '';
}
},
onLoad(options) {
if (options && options.type) {
if (options.type === 'maintain') {
uni.setNavigationBarTitle({
title: '维修帐单导出'
});
}
this.type = options.type;
}
},
onReady() {
this.initDate();
},
methods: {
initDate() {
var endDay = this.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd');
var date = this.$u.timeFormat(new Date().getTime(), 'yyyy/mm');
var newDay = this.$u.timeFormat(new Date(date + '/01').getTime(), 'yyyy-mm-dd');
this.daterange = [newDay, endDay];
},
beforeDownload(range) {
console.log(range);
let startTime = "";
let endTime = "";
if (range) {
startTime = range[0] + ' 00:00:00';
endTime = range[1] + ' 23:59:59';
}
this.downloadExcel({ startTime, endTime });
// 导出
},
async downloadExcel(date) {
console.log('downloadExcel');
uni.showLoading({
mask: true,
title: '下载中'
});
try {
let { startTime, endTime } = date;
let params = {
start: startTime,
end: endTime
};
console.log(params);
if (this.type === 'maintain') {
// 维修账单
let res = await repairExport(params);
this.saveFile(res);
}else{
// 日常账单
let res = await exportBill(params);
this.saveFile(res);
}
} catch (e) {
this.showToast('下载错误');
this.stopLoading();
console.log('downloadExcel_error', e);
//TODO handle the exception
}
uni.hideLoading();
},
async saveFile(file) {
console.log('saveFile');
try {
let res = await downLoad(file);
this.stopLoading();
} catch (e) {
uni.hideLoading();
this.stopLoading();
console.log('saveFile_error', e);
//TODO handle the exception
}
},
handleChange(index) {
this.currentIndex = index;
},
handleClickChange(range) {
this.daterange = range;
},
changeVisibleValue(val) {
this.show = val;
},
handleClickConfirm() {
// this.changeVisibleValue(false)
this.loading = true;
// this.$emit('confirm', this.currentIndex == 0 ? null : this.daterange);
this.beforeDownload(this.currentIndex == 0 ? null : this.daterange)
},
handleClose() {
this.changeVisibleValue(false);
},
stopLoading() {
this.loading = false;
}
}
};
</script>
<style lang="scss" scoped>
.export {
padding: 32rpx 24rpx;
.pop-export-bill {
text-align: center;
.title-view {
color: #333333;
font-weight: bold;
font-size: 40rpx;
margin: 32rpx 0 24rpx 0;
}
.content-view {
background-color: #ffffff;
padding: 0 24rpx;
color: #333333;
font-size: 32rpx;
// min-height: 320rpx;
line-height: 54rpx;
font-size: 28rpx;
border-radius: 16rpx;
margin-bottom: 104rpx;
.content-view-time{
display: flex;
justify-content: space-between;
align-items: center;
padding: 40rpx 0;
}
.label-view {
text-align: left;
}
.tabs-view {
display: flex;
align-items: center;
.item-view {
height: 80rpx;
width: 202rpx;
line-height: 80rpx;
font-weight: bold;
color: #8d8d8d;
text-align: center;
background-color: #f6f7fa;
border-radius: 16rpx;
margin-right: 24rpx;
&:last-child{
margin-right: 0;
}
&.select {
color: #ffffff;
text-align: center;
background-color: #02a074;
}
}
}
.date-view {
display: flex;
justify-content: space-between;
align-items: center;
overflow: hidden;
height: 0;
&.show {
border-top: 1px solid #F6F7FA;
// height: 54rpx;
height: 110rpx;
padding: 28rpx 0;
}
.label-view {
flex-shrink: 0;
width: 120rpx;
}
.value-view {
.select-view {
display: flex;
justify-content: flex-end;
align-items: center;
font-weight: bold;
&-icon {
margin-bottom: 4rpx;
margin-left: 16upx;
font-size: 32upx;
font-weight: normal;
color: $default-color;
}
}
}
}
}
.buttons-view {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32rpx;
.right-view {
width: 100%;
.confirm-view {
color: #ffffff;
height: 96rpx;
line-height: 96rpx;
font-weight: bold;
font-size: 32rpx;
}
}
}
}
}
</style>
<template>
<view class="import-export">
<package-card title="数据导出" :list="exportOptions"></package-card>
<package-card title="数据导入" :list="importOptions"></package-card>
</view>
</template>
<script>
import PackageCard from './components/package-card.vue';
import { exportOptions, importOptions } from '@/utils/options/mine/import-export.js';
export default {
components: {
PackageCard
},
data() {
return {
exportOptions,
importOptions
};
}
};
</script>
<style lang="scss" scoped>
.import-export {
padding: 32rpx 24rpx;
}
</style>
<template>
<view class="download">
<view class="download-icon" @click="downloadFile"><image :src="downloadImg" /></view>
<view class="download-content">
<view class="download-content-item">1. 点击图标,打开模板文件;</view>
<view class="download-content-item">2. 文件左上角"...",选择转发自己或朋友;</view>
<view class="">3. 登录电脑版微信,再次转发可获得模板。</view>
</view>
</view>
</template>
<script>
import { mineBaseUrl } from '@/utils/config.js';
import { downLoadFile } from '@/utils/download.js';
export default {
data() {
return {
downloadImg: mineBaseUrl + 'XISX@3x.png',
filePath:"https://api-book-test.banshouhui.com/%E8%B4%A6%E5%8D%95%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx"
};
},
methods:{
async downloadFile(){
try{
let res=await downLoadFile(this.filePath)
let {tempFilePath}=res
this.openFile(tempFilePath)
console.log(res)
}catch(e){
//TODO handle the exception
}
},
openFile(filePath){
uni.showModal({
title: "下载成功",
content: "是否打开?",
confirmColor: "#0bc183",
confirmText: "打开",
success(res) {
if (res.confirm) {
uni.openDocument({ //打开文件
filePath, //文件名
showMenu: true, //右上角是否显示(...)
success(res) {
console.log(res);
},
});
} else if (res.cancel) {}
},
});
}
}
};
</script>
<style lang="scss" scoped>
.download {
display: flex;
align-items: center;
&-icon {
display: flex;
width: 136rpx;
height: 136rpx;
margin-right: 40rpx;
}
&-content {
font-size: 24rpx;
line-height: 24rpx;
color: #8d8d8d;
&-item {
margin-bottom: 24rpx;
}
}
}
</style>
<template>
<view class="package" :class="{ 'no-padding': noPadding }">
<view class="my-car-title" :style="{ padding: noPadding ? '0 24rpx' : '' }" v-if="title">{{ title }}</view>
<slot></slot>
</view>
</template>
<script>
export default {
props: {
title: {
type: String
},
noPadding: {
type: Boolean,
default: false
}
},
data() {
return {};
},
methods: {}
};
</script>
<style lang="scss" scoped>
.package {
margin-bottom: 24rpx;
padding: 30upx 24upx;
background: #ffffff;
border-radius: 16upx;
.my-car-title {
margin-bottom: 40upx;
font-size: 36upx;
font-weight: bold;
line-height: 50upx;
color: #323233;
}
}
.no-padding {
padding: 30rpx 0;
}
</style>
<template>
<view class="content">
<view class="process">
<view class="process-step process-step-top">
<block v-for="(item, index) in list" :key="index">
<view>
<text>{{ item.step }}</text>
</view>
<view class="process-step-line" v-if="index !== list.length - 1"></view>
</block>
</view>
<view class="process-step">
<block v-for="(item, index) in list" :key="index">
<view class="process-step-item">
<view class="process-step-item-icon"><image :src="item.icon" mode="widthFix" v-if="item.icon"></image></view>
<text>{{ item.title }}</text>
</view>
</block>
</view>
</view>
<card-line :height="24" dotColor="#f7f6fd"></card-line>
<view class="tips">
<view class="tips-title">
<view class="tips-title-icon"><image :src="duihuanwentiImg" /></view>
<text>注意事项</text>
</view>
<view class="tips-content">
<view class="tips-content-item">1. 请按照下载的导入模板样式,在电脑上编辑需导入的账单;</view>
<view class="tips-content-item">2. 请勿修改模板标题/样式,会导致导入数据异常;</view>
<view class="">3. 若导入的分类无法匹配,将统一归类到其它分类之下。</view>
</view>
</view>
</view>
</template>
<script>
import CardLine from '@/components/common/card-line.vue';
import { mineBaseUrl } from '@/utils/config.js';
import { processStepOptions } from '@/utils/options/mine/import-export.js';
export default {
components: {
CardLine
},
data() {
return {
list: processStepOptions,
duihuanwentiImg: mineBaseUrl + 'duihuanwenti@3x.png',
};
}
};
</script>
<style lang="scss" scoped>
.content {
.tips {
padding: 0 24rpx;
&-title {
display: flex;
align-items: center;
font-size: 28rpx;
color: #333333;
margin: 24rpx 0;
&-icon {
display: flex;
width: 28rpx;
height: 28rpx;
margin-right: 12rpx;
}
}
&-content {
font-size: 24rpx;
line-height: 24rpx;
color: #8d8d8d;
&-item {
margin-bottom: 24rpx;
}
}
}
}
.process {
padding: 0 64rpx;
width: 100%;
&-step {
width: 100%;
padding: 0 rpx;
display: flex;
align-items: center;
color: #8d8d8d;
line-height: 24rpx;
font-size: 24rpx;
justify-content: space-between;
margin-bottom: 24rpx;
&-item {
display: flex;
flex-direction: column;
align-items: center;
color: #333333;
&-icon {
width: 52rpx;
height: 52rpx;
display: flex;
margin-bottom: 16rpx;
}
}
&-line {
width: 160rpx;
height: 0;
border-top: 1px dashed #dae1ec;
}
}
&-step-top {
padding: 0 12rpx;
margin-bottom: 36rpx;
}
}
</style>
<template>
<view class="download" @click="selectFile">
<view class="download-icon"><image :src="downloadImg" /></view>
<view class="download-content">
<view class="download-content-item">1. 通过电脑版微信,回传账单模板;</view>
<view class="download-content-item">2. 点击左侧图标,找到回传对象微信或群;</view>
<view class="">3. 找到文件,选择保存,完成上传操作。</view>
</view>
</view>
</template>
<script>
import { mineBaseUrl } from '@/utils/config.js';
import { getToken } from '@/utils/common.js';
export default {
data() {
return {
downloadImg: mineBaseUrl + 'kaishishangchuan@3x.png',
currentCount: 1,
filePath: null
};
},
methods: {
selectFile() {
wx.chooseMessageFile({
count: this.currentCount,
type: 'file',
// extension: ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'],
extension: ['xls', 'xlsx'],
success: res => {
var tempFilePaths = res.tempFiles[0];
this.filePath = tempFilePaths.path;
console.log(tempFilePaths);
this.uploadFile();
},
fail(err) {
console.log(err);
}
});
},
uploadFile() {
const globalUrl = process.uniEnv || {};
let apiUrl = globalUrl.apiUrl;
let token = getToken();
uni.showLoading({
mask:true,
title:"正在上传..."
})
uni.uploadFile({
url: apiUrl + '/rest/bookRecord/import',
filePath: this.filePath,
name: 'file',
header: {
token: 'Bearer ' + token
},
formData: {},
complete: res => {
console.log(res);
// let { data, statusCode } = res;
let data=JSON.parse(res.data)
let {code,msg}=data
uni.hideLoading()
if(code===0){
this.showToast("上传成功",true)
}else{
this.showToast(msg,true)
}
}
});
}
}
};
</script>
<style lang="scss" scoped>
.download {
display: flex;
align-items: center;
&-icon {
display: flex;
width: 136rpx;
height: 136rpx;
margin-right: 40rpx;
}
&-content {
font-size: 24rpx;
line-height: 24rpx;
color: #8d8d8d;
&-item {
margin-bottom: 24rpx;
}
}
}
</style>
<template>
<view class="import">
<package-card title="操作流程" noPadding>
<Process></Process>
</package-card>
<package-card title="下载导入模板">
<download-template></download-template>
</package-card>
<package-card title="上传账单">
<upload-bill></upload-bill>
</package-card>
</view>
</template>
<script>
import PackageCard from './components/package-card.vue';
import Process from './components/process.vue';
import DownloadTemplate from './components/download-template.vue';
import UploadBill from './components/upload-bill.vue';
export default {
components: {
PackageCard,
Process,
DownloadTemplate,
UploadBill,
},
data() {
return {
};
}
}
</script>
<style lang="scss" scoped>
.import{
padding: 32rpx 24rpx;
}
</style>
This diff is collapsed.
This diff is collapsed.
<template>
<!-- 收支设置 -->
<view class="column-administer">
<view class="content-view">
<view class="button-view">
<view class="button-view-item" :class="{ 'button-view-active': form.type === item.value }" v-for="(item, index) in buttons" :key="index" @click="tabChange(item)">
{{ item.label + '类型' }}
</view>
</view>
<!-- 拖动 -->
<view class="drap-view"><drap-view ref="drap-view" :checked="form.payType" :list="list" @handleClick="handleClick"></drap-view></view>
<!-- <view class="submit"><ab-button content="确定" :customStyle="customStyle" @click="toSave"></ab-button></view> -->
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import AbButton from '@/components/common/ab-button.vue';
import DrapView from './components/drap-view.vue';
import { billingTypeOptions } from '@/utils/options/bill';
import { baseUrl } from '@/utils/config.js';
import { getList} from '@/api/mine/payments-setting.js';
export default {
name: 'choose-type',
components: {
AbButton,
DrapView
},
data() {
return {
baseUrl,
customStyle: {
height: '104rpx',
'font-size': '32rpx'
},
buttons: billingTypeOptions,
form: {
type: 'INCOME'
},
list: [],
notification : 'choose-type',
};
},
computed: {
bottomImage() {
return this.baseUrl + 'column-administer/wozhidaole@3x.png';
},
},
onLoad(options) {
this.getList();
},
onReady() {
},
onUnload() {
uni.$off(this.notification);
},
methods: {
tabChange(item) {
this.form.type = item.value;
this.getList();
},
async getList() {
try {
let params = {
type: this.form.type
};
let { data } = await getList(params);
data.forEach(item => {
item.label = item.name;
item.icon=item.recordSelectedIcon;
});
this.list = data || [];
} catch (e) {
console.log(e)
//TODO handle the exception
}
},
handleClick(item){
uni.$emit(this.notification, {
...item,
});
this.$u.route({
type: 'back'
});
}
}
};
</script>
<style scoped lang="scss">
.column-administer {
background: #f6f7fa;
padding: 24rpx;
width: 100%;
.content-view {
.drap-view {
}
.button-view {
display: flex;
align-items: center;
width: 360upx;
// height: 72upx;
background: #ffffff;
border-radius: 12upx;
border: 4upx solid #ffffff;
margin-bottom: 24upx;
&-item {
width: 176upx;
height: 64upx;
font-size: 28upx;
color: #8d8d8d;
display: flex;
align-items: center;
justify-content: center;
}
&-active {
background: #02a074;
border-radius: 12upx;
color: #ffffff;
font-weight: bold;
}
}
}
.submit {
padding: 36upx 0;
}
}
</style>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment