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

首页打开日常记账

parent 77119105
Pipeline #2937 canceled with stages
...@@ -13,9 +13,7 @@ ...@@ -13,9 +13,7 @@
</view> </view>
<view class="right-view"> <view class="right-view">
<view class="location-view"> <view class="location-view">
<view class="location-icon-view"> <view class="location-icon-view"><image :src="dingweidizhiImage"></image></view>
<image :src="dingweidizhiImage"></image>
</view>
<view>{{ weather.city }}</view> <view>{{ weather.city }}</view>
</view> </view>
<view class="weather-view"> <view class="weather-view">
...@@ -32,40 +30,26 @@ ...@@ -32,40 +30,26 @@
<view class="info-content"> <view class="info-content">
<view class="info-head-view"> <view class="info-head-view">
<view class="left-view">本月结余(元)</view> <view class="left-view">本月结余(元)</view>
<view <view class="right-view" hover-class="u-hover-class" @click="$u.throttle(handleSelectDate, 500)">
class="right-view"
hover-class="u-hover-class"
@click="$u.throttle(handleSelectDate, 500)"
>
<view class="date-view">{{ date }}</view> <view class="date-view">{{ date }}</view>
<u-icon name="arrow-down-fill" color="#ffffff" size="22"></u-icon> <u-icon name="arrow-down-fill" color="#ffffff" size="22"></u-icon>
</view> </view>
</view> </view>
<view class="info-money-view">{{ formatCount(money.money) }}</view> <view class="info-money-view">{{ formatCount(money.money) }}</view>
<view class="info-bottom-view"> <view class="info-bottom-view">
<view class="left-view" <view class="left-view">
><view>本月收入(元)</view <view>本月收入(元)</view>
><view class="money-view">{{ <view class="money-view">{{ formatCount(money.income) }}</view>
formatCount(money.income) </view>
}}</view></view <view class="right-view">
> <view>本月支付(元)</view>
<view class="right-view" <view class="money-view">{{ formatCount(money.expense) }}</view>
><view>本月支付(元)</view </view>
><view class="money-view">{{
formatCount(money.expense)
}}</view></view
>
</view> </view>
</view> </view>
</view> </view>
<view class="tool-view"> <view class="tool-view">
<view <view class="item-view" v-for="(item, index) in toolArray" :key="index" hover-class="u-hover-class" @click="handleClickTool(item)">
class="item-view"
v-for="(item, index) in toolArray"
:key="index"
hover-class="u-hover-class"
@click="handleClickTool(item.path)"
>
<view class="left-view"> <view class="left-view">
<view class="name-view">{{ item.name }}</view> <view class="name-view">{{ item.name }}</view>
<view class="tip-view"> <view class="tip-view">
...@@ -73,22 +57,12 @@ ...@@ -73,22 +57,12 @@
<u-icon name="arrow-right" color="#02A074" size="22"></u-icon> <u-icon name="arrow-right" color="#02A074" size="22"></u-icon>
</view> </view>
</view> </view>
<view class="right-view"> <view class="right-view"><image :src="item.image"></image></view>
<image :src="item.image"></image>
</view>
</view> </view>
</view> </view>
<view class="operate-view"> <view class="operate-view">
<view <view class="item-view" v-for="(item, index) in operateArray" :key="index" hover-class="u-hover-class" @click="handleClickOperate(item.path)">
class="item-view" <view class="image-view"><image :src="item.image"></image></view>
v-for="(item, index) in operateArray"
:key="index"
hover-class="u-hover-class"
@click="handleClickOperate(item.path)"
>
<view class="image-view">
<image :src="item.image"></image>
</view>
<view class="name-view">{{ item.name }}</view> <view class="name-view">{{ item.name }}</view>
</view> </view>
</view> </view>
...@@ -141,32 +115,27 @@ ...@@ -141,32 +115,27 @@
<PopNormal :visible.sync="visible" :isShare="true" /> <PopNormal :visible.sync="visible" :isShare="true" />
<u-toast ref="uToast" /> <u-toast ref="uToast" />
<mid-popup ref="midPopup"></mid-popup> <mid-popup ref="midPopup"></mid-popup>
<u-tabbar <u-tabbar :list="tabbar" :mid-button="true" :mid-button-size="80" :before-switch="beforeSwitch"></u-tabbar>
:list="tabbar"
:mid-button="true"
:mid-button-size="80"
:before-switch="beforeSwitch"
></u-tabbar>
</view> </view>
</template> </template>
<script> <script>
let systemInfo = uni.getSystemInfoSync() let systemInfo = uni.getSystemInfoSync();
import MidPopup from '@/components/mid-popup/mid-popup.vue' import MidPopup from '@/components/mid-popup/mid-popup.vue';
// import CellBill from '@/components/cell-bill-list/index.vue' // import CellBill from '@/components/cell-bill-list/index.vue'
// import NoData from '@/components/no-data' // import NoData from '@/components/no-data'
import BillList from '@/components/bill-list' import BillList from '@/components/bill-list';
import PopNormal from '@/components/pop-normal' import PopNormal from '@/components/pop-normal';
import { tabbar } from '@/utils/settings.js' import { tabbar } from '@/utils/settings.js';
import { getWeather, bookRecord, monthRecord } from '@/api/maintain/index.js' import { getWeather, bookRecord, monthRecord } from '@/api/maintain/index.js';
import { checkVip } from '@/utils/common.js' import { checkVip } from '@/utils/common.js';
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex';
export default { export default {
components: { components: {
MidPopup, MidPopup,
BillList, BillList,
PopNormal, PopNormal
// CellBill, // CellBill,
// NoData // NoData
}, },
...@@ -179,75 +148,75 @@ export default { ...@@ -179,75 +148,75 @@ export default {
date: this.$u.timeFormat(new Date().getTime(), 'yyyy-mm'), date: this.$u.timeFormat(new Date().getTime(), 'yyyy-mm'),
money: { money: {
income: '-', income: '-',
expense: '-', expense: '-'
}, },
list: [], list: []
} };
}, },
computed: { computed: {
...mapGetters(['userInfo']), ...mapGetters(['userInfo']),
baseUrl() { baseUrl() {
return process.uniEnv.qn_base_url return process.uniEnv.qn_base_url;
}, },
infoBackImage() { infoBackImage() {
return this.baseUrl + 'beijing@3x.png' return this.baseUrl + 'beijing@3x.png';
}, },
background() { background() {
return { return {
backgroundColor: 'transparent', backgroundColor: 'transparent'
} };
}, },
shareImage() { shareImage() {
return this.baseUrl + 'share_index.png' return this.baseUrl + 'share_index.png';
}, },
dingweidizhiImage() { dingweidizhiImage() {
return this.baseUrl + 'dingweidizhi@3x.png' return this.baseUrl + 'dingweidizhi@3x.png';
}, },
toolArray() { toolArray() {
return [ return [
{ {
image: this.baseUrl + 'weixiujizhangtubiao@3x.png', image: this.baseUrl + 'weixiujizhangtubiao@3x.png',
path: 'pages/maintain-bill/index', path: 'pages/maintain-bill/index',
name: '维修记账', name: '维修记账'
}, },
{ {
image: this.baseUrl + 'richangjizhangtubiao@3x.png', image: this.baseUrl + 'richangjizhangtubiao@3x.png',
path: '', path: '',
name: '日常记账', name: '日常记账'
}, }
] ];
}, },
operateArray() { operateArray() {
return [ return [
{ {
image: this.baseUrl + 'shoukuanma@3x.png', image: this.baseUrl + 'shoukuanma@3x.png',
path: 'pages/card/payee-code', path: 'pages/card/payee-code',
name: '收款码', name: '收款码'
}, },
{ {
image: this.baseUrl + 'famingpian@3x.png', image: this.baseUrl + 'famingpian@3x.png',
path: 'pages/card/index', path: 'pages/card/index',
name: '发名片', name: '发名片'
}, },
{ {
image: this.baseUrl + 'chabaojia@3x.png', image: this.baseUrl + 'chabaojia@3x.png',
path: '/pages/bill/quoted-price/quoted-price', path: '/pages/bill/quoted-price/quoted-price',
name: '查报价', name: '查报价'
}, },
{ {
image: this.baseUrl + 'chaqianzhang@3x.png', image: this.baseUrl + 'chaqianzhang@3x.png',
path: '/pages/bill/debit-note/debit-note', path: '/pages/bill/debit-note/debit-note',
name: '查欠账', name: '查欠账'
}, }
] ];
}, },
paddingTop() { paddingTop() {
var top = systemInfo.safeAreaInsets.top var top = systemInfo.safeAreaInsets.top;
// #ifdef APP-PLUS || H5 // #ifdef APP-PLUS || H5
return 44 + top return 44 + top;
// #endif // #endif
// #ifdef MP // #ifdef MP
return (systemInfo.platform == 'ios' ? 44 : 48) + top return (systemInfo.platform == 'ios' ? 44 : 48) + top;
// #endif // #endif
}, },
params() { params() {
...@@ -257,112 +226,116 @@ export default { ...@@ -257,112 +226,116 @@ export default {
day: false, day: false,
hour: false, hour: false,
minute: false, minute: false,
second: false, second: false
} };
}, },
dateString() { dateString() {
var string = this.date.replace(/-/g, '/') var string = this.date.replace(/-/g, '/');
return this.$u.timeFormat(new Date(string).getTime(), 'yyyy年mm月') return this.$u.timeFormat(new Date(string).getTime(), 'yyyy年mm月');
}, }
}, },
onLoad(options) { onLoad(options) {
if (options.q) { if (options.q) {
const q = decodeURIComponent(options.q) // 获取到二维码原始链接内容 const q = decodeURIComponent(options.q); // 获取到二维码原始链接内容
console.log(q) console.log(q);
} }
}, },
onShow() { onShow() {
console.log('----------------') console.log('----------------');
this.getWeather() this.getWeather();
this.monthRecord() this.monthRecord();
this.bookRecord() this.bookRecord();
}, },
onReady() {}, onReady() {},
methods: { methods: {
getWeather() { getWeather() {
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
success: (res) => { success: res => {
console.log(res) console.log(res);
getWeather({ getWeather({
latitude: res.latitude, latitude: res.latitude,
longitude: res.longitude, longitude: res.longitude
}).then((res) => { }).then(res => {
console.log('--------getWeather--------', res) console.log('--------getWeather--------', res);
if (res.data) { if (res.data) {
this.weather = res.data this.weather = res.data;
} }
}) });
}, }
}) });
}, },
beforeSwitch(index) { beforeSwitch(index) {
if (index === 2) { if (index === 2) {
this.$refs['midPopup'].open() this.$refs['midPopup'].open();
return false return false;
} }
return true return true;
}, },
handleSelectDate() { handleSelectDate() {
this.showDatePicker = true this.showDatePicker = true;
}, },
handleComfirmDate(date) { handleComfirmDate(date) {
console.log(date) console.log(date);
this.date = `${date.year}-${date.month}` this.date = `${date.year}-${date.month}`;
this.monthRecord() this.monthRecord();
}, },
monthRecord() { monthRecord() {
monthRecord({ month: this.date + '-01' }) monthRecord({ month: this.date + '-01' })
.then((res) => { .then(res => {
var obj = res.data var obj = res.data;
if (obj) { if (obj) {
this.money = { this.money = {
money: Number(obj.income || 0) - Number(obj.expense || 0), money: Number(obj.income || 0) - Number(obj.expense || 0),
income: Number(obj.income || 0), income: Number(obj.income || 0),
expense: Number(obj.expense || 0), expense: Number(obj.expense || 0)
} };
} }
}) })
.catch((res) => {}) .catch(res => {});
}, },
bookRecord() { bookRecord() {
bookRecord({}).then((res) => { bookRecord({}).then(res => {
if (res.data) { if (res.data) {
this.list = res.data this.list = res.data;
} }
}) });
}, },
handleClickTool(path) { handleClickTool(item) {
if (!this.checkVip()) return if (!this.checkVip()) return;
if (item.name === '日常记账') {
this.$refs['midPopup'].open();
} else {
uni.navigateTo({ uni.navigateTo({
url: path, url: item.path
}) });
}
}, },
handleClickOperate(path) { handleClickOperate(path) {
if (!this.checkVip()) return if (!this.checkVip()) return;
uni.navigateTo({ uni.navigateTo({
url: path, url: path
}) });
}, },
handleSelectCell(id) { handleSelectCell(id) {
console.log('-----------', id) console.log('-----------', id);
uni.navigateTo({ uni.navigateTo({
url: `/pages/bill/bill-detail/bill-detail?id=${id}`, url: `/pages/bill/bill-detail/bill-detail?id=${id}`
}) });
}, },
checkVip() { checkVip() {
// 测试数据 // 测试数据
return true return true;
if (checkVip()) { if (checkVip()) {
return true return true;
} else { } else {
this.visible = true this.visible = true;
return false return false;
} }
}, },
formatCount(count) { formatCount(count) {
return (Math.trunc((count || 0) * 100) / 100).toFixed(2) return (Math.trunc((count || 0) * 100) / 100).toFixed(2);
}, },
toLogin() { toLogin() {
this.$refs.uToast.show({ this.$refs.uToast.show({
...@@ -371,29 +344,29 @@ export default { ...@@ -371,29 +344,29 @@ export default {
type: 'error', type: 'error',
callback: () => { callback: () => {
this.$u.route({ this.$u.route({
url: 'pages/login/index', url: 'pages/login/index'
}) });
}, }
}) });
}, },
// 朋友圈 // 朋友圈
onShareTimeline(res) { onShareTimeline(res) {
return { return {
title: '扳手记账', title: '扳手记账',
path: `/pages/index/index?shareUserId=${this.userInfo.id}`, path: `/pages/index/index?shareUserId=${this.userInfo.id}`,
imageUrl: this.shareImage, imageUrl: this.shareImage
} };
}, },
// 好友 // 好友
onShareAppMessage(res) { onShareAppMessage(res) {
return { return {
title: '扳手记账', title: '扳手记账',
path: `/pages/index/index?shareUserId=${this.userInfo.id}`, path: `/pages/index/index?shareUserId=${this.userInfo.id}`,
imageUrl: this.shareImage, imageUrl: this.shareImage
};
} }
}, }
}, };
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
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