Commit c3bdde9a authored by 刘文虎's avatar 刘文虎

导出

parent fd8499f8
......@@ -7,6 +7,15 @@ export function getList(data) {
})
}
export function get(data) {
return request({
url: `/rest/bookRecord/detail`,
method: 'GET',
data
})
}
export function getStatistics(data) {
return request({
url: `/rest/bookRecord/statistics`,
......
......@@ -7,6 +7,14 @@ export function getList(data) {
})
}
export function getSign(data) {
return request({
url: `/rest/trip/calendar`,
method: 'GET',
data
})
}
export function get(data) {
return request({
url: `/rest/trip/detail`,
......
......@@ -12,7 +12,7 @@
<view class="billing-type">
<checkbox-groups :checked="form.type" :custom-style="customStyle" :options="billingTypeOptions" @handleClick="billingTypeChange"></checkbox-groups>
<view class="billing-type-date" @click="openCalendarPopup">
<text>{{ form.happenTime }}</text>
<view class="billing-type-date-text">{{ form.happenTime }}</view>
<u-icon name="arrow-down-fill" class="billing-type-date-icon"></u-icon>
</view>
</view>
......@@ -55,9 +55,10 @@ import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue';
import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue';
import BillingCategory from './components/billing-category.vue';
import { billingTypeOptions } from '@/utils/options/bill';
import { indexBaseUrl,UPLOAD_FILE_HOST } from '@/utils/config.js';
import { indexBaseUrl, UPLOAD_FILE_HOST } from '@/utils/config.js';
import upload from '@/utils/upload';
import { getBillTypes, add } from '@/api/bill/daily.js';
import { get } from '@/api/bill/index.js';
import { getQiNiuToken } from '@/api/upload/index.js';
export default {
name: 'billing-daily',
......@@ -124,11 +125,14 @@ export default {
};
},
mounted() {
this.form.happenTime = this.parseTime(new Date(), '{y}-{m}-{d}');
this.getBillTypeOptions();
this.getQiniuToken();
this.init();
},
methods: {
init() {
this.form.happenTime = this.parseTime(new Date(), '{y}-{m}-{d}');
this.getBillTypeOptions();
this.getQiniuToken();
},
async getBillTypeOptions() {
try {
let { data } = await getBillTypes({ type: this.form.type });
......@@ -161,19 +165,37 @@ export default {
//TODO handle the exception
}
},
open() {
this.form= {
type: 'INCOME',
address: '',
happenTime: '',
amount: '',
classificationId: '',
attach: null,
latitude: '',
longitude: ''
open(id) {
this.getQiniuToken();
if (id) {
this.id = id;
this.getDetail()
} else {
this.form = {
type: 'INCOME',
address: '',
happenTime: '',
amount: '',
classificationId: '',
attach: null,
latitude: '',
longitude: ''
};
this.show = true;
}
},
async getDetail() {
try {
let { data } = await get({ id: this.id });
data.classificationId = data.classification.id;
data.type = data.type.code;
data.happenTime = this.parseTime(data.happenTime,'{y}-{m}-{d}')
this.form = data;
this.show = true;
} catch (e) {
console.log(e);
//TODO handle the exception
}
this.form.happenTime = this.parseTime(new Date(), '{y}-{m}-{d}');
this.show = true;
},
close() {
this.show = false;
......@@ -191,7 +213,7 @@ export default {
this.form.longitude = longitude;
},
fail(err) {
console.log('chooseLocation_fail:' , err);
console.log('chooseLocation_fail:', err);
}
});
},
......@@ -203,11 +225,11 @@ export default {
break;
}
}
if(title){
this.showToast(title)
return false
if (title) {
this.showToast(title);
return false;
}
this.save()
this.save();
},
async save() {
let title = this.form.id ? '修改' : '新增';
......@@ -215,8 +237,8 @@ export default {
await add(this.form);
this.showToast(title + '成功', true);
setTimeout(() => {
this.show=false;
this.$emit("afterSave")
this.show = false;
this.$emit('afterSave');
}, 1500);
} catch (error) {
this.showToast(title + '失败');
......@@ -231,7 +253,7 @@ export default {
// 点击确认
calculatorSure(e) {
console.log('calculatorSure', e);
this.beforeSave()
this.beforeSave();
},
// 日历
calendarChange(e) {
......@@ -261,17 +283,16 @@ export default {
}
},
async handleClickChangeImage() {
try{
try {
// 上传图片
let res=await upload.getPhoto(this.upload.qiniuToken)
uni.hideLoading()
let {hash,key}=res
this.form.attach=[UPLOAD_FILE_HOST+key]
}catch(e){
uni.hideLoading()
let res = await upload.getPhoto(this.upload.qiniuToken);
uni.hideLoading();
let { hash, key } = res;
this.form.attach = [UPLOAD_FILE_HOST + key];
} catch (e) {
uni.hideLoading();
//TODO handle the exception
}
}
}
};
......@@ -321,7 +342,6 @@ export default {
justify-content: space-between;
&-date {
padding: 0 18upx;
height: 48upx;
background: #f6f7fa;
border-radius: 8upx;
display: flex;
......@@ -329,6 +349,14 @@ export default {
justify-content: center;
font-size: 24upx;
color: #333333;
&-text{
text-align: right;
width: 140rpx;
height: 48upx;
display: flex;
align-items: center;
justify-content: center;
}
&-icon {
color: #8d8d8d;
margin-left: 16upx;
......
......@@ -2,25 +2,27 @@
<!-- 账单详情 -->
<view class="bill-detail">
<view class="card">
<view class="card-icon"></view>
<view class="card-icon">
<view class="card-icon-image">
<image :src="billBaseUrl + detail.classification.bookDetailIcon" mode="" v-if="detail.classification && detail.classification.bookDetailIcon"></image>
</view>
</view>
<view class="card-head">
<view class="card-title">{{ detail.money }}</view>
<view class="card-subtitle">{{ detail.money }}</view>
<view class="card-title">{{ detail.classification && detail.classification.name }}</view>
<view class="card-subtitle">{{ detail.amount }}</view>
</view>
<view class="card-line"></view>
<view class="card-bdoy">
<view class="item" v-for="(item, index) in list" :key="index">
<view class="item-label">{{ item.label }}</view>
<view class="item-value">
<text v-if="item.value === 'createdTime'">
<text v-if="detail.createdTime && detail.time">{{ detail.createdTime + ' ' + detail.time }}</text>
</text>
<text v-else>{{ detail[item.value] }}</text>
<text class="item-value-repair" v-if="item.value === 'remark' && detail.repairId">点击查看维修账单</text>
<text v-else>{{ detail[item.value]||'' }}</text>
</view>
</view>
<view class="card-bdoy-images" v-if="detail.images">
<view class="card-bdoy-images-item" v-for="(item, index) in detail.images" :key="index">
<image :src="item.url" v-if="item.url" @click="preview(item, index)"></image>
<view class="card-bdoy-images" v-if="detail.attach">
<view class="card-bdoy-images-item" v-for="(item, index) in detail.attach" :key="index">
<image :src="item" v-if="item" @click="preview(item, index)"></image>
</view>
</view>
</view>
......@@ -30,7 +32,7 @@
</view>
</view>
<PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该账单?" :visible.sync="showConfirm" @click="handleConfirm" />
<billing-daily ref="billing-daily" :type="type"></billing-daily>
<billing-daily ref="billing-daily" :type="type" @afterSave="afterSave"></billing-daily>
</view>
</template>
......@@ -38,7 +40,8 @@
import AbButton from '@/components/common/ab-button.vue';
import PopInput from '@/components/pop-input-view';
import BillingDetails from '@/components/billing-daily/billing-daily.vue';
import { repairDetail } from '@/api/maintain/index.js';
import { billBaseUrl } from '@/utils/config.js';
import { get } from '@/api/bill/index.js';
export default {
components: {
AbButton,
......@@ -47,6 +50,7 @@ export default {
},
data() {
return {
billBaseUrl,
showConfirm: false,
id: '',
type: '',
......@@ -65,17 +69,16 @@ export default {
'font-size': '32rpx'
},
detail: {
name: '餐饮',
money: '-16.00',
createdTime: '2022-07-10',
time: '14:00',
remark: '这家饭店的面有点难吃还很贵',
images: [1, 1, 1, 1]
name: '',
amount: '',
happenTime: '',
remark: '',
attach: []
},
list: [
{
label: '账单时间:',
value: 'createdTime'
value: 'happenTime'
},
{
label: '账单备注:',
......@@ -96,10 +99,18 @@ export default {
}
}
},
onShow() {
if (this.id) {
this.getDetail();
}
},
methods: {
afterSave(){
this.getDetail();
},
async getDetail() {
try {
let res = await repairDetail({ id: this.id });
let res = await get({ id: this.id });
let { code, data, msg } = res;
this.detail = data;
} catch (e) {
......@@ -110,7 +121,11 @@ export default {
this.showConfirm = true;
},
toEdit() {
this.$refs['billing-daily'].open();
if(this.detail.repairId){
}else{
this.$refs['billing-daily'].open(this.detail.id);
}
},
handleConfirm() {
uni.showToast({
......@@ -119,7 +134,7 @@ export default {
});
},
preview(item, index) {
let urls = this.detail.images.map(item => item.url);
let urls = this.detail.attach;
// 预览图片
uni.previewImage({
urls: urls,
......@@ -170,6 +185,13 @@ page {
top: 0;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
align-items: center;
justify-content: center;
&-image{
width: 76upx;
height: 76upx;
}
}
&-title {
color: #8d8d8d;
......@@ -203,6 +225,9 @@ page {
&-value {
font-weight: bold;
font-size: 28upx;
&-repair {
color: $default-color;
}
}
}
&-images {
......
......@@ -25,6 +25,7 @@ import MidPopup from '@/components/mid-popup/mid-popup.vue';
import NavbarNormal from '@/components/navbar-normal';
import PlanView from './components/plan-view.vue';
import { tabbar } from '@/utils/settings.js';
import {getSign} from "@/api/schedule/index.js"
export default {
components: {
MidPopup,
......@@ -38,12 +39,12 @@ export default {
{
date: '2022-07-08',
// title: '张三生日',
info: '八月初四张三生日'
// info: '八月初四张三生日'
},
{
date: '2022-07-09',
// title: '生日',
info: '八月初四张三生日'
// info: '八月初四张三生日'
},
{
date: '2022-07-12'
......@@ -51,12 +52,15 @@ export default {
}
],
date: '',
month:'',
firstEnter: true
};
},
onReady() {
this.date = this.parseTime(new Date(), '{y}-{m}-{d}');
this.month = this.parseTime(new Date(), '{y}-{m}')+'-01';
this.getList();
this.getSignList()
},
onShow() {
if (!this.firstEnter) {
......@@ -81,13 +85,29 @@ export default {
},
monthChange(e) {
console.log('monthChange', e);
let {date}=e
this.month=this.parseTime(date, '{y}-{m}')+'-01';
this.getSignList()
},
chooseMonth(selDate) {
console.log('selDate', selDate);
let {date}=e
this.month=this.parseTime(date, '{y}-{m}')+'-01';
this.getSignList()
},
getList() {
this.$refs['plan-view'].getList(this.date);
this.firstEnter = false;
},
async getSignList(){
try{
let params={
month:this.month
}
let res=await getSign(params)
}catch(e){
//TODO handle the exception
}
}
}
};
......
......@@ -10,7 +10,7 @@
</view>
</picker>
</view>
<view class="head-icon head-icon-right" @click="$u.throttle(goNextMonth, 500)" v-if="shouChangeBtn"><u-icon name="arrow-right" size="26"></u-icon></view>
<!-- <view class="go-to-today" v-show="showToday" @click="goToday">回到今天</view> -->
</view>
......@@ -114,7 +114,7 @@ export default {
allDataArr: [], //轮播数组
tranIndex: 1, //轮播所在位置
selDate: {}, //当前轮播日期信息 -> year, month, day, week
selectDate:{}, //当前选中的日期信息
selectDate: {}, //当前选中的日期信息
today: {}, //今天日期 -> year, month, day, week
tranDuration: 500, //轮播时间(单位毫秒)
showToday: false, //显示回到今天(非当月才显示)
......@@ -162,6 +162,9 @@ export default {
month: nd.getMonth() + 1,
day: nd.getDate()
};
this.$emit('chooseMonth',{
date:year + '-' + month + '-' + day
})
this.initDateTime(date);
},
setPickValue() {
......@@ -287,7 +290,8 @@ export default {
this.$emit('monthChange', {
year: new Date().getFullYear(),
month: new Date().getMonth() + 1,
type: 'today'
type: 'today',
date: this.date
});
},
//点击上月按钮
......@@ -317,7 +321,8 @@ export default {
this.$emit('monthChange', {
year: preMonth.year,
month: preMonth.month,
type: 'pre'
type: 'pre',
date: this.date
});
},
//获取下下月数据
......@@ -333,7 +338,8 @@ export default {
this.$emit('monthChange', {
year: nextMonth.year,
month: nextMonth.month,
type: 'next'
type: 'next',
date: this.date
});
},
//获取上月的月份
......@@ -406,7 +412,7 @@ export default {
// 仅点击天数时返回日期
if (flag) {
this.$emit('dayChange', returnData);
this.selectDate=returnData
this.selectDate = returnData;
}
this.setPickValue();
}
......@@ -433,7 +439,7 @@ export default {
line-height: 80rpx;
margin: 0 40rpx;
}
.head-month-inner{
.head-month-inner {
width: 100%;
line-height: 80rpx;
}
......
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