Commit 2de2422a authored by 刘文虎's avatar 刘文虎

退出登录后,数据置空

parent 1b63ddbf
......@@ -140,6 +140,7 @@ export default {
this.getBillTypeOptions();
this.getQiniuToken();
}
this.$refs['ab-calculator'].clearAll()
},
async getBillTypeOptions() {
......@@ -187,6 +188,7 @@ export default {
open(id) {
this.getQiniuToken();
this.getBillTypeOptions();
this.$refs['ab-calculator'].clearAll()
if (id) {
this.id = id;
this.getDetail();
......
......@@ -19,7 +19,7 @@
return {
context: null,
currentTime: 0,
duration: 100,
duration: 0,
status: false
}
},
......
......@@ -49,7 +49,7 @@ export default {
this.type = item.type;
this.close();
if (this.type === '3') {
this.$refs['billing-daily'].open();
this.openBillingDaily()
} else {
if (item.path) {
uni.navigateTo({
......@@ -58,6 +58,9 @@ export default {
}
}
},
openBillingDaily(){
this.$refs['billing-daily'].open();
},
afterSave(){
this.$emit("afterSave")
}
......
......@@ -17,7 +17,7 @@
<view class="item-label">{{ item.label }}</view>
<view class="item-value">
<text class="item-value-repair" v-if="item.value === 'remark' && detail.repairId">点击查看维修账单</text>
<text v-else>{{ detail[item.value]||'' }}</text>
<text v-else>{{ detail[item.value] || '' }}</text>
</view>
</view>
<view class="card-bdoy-images" v-if="detail.attach">
......@@ -42,6 +42,7 @@ import PopInput from '@/components/pop-input-view';
import BillingDetails from '@/components/billing-daily/billing-daily.vue';
import { billBaseUrl } from '@/utils/config.js';
import { get } from '@/api/bill/index.js';
import { deleteByIds } from '@/api/bill/daily.js';
export default {
components: {
AbButton,
......@@ -84,7 +85,8 @@ export default {
label: '账单备注:',
value: 'remark'
}
]
],
firstEnter:true
};
},
onLoad(options) {
......@@ -100,12 +102,12 @@ export default {
}
},
onShow() {
if (this.id) {
if (!this.firstEnter&&this.id) {
this.getDetail();
}
},
methods: {
afterSave(){
afterSave() {
this.getDetail();
},
async getDetail() {
......@@ -116,22 +118,43 @@ export default {
} catch (e) {
//TODO handle the exception
}
this.firstEnter=false
},
toDelete() {
this.showConfirm = true;
},
toEdit() {
if(this.detail.repairId){
}else{
if (this.detail.repairId) {
} else {
this.$refs['billing-daily'].open(this.detail.id);
}
},
handleConfirm() {
uni.showToast({
icon: 'none',
title: '删除成功'
});
async handleConfirm() {
try {
let params = {
id: this.detail.id
};
let {data} = await deleteByIds(params);
if(data){
this.showToast('删除成功', true);
setTimeout(() => {
uni.navigateBack({
delta: 1
});
}, 1500);
}else{
this.showToast('删除失败');
}
} catch (e) {
console.log(e);
let { msg } = e;
if (msg) {
this.showToast(msg);
}else{
this.showToast('删除失败');
}
//TODO handle the exception
}
},
preview(item, index) {
let urls = this.detail.attach;
......@@ -188,7 +211,7 @@ page {
display: flex;
align-items: center;
justify-content: center;
&-image{
&-image {
width: 76upx;
height: 76upx;
}
......
......@@ -11,13 +11,11 @@
</view>
</picker>
</view>
<view class="bill-view" >
<view class="content-view">
<scroll-box ref="scroll-box" :date="defaultDate" :count="statistics"></scroll-box>
</view>
<view class="bill-view">
<view class="content-view"><scroll-box ref="scroll-box" :date="defaultDate" :count="statistics"></scroll-box></view>
</view>
<u-toast ref="uToast" />
<PopExport ref='pop-export-bill' :visible.sync="visible" @confirm="handleClickConfirm" />
<PopExport ref="pop-export-bill" :visible.sync="visible" @confirm="handleClickConfirm" />
<mid-popup ref="midPopup" @afterSave="afterSave"></mid-popup>
<u-tabbar :list="tabbar" :mid-button="true" :mid-button-size="80" :before-switch="beforeSwitch"></u-tabbar>
</view>
......@@ -31,7 +29,7 @@ import NavbarNormal from '@/components/navbar-normal';
import ScrollBox from './components/scroll-box.vue';
import { tabbar } from '@/utils/settings.js';
import { baseUrl } from '@/utils/config.js';
import { keepTwoDecimalFull,checkLoginAndVip} from '@/utils/common.js';
import { keepTwoDecimalFull, checkLoginAndVip, checkToken } from '@/utils/common.js';
import { downLoad } from '@/utils/download.js';
import { getList, getStatistics } from '@/api/bill/index.js';
import { exportBill } from '@/api/bill/index.js';
......@@ -57,23 +55,22 @@ export default {
income: 0,
surplus: 0
},
firstEnter:true
firstEnter: true
};
},
computed: {
},
computed: {},
onLoad() {
this.initDate();
this.getMouthStatistics();
},
onReady() {
this.$refs['scroll-box'].reloadList();
this.firstEnter=false
this.firstEnter = false;
},
onShow() {
console.log('onShow');
if (!this.firstEnter) {
this.$refs['scroll-box'].reloadList();
this.getMouthStatistics();
}
},
methods: {
......@@ -82,7 +79,9 @@ export default {
url: '/pages/index/index'
});
},
afterSave() {},
afterSave() {
this.$refs['scroll-box'].reloadList();
},
initDate() {
this.form.date = this.parseTime(new Date(), '{y}年{m}月');
this.defaultDate = this.parseTime(new Date(), '{y}-{m}') + '-01';
......@@ -97,6 +96,11 @@ export default {
this.statistics.surplus = surplus;
} catch (e) {
//TODO handle the exception
this.statistics = {
expense: 0,
income: 0,
surplus: 0
};
console.log(e);
}
},
......@@ -131,17 +135,17 @@ export default {
};
},
handlClickOut() {
checkLoginAndVip(()=>{
this.visible=true
})
checkLoginAndVip(() => {
this.visible = true;
});
},
handleClickConfirm(range) {
console.log(range);
let startTime = null;
let endTime = null;
if (range) {
startTime = range[0]+' 00:00:00';
endTime = range[1]+' 23:59:59';
startTime = range[0] + ' 00:00:00';
endTime = range[1] + ' 23:59:59';
}
this.downloadExcel({ startTime, endTime });
// 导出
......@@ -166,21 +170,21 @@ export default {
this.saveFile(res);
} catch (e) {
this.showToast('下载错误');
this.$refs['pop-export-bill'].stopLoading()
this.$refs['pop-export-bill'].stopLoading();
console.log('downloadExcel_error', e);
//TODO handle the exception
}
uni.hideLoading()
uni.hideLoading();
},
async saveFile(file) {
console.log('saveFile');
try {
let res = await downLoad(file);
this.$refs['pop-export-bill'].stopLoading()
this.visible=false
this.$refs['pop-export-bill'].stopLoading();
this.visible = false;
} catch (e) {
uni.hideLoading();
this.$refs['pop-export-bill'].stopLoading()
this.$refs['pop-export-bill'].stopLoading();
console.log('saveFile_error', e);
//TODO handle the exception
}
......@@ -211,7 +215,7 @@ export default {
height: 100vh;
display: flex;
flex-direction: column;
.bill-view{
.bill-view {
flex: 1;
width: 100%;
overflow: hidden;
......@@ -240,6 +244,5 @@ export default {
margin-left: 8upx;
}
}
}
</style>
......@@ -92,6 +92,7 @@ export default {
},
async getList() {
if (this.current == 0) {
this.records = [];
this.loaded = false;
}
try {
......@@ -102,10 +103,7 @@ export default {
};
console.log('23131');
let res = await getList(params);
let {records,total}=res.data
if (this.current == 0) {
this.records = [];
}
let { records, total } = res.data;
if (records) {
records.forEach(item => {
let week = '';
......@@ -120,7 +118,7 @@ export default {
week = getWeek(item.day);
break;
}
item.week=week
item.week = week;
});
this.records.push(...records);
// 更新底部加载状态
......@@ -135,8 +133,13 @@ export default {
} catch (e) {
//TODO handle the exception
console.log('error', e);
this.triggered = false;
this.freshing = false;
this.$nextTick(() => {
if (this.freshing) {
this.triggered = false;
this.freshing = false;
}
});
this.loadStatus='loadmore'
}
this.loaded = true;
},
......
......@@ -85,16 +85,8 @@ export default {
onShow() {
if (checkToken()) {
this.getUserInfo();
return;
}
// if (!this.userInfo || !this.userInfo.nickname) {
// uni.navigateTo({
// url: '/pages/login/quick-login/quick-login'
// });
// return;
// }
//拉取新用户信息,更新到storage
// this.getUserInfo()
// this.getUserCount();
// this.hasNewMessage();
},
......
......@@ -45,6 +45,7 @@ export default {
created() {},
methods: {
async getList(date) {
this.list=[]
try {
let res = await getList({
day: date
......
......@@ -95,6 +95,7 @@ export default {
this.firstEnter = false;
},
async getSignList() {
this.signList=[]
try {
let params = {
month: this.month
......
......@@ -20,7 +20,7 @@
<text>{{ platform == '2' || platform == '3' ? '授权登录' : '微信登录' }}</text>
</view>
</view>
<view class="cancel-button"><text @click.stop="toPhoneLogin">手机验证码登录</text></view>
<!-- <view class="cancel-button"><text @click.stop="toPhoneLogin">手机验证码登录</text></view> -->
<!-- <view class="other-login">
<u-divider>其他登录方式</u-divider>
<view class="other-login-item">
......
......@@ -16,7 +16,7 @@
</view>
</view>
</view>
<view class="unsubscribe" v-if="userInfo && userInfo.userId"><text @click="$u.throttle(unsubscribe, 500)">注销账号</text></view>
<view class="unsubscribe" v-if="userInfo && userInfo.id"><text @click="$u.throttle(unsubscribe, 500)">注销账号</text></view>
<unsubscribe-popup :title="title" :content="content" ref="unsubscribe-popup" @confirm="onUnsubscribe"></unsubscribe-popup>
</view>
</template>
......
......@@ -66,6 +66,7 @@ export default {
},
async getList() {
if (this.current == 0) {
this.records = [];
this.loaded = false;
}
try {
......@@ -75,9 +76,6 @@ export default {
};
let res = await getList(params);
let { records, total } = res.data;
if (this.current == 0) {
this.records = [];
}
if (records) {
this.records.push(...records);
// 更新底部加载状态
......
......@@ -164,6 +164,7 @@ export default {
this.navigateTo();
}, 1500);
} catch (error) {
console.log(error)
this.showToast(title+'失败');
}
this.loading = false;
......
......@@ -38,7 +38,7 @@ export const packageOptions = [
// },
{
id: 1,
title: '用户服务&隐私协议',
title: '关于',
icon: 'file-text',
path: "/pages/mine/about/about"
},
......
......@@ -3,7 +3,7 @@ export const scheduleTypeOptions = [{
label: "工作"
},
{
value: "LIfE",
value: "LIFE",
label: "生活"
},
]
......
......@@ -80,21 +80,23 @@ function request({
// 白名单内直接返回
if (responseWhiteList.findIndex(item => url.indexOf(item) !== -1) !== -1) {
resolve(res.data)
} else if (res.data.code === 23007 || res.data.code === 23009) {
if (url.indexOf("customer/logout") !== -1) {
resolve(res.data)
} else {
console.log("未登录或者登陆已过期")
reject(res.data)
store.dispatch("LogOut")
uni.switchTab({
url: "/pages/index/index"
})
}
} else if (res.data.code === 403 || res.data.code === 401) {
// if (url.indexOf("customer/logout") !== -1) {
// resolve(res.data)
// } else {
// reject(res.data)
// uni.switchTab({
// url: "/pages/index/index"
// })
// }
console.log("未登录或者登陆已过期")
console.log(res)
store.dispatch("LogOut")
reject(res.data)
} else if (res.data.code === 23001) {
reject(res.data)
} else {
if(checkToken()){
if (checkToken()) {
showToast(res.data.msg)
}
reject(res.data)
......
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