修改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
|
||||
:disabled="!detail.enable"
|
||||
:disabled="noCheck"
|
||||
@click="clockIn"
|
||||
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 noCheck = computed(() => {
|
||||
return isGPS.value || !detail.enable
|
||||
})
|
||||
|
||||
const timeConfirm = ({ value }) => {
|
||||
form.time = value[0].value
|
||||
form.sign_time = value[0].name
|
||||
|
|
@ -143,10 +147,11 @@ const getLoca = async () => {
|
|||
success: (res) => {
|
||||
isGPS.value = true
|
||||
},
|
||||
complete: async ({ latitude, longitude }) => {
|
||||
complete: async (e) => {
|
||||
position.value = {
|
||||
lat: latitude,
|
||||
lng: longitude,
|
||||
lat: e.latitude,
|
||||
lng: e.longitude,
|
||||
...e
|
||||
}
|
||||
initLo()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<view>
|
||||
<view class="flex-center h-44px text-white" :style="{ color: color }">
|
||||
<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
|
||||
:color="color"
|
||||
class="ml-10rpx"
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
></uv-icon>
|
||||
</view>
|
||||
<view class="flex-center flex-1" @click="openStore">
|
||||
<view>{{ storeText }}</view>
|
||||
<view class="line-clamp-1">{{ storeText }}</view>
|
||||
<uv-icon
|
||||
:color="color"
|
||||
class="ml-10rpx"
|
||||
|
|
@ -45,8 +45,8 @@ import debounce from '@climblee/uv-ui/libs/function/debounce'
|
|||
const props = defineProps({
|
||||
color: {
|
||||
type: String,
|
||||
default: '#fff'
|
||||
}
|
||||
default: '#fff',
|
||||
},
|
||||
})
|
||||
onMounted(() => {
|
||||
getData()
|
||||
|
|
@ -78,7 +78,8 @@ const regionseText = computed(() => {
|
|||
const province = result.value.find((item) => item.name == 'province_code')
|
||||
const city = result.value.find((item) => item.name == 'city_code')
|
||||
let text = province?.label
|
||||
if (city?.value) text += `/${city?.label}`
|
||||
if (city?.value)
|
||||
text = truncateString(text, 3) + `/${truncateString(city?.label, 3)}`
|
||||
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) => {
|
||||
e.forEach((item) => {
|
||||
const findIndex = result.value.findIndex((el) => el.name == item.name)
|
||||
|
|
@ -112,11 +124,11 @@ const selectMenu = (e) => {
|
|||
}
|
||||
|
||||
function arrayToObject(arr) {
|
||||
const obj = {};
|
||||
arr.forEach(item => {
|
||||
obj[item.name] = item.value;
|
||||
});
|
||||
return obj;
|
||||
const obj = {}
|
||||
arr.forEach((item) => {
|
||||
obj[item.name] = item.value
|
||||
})
|
||||
return obj
|
||||
}
|
||||
|
||||
const getData = async () => {
|
||||
|
|
|
|||
|
|
@ -16,21 +16,42 @@
|
|||
name="chat"
|
||||
></uv-icon>
|
||||
</view>
|
||||
<view class="mt-60rpx">昨日累计金额</view>
|
||||
<view class="mt-20rpx">截止{{ yesterday }}</view>
|
||||
<view class="flex items-center mt-40rpx">
|
||||
<view class="flex-1 text-center">
|
||||
<view>销售</view>
|
||||
<view>{{ yesday_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>{{ yesday_ledger.expenditure }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<Swiper>
|
||||
<swiper-item>
|
||||
<view class="mt-60rpx">昨日累计金额</view>
|
||||
<view class="mt-20rpx">截止{{ yesday_ledger.date }}</view>
|
||||
<view class="flex items-center mt-40rpx">
|
||||
<view class="flex-1 text-center">
|
||||
<view>销售</view>
|
||||
<view>{{ yesday_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>{{ yesday_ledger.expenditure }}</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 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 { timeFormat } from '@climblee/uv-ui/libs/function'
|
||||
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 { Swiper } from '@dcloudio/uni-h5'
|
||||
const userStore = useUserStore()
|
||||
const opts = {
|
||||
color: ['#ee2c37'],
|
||||
|
|
@ -106,13 +128,12 @@ const list = ref([
|
|||
])
|
||||
const tabIndex = ref(0)
|
||||
const detail = ref({
|
||||
yesday_ledger: {
|
||||
sales: 0,
|
||||
expenditure: 0,
|
||||
},
|
||||
yesday_ledger: {},
|
||||
current_month_ledger:{}
|
||||
})
|
||||
const chartData = ref({})
|
||||
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 yesterday = computed(() => {
|
||||
|
|
@ -120,7 +141,7 @@ const yesterday = computed(() => {
|
|||
})
|
||||
const tabObj = computed(() => list.value[tabIndex.value])
|
||||
|
||||
const storeChange = (e)=>{
|
||||
const storeChange = (e) => {
|
||||
getData(e)
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +151,6 @@ const onTabClick = (e) => {
|
|||
}
|
||||
|
||||
const updateData = () => {
|
||||
|
||||
const arr =
|
||||
trends_of_30days?.value?.reduce((p, c) => {
|
||||
p.push({
|
||||
|
|
@ -155,17 +175,16 @@ onShow(() => {
|
|||
getData()
|
||||
})
|
||||
|
||||
const getData = (e={}) => {
|
||||
|
||||
if(!checkPermission(['admin'])){
|
||||
const getData = (e = {}) => {
|
||||
if (!checkPermission(['admin'])) {
|
||||
e.store_id = userStore?.userInfo?.store?.id
|
||||
}
|
||||
console.log(e.store_id);
|
||||
console.log(e.store_id)
|
||||
http
|
||||
.get('/statistics/dashboard', {
|
||||
params: {
|
||||
date: yesterday.value,
|
||||
...e
|
||||
...e,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
placeholder="请选择时间"
|
||||
ref="dateEndPicker"
|
||||
mode="datetime"
|
||||
:minDate="endTime.min"
|
||||
@confirm="confirmEndDatePicker"
|
||||
>
|
||||
</uv-datetime-picker>
|
||||
|
|
@ -98,6 +99,12 @@ const form = reactive({
|
|||
reason: "",
|
||||
date: ""
|
||||
})
|
||||
const endTime = computed(()=>{
|
||||
return {
|
||||
min:form.start_at? new Date(form.start_at).getTime():null,
|
||||
max:new Date().getTime()
|
||||
}
|
||||
})
|
||||
const openDate = () => {
|
||||
datePicker.value.open()
|
||||
}
|
||||
|
|
@ -111,14 +118,35 @@ const confirmDatePicker = e => {
|
|||
form.date = timeFormat(e.value, "yyyy-mm-dd")
|
||||
}
|
||||
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 => {
|
||||
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({
|
||||
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: "请输入加班事由" }],
|
||||
date: [{ required: true, message: "请选择日期" }]
|
||||
})
|
||||
|
|
@ -148,6 +176,8 @@ onLoad(options => {
|
|||
|
||||
const submit = () => {
|
||||
formRef.value.validate().then(res => {
|
||||
|
||||
//判断开始时间和结束时间是否小于1小时
|
||||
modalRef.value.open()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ const salesChange = async () => {
|
|||
return add(a, b?.sales ?? 0)
|
||||
}, 0)
|
||||
|
||||
form.sales = sales || null
|
||||
form.sales = sales || 0
|
||||
}
|
||||
|
||||
const expenditureChange = async () => {
|
||||
|
|
@ -414,7 +414,7 @@ const expenditureChange = async () => {
|
|||
const expenditure = val.reduce((a, b) => {
|
||||
return add(a, b?.expenditure ?? 0)
|
||||
}, 0)
|
||||
form.expenditure = expenditure || null
|
||||
form.expenditure = expenditure || 0
|
||||
}
|
||||
|
||||
watch(
|
||||
|
|
|
|||
Loading…
Reference in New Issue