Commit 79f72084 authored by 刘文虎's avatar 刘文虎

行程/日常记账接口调试

parent bd51154d
import request from "@/utils/request.js"
export function getList(data) {
return request({
url: `/rest/bookRecord`,
method: 'GET',
data
})
}
export function getBillTypes(data) {
return request({
url: `/rest/user/bookClassification`,
method: 'GET',
data
})
}
export function get(data) {
return request({
url: `/rest/bookRecord/detail`,
method: 'GET',
data
})
}
export function add(data) {
return request({
url: `/rest/bookRecord`,
method: 'POST',
data
})
}
export function deleteByIds(data) {
return request({
url: `/rest/bookRecord/delete`,
method: 'POST',
data
})
}
\ No newline at end of file
import request from "@/utils/request.js"
export function getShopInfo() {
return request({
url: `/rest/user/shop`,
method: 'GET',
})
}
export function updateShopInfo(data) {
return request({
url: `/rest/user/shop`,
method: 'POST',
data
})
}
\ No newline at end of file
import request from "@/utils/request.js"
export function getList(data) {
return request({
url: `/rest/trip/day`,
method: 'GET',
data
})
}
export function get(data) {
return request({
url: `/rest/trip/detail`,
method: 'GET',
data
})
}
export function add(data) {
return request({
url: `/rest/trip`,
method: 'POST',
data
})
}
export function deleteByIds(data) {
return request({
url: `/rest/trip/delete`,
method: 'POST',
data
})
}
\ No newline at end of file
...@@ -3,27 +3,27 @@ ...@@ -3,27 +3,27 @@
<view class="content"> <view class="content">
<view class="billing"> <view class="billing">
<view class="billing-head"> <view class="billing-head">
<view class="billing-head-location "> <view class="billing-head-location" @click="$u.throttle(chooseLocation, 500)">
<u-icon name="map" class="billing-head-location-icon"></u-icon> <u-icon name="map" class="billing-head-location-icon"></u-icon>
<view class="billing-head-location-address ellipsis">{{ form.location }}</view> <view class="billing-head-location-address ellipsis">{{ form.address }}</view>
</view> </view>
<view class="billing-head-close" @click="close"><u-icon name="close"></u-icon></view> <view class="billing-head-close" @click="close"><u-icon name="close"></u-icon></view>
</view> </view>
<view class="billing-type"> <view class="billing-type">
<checkbox-groups :checked="form.type" :custom-style="customStyle" :options="billingTypeOptions" @handleClick="billingTypeChange"></checkbox-groups> <checkbox-groups :checked="form.type" :custom-style="customStyle" :options="billingTypeOptions" @handleClick="billingTypeChange"></checkbox-groups>
<view class="billing-type-date" @click="openCalendarPopup"> <view class="billing-type-date" @click="openCalendarPopup">
<text>{{ form.date }}</text> <text>{{ form.happenTime }}</text>
<u-icon name="arrow-down-fill" class="billing-type-date-icon"></u-icon> <u-icon name="arrow-down-fill" class="billing-type-date-icon"></u-icon>
</view> </view>
</view> </view>
<view class="billing-money ellipsis"> <view class="billing-money ellipsis">
<text>¥</text> <text>¥</text>
<text>{{ form.money }}</text> <text>{{ form.amount }}</text>
</view> </view>
<view class="billing-category"><billing-category :checked="form.category" @handleClick="billingCategoryChange"></billing-category></view> <view class="billing-category"><billing-category :list="billingCategoryList" :checked="form.classificationId" @handleClick="billingCategoryChange"></billing-category></view>
<view class="billing-remark"> <view class="billing-remark">
<view class="billing-remark-upload" @click="handleClickChangeImage"> <view class="billing-remark-upload" @click="handleClickChangeImage">
<image :src="takePhotoSuccessIcon" mode="" v-if="form.photos"></image> <image :src="takePhotoSuccessIcon" mode="" v-if="form.attach"></image>
<image :src="takePhotoIcon" mode="" v-else></image> <image :src="takePhotoIcon" mode="" v-else></image>
</view> </view>
<view class="billing-remark-input"> <view class="billing-remark-input">
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<!-- 计算器 --> <!-- 计算器 -->
<view class="billing-calculator"><ab-calculator @change="calculatorChange" @sure="calculatorSure"></ab-calculator></view> <view class="billing-calculator"><ab-calculator @change="calculatorChange" @sure="calculatorSure"></ab-calculator></view>
<!-- 日历 --> <!-- 日历 -->
<calendar-popup :date="form.date" ref="calendar-popup" @confirm="calendarChange"></calendar-popup> <calendar-popup :date="form.happenTime" ref="calendar-popup" @confirm="calendarChange"></calendar-popup>
</view> </view>
</u-popup> </u-popup>
</template> </template>
...@@ -55,8 +55,9 @@ import BillingCategory from './components/billing-category.vue'; ...@@ -55,8 +55,9 @@ import BillingCategory from './components/billing-category.vue';
import { billingTypeOptions } from '@/utils/options/index'; import { billingTypeOptions } from '@/utils/options/index';
import { indexBaseUrl } from '@/utils/config.js'; import { indexBaseUrl } from '@/utils/config.js';
import upload from '@/utils/upload'; import upload from '@/utils/upload';
import { getBillTypes, add } from '@/api/bill/daily.js';
export default { export default {
name: 'billing-details', name: 'billing-daily',
components: { components: {
AbCalculator, AbCalculator,
CheckboxGroups, CheckboxGroups,
...@@ -66,8 +67,8 @@ export default { ...@@ -66,8 +67,8 @@ export default {
data() { data() {
return { return {
billingTypeOptions, billingTypeOptions,
takePhotoIcon:indexBaseUrl+'shangchuanbeizhu@3x.png', takePhotoIcon: indexBaseUrl + 'shangchuanbeizhu@3x.png',
takePhotoSuccessIcon:indexBaseUrl+'shangchuanbeizhuchenggong@3x.png', takePhotoSuccessIcon: indexBaseUrl + 'shangchuanbeizhuchenggong@3x.png',
show: false, show: false,
customStyle: { customStyle: {
width: '104rpx', width: '104rpx',
...@@ -75,31 +76,70 @@ export default { ...@@ -75,31 +76,70 @@ export default {
fontSize: '24rpx' fontSize: '24rpx'
}, },
form: { form: {
type: '1', type: 'INCOME',
location: '庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威', address: '庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威',
date: '2022-07-13', happenTime: '2022-07-13',
money: '56465464646456544444444444444444444444444444444444', amount: '0.00',
category: '2', classificationId: '2',
photos:'1' attach: '1',
latitude: '',
longitude: ''
}, },
upload: { upload: {
uploading: false, uploading: false,
fileList: [], fileList: [],
qiniuToken: '' qiniuToken: ''
} },
limit:6,
billingCategoryList:[]
}; };
}, },
mounted() {
this.getBillTypeOptions();
},
methods: { methods: {
async getBillTypeOptions() {
try {
let { data } = await getBillTypes({ type: this.form.type });
let list=[]
let resData=[...data]
data.forEach((item,index)=>{
if(index % this.limit ===0){
console.log(index,index % this.limit)
list.push(resData.slice(index,index+this.limit))
console.log(resData.slice(index,index+this.limit))
}
})
console.log("billingCategoryList",list)
} catch (e) {
//TODO handle the exception
console.log(e)
}
},
open() { open() {
this.show = true; this.show = true;
}, },
close() { close() {
this.show = false; this.show = false;
}, },
chooseLocation() {
uni.chooseLocation({
success: res => {
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
let { name, address, latitude, longitude } = res;
this.form.address = name;
this.form.latitude = latitude;
this.form.longitude = longitude;
}
});
},
// 点击= // 点击=
calculatorChange(e) { calculatorChange(e) {
console.log('calculatorChange', e); console.log('calculatorChange', e);
this.form.money = e; this.form.amount = e;
}, },
// 点击确认 // 点击确认
calculatorSure(e) { calculatorSure(e) {
...@@ -108,7 +148,7 @@ export default { ...@@ -108,7 +148,7 @@ export default {
// 日历 // 日历
calendarChange(e) { calendarChange(e) {
console.log('calendarChange', e); console.log('calendarChange', e);
this.form.date = e; this.form.happenTime = e;
}, },
billingTypeChange(e) { billingTypeChange(e) {
console.log(e); console.log(e);
...@@ -118,7 +158,7 @@ export default { ...@@ -118,7 +158,7 @@ export default {
this.$refs['calendar-popup'].open(); this.$refs['calendar-popup'].open();
}, },
billingCategoryChange(item) { billingCategoryChange(item) {
this.form.category = item.value; this.form.classificationId = item.value;
}, },
// 上传组件 // 上传组件
handleListChange(lists) { handleListChange(lists) {
......
<template> <template>
<view class="billing-category"> <view class="billing-category">
<uni-swiper-dot :info="swiperList" :current="current" field="content" :mode="mode" :dotsStyles="dotsStyles"> <uni-swiper-dot :info="list" :current="current" field="content" :mode="mode" :dotsStyles="dotsStyles">
<swiper class="swiper" :indicator-dots="false" indicator-color="#8d8d8d" indicator-active-color="#02A074" :autoplay="false" :duration="duration" @change="change"> <swiper class="swiper" :indicator-dots="false" indicator-color="#8d8d8d" indicator-active-color="#02A074" :autoplay="false" :duration="duration" @change="change">
<swiper-item v-for="(swiper, swiperIndex) in swiperList" :key="swiperIndex"> <swiper-item v-for="(swiper, swiperIndex) in list" :key="swiperIndex">
<view class="swiper-item"> <view class="swiper-item">
<view class="billing-category-item" :class="{ active: item.value === checked }" v-for="(item, index) in list" :key="index" @click="handleCheck(item)"> <view class="billing-category-item" :class="{ active: item.value === checked }" v-for="(item, index) in swiper" :key="index" @click="handleCheck(item)">
<view class="billing-category-item-icon"> <view class="billing-category-item-icon">
<image :src="billBaseUrl + item.icon" mode="" v-if="item.value !== checked"></image> <image :src="billBaseUrl + item.icon" mode="" v-if="item.value !== checked"></image>
<image :src="billBaseUrl + item.selectedIcon" mode="" v-else></image> <image :src="billBaseUrl + item.selectedIcon" mode="" v-else></image>
...@@ -31,13 +31,16 @@ export default { ...@@ -31,13 +31,16 @@ export default {
checked: { checked: {
type: Number | String, type: Number | String,
default: '' default: ''
},
list:{
type:Array,
default: ()=>[]
} }
}, },
data() { data() {
return { return {
billBaseUrl, billBaseUrl,
list: billingCategoryOptions, // list: billingCategoryOptions,
swiperList: [1, 2],
duration: 500, duration: 500,
current:0, current:0,
mode:'round', mode:'round',
......
...@@ -33,10 +33,11 @@ export default { ...@@ -33,10 +33,11 @@ export default {
data() { data() {
return { return {
show: false, show: false,
defaultDate: '' defaultDate: parseTime(new Date(), '{y}-{m}-{d}')
}; };
}, },
mounted() { mounted() {
// this.defaultDate=this.date
this.$refs['lunc-calendar'].init(this.date); this.$refs['lunc-calendar'].init(this.date);
}, },
methods: { methods: {
......
...@@ -21,6 +21,11 @@ export default { ...@@ -21,6 +21,11 @@ export default {
customStyle:{ customStyle:{
type: Object, type: Object,
default: () => {} default: () => {}
},
// 是否允许空值 默认false
allowsNull:{
type: Boolean,
default:false
} }
}, },
data() { data() {
...@@ -28,7 +33,13 @@ export default { ...@@ -28,7 +33,13 @@ export default {
}, },
methods: { methods: {
handleCheck(item) { handleCheck(item) {
this.$emit('handleClick', item); let detail={
...item
}
if(this.allowsNull&&item.value===this.checked){
detail.value=''
}
this.$emit('handleClick', detail);
} }
} }
}; };
......
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
<!-- <view class="close"><view class="close-button" @click="close">X</view></view> --> <!-- <view class="close"><view class="close-button" @click="close">X</view></view> -->
</view> </view>
</u-popup> </u-popup>
<billing-details ref="billing-details" :type="type"></billing-details> <billing-daily ref="billing-daily" :type="type"></billing-daily>
</view> </view>
</template> </template>
<script> <script>
import BillingDetails from '@/components/billing-details/billing-details.vue'; import BillingDetails from '@/components/billing-daily/billing-daily.vue';
import { minPopupOptions } from '@/utils/options/index/index.js'; import { minPopupOptions } from '@/utils/options/index/index.js';
export default { export default {
name: 'mid-popup', name: 'mid-popup',
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
this.type = item.type; this.type = item.type;
this.close(); this.close();
if (this.type === '3') { if (this.type === '3') {
this.$refs['billing-details'].open(); this.$refs['billing-daily'].open();
} else { } else {
if (item.path) { if (item.path) {
uni.navigateTo({ uni.navigateTo({
......
...@@ -12,8 +12,10 @@ Vue.use(router) ...@@ -12,8 +12,10 @@ Vue.use(router)
import uView from "uview-ui"; import uView from "uview-ui";
Vue.use(uView); Vue.use(uView);
import {parseTime,showToast} from "@/utils/common.js" import {parseTime,showToast,deepClone} from "@/utils/common.js"
Vue.prototype.parseTime=parseTime Vue.prototype.parseTime=parseTime
Vue.prototype.showToast=showToast
Vue.prototype.deepClone=deepClone
import {platform, channel} from './utils/platform' import {platform, channel} from './utils/platform'
Vue.prototype.$u.platform = platform Vue.prototype.$u.platform = platform
Vue.prototype.$u.channel = channel Vue.prototype.$u.channel = channel
......
...@@ -62,7 +62,12 @@ ...@@ -62,7 +62,12 @@
"urlCheck" : false, "urlCheck" : false,
"minified" : true "minified" : true
}, },
"usingComponents" : true "usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "用于获取当前位置信息"
}
}
}, },
"mp-alipay" : { "mp-alipay" : {
"usingComponents" : true "usingComponents" : true
......
...@@ -85,7 +85,8 @@ ...@@ -85,7 +85,8 @@
"path": "create-schedule/create-schedule", "path": "create-schedule/create-schedule",
"style": { "style": {
"navigationBarTitleText": "添加行程", "navigationBarTitleText": "添加行程",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"navigationStyle": "custom"
} }
}, { }, {
......
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
</view> </view>
</view> </view>
<PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该账单?" :visible.sync="showConfirm" @click="handleConfirm" /> <PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该账单?" :visible.sync="showConfirm" @click="handleConfirm" />
<billing-details ref="billing-details" :type="type"></billing-details> <billing-daily ref="billing-daily" :type="type"></billing-daily>
</view> </view>
</template> </template>
<script> <script>
import AbButton from '@/components/common/ab-button.vue'; import AbButton from '@/components/common/ab-button.vue';
import PopInput from '@/components/pop-input-view'; import PopInput from '@/components/pop-input-view';
import BillingDetails from '@/components/billing-details/billing-details.vue'; import BillingDetails from '@/components/billing-daily/billing-daily.vue';
export default { export default {
components: { components: {
AbButton, AbButton,
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
this.showConfirm=true this.showConfirm=true
}, },
toEdit() { toEdit() {
this.$refs["billing-details"].open() this.$refs["billing-daily"].open()
}, },
handleConfirm(){ handleConfirm(){
uni.showToast({ uni.showToast({
......
...@@ -15,15 +15,20 @@ ...@@ -15,15 +15,20 @@
</view> </view>
</view> </view>
</view> </view>
<PopInput title="提醒" type="text" sureText="退出" content="确定要退出登录吗?" :visible.sync="showConfirm" @click="handleConfirm" />
</view> </view>
</template> </template>
<script> <script>
import PopInput from '@/components/pop-input-view';
import { packageOptions } from '@/utils/options/mine/index.js'; import { packageOptions } from '@/utils/options/mine/index.js';
import { version } from '@/utils/config.js'; import { version } from '@/utils/config.js';
import {getToken} from "@/utils/common.js"
export default { export default {
components:{
PopInput
},
props: { props: {
messageNum: { messageNum: {
type: Number type: Number
...@@ -32,16 +37,31 @@ export default { ...@@ -32,16 +37,31 @@ export default {
data() { data() {
return { return {
packageOptions, packageOptions,
version version,
showConfirm:false
} }
}, },
methods:{ methods:{
itemClick(item) { itemClick(item) {
if (item.path) { if(item.title==='退出登录'){
if(getToken()){
this.showConfirm=true
}
}else if (item.path) {
uni.navigateTo({ uni.navigateTo({
url: item.path url: item.path
}); });
} }
},
handleConfirm(path){
this.$store.dispatch("LogOut")
this.showToast("已退出登录",true)
setTimeout(()=>{
uni.switchTab({
url: "/pages/index/index"
});
},1500)
} }
} }
}; };
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<image :src="userInfo.avatar_l" mode="" v-if="userInfo.avatar_l"></image> <image :src="userInfo.avatar_l" mode="" v-if="userInfo.avatar_l"></image>
<image :src="avatar" v-else></image> <image :src="avatar" v-else></image>
</view> </view>
<view class="user-info"> <view class="user-info" @click="toLogin">
<view class="user-nickname"> <view class="user-nickname">
<text v-if="userInfo.id">{{ userInfo.nickname }}</text> <text v-if="userInfo.id">{{ userInfo.nickname }}</text>
<text v-else>立即登录</text> <text v-else>立即登录</text>
...@@ -54,7 +54,15 @@ export default { ...@@ -54,7 +54,15 @@ export default {
return this.baseUrl+'bushihuiyuan@3x.png' return this.baseUrl+'bushihuiyuan@3x.png'
}, },
}, },
methods:{
toLogin(){
if(!this.userInfo.id){
uni.navigateTo({
url:"/pages/login/login"
})
}
}
}
}; };
</script> </script>
......
<template> <template>
<view class="ali"> <view class="ali">
<!-- ======="state": 0 ,1 ,2====== --> <!-- ======="status": 0 ,1 ====== -->
<view class="ali_state"> <view class="ali_state">
<block v-for="(item, i) in datas" :key="i"> <block v-for="(item, i) in list" :key="i">
<view class="State_Four"> <view class="State_Four">
<view class="FourBox"> <view class="FourBox">
<text class="line" :class="{ noline: i == 0, 'closed-border': i >= firstClosed }"></text> <text class="line" :class="{ noline: i == 0, 'closed-border': i >= firstClosed }"></text>
<text class="ali_top_icon" style="margin: 0 0;" :class="{ closed: item.status === '0' }">{{ item.time }}</text> <text class="ali_top_icon" style="margin: 0 0;" :class="{ closed: item.status === '0' }">{{ resetTime(item.startTime) }}</text>
<text class="ali_top_dot" style="margin: 0 0;" :class="{ 'closed-background': i >= firstClosed }" v-if="i !== datas.length - 1"></text> <text class="ali_top_dot" style="margin: 0 0;" :class="{ 'closed-background': i >= firstClosed }" v-if="i !== list.length - 1"></text>
<text class="line" :class="{ noline: i == datas.length - 1, 'closed-border': i >= firstClosed - 1 }"></text> <text class="line" :class="{ noline: i == list.length - 1, 'closed-border': i >= firstClosed - 1 }"></text>
</view> </view>
<view class="remark" @click.stop="handleClick(item)"> <view class="remark" @click.stop="handleClick(item)">
<view class="remark-content" :class="{ closed: item.status === '0' }">{{ item.remark }}</view> <view class="remark-content" :class="{ closed: item.status === '0' }">{{ item.name }}</view>
<view class="status" :class="{ closed: item.status === '0' }" @click.stop="handleRemind(item)">{{ item.status === '1' ? '提醒' : '已结束' }}</view> <view class="status" :class="{ closed: item.status === '0' }" @click.stop="handleRemind(item)">{{ item.status === '1' ? '提醒' : '已结束' }}</view>
</view> </view>
</view> </view>
...@@ -22,18 +22,21 @@ ...@@ -22,18 +22,21 @@
<script> <script>
export default { export default {
props: ['datas', 'state', 'ways'], props: ['list'],
data() { data() {
return {}; return {};
}, },
computed: { computed: {
firstClosed() { firstClosed() {
let index = this.datas.findIndex(item => item.status === '0'); let index = this.list.findIndex(item => item.status === '0');
console.log(index); console.log(index);
return index; return index;
} }
}, },
methods: { methods: {
resetTime(time){
return this.parseTime(time,'{h}:{i}')
},
handleRemind(item){ handleRemind(item){
this.$emit("handleRemind",item) this.$emit("handleRemind",item)
}, },
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<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 :datas="list" @handleClick="handleClick" @handleRemind="handleRemind"></plan-step></block> <block v-if="list.length"><plan-step :list="list" @handleClick="handleClick" @handleRemind="handleRemind"></plan-step></block>
<block v-else-if="afterGetList"><no-data :imageName="imageName" text="当前暂无待办计划"></no-data></block> <block v-else-if="afterGetList"><no-data :imageName="imageName" text="当前暂无待办计划"></no-data></block>
</view> </view>
</view> </view>
...@@ -16,6 +16,8 @@ import AbButton from '@/components/common/ab-button.vue'; ...@@ -16,6 +16,8 @@ import AbButton from '@/components/common/ab-button.vue';
import EmptyPage from '@/components/common/empty-page.vue'; import EmptyPage from '@/components/common/empty-page.vue';
import NoData from '@/components/no-data'; import NoData from '@/components/no-data';
import PlanStep from './plan-step.vue'; import PlanStep from './plan-step.vue';
import { getTime } from '@/utils/common.js';
import { getList } from '@/api/schedule/index.js';
export default { export default {
name: 'plan-view', name: 'plan-view',
...@@ -33,49 +35,38 @@ export default { ...@@ -33,49 +35,38 @@ export default {
height: '64rpx' height: '64rpx'
}, },
list: [ list: [
// {
// time: '10:30',
// status: '1',
// remark: '[杭州市]快件派送至【丰巢智能快递柜】'
// },
// {
// time: '14:00',
// status: '1',
// remark: '[杭州市]快件交给黄平,正在派送途中(联系电话:15157162459)'
// },
// {
// time: '08:30',
// status: '0',
// remark: '[杭州市]正在派送途中'
// },
// {
// time: '14:00',
// status: '0',
// remark: '[杭州市]快件交给黄平,正在派送途中(联系电话:15157162459)'
// },
// {
// time: '08:30',
// status: '0',
// remark: '[杭州市]正在派送途中'
// }, {
// time: '14:00',
// status: '0',
// remark: '[杭州市]快件交给黄平,正在派送途中(联系电话:15157162459)'
// },
// {
// time: '08:30',
// status: '0',
// remark: '[杭州市]正在派送途中'
// },
], ],
afterGetList: false afterGetList: false
}; };
}, },
created() {},
methods: { methods: {
async getList(date) { async getList(date) {
// let res=await getList() try {
let time = this.parseTime(date, '{y}-{m}-{d}'); let res = await getList({
console.log(time); day: date
});
let validList=[]
let disabledList=[]
res.data.sort((a, b) => {
return getTime(a.startTime)-getTime(b.startTime);
});
let time = getTime(new Date());
res.data.forEach(item => {
if (getTime(item.startTime) > time) {
item.status = '1';
validList.push(item)
} else {
item.status = '0';
disabledList.push(item)
}
});
this.list = [...validList,...disabledList];
} catch (e) {
//TODO handle the exception
}
this.afterGetList = true; this.afterGetList = true;
}, },
toAdd() { toAdd() {
......
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
@chooseMonth="chooseMonth" @chooseMonth="chooseMonth"
></lunc-calendar> ></lunc-calendar>
</view> </view>
<view class=""> <view class=""><plan-view ref="plan-view" :day="date"></plan-view></view>
<plan-view ref="plan-view"></plan-view>
</view>
<mid-popup ref="midPopup"></mid-popup> <mid-popup ref="midPopup"></mid-popup>
<u-tabbar :list="tabbar" :mid-button="true" :mid-button-size="80" :before-switch="beforeSwitch"></u-tabbar> <u-tabbar :list="tabbar" :mid-button="true" :mid-button-size="80" :before-switch="beforeSwitch"></u-tabbar>
</view> </view>
...@@ -25,7 +23,7 @@ ...@@ -25,7 +23,7 @@
<script> <script>
import MidPopup from '@/components/mid-popup/mid-popup.vue'; import MidPopup from '@/components/mid-popup/mid-popup.vue';
import NavbarNormal from '@/components/navbar-normal'; import NavbarNormal from '@/components/navbar-normal';
import PlanView from "./components/plan-view.vue" import PlanView from './components/plan-view.vue';
import { tabbar } from '@/utils/settings.js'; import { tabbar } from '@/utils/settings.js';
export default { export default {
components: { components: {
...@@ -48,15 +46,22 @@ export default { ...@@ -48,15 +46,22 @@ export default {
info: '八月初四张三生日' info: '八月初四张三生日'
}, },
{ {
date: '2022-07-12', date: '2022-07-12'
// title: '朋友聚会' // title: '朋友聚会'
} }
], ],
date:new Date() date: '',
firstEnter: true
}; };
}, },
onReady() { onReady() {
this.getList() this.date = this.parseTime(new Date(), '{y}-{m}-{d}');
this.getList();
},
onShow() {
if (!this.firstEnter) {
this.getList();
}
}, },
methods: { methods: {
beforeSwitch(index) { beforeSwitch(index) {
...@@ -71,17 +76,18 @@ export default { ...@@ -71,17 +76,18 @@ export default {
}, },
dayChange(e) { dayChange(e) {
console.log('dayChange', e); console.log('dayChange', e);
this.date=e.date this.date = e.date;
this.getList() this.getList();
}, },
monthChange(e) { monthChange(e) {
console.log('monthChange', e); console.log('monthChange', e);
}, },
chooseMonth(selDate){ chooseMonth(selDate) {
console.log('selDate', selDate); console.log('selDate', selDate);
}, },
getList(){ getList() {
this.$refs["plan-view"].getList(this.date) this.$refs['plan-view'].getList(this.date);
this.firstEnter = false;
} }
} }
}; };
......
...@@ -177,8 +177,9 @@ export default { ...@@ -177,8 +177,9 @@ export default {
return false return false
} }
let notification = `input-sure-${this.type}`; let notification = `input-sure-${this.type}`;
let str= this.value.replace(/[\r\n]/g,"")
uni.$emit(notification, { uni.$emit(notification, {
content: this.value content: str
}); });
} }
......
<template> <template>
<view class="content"> <view class="content">
<view class="package"> <view class="package">
<view class="package-item" v-for="(item, index) in shopSettingOptions" :key="index" @click="itemClick(item)"> <!-- <view class="package-item" v-for="(item, index) in shopSettingOptions" :key="index" @click="itemClick(item)">
<view class="package-item-title">{{ item.label +":"}}</view> <view class="package-item-title">{{ item.label +":"}}</view>
<view class="package-item-right ellipsis"> <view class="package-item-right ellipsis">
<text class="" v-if="detail[item.value]">{{ detail[item.value] }}</text> <text class="ellipsis" v-if="detail[item.value]">{{ detail[item.value] }}</text>
<text class="package-item-right-text" v-else>去填写</text> <text class="package-item-right-text" v-else>去填写</text>
<u-icon name="arrow-right" class="package-item-right-icon"></u-icon> <u-icon name="arrow-right" class="package-item-right-icon"></u-icon>
</view> </view>
</view> </view> -->
<u-cell-group>
<u-cell-item
title-width="160"
:title-style="titleStyle"
:value-style="valueStyle(detail[item.value])"
:title="item.label + ':'"
:value="detail[item.value] || '去填写'"
v-for="(item, index) in shopSettingOptions"
:key="index"
@click="itemClick(item)"
></u-cell-item>
</u-cell-group>
</view> </view>
</view> </view>
</template> </template>
...@@ -24,10 +36,25 @@ export default { ...@@ -24,10 +36,25 @@ export default {
}, },
data() { data() {
return { return {
shopSettingOptions shopSettingOptions,
titleStyle: {
fontSize: '28rpx',
color: '#8D8D8D',
},
}; };
}, },
methods: { methods: {
valueStyle(value){
let valueStyle= {
fontSize: '28rpx',
color: '#8D8D8D',
}
if(value){
valueStyle.color="#333333"
}
return valueStyle
},
itemClick(item) { itemClick(item) {
if (item.path) { if (item.path) {
this.$u.route({ this.$u.route({
...@@ -38,16 +65,14 @@ export default { ...@@ -38,16 +65,14 @@ export default {
} }
}); });
uni.$once(`input-sure-${item.value}`, res => { uni.$once(`input-sure-${item.value}`, res => {
this.$emit("update",{ this.$emit('update', {
value:item.value, value: item.value,
content:res.content content: res.content
}) });
}); });
} }
}, },
updateCamp(param){ updateCamp(param) {}
}
} }
}; };
</script> </script>
...@@ -56,7 +81,8 @@ export default { ...@@ -56,7 +81,8 @@ export default {
.package { .package {
background: #ffffff; background: #ffffff;
border-radius: 16upx; border-radius: 16upx;
padding: 0 24upx; // padding: 0 24upx;
overflow: hidden;
width: 100%; width: 100%;
.package-item { .package-item {
height: 110upx; height: 110upx;
...@@ -71,14 +97,19 @@ export default { ...@@ -71,14 +97,19 @@ export default {
} }
.package-item-title { .package-item-title {
font-size: 28upx; font-size: 28upx;
line-height: 28upx;
color: #8d8d8d; color: #8d8d8d;
margin-right: 30upx; margin-right: 30upx;
} }
.package-item-right { .package-item-right {
vertical-align: middle;
height: 28rpx;
flex: 1; flex: 1;
text-align: right; text-align: right;
font-weight: bold; font-weight: bold;
line-height: 28rpx;
color: #3d3f4d; color: #3d3f4d;
width: 400rpx;
&-text { &-text {
font-weight: normal; font-weight: normal;
color: #8d8d8d; color: #8d8d8d;
......
<template> <template>
<view class="content"> <view class="content">
<setting-card :detail="detail" @update="updateDetail"></setting-card> <setting-card :detail="stopInfo" @update="updateDetail"></setting-card>
<view class="switch"> <view class="switch">
<view class="label">维修记账自动统计为收入</view> <view class="label">维修记账自动统计为收入</view>
<u-switch slot="right-icon" v-model="detail.memberOpen" active-color="#02A074" inactive-color="#8D8D8D" :loading="switchLoading" @change="switchChange"></u-switch> <u-switch slot="right-icon" v-model="stopInfo.intoBookRecord" active-color="#02A074" inactive-color="#8D8D8D" :loading="switchLoading" @change="switchChange"></u-switch>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import settingCard from './components/setting-card.vue'; import settingCard from './components/setting-card.vue';
import {getShopInfo,updateShopInfo} from "@/api/mine/shop.js"
export default { export default {
components: { components: {
settingCard settingCard
}, },
data() { data() {
return { return {
detail: { stopInfo: {
name: '', name: '',
address: '', address: '',
phone: '' phone: '',
intoBookRecord:false
}, },
switchLoading: false switchLoading: false
}; };
}, },
onLoad() {
this.getShop()
},
methods: { methods: {
async getShop(){
try{
let res=await getShopInfo()
this.stopInfo=res.data
}catch(e){
//TODO handle the exception
console.log(e)
}
},
updateDetail(params) { updateDetail(params) {
let { value, content } = params; let { value, content } = params;
this.detail[value] = content; this.stopInfo[value] = content;
this.updateCamp({}) this.updateShop(this.stopInfo)
}, },
switchChange(val) { switchChange(val) {
this.switchLoading = true; this.switchLoading = true;
this.updateCamp({ this.updateShop(this.stopInfo);
// memberOpen: this.info.memberOpen,
// id: this.camp_id
});
}, },
updateCamp(param) { async updateShop(param) {
// this.$u.api try{
// .updateCamp(param) let res=await updateShopInfo(param)
// .then(res => { this.stopInfo=res.data
// this.switchLoading = false; }catch(e){
// console.log('menu:', res); //TODO handle the exception
// }) console.log(e)
// .catch(err => { }
// console.log(err);
// });
this.switchLoading = false; this.switchLoading = false;
} }
} }
......
<template> <template>
<view class="create-schedule"> <view class="create-schedule">
<NavbarRight :backText="title" :text="deleteText" :background="{'background-color': '#f6f7fa'}" :image="deleteImage" @click="handlClickDelete" />
<u-form :model="form" ref="uForm" label-position="top" :error-type="errorType" label-width="180"> <u-form :model="form" ref="uForm" label-position="top" :error-type="errorType" label-width="180">
<view class="schedule-card"> <view class="schedule-card">
<u-form-item label="计划类型:" prop="type"> <u-form-item label="计划类型:" prop="type" required>
<view class="input-view"><checkbox-groups :checked="form.type" :options="scheduleTypeOptions" @handleClick="scheduleTypeChange"></checkbox-groups></view> <view class="input-view"><checkbox-groups :checked="form.type" :options="scheduleTypeOptions" @handleClick="scheduleTypeChange"></checkbox-groups></view>
</u-form-item> </u-form-item>
<u-form-item label="计划时间:" :prop="form.createdTime ? 'time' : 'createdTime'" label-position="left"> <u-form-item label="计划时间:" :prop="form.createdTime ? 'time' : 'createdTime'" label-position="left" required>
<view class="created-time"> <view class="created-time">
<view class="created-time-item" @click="openCalendarPopup"> <view class="created-time-item" @click="openCalendarPopup">
<view class="created-time-item-inner"> <view class="created-time-item-inner">
...@@ -23,52 +24,59 @@ ...@@ -23,52 +24,59 @@
</view> </view>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="提醒设置:" prop="setting" :border-bottom="false"> <u-form-item label="提醒设置:" prop="remindMinute" :border-bottom="false">
<checkbox-groups :checked="form.setting" :options="scheduleSettingOptions" @handleClick="scheduleSettingChange"></checkbox-groups> <checkbox-groups :checked="form.remindMinute" :allowsNull="true" :options="scheduleSettingOptions" @handleClick="scheduleSettingChange"></checkbox-groups>
</u-form-item> </u-form-item>
</view> </view>
<view class="schedule-card"> <view class="schedule-card">
<u-form-item label="计划标题:" prop="title" label-position="left"> <u-form-item label="计划标题:" prop="name" label-position="left" required>
<u-input type="text" v-model="form.title" placeholder="请输入计划标题" :clearable="false" input-align="right" maxlength="100" class="form-input" /> <u-input type="text" v-model="form.name" placeholder="请输入计划标题" :clearable="false" input-align="right" maxlength="100" class="form-input" />
</u-form-item> </u-form-item>
<u-form-item label="计划纪要:" prop="desc" :border-bottom="false"> <u-form-item label="计划纪要:" prop="content" :border-bottom="false">
<u-input v-model="form.desc" type="textarea" :border="true" :height="240" :auto-height="false" :clearable="false" /> <u-input v-model="form.content" type="textarea" :border="true" :height="240" :auto-height="false" :clearable="false" />
</u-form-item> </u-form-item>
<u-form-item prop="sound" :border-bottom="false"> <u-form-item prop="attach" :border-bottom="false">
<sound-player ref="sound-player" :path="form.sound" @clear="clearSound" v-if="form.sound"></sound-player> <sound-player ref="sound-player" :path="form.attach" @clear="clearSound" v-if="form.attach"></sound-player>
<view class="sound-button" hover-class="u-hover-class" @click="startRecording" v-else><u-icon name="mic"></u-icon></view> <view class="sound-button" hover-class="u-hover-class" @click="startRecording" v-else><u-icon name="mic"></u-icon></view>
</u-form-item> </u-form-item>
</view> </view>
</u-form> </u-form>
<view class="submit"><ab-button :disabled="disabled" :customStyle="customStyle" @click="submit"></ab-button></view> <view class="submit" v-loading="loading"><ab-button :disabled="disabled" :customStyle="customStyle" @click="submit"></ab-button></view>
<u-popup v-model="soundShow" mode="bottom" border-radius="14" safe-area-inset-bottom> <u-popup v-model="soundShow" mode="bottom" border-radius="14" safe-area-inset-bottom>
<sound-recording ref="sound-recording" @cancel="soundCancel" @confirm="soundConfirm"></sound-recording> <sound-recording ref="sound-recording" @cancel="soundCancel" @confirm="soundConfirm"></sound-recording>
</u-popup> </u-popup>
<calendar-popup :date="form.createdTime" ref="calendar-popup" @confirm="calculatorChange"></calendar-popup> <calendar-popup :date="form.createdTime" ref="calendar-popup" @confirm="calculatorChange"></calendar-popup>
<u-picker v-model="timeShow" mode="time" :default-time="defaultTime" :params="timeParams" @confirm="timePickerConfirm"></u-picker> <u-picker v-model="timeShow" mode="time" :default-time="defaultTime" :params="timeParams" @confirm="timePickerConfirm"></u-picker>
<PopInput title="提醒" type="text" sureText="删除" content="确定删除此行程吗?" :visible.sync="showConfirm" @click="handleConfirm" />
</view> </view>
</template> </template>
<script> <script>
import NavbarRight from '@/components/navbar-right';
import PopInput from '@/components/pop-input-view';
import SoundRecording from '@/components/sound-recording/sound-recording.vue'; import SoundRecording from '@/components/sound-recording/sound-recording.vue';
import AbButton from '@/components/common/ab-button.vue'; import AbButton from '@/components/common/ab-button.vue';
import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue'; import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue';
import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue'; import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue';
import SoundPlayer from './components/sound-player.vue'; import SoundPlayer from './components/sound-player.vue';
import { authorize, openSetting, showModal } from '@/utils/auth.js'; import { authorize, openSetting, showModal } from '@/utils/auth.js';
import { baseUrl } from '@/utils/config.js';
import { scheduleTypeOptions, scheduleSettingOptions } from '@/utils/options/schedule'; import { scheduleTypeOptions, scheduleSettingOptions } from '@/utils/options/schedule';
import { get, add, deleteById } from '@/api/schedule/index.js';
export default { export default {
components: { SoundRecording, CheckboxGroups, CalendarPopup, SoundPlayer, AbButton }, components: { NavbarRight, PopInput, SoundRecording, CheckboxGroups, CalendarPopup, SoundPlayer, AbButton },
data() { data() {
return { return {
customStyle:{ customStyle: {
fontSize:"32rpx" fontSize: '32rpx'
}, },
scheduleTypeOptions, scheduleTypeOptions,
scheduleSettingOptions, scheduleSettingOptions,
loading:false,
soundShow: false, // 录音弹框 soundShow: false, // 录音弹框
showConfirm: false, // 删除弹框
timeShow: false, // 时间Picker timeShow: false, // 时间Picker
defaultTime: '', defaultTime: '',
timeParams: { timeParams: {
...@@ -81,72 +89,84 @@ export default { ...@@ -81,72 +89,84 @@ export default {
}, },
id: '', id: '',
form: { form: {
type: '1', type: 'WORK',
createdTime: '', startTime: '', // 开始时间
time: '', createdTime: '', //开始日期
setting: '', time: '', // 开始时间 时-分
title: '', remindMinute: '',
sound: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3' name: '', // 标题
content: '',
attach: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3'
}, },
errorType: ['toast', 'border-bottom'], errorType: ['toast', 'border-bottom'],
rules: { rules: {
type: [{ required: true, message: '请选择计划类型', trigger: ['change', 'blur'] }], type: [{ required: true, message: '请选择计划类型', trigger: ['change', 'blur'] }],
createdTime: [{ required: true, message: '请选择计划日期', trigger: ['change', 'blur'] }], createdTime: [{ required: true, message: '请选择计划日期', trigger: ['change', 'blur'] }],
time: [{ required: true, message: '请选择计划时间', trigger: ['change', 'blur'] }], time: [{ required: true, message: '请选择计划时间', trigger: ['change', 'blur'] }],
title: [{ required: true, message: '请输入计划标题', trigger: ['blur'] }] name: [{ required: true, message: '请输入计划标题', trigger: ['blur'] }]
} }
}; };
}, },
computed: { computed: {
disabled() { disabled() {
let flag = !this.form.createdTime || !this.form.time || !this.form.title; let flag = !this.form.createdTime || !this.form.time || !this.form.name;
return flag; return flag;
},
title() {
return this.id ? '修改行程' : '新增行程';
},
deleteText() {
return this.id ? '删除' : '';
},
deleteImage() {
return this.id ? baseUrl + 'shanchuzhangdanxiangqing@3x.png' : '';
} }
}, },
onLoad(options) { onLoad(options) {
this.form.createdTime=this.parseTime(new Date(), '{y}-{m}-{d}')
this.form.time=this.parseTime(new Date(), '{h}:{i}')
if (options && options.id) { if (options && options.id) {
this.id = options.id; this.id = options.id;
// this.geDetail() this.geDetail();
} }
}, },
onReady() { onReady() {
this.$refs.uForm.setRules(this.rules); this.$refs.uForm.setRules(this.rules);
uni.setNavigationBarTitle({
title: this.id ? '修改行程' : '新增行程'
});
}, },
methods: { methods: {
async geDetail() { async geDetail() {
let res = await addBind(this.form); try {
let { code, data, msg } = res; let { code, data, msg } = await get({id:this.id});
if (code === 200) { this.form = { ...this.form, ...data };
this.form = data; } catch (e) {
//TODO handle the exception
} }
}, },
submit() { submit() {
this.loading = true;
this.$refs.uForm.validate(valid => { this.$refs.uForm.validate(valid => {
if (valid) { if (valid) {
this.create(); let { createdTime, time } = this.form;
this.form.startTime = createdTime + ' ' + time + ':00';
this.save();
} else { } else {
this.loading = false;
console.log('验证失败'); console.log('验证失败');
} }
}); });
}, },
async create() { async save() {
// let res = await addBind(this.form); let title=this.form.id?"修改":"新增"
let res = { try {
code: 200 await add(this.form);
}; this.showToast(title+'成功', true);
let { code, data, msg } = res;
if (code === 200) {
uni.showToast({
title: '创建成功',
mask: true
});
setTimeout(() => { setTimeout(() => {
this.navigateTo(); this.navigateTo();
}, 1500); }, 1500);
} catch (error) {
this.showToast(title+'失败');
} }
this.loading = false;
}, },
navigateTo() { navigateTo() {
uni.switchTab({ uni.switchTab({
...@@ -187,16 +207,16 @@ export default { ...@@ -187,16 +207,16 @@ export default {
soundConfirm(e) { soundConfirm(e) {
console.log(e); console.log(e);
this.soundShow = false; this.soundShow = false;
this.form.sound = e; this.form.attach = e;
}, },
scheduleTypeChange(item) { scheduleTypeChange(item) {
this.form.type = item.value; this.form.type = item.value;
}, },
scheduleSettingChange(item) { scheduleSettingChange(item) {
if (this.form.setting === item.value) { if (this.form.remindMinute === item.value) {
this.form.setting = ''; this.form.remindMinute = '';
} else { } else {
this.form.setting = item.value; this.form.remindMinute = item.value;
} }
}, },
openCalendarPopup() { openCalendarPopup() {
...@@ -218,7 +238,27 @@ export default { ...@@ -218,7 +238,27 @@ export default {
this.form.time = `${e.hour}:${e.minute}`; this.form.time = `${e.hour}:${e.minute}`;
}, },
clearSound() { clearSound() {
this.form.sound = ''; this.form.attach = '';
},
handlClickDelete() {
this.showConfirm = true;
},
async handleConfirm() {
if (!this.form.id) {
this.showToast('行程不存在');
return false;
}
try {
await deleteById({
id:this.form.id
});
this.showToast('删除成功', true);
setTimeout(() => {
this.navigateTo();
}, 1500);
} catch (e) {
//TODO handle the exception
}
} }
} }
}; };
......
<template> <template>
<view class="schedule-detail"> <view class="schedule-detail">
<view class="schedule-detail-head"> <view class="schedule-detail-head">
<view class="schedule-detail-head-status" :class="{ closed: detail.status === '0' }">{{ detail.status === '1' ? '待提醒' : '已结束' }}</view> <view class="schedule-detail-head-status" :class="{ closed: status === '0' }">{{ status === '1' ? '待提醒' : '已结束' }}</view>
<view class="schedule-detail-head-edit" v-if="detail.status === '1'" @click="toEdit"> <view class="schedule-detail-head-right">
<view class="schedule-detail-head-edit" v-if="status === '1'" @click="toEdit">
<view class="schedule-detail-head-edit-icon"><u-icon name="edit-pen"></u-icon></view> <view class="schedule-detail-head-edit-icon"><u-icon name="edit-pen"></u-icon></view>
<text class="">编辑</text> <text class="">编辑</text>
</view> </view>
<view class="schedule-detail-head-edit schedule-detail-head-delete" @click="handlClickDelete">
<view class="schedule-detail-head-edit-icon"><u-icon name="trash"></u-icon></view>
<text class="">删除</text>
</view>
</view>
</view> </view>
<view class="schedule-card"> <view class="schedule-card">
<u-card :title="detail.title" margin="0" :head-style="{ 'padding-bottom': 0, 'font-weight': 'bold' }" :head-border-bottom="false"> <u-card :title="detail.title" margin="0" :head-style="{ 'padding-bottom': 0, 'font-weight': 'bold' }" :head-border-bottom="false">
...@@ -13,8 +19,11 @@ ...@@ -13,8 +19,11 @@
<view class="item" v-for="(item, index) in list" :key="index"> <view class="item" v-for="(item, index) in list" :key="index">
<view class="item-label">{{ item.label }}</view> <view class="item-label">{{ item.label }}</view>
<view class="item-value"> <view class="item-value">
<text v-if="item.value === 'createdTime'"> <text v-if="item.value === 'type'">
<text v-if="detail.createdTime && detail.time">{{ detail.createdTime + ' ' + detail.time }}</text> <text>{{ detail.type.desc }}</text>
</text>
<text v-else-if="item.value === 'remindMinute'">
<text>{{ myFilter(detail[item.value] + '', scheduleSettingOptions) }}</text>
</text> </text>
<text v-else>{{ detail[item.value] }}</text> <text v-else>{{ detail[item.value] }}</text>
</view> </view>
...@@ -27,30 +36,37 @@ ...@@ -27,30 +36,37 @@
<view class="schedule-card-body" slot="body"> <view class="schedule-card-body" slot="body">
<view class="item desc"> <view class="item desc">
<view class="item-label">计划纪要:</view> <view class="item-label">计划纪要:</view>
<view class="item-value">{{ detail.desc }}</view> <view class="item-value">{{ detail.content }}</view>
<sound-player ref="sound-player" :path="detail.sound" :showClose="false" v-if="detail.sound"></sound-player> <sound-player ref="sound-player" :path="detail.attach" :showClose="false" v-if="detail.attach"></sound-player>
</view> </view>
</view> </view>
</u-card> </u-card>
</view> </view>
<PopInput title="提醒" type="text" sureText="删除" content="确定删除此行程吗?" :visible.sync="showConfirm" @click="handleConfirm" />
</view> </view>
</template> </template>
<script> <script>
import PopInput from '@/components/pop-input-view';
import SoundPlayer from '@/pages/schedule/create-schedule/components/sound-player.vue'; import SoundPlayer from '@/pages/schedule/create-schedule/components/sound-player.vue';
import { get, deleteById } from '@/api/schedule/index.js';
import { myFilter, getTime } from '@/utils/common.js';
import { scheduleSettingOptions } from '@/utils/options/schedule';
export default { export default {
components: { SoundPlayer }, components: { SoundPlayer,PopInput },
data() { data() {
return { return {
scheduleSettingOptions,
myFilter,
id: '', id: '',
detail: { detail: {
title: '计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题', name: '',
type: '0', type: '',
createdTime: '2022-07-19', startTime: '',
time: '19:00', status: '',
status: '1', content: '',
desc: '描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述', attach: ''
sound: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3'
}, },
list: [ list: [
{ {
...@@ -59,34 +75,66 @@ export default { ...@@ -59,34 +75,66 @@ export default {
}, },
{ {
label: '计划时间:', label: '计划时间:',
value: 'createdTime' value: 'startTime'
}, },
{ {
label: '提醒时间:', label: '提醒时间:',
value: 'time' value: 'remindMinute'
} }
] ]
}; };
}, },
computed: {
status() {
let time = getTime(new Date());
if (getTime(this.detail.startTime) > time) {
return '1';
} else {
return '0';
}
}
},
onLoad(options) { onLoad(options) {
if (options && options.id) { if (options && options.id) {
this.id = options.id; this.id = options.id;
// this.geDetail() this.geDetail();
} }
}, },
methods: { methods: {
async geDetail() { async geDetail() {
let res = await addBind(this.form); try {
let res = await get({ id: this.id });
let { code, data, msg } = res; let { code, data, msg } = res;
if (code === 200) {
this.detail = data; this.detail = data;
} catch (e) {
//TODO handle the exception
} }
}, },
toEdit() { toEdit() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/schedule/create-schedule/create-schedule?id=${this.id}` url: `/pages/schedule/create-schedule/create-schedule?id=${this.id}`
}); });
},
handlClickDelete() {
this.showConfirm = true;
},
async handleConfirm() {
if (!this.form.id) {
this.showToast('行程不存在');
return false;
}
try {
await deleteById({
id:this.form.id
});
this.showToast('删除成功', true);
setTimeout(() => {
this.navigateTo();
}, 1500);
} catch (e) {
//TODO handle the exception
}
} }
} }
}; };
...@@ -108,6 +156,10 @@ export default { ...@@ -108,6 +156,10 @@ export default {
.closed { .closed {
color: #8d8d8d; color: #8d8d8d;
} }
&-right{
display: flex;
align-items: center;
}
&-edit { &-edit {
font-size: 28upx; font-size: 28upx;
line-height: 28upx; line-height: 28upx;
...@@ -118,6 +170,10 @@ export default { ...@@ -118,6 +170,10 @@ export default {
margin-right: 6upx; margin-right: 6upx;
} }
} }
&-delete {
margin-left: 16rpx;
color: #fc524d;
}
} }
.schedule-card { .schedule-card {
margin-top: 24upx; margin-top: 24upx;
......
...@@ -29,11 +29,6 @@ const router = createRouter({ ...@@ -29,11 +29,6 @@ const router = createRouter({
console.log(to) console.log(to)
let {path}=to let {path}=to
let index=whiteList.findIndex(item=>item===path) let index=whiteList.findIndex(item=>item===path)
if(index!==-1){
// 白名单内直接跳转
console.log("白名单内直接跳转")
next()
}else{
// 鉴权 // 鉴权
console.log("需要鉴权") console.log("需要鉴权")
if(checkToken()){ if(checkToken()){
...@@ -41,44 +36,42 @@ const router = createRouter({ ...@@ -41,44 +36,42 @@ const router = createRouter({
}else { }else {
// next() // next()
if(store.getters.platform==='4'){ if(store.getters.platform==='4'){
if(index!==-1){
// 白名单内直接跳转
console.log("白名单内直接跳转")
next()
}else{
showToast('登录已过期,请重新登录') showToast('登录已过期,请重新登录')
setTimeout(()=>{ setTimeout(()=>{
next({ next({
path:'/pages/login/login' path:'/pages/login/login'
}) })
},1500) },1500)
}
}else{ }else{
store.dispatch('Auto_login').then(()=>{ store.dispatch('Auto_login').then(()=>{
next() next()
// if(!store.getters.userInfo||!store.getters.userInfo.id){
// console.log("未获取到用户信息")
// store.dispatch('Get_UserInfo').then(()=>{
// next()
// }).catch(()=>{
// showToast('获取用户信息失败');
// setTimeout(()=>{
// next({
// path:'/pages/login/login'
// })
// },1500)
// })
// }else{
// next()
// }
}).catch(()=>{ }).catch(()=>{
if(index!==-1){
// 白名单内直接跳转
console.log("白名单内直接跳转")
next()
}else{
showToast('自动登录失败'); showToast('自动登录失败');
setTimeout(()=>{ setTimeout(()=>{
next({ next({
path:'/pages/login/login' path:'/pages/login/login'
}) })
},1500) },1500)
}
}) })
} }
} }
}
}, },
routerAfterEach: (to, from) => { routerAfterEach: (to, from) => {
console.log('--------routerAfterEach----') console.log('--------routerAfterEach----')
......
import {
getLocation
} from "@/utils/auth.js"
const state = {
location: null,
}
const mutations = {
SAVE_LOCATION: (state, data) => {
state.location = data
},
}
const actions = {
Get_location: ({
state,
commit
}) => {
return new Promise((resolve, reject) => {
let time = new Date().getTime()
if (state.timetamp && (time - state.timetamp) <= 60 * 1000) {
resolve(state.location)
} else {
getLocation().then(res => {
state.timetamp = time
commit("SAVE_LOCATION", res)
resolve(state.location)
}).catch(err => {
reject(err)
})
}
})
},
Save_location:({
state,
commit
},res) => {
commit("SAVE_LOCATION", res)
},
}
export default {
state,
mutations,
actions
}
...@@ -112,10 +112,26 @@ export function checkToken() { ...@@ -112,10 +112,26 @@ export function checkToken() {
} }
} }
export function checkVip() {
let userinfo = getUserinfo()
if (userinfo) {
if (userinfo.remainDay > 0 && userinfo.vip) {
return true;
}
}
return false;
}
export function checkAdminToken() { export function checkAdminToken() {
let time = new Date().getTime() let time = new Date().getTime()
let {check,expireTime,headName,token}=getPasswordCheck() let {
if (check&&token) { check,
expireTime,
headName,
token
} = getPasswordCheck()
if (check && token) {
if (expireTime && time < expireTime) { if (expireTime && time < expireTime) {
return true; return true;
} else { } else {
...@@ -160,11 +176,11 @@ export function myFilter(value, options) { ...@@ -160,11 +176,11 @@ export function myFilter(value, options) {
} }
// 自定义弹框消息 // 自定义弹框消息
export function showToast(message) { export function showToast(message, mask = false) {
uni.showToast({ uni.showToast({
title: message, title: message,
icon: 'none', icon: 'none',
// mask: true mask
}) })
} }
...@@ -314,3 +330,43 @@ export const getTime = function(time) { ...@@ -314,3 +330,43 @@ export const getTime = function(time) {
} }
return t; return t;
} }
// 初始化查询参数
export const initQueryParams = (params) => {
const defParams = {
size: 10,
current: 1,
sort: "createTime",
order: "descending",
model: {},
extra: {},
timeRange: null,
};
return params ? {
...defParams,
...params
} : defParams;
};
/**
* This is just a simple version of deep copy
* Has a lot of edge cases bug
* If you want to use a perfect deep copy, use lodash's _.cloneDeep
* @param {Object} source
* @returns {Object}
*/
export function deepClone(source) {
if (!source && typeof source !== 'object') {
throw new Error('error arguments', 'deepClone')
}
const targetObj = source.constructor === Array ? [] : {}
Object.keys(source).forEach(keys => {
if (source[keys] && typeof source[keys] === 'object') {
targetObj[keys] = deepClone(source[keys])
} else {
targetObj[keys] = source[keys]
}
})
return targetObj
}
...@@ -22,11 +22,11 @@ export const minPopupOptions = [{ ...@@ -22,11 +22,11 @@ export const minPopupOptions = [{
] ]
export const billingTypeOptions = [{ export const billingTypeOptions = [{
value: "1", value: "INCOME",
label: "收入" label: "收入"
}, },
{ {
value: "2", value: "EXPENSE",
label: "支出" label: "支出"
}, },
] ]
......
...@@ -45,7 +45,7 @@ export const packageOptions = [{ ...@@ -45,7 +45,7 @@ export const packageOptions = [{
id: 3, id: 3,
title: '退出登录', title: '退出登录',
icon: 'bookmark', icon: 'bookmark',
path: "/pages/mine/logout/logout" path: ""
} }
] ]
......
export const scheduleTypeOptions = [{ export const scheduleTypeOptions = [{
value: "1", value: "WORK",
label: "工作" label: "工作"
}, },
{ {
value: "2", value: "LIfE",
label: "生活" label: "生活"
}, },
] ]
export const scheduleSettingOptions = [{ export const scheduleSettingOptions = [{
value: "1", value: "30",
label: "30分钟前" label: "30分钟前"
}, },
{ {
value: "2", value: "60",
label: "1小时前" label: "1小时前"
}, },
{ {
value: "3", value: "120",
label: "2小时前" label: "2小时前"
}, },
] ]
...@@ -92,10 +92,8 @@ function request({ ...@@ -92,10 +92,8 @@ function request({
} }
}, },
fail: error => { fail: error => {
// 重置时间戳
setTimetamp()
uni.hideLoading() uni.hideLoading()
showToast("request error") showToast("REQUEST ERROR")
console.log(error) console.log(error)
reject(error) reject(error)
} }
......
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