修改bug
parent
6a9748522d
commit
2a633adb5f
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"i18n-ally.localesPaths": [
|
||||||
|
"src/components/cu-calendars/i18n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
<view class="h-40vh flex-center flex-col">
|
<view class="h-40vh flex-center flex-col">
|
||||||
<view
|
<view
|
||||||
:disabled="!detail.enable"
|
:disabled="noCheck"
|
||||||
@click="clockIn"
|
@click="clockIn"
|
||||||
class="w-220rpx h-220rpx rounded-full overflow-hidden card-shadow1 flex-center btn"
|
class="w-220rpx h-220rpx rounded-full overflow-hidden card-shadow1 flex-center btn"
|
||||||
>
|
>
|
||||||
|
|
@ -117,6 +117,10 @@ const form = reactive({
|
||||||
})
|
})
|
||||||
const rules = ref({})
|
const rules = ref({})
|
||||||
|
|
||||||
|
const noCheck = computed(() => {
|
||||||
|
return isGPS.value || !detail.enable
|
||||||
|
})
|
||||||
|
|
||||||
const timeConfirm = ({ value }) => {
|
const timeConfirm = ({ value }) => {
|
||||||
form.time = value[0].value
|
form.time = value[0].value
|
||||||
form.sign_time = value[0].name
|
form.sign_time = value[0].name
|
||||||
|
|
@ -143,10 +147,11 @@ const getLoca = async () => {
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
isGPS.value = true
|
isGPS.value = true
|
||||||
},
|
},
|
||||||
complete: async ({ latitude, longitude }) => {
|
complete: async (e) => {
|
||||||
position.value = {
|
position.value = {
|
||||||
lat: latitude,
|
lat: e.latitude,
|
||||||
lng: longitude,
|
lng: e.longitude,
|
||||||
|
...e
|
||||||
}
|
}
|
||||||
initLo()
|
initLo()
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<view>
|
<view>
|
||||||
<view class="flex-center h-44px text-white" :style="{ color: color }">
|
<view class="flex-center h-44px text-white" :style="{ color: color }">
|
||||||
<view class="flex-center flex-1" @click="openRegions">
|
<view class="flex-center flex-1" @click="openRegions">
|
||||||
<view class="max-w-190rpx line-clamp-1">{{ regionseText }}</view>
|
<view class="line-clamp-1">{{ regionseText }}</view>
|
||||||
<uv-icon
|
<uv-icon
|
||||||
:color="color"
|
:color="color"
|
||||||
class="ml-10rpx"
|
class="ml-10rpx"
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
></uv-icon>
|
></uv-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-center flex-1" @click="openStore">
|
<view class="flex-center flex-1" @click="openStore">
|
||||||
<view>{{ storeText }}</view>
|
<view class="line-clamp-1">{{ storeText }}</view>
|
||||||
<uv-icon
|
<uv-icon
|
||||||
:color="color"
|
:color="color"
|
||||||
class="ml-10rpx"
|
class="ml-10rpx"
|
||||||
|
|
@ -45,8 +45,8 @@ import debounce from '@climblee/uv-ui/libs/function/debounce'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '#fff'
|
default: '#fff',
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getData()
|
getData()
|
||||||
|
|
@ -78,7 +78,8 @@ const regionseText = computed(() => {
|
||||||
const province = result.value.find((item) => item.name == 'province_code')
|
const province = result.value.find((item) => item.name == 'province_code')
|
||||||
const city = result.value.find((item) => item.name == 'city_code')
|
const city = result.value.find((item) => item.name == 'city_code')
|
||||||
let text = province?.label
|
let text = province?.label
|
||||||
if (city?.value) text += `/${city?.label}`
|
if (city?.value)
|
||||||
|
text = truncateString(text, 3) + `/${truncateString(city?.label, 3)}`
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -92,6 +93,17 @@ const storeText = computed(() => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function truncateString(str, maxLength) {
|
||||||
|
if (str.length <= maxLength) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
if (maxLength <= 3) {
|
||||||
|
return str.substring(0, maxLength) + '...';
|
||||||
|
}
|
||||||
|
return str.substring(0, maxLength - 3) + '...';
|
||||||
|
}
|
||||||
|
|
||||||
const selectMenu = (e) => {
|
const selectMenu = (e) => {
|
||||||
e.forEach((item) => {
|
e.forEach((item) => {
|
||||||
const findIndex = result.value.findIndex((el) => el.name == item.name)
|
const findIndex = result.value.findIndex((el) => el.name == item.name)
|
||||||
|
|
@ -112,11 +124,11 @@ const selectMenu = (e) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
function arrayToObject(arr) {
|
function arrayToObject(arr) {
|
||||||
const obj = {};
|
const obj = {}
|
||||||
arr.forEach(item => {
|
arr.forEach((item) => {
|
||||||
obj[item.name] = item.value;
|
obj[item.name] = item.value
|
||||||
});
|
})
|
||||||
return obj;
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,10 @@
|
||||||
name="chat"
|
name="chat"
|
||||||
></uv-icon>
|
></uv-icon>
|
||||||
</view>
|
</view>
|
||||||
|
<Swiper>
|
||||||
|
<swiper-item>
|
||||||
<view class="mt-60rpx">昨日累计金额</view>
|
<view class="mt-60rpx">昨日累计金额</view>
|
||||||
<view class="mt-20rpx">截止{{ yesterday }}</view>
|
<view class="mt-20rpx">截止{{ yesday_ledger.date }}</view>
|
||||||
<view class="flex items-center mt-40rpx">
|
<view class="flex items-center mt-40rpx">
|
||||||
<view class="flex-1 text-center">
|
<view class="flex-1 text-center">
|
||||||
<view>销售</view>
|
<view>销售</view>
|
||||||
|
|
@ -31,6 +33,25 @@
|
||||||
<view>{{ yesday_ledger.expenditure }}</view>
|
<view>{{ yesday_ledger.expenditure }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</swiper-item>
|
||||||
|
<swiper-item>
|
||||||
|
<view class="mt-60rpx">本月累计金额</view>
|
||||||
|
<view class="mt-20rpx">截止{{ current_month_ledger.deadline }}</view>
|
||||||
|
<view class="flex items-center mt-40rpx">
|
||||||
|
<view class="flex-1 text-center">
|
||||||
|
<view>销售</view>
|
||||||
|
<view>{{ current_month_ledger.sales }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="h-80rpx flex-none flex-center">
|
||||||
|
<uv-line direction="vertical"></uv-line>
|
||||||
|
</view>
|
||||||
|
<view class="flex-1 text-center">
|
||||||
|
<view>支出</view>
|
||||||
|
<view>{{ current_month_ledger.expenditure }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</swiper-item>
|
||||||
|
</Swiper>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view class="h-80rpx leading-80rpx px-base">近30天趋势数据</view>
|
<view class="h-80rpx leading-80rpx px-base">近30天趋势数据</view>
|
||||||
|
|
@ -59,8 +80,9 @@ import { http } from '@/utils/request'
|
||||||
import { onShow } from '@dcloudio/uni-app'
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
import { timeFormat } from '@climblee/uv-ui/libs/function'
|
import { timeFormat } from '@climblee/uv-ui/libs/function'
|
||||||
import StoreDown from './components/store-down.vue'
|
import StoreDown from './components/store-down.vue'
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from '@/store/modules/user'
|
||||||
import checkPermission from '@/utils/permission'
|
import checkPermission from '@/utils/permission'
|
||||||
|
import { Swiper } from '@dcloudio/uni-h5'
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const opts = {
|
const opts = {
|
||||||
color: ['#ee2c37'],
|
color: ['#ee2c37'],
|
||||||
|
|
@ -106,13 +128,12 @@ const list = ref([
|
||||||
])
|
])
|
||||||
const tabIndex = ref(0)
|
const tabIndex = ref(0)
|
||||||
const detail = ref({
|
const detail = ref({
|
||||||
yesday_ledger: {
|
yesday_ledger: {},
|
||||||
sales: 0,
|
current_month_ledger:{}
|
||||||
expenditure: 0,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const chartData = ref({})
|
const chartData = ref({})
|
||||||
const yesday_ledger = computed(() => detail.value.yesday_ledger)
|
const yesday_ledger = computed(() => detail.value.yesday_ledger)
|
||||||
|
const current_month_ledger = computed(() => detail.value.current_month_ledger)
|
||||||
const trends_of_30days = computed(() => detail.value.trends_of_30days)
|
const trends_of_30days = computed(() => detail.value.trends_of_30days)
|
||||||
|
|
||||||
const yesterday = computed(() => {
|
const yesterday = computed(() => {
|
||||||
|
|
@ -120,7 +141,7 @@ const yesterday = computed(() => {
|
||||||
})
|
})
|
||||||
const tabObj = computed(() => list.value[tabIndex.value])
|
const tabObj = computed(() => list.value[tabIndex.value])
|
||||||
|
|
||||||
const storeChange = (e)=>{
|
const storeChange = (e) => {
|
||||||
getData(e)
|
getData(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,7 +151,6 @@ const onTabClick = (e) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateData = () => {
|
const updateData = () => {
|
||||||
|
|
||||||
const arr =
|
const arr =
|
||||||
trends_of_30days?.value?.reduce((p, c) => {
|
trends_of_30days?.value?.reduce((p, c) => {
|
||||||
p.push({
|
p.push({
|
||||||
|
|
@ -155,17 +175,16 @@ onShow(() => {
|
||||||
getData()
|
getData()
|
||||||
})
|
})
|
||||||
|
|
||||||
const getData = (e={}) => {
|
const getData = (e = {}) => {
|
||||||
|
if (!checkPermission(['admin'])) {
|
||||||
if(!checkPermission(['admin'])){
|
|
||||||
e.store_id = userStore?.userInfo?.store?.id
|
e.store_id = userStore?.userInfo?.store?.id
|
||||||
}
|
}
|
||||||
console.log(e.store_id);
|
console.log(e.store_id)
|
||||||
http
|
http
|
||||||
.get('/statistics/dashboard', {
|
.get('/statistics/dashboard', {
|
||||||
params: {
|
params: {
|
||||||
date: yesterday.value,
|
date: yesterday.value,
|
||||||
...e
|
...e,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@
|
||||||
placeholder="请选择时间"
|
placeholder="请选择时间"
|
||||||
ref="dateEndPicker"
|
ref="dateEndPicker"
|
||||||
mode="datetime"
|
mode="datetime"
|
||||||
|
:minDate="endTime.min"
|
||||||
@confirm="confirmEndDatePicker"
|
@confirm="confirmEndDatePicker"
|
||||||
>
|
>
|
||||||
</uv-datetime-picker>
|
</uv-datetime-picker>
|
||||||
|
|
@ -98,6 +99,12 @@ const form = reactive({
|
||||||
reason: "",
|
reason: "",
|
||||||
date: ""
|
date: ""
|
||||||
})
|
})
|
||||||
|
const endTime = computed(()=>{
|
||||||
|
return {
|
||||||
|
min:form.start_at? new Date(form.start_at).getTime():null,
|
||||||
|
max:new Date().getTime()
|
||||||
|
}
|
||||||
|
})
|
||||||
const openDate = () => {
|
const openDate = () => {
|
||||||
datePicker.value.open()
|
datePicker.value.open()
|
||||||
}
|
}
|
||||||
|
|
@ -111,14 +118,35 @@ const confirmDatePicker = e => {
|
||||||
form.date = timeFormat(e.value, "yyyy-mm-dd")
|
form.date = timeFormat(e.value, "yyyy-mm-dd")
|
||||||
}
|
}
|
||||||
const confirmStartDatePicker = e => {
|
const confirmStartDatePicker = e => {
|
||||||
form.start_at = timeFormat(e.value, "yyyy-mm-dd hh:MM:ss")
|
form.end_at = null
|
||||||
|
form.start_at = timeFormat(e.value, "yyyy-mm-dd hh:MM")
|
||||||
}
|
}
|
||||||
const confirmEndDatePicker = e => {
|
const confirmEndDatePicker = e => {
|
||||||
form.end_at = timeFormat(e.value, "yyyy-mm-dd hh:MM:ss")
|
form.end_at = timeFormat(e.value, "yyyy-mm-dd hh:MM")
|
||||||
}
|
}
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
start_at: [{ required: true, message: "请选择加班开始时间" }],
|
start_at: [{ required: true, message: "请选择加班开始时间" }],
|
||||||
end_at: [{ required: true, message: "请选择加班结束时间" }],
|
end_at: [
|
||||||
|
{ required: true, message: "请选择加班结束时间" },
|
||||||
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
const startTime = new Date(form.start_at).getTime()
|
||||||
|
const endTime = new Date(value).getTime()
|
||||||
|
if (endTime < startTime) {
|
||||||
|
callback(new Error("结束时间不能小于开始时间"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
const endTime = new Date(value).getTime()
|
||||||
|
const startTime = new Date(form.start_at).getTime()
|
||||||
|
const diff = endTime-startTime
|
||||||
|
if(diff< 1000*60*60){
|
||||||
|
callback(new Error("加班时间不能小于1小时"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
reason: [{ required: true, message: "请输入加班事由" }],
|
reason: [{ required: true, message: "请输入加班事由" }],
|
||||||
date: [{ required: true, message: "请选择日期" }]
|
date: [{ required: true, message: "请选择日期" }]
|
||||||
})
|
})
|
||||||
|
|
@ -148,6 +176,8 @@ onLoad(options => {
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
formRef.value.validate().then(res => {
|
formRef.value.validate().then(res => {
|
||||||
|
|
||||||
|
//判断开始时间和结束时间是否小于1小时
|
||||||
modalRef.value.open()
|
modalRef.value.open()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -405,7 +405,7 @@ const salesChange = async () => {
|
||||||
return add(a, b?.sales ?? 0)
|
return add(a, b?.sales ?? 0)
|
||||||
}, 0)
|
}, 0)
|
||||||
|
|
||||||
form.sales = sales || null
|
form.sales = sales || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const expenditureChange = async () => {
|
const expenditureChange = async () => {
|
||||||
|
|
@ -414,7 +414,7 @@ const expenditureChange = async () => {
|
||||||
const expenditure = val.reduce((a, b) => {
|
const expenditure = val.reduce((a, b) => {
|
||||||
return add(a, b?.expenditure ?? 0)
|
return add(a, b?.expenditure ?? 0)
|
||||||
}, 0)
|
}, 0)
|
||||||
form.expenditure = expenditure || null
|
form.expenditure = expenditure || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue