ihzero 2024-04-24 05:15:26 +08:00
parent 98dca1863c
commit a7455690bf
15 changed files with 628 additions and 157 deletions

View File

@ -296,6 +296,39 @@
}
}
]
},{
"root": "pages/train-books",
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "培训课件"
}
},
{
"path": "detail",
"style": {
"navigationBarTitleText": "培训课件"
}
}
]
},
{
"root": "pages/examination",
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "培训考试"
}
},
{
"path": "detail",
"style": {
"navigationBarTitleText": "培训考试"
}
}
]
}
],
"globalStyle": {

View File

@ -2,7 +2,11 @@
<view>
<CuNavbar title="请假申请">
<template #right>
<view @click="goPath('/pages/ask-leave/create')" class="text-24rpx text-white">申请</view>
<view
@click="goPath('/pages/ask-leave/create')"
class="text-24rpx text-white"
>申请</view
>
</template>
</CuNavbar>
<uv-sticky bgColor="#fff">
@ -14,7 +18,28 @@
@change="tabChange"
></uv-tabs>
</uv-sticky>
<MescrollItem ref="mescrollItem0" :top="88" :i="0" :index="tabIndex" :apiUrl="tabList[0].apiUrl">
<MescrollItem
ref="mescrollItem0"
:top="88"
:i="0"
:index="tabIndex"
:apiUrl="tabList[0].apiUrl"
>
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
<Item :item="item"></Item>
</view>
</view>
</template>
</MescrollItem>
<MescrollItem
ref="mescrollItem1"
:top="88"
:i="1"
:index="tabIndex"
:apiUrl="tabList[1].apiUrl"
>
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
@ -26,29 +51,37 @@
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { ref } from "vue"
import { onPageScroll, onReachBottom, onShow } from "@dcloudio/uni-app"
import useMescrollMore from "@/uni_modules/mescroll-uni/hooks/useMescrollMore.js"
import MescrollItem from "@/components/mescroll-api/more.vue"
import Item from "./components/item.vue"
import CuNavbar from '@/components/cu-navbar/index'
import { ref } from 'vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import Item from './components/item.vue'
const tabList = ref([
{
name: "我的请假",
apiUrl: "/hr/holidays"
name: '我的请假',
apiUrl: '/hr/holidays',
},
{
name: "请假审核"
}
name: '请假审核',
apiUrl: '/workflow',
params: {
subject_type: 'holiday_applies',
},
},
])
const mescrollItem0 = ref(null)
const mescrollItem1 = ref(null)
const mescrollItems = [mescrollItem0, mescrollItem1]
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(mescrollItems, onPageScroll, onReachBottom)
const goPath = url => {
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
mescrollItems,
onPageScroll,
onReachBottom
)
const goPath = (url) => {
uni.navigateTo({
url
url,
})
}
const tabChange = ({ index }) => {

View File

@ -2,7 +2,11 @@
<view>
<CuNavbar title="出差申请">
<template #right>
<view @click="goPath('/pages/business/create')" class="text-24rpx text-white">申请</view>
<view
@click="goPath('/pages/business/create')"
class="text-24rpx text-white"
>申请</view
>
</template>
</CuNavbar>
<uv-sticky bgColor="#fff">
@ -14,7 +18,30 @@
@change="tabChange"
></uv-tabs>
</uv-sticky>
<MescrollItem ref="mescrollItem0" :top="88" :i="0" :index="tabIndex" :apiUrl="tabList[0].apiUrl">
<MescrollItem
ref="mescrollItem0"
:top="88"
:i="0"
:index="tabIndex"
:apiUrl="tabList[0].apiUrl"
>
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
<Item :item="item"></Item>
</view>
</view>
</template>
</MescrollItem>
<MescrollItem
ref="mescrollItem1"
:top="88"
:i="1"
:index="tabIndex"
:apiUrl="tabList[1].apiUrl"
:params="tabList[1].params"
>
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
@ -26,29 +53,37 @@
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { ref } from "vue"
import { onPageScroll, onReachBottom, onShow } from "@dcloudio/uni-app"
import useMescrollMore from "@/uni_modules/mescroll-uni/hooks/useMescrollMore.js"
import MescrollItem from "@/components/mescroll-api/more.vue"
import Item from "./components/item.vue"
import CuNavbar from '@/components/cu-navbar/index'
import { ref } from 'vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import Item from './components/item.vue'
const tabList = ref([
{
name: "我的请假",
apiUrl: "/hr/offical-bussiness"
name: '我的请假',
apiUrl: '/hr/offical-bussiness',
},
{
name: "请假审核"
}
name: '请假审核',
apiUrl: '/workflow',
params: {
subject_type: 'holiday_applies',
},
},
])
const mescrollItem0 = ref(null)
const mescrollItem1 = ref(null)
const mescrollItems = [mescrollItem0, mescrollItem1]
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(mescrollItems, onPageScroll, onReachBottom)
const goPath = url => {
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
mescrollItems,
onPageScroll,
onReachBottom
)
const goPath = (url) => {
uni.navigateTo({
url
url,
})
}
const tabChange = ({ index }) => {

View File

@ -1,32 +1,43 @@
<template>
<view class="card-shadow bg-white rounded-19rpx p-base space-y-10rpx" @click.stop="onClick">
<view
class="card-shadow bg-white rounded-19rpx p-base space-y-10rpx"
@click.stop="onClick"
>
<view class="flex items-center justify-between">
<view class="text-30rpx">{{ item.name }}</view>
</view>
<uv-scroll-list>
<view v-for="(item, index) in item.images" :key="index">
<image :src="item" mode="heightFix" class="mr-20rpx" style="height: 200rpx"></image>
<uv-scroll-list v-if="item.images" :indicator="false">
<view class="space-x-15rpx flex">
<view v-for="(item, index) in item?.images ?? []" :key="index">
<image
:src="item + ''"
mode="heightFix"
style="height: 160rpx"
></image>
</view>
</view>
</uv-scroll-list>
<view
:style="{
color: statusFun(item.workflow_check.status, 'workflow_check', 'color')
color: statusFun(item.workflow_check.check_status, 'workflow_check', 'color'),
}"
class="text-24rpx"
>{{ statusFun(item.workflow_check.status, "workflow_check", "name") }}</view
>{{
statusFun(item.workflow_check.check_status, 'workflow_check', 'name')
}}</view
>
</view>
</template>
<script setup>
import statusFun from "@/utils/status"
import { timeFormat } from "@climblee/uv-ui/libs/function/index"
import statusFun from '@/utils/status'
import { timeFormat } from '@climblee/uv-ui/libs/function/index'
const props = defineProps({
item: Object
item: Object,
})
const onClick = () => {
uni.navigateTo({
url: `/pages/contract/detail?id=${props.item.id}`
url: `/pages/contract/detail?id=${props.item.id}`,
})
}
</script>

View File

@ -1,31 +1,34 @@
<template>
<view class="px-base" v-if="detail">
<CuNavbar title="合同详情">
<template v-if="!isEdit" #right>
<template #right>
<uv-icon color="white" @click="open" name="more-dot-fill"></uv-icon>
</template>
</CuNavbar>
<view class="mt-30rpx card-shadow bg-white rounded-19rpx px-base text-[#333333] text-27rpx">
<view
class="mt-30rpx card-shadow bg-white rounded-19rpx px-base text-[#333333] text-27rpx"
>
<view class="py-20rpx flex items-center justify-between">
<view>上传人</view>
<view class="text-hex-999999">{{ detail.employee.name }}</view>
</view>
<uv-line></uv-line>
<uv-line color="#f5f5f5"></uv-line>
<!-- <view class="py-20rpx flex items-center justify-between">
<view>所属门店</view>
<view class="text-hex-999999">{{ detail.store.title }}</view>
</view> -->
<uv-line></uv-line>
<view class="py-20rpx flex items-center justify-between">
<view>电话号码</view>
<view class="text-hex-999999">{{ detail.employee.phone }}</view>
</view>
<uv-line></uv-line>
<uv-line color="#f5f5f5"></uv-line>
<view class="py-20rpx flex items-center justify-between">
<view>上传时间</view>
<view class="text-hex-999999">{{ timeFormat(detail.created_at, "yyyy-mm-dd hh:MM") }}</view>
<view class="text-hex-999999">{{
timeFormat(detail.created_at, 'yyyy-mm-dd hh:MM')
}}</view>
</view>
<uv-line></uv-line>
<uv-line color="#f5f5f5"></uv-line>
<view class="py-20rpx flex items-center justify-between">
<view>合同名称</view>
<view class="text-hex-999999">{{ detail.name }}</view>
@ -33,47 +36,67 @@
<view class="py-20rpx flex items-center justify-between">
<view>合同内容</view>
</view>
<uv-scroll-list>
<view v-for="(item, index) in detail.images" :key="index">
<image :src="item" mode="heightFix" class="mr-20rpx" style="height: 200rpx"></image>
<uv-scroll-list :indicator="false">
<view class="space-x-15rpx flex">
<view v-for="(item, index) in detail.images" :key="index">
<image
:src="item"
mode="heightFix"
style="height: 160rpx"
></image>
</view>
</view>
</uv-scroll-list>
</view>
<view class="h-100rpx">
<view class="fixed bottom-0 left-0 right-0 h-120rpx bg-white flex items-center px-base space-x-30rpx">
<view
class="fixed bottom-0 left-0 right-0 h-120rpx bg-white flex items-center px-base space-x-30rpx"
>
<view class="flex-1">
<uv-button color="#999999" shape="circle" plain block> 拒绝 </uv-button>
<uv-button color="#999999" shape="circle" plain block>
拒绝
</uv-button>
</view>
<view class="flex-1">
<uv-button type="primary" shape="circle" block> 通过 </uv-button>
</view>
</view>
</view>
<uv-picker ref="pickerRef" :columns="columns" @confirm="confirmPicker"></uv-picker>
<uv-modal ref="modalRef" title="提示" content="确定删除吗?" @confirm="onSubmit" :showCancelButton="true"></uv-modal>
<uv-picker
ref="pickerRef"
:columns="columns"
@confirm="confirmPicker"
></uv-picker>
<uv-modal
ref="modalRef"
title="提示"
content="确定删除吗?"
@confirm="onSubmit"
:showCancelButton="true"
></uv-modal>
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { http } from "@/utils/request"
import { onLoad } from "@dcloudio/uni-app"
import { ref } from "vue"
import { timeFormat } from "@climblee/uv-ui/libs/function/index"
import CuNavbar from '@/components/cu-navbar/index'
import { http } from '@/utils/request'
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { timeFormat } from '@climblee/uv-ui/libs/function/index'
const modalRef = ref(null)
const columns = [["修改", "删除"]]
const columns = [['修改', '删除']]
const detail = ref()
const pickerRef = ref(null)
const id = ref(0)
const open = () => {
pickerRef.value.open()
}
const confirmPicker = e => {
const confirmPicker = (e) => {
console.log(e)
if (e.value[0] === "删除") {
if (e.value[0] === '删除') {
modalRef.value.open()
} else {
uni.navigateTo({
url: `/pages/contract/create?id=${id.value}`
url: `/pages/contract/create?id=${id.value}`,
})
}
}
@ -81,14 +104,14 @@ const onSubmit = async () => {
try {
await http.request({
url: `/agreements/${id.value}`,
method: "DELETE",
method: 'DELETE',
header: {
Accept: "application/json"
}
Accept: 'application/json',
},
})
uni.showToast({
title: "删除成功",
icon: "none"
title: '删除成功',
icon: 'none',
})
uni.navigateBack()
} catch (error) {
@ -97,17 +120,17 @@ const onSubmit = async () => {
loading.value = false
}
}
onLoad(options => {
onLoad((options) => {
id.value = options.id
http
.request({
url: `/agreements/${options.id}`,
method: "GET",
method: 'GET',
header: {
Accept: "application/json"
}
Accept: 'application/json',
},
})
.then(res => {
.then((res) => {
detail.value = res
})
})

View File

@ -2,7 +2,11 @@
<view>
<CuNavbar title="我的合同">
<template #right>
<view @click="goPath('/pages/contract/create')" class="text-24rpx text-white">上传</view>
<view
@click="goPath('/pages/contract/create')"
class="text-24rpx text-white"
>上传</view
>
</template>
</CuNavbar>
<uv-sticky bgColor="#fff">
@ -17,7 +21,30 @@
></uv-tabs>
</uv-sticky>
<MescrollItem ref="mescrollItem0" :top="88" :i="0" :index="tabIndex" :apiUrl="tabList[0].apiUrl">
<MescrollItem
ref="mescrollItem0"
:top="88"
:i="0"
:index="tabIndex"
:apiUrl="tabList[0].apiUrl"
>
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
<Item :item="item"></Item>
</view>
</view>
</template>
</MescrollItem>
<MescrollItem
ref="mescrollItem1"
:top="88"
:i="1"
:index="tabIndex"
:apiUrl="tabList[1].apiUrl"
:params="tabList[1].params"
>
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
@ -29,34 +56,38 @@
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { computed, reactive, ref } from "vue"
import Item from "./components/item.vue"
import { onPageScroll, onReachBottom, onShow } from "@dcloudio/uni-app"
import useMescrollMore from "@/uni_modules/mescroll-uni/hooks/useMescrollMore.js"
import MescrollItem from "@/components/mescroll-api/more.vue"
import CuNavbar from '@/components/cu-navbar/index'
import { computed, reactive, ref } from 'vue'
import Item from './components/item.vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
const mescrollItem0 = ref(null)
const mescrollItem1 = ref(null)
const mescrollItems = [mescrollItem0, mescrollItem1]
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(mescrollItems, onPageScroll, onReachBottom)
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
mescrollItems,
onPageScroll,
onReachBottom
)
const tabList = ref([
{
name: "我的合同",
apiUrl: "/agreements"
name: '我的合同',
apiUrl: '/agreements',
},
{
name: "合同审核",
apiUrl: "",
name: '合同审核',
apiUrl: '/workflow',
params: {
// aaa:111
}
}
subject_type: 'agreements',
},
},
])
const goPath = url => {
const goPath = (url) => {
uni.navigateTo({
url
url,
})
}
const tabChange = ({ index }) => {

View File

@ -28,20 +28,31 @@
</view>
</uv-sticky>
<view class="">
<view v-for="ob in 10" :key="ob">
<uv-sticky bgColor="#f5f5f5" zIndex="10" offsetTop="44" >
<view v-for="(ob, i) in showList" :key="i">
<uv-sticky bgColor="#f5f5f5" zIndex="10" offsetTop="44">
<view class="h-80rpx flex items-center px-base">
<TitleComp title="2024"></TitleComp>
<TitleComp :title="`${timeFormat(i, 'yyyy')}`"></TitleComp>
</view>
</uv-sticky>
<view class="card">
<view v-for="(item, i) in 3" :key="i">
<view v-for="(item, i) in ob" :key="i">
<view class="flex items-center h-84rpx">
<view class="w-110rpx text-primary">4</view>
<view class="flex-1">0/150000</view>
<view>未开始</view>
<view class="w-110rpx text-primary"
>{{ timeFormat(i, 'mm') }}</view
>
<view class="flex-1"
>{{ item.actual_performance }}/{{
item.expected_performance
}}</view
>
<view
:style="{
color: statusFun(item.status, 'shore_task_status', 'color'),
}"
>{{ statusFun(item.status, 'shore_task_status', 'name') }}</view
>
</view>
<uv-line></uv-line>
<uv-line v-if="i !== ob.length - 1" color="#f5f5f5"></uv-line>
</view>
</view>
</view>
@ -56,7 +67,7 @@ import { http } from '@/utils/request'
import { onLoad } from '@dcloudio/uni-app'
import { timeFormat } from '@climblee/uv-ui/libs/function/index'
import { ref, reactive, computed } from 'vue'
import statusFun from '@/utils/status'
const list = ref([])
const tabList = [
{ name: '业绩目标', value: 'future' },
@ -70,6 +81,7 @@ const countData = reactive({
expected_performance: 0,
})
const currentTabObj = computed(() => tabList[currentTab.value])
const showList = computed(() => encapsulateDataByMonth(list.value))
onLoad(() => {
getCount()
@ -104,4 +116,13 @@ const getList = async () => {
})
list.value = resData
}
function encapsulateDataByMonth(data) {
return data.reduce((result, item) => {
const { month, ...rest } = item
result[month] = result[month] || []
result[month].push(rest)
return result
}, {})
}
</script>

View File

@ -2,7 +2,11 @@
<view>
<CuNavbar title="补卡申请">
<template #right>
<view @click="goPath('/pages/make-card/create')" class="text-24rpx text-white">申请</view>
<view
@click="goPath('/pages/make-card/create')"
class="text-24rpx text-white"
>申请</view
>
</template>
</CuNavbar>
<uv-sticky bgColor="#fff">
@ -14,7 +18,29 @@
@change="tabChange"
></uv-tabs>
</uv-sticky>
<MescrollItem ref="mescrollItem0" :top="88" :i="0" :index="tabIndex" :apiUrl="tabList[0].apiUrl">
<MescrollItem
ref="mescrollItem0"
:top="88"
:i="0"
:index="tabIndex"
:apiUrl="tabList[0].apiUrl"
>
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
<Item :item="item"></Item>
</view>
</view>
</template>
</MescrollItem>
<MescrollItem
ref="mescrollItem1"
:top="88"
:i="1"
:index="tabIndex"
:apiUrl="tabList[1].apiUrl"
:params="tabList[1].params"
>
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
@ -26,29 +52,37 @@
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { ref } from "vue"
import { onPageScroll, onReachBottom, onShow } from "@dcloudio/uni-app"
import useMescrollMore from "@/uni_modules/mescroll-uni/hooks/useMescrollMore.js"
import MescrollItem from "@/components/mescroll-api/more.vue"
import Item from "./components/item.vue"
import CuNavbar from '@/components/cu-navbar/index'
import { ref } from 'vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import Item from './components/item.vue'
const tabList = ref([
{
name: "我的补卡",
apiUrl: "/hr/sign-repairs"
name: '我的补卡',
apiUrl: '/hr/sign-repairs',
},
{
name: "补卡审核"
}
name: '补卡审核',
apiUrl: '/workflow',
params: {
subject_type: 'employee_sign_repairs',
},
},
])
const mescrollItem0 = ref(null)
const mescrollItem1 = ref(null)
const mescrollItems = [mescrollItem0, mescrollItem1]
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(mescrollItems, onPageScroll, onReachBottom)
const goPath = url => {
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
mescrollItems,
onPageScroll,
onReachBottom
)
const goPath = (url) => {
uni.navigateTo({
url
url,
})
}
const tabChange = ({ index }) => {

View File

@ -2,7 +2,11 @@
<view>
<CuNavbar title="加班申请">
<template #right>
<view @click="goPath('/pages/overtime/create')" class="text-24rpx text-white">申请</view>
<view
@click="goPath('/pages/overtime/create')"
class="text-24rpx text-white"
>申请</view
>
</template>
</CuNavbar>
<uv-sticky bgColor="#fff">
@ -14,7 +18,30 @@
@change="tabChange"
></uv-tabs>
</uv-sticky>
<MescrollItem ref="mescrollItem0" :top="88" :i="0" :index="tabIndex" :apiUrl="tabList[0].apiUrl">
<MescrollItem
ref="mescrollItem0"
:top="88"
:i="0"
:index="tabIndex"
:apiUrl="tabList[0].apiUrl"
>
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
<Item :item="item"></Item>
</view>
</view>
</template>
</MescrollItem>
<MescrollItem
ref="mescrollItem1"
:top="88"
:i="1"
:index="tabIndex"
:apiUrl="tabList[1].apiUrl"
:params="tabList[1].params"
>
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
@ -26,29 +53,37 @@
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { ref } from "vue"
import { onPageScroll, onReachBottom, onShow } from "@dcloudio/uni-app"
import useMescrollMore from "@/uni_modules/mescroll-uni/hooks/useMescrollMore.js"
import MescrollItem from "@/components/mescroll-api/more.vue"
import Item from "./components/item.vue"
import CuNavbar from '@/components/cu-navbar/index'
import { ref } from 'vue'
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
import MescrollItem from '@/components/mescroll-api/more.vue'
import Item from './components/item.vue'
const tabList = ref([
{
name: "我的加班",
apiUrl: "/hr/overtimes"
name: '我的加班',
apiUrl: '/hr/overtimes',
},
{
name: "加班审核"
}
name: '加班审核',
apiUrl: '/workflow',
params: {
subject_type: 'overtime_applies',
},
},
])
const mescrollItem0 = ref(null)
const mescrollItem1 = ref(null)
const mescrollItems = [mescrollItem0, mescrollItem1]
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(mescrollItems, onPageScroll, onReachBottom)
const goPath = url => {
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
mescrollItems,
onPageScroll,
onReachBottom
)
const goPath = (url) => {
uni.navigateTo({
url
url,
})
}
const tabChange = ({ index }) => {

View File

@ -13,7 +13,7 @@
<view>
<Cell title="当前版本" :isLink="false">
<view class="flex justify-end text-hex-999999 text-24rpx px-base">
v1.0.0
v{{ varsion }}
</view>
</Cell>
</view>
@ -26,7 +26,10 @@
<script setup>
import CuNavbar from '@/components/cu-navbar/index'
import Cell from '@/components/cell/index'
import { sys } from '@climblee/uv-ui/libs/function';
import { computed } from 'vue';
const sysInfo = sys()
const varsion = computed(() => sysInfo.appVersion)
const goPath = (url) => {
uni.navigateTo({
url

View File

@ -0,0 +1,61 @@
<template>
<uv-scroll-list
:indicator="true"
indicatorColor="#fff0f0"
indicatorActiveColor="#f56c6c"
>
<view>
<template v-for="(item, i) in list" :key="i">
<view v-if="i == 0" class="flex items-center w-full text-24rpx b-solid b-b-1px">
<view class="w-140rpx text-center flex-none"> 日期 </view>
<view class="w-300rpx text-center leading-60rpx flex-none b-r-solid b-r-1px b-l-solid b-l-1px">
<view class="h-60rpx b-b-solid b-1px">总账</view>
<view class="h-60rpx grid grid-cols-3">
<view>销售</view>
<view>支出</view>
<view>新增客户</view>
</view>
</view>
<view
class="text-center leading-60rpx w-140rpx flex-none"
v-for="(ty, j) in item.lottery_types"
:key="j"
>
<view class="b-b-solid b-1px">{{ ty.name }}</view>
<view class="grid grid-cols-2">
<view>{{ ty.sales }}</view>
<view>{{ ty.expenditure }}</view>
</view>
</view>
</view>
<view
class="flex justify-between text-center text-24rpx items-center card-shadow bg-white rounded-19rpx h-80rpx"
>
<view class="flex-1 w-140rpx flex-none">{{
timeFormat(item.date, 'mm-dd')
}}</view>
<!-- 总账 -->
<view class="flex-1">{{ item.ledger.sales }}</view>
<view class="flex-1">{{ item.ledger.expenditure }}</view>
<view class="flex-1">{{ item.ledger.new_customers }}</view>
<!-- 种类 -->
<template v-for="(ty, j) in item.lottery_types" :key="j">
<view class="flex-1">{{ ty.sales }}</view>
<view class="flex-1">{{ ty.expenditure }}</view>
</template>
</view>
</template>
</view>
</uv-scroll-list>
</template>
<script setup>
import { timeFormat } from '@climblee/uv-ui/libs/function'
const props = defineProps({
list: {
type: Array,
default: () => [],
},
})
</script>

View File

@ -0,0 +1,32 @@
<template>
<view>
<view
class="flex justify-between text-center text-28rpx items-center h-80rpx"
>
<view class="flex-1">排名</view>
<view class="flex-1">门店</view>
<view class="flex-1">累计客户</view>
<view class="flex-1">销售额</view>
</view>
<view
class="flex justify-between text-center text-24rpx items-center bg-white rounded-19rpx h-80rpx"
v-for="(item, i) in list"
:key="i"
>
<view class="flex-1">{{ item.ranking }}</view>
<view class="flex-1">{{ item.store.title }}</view>
<view class="flex-1">{{ item.expenditure }}</view>
<view class="flex-1">{{ item.sales }}</view>
</view>
</view>
</template>
<script setup>
import { timeFormat } from '@climblee/uv-ui/libs/function'
const props = defineProps({
list: {
type: Array,
default: () => [],
},
})
</script>

View File

@ -37,57 +37,66 @@
:lineColor="'#ee2c37'"
:list="tabsList"
:scrollable="false"
:current="tabIndex"
@change="tabChange"
></uv-tabs>
<view class="text-center text-28rpx"> 2024-03-21 2024-03-21 </view>
<view class="text-center text-28rpx" v-if="tabIndex != 0"
>{{ currentTabs.start }} {{ currentTabs.end }}
</view>
<view class="text-center text-28rpx" v-else>{{ currentTabs.start }}</view>
<view class="flex my-20rpx items-center">
<view class="text-center flex-1">
<view>销售金额</view>
<view class="font-600">991122</view>
<view class="font-600">{{ ledger.sales }}</view>
</view>
<view class="h-60rpx">
<uv-line direction="col"></uv-line>
</view>
<view class="text-center flex-1">
<view>销售金额</view>
<view class="font-600">991122</view>
<view>兑奖金额</view>
<view class="font-600">{{ ledger.sales }}</view>
</view>
<view class="h-60rpx">
<uv-line direction="col"></uv-line>
</view>
<view class="text-center flex-1">
<view>销售涨幅</view>
<view class="text-primary font-600">+20%</view>
<view class="text-primary font-600"
>{{ ledger.sales_growth_rate }}%</view
>
</view>
</view>
<uv-tabs
@change="tabChange1"
:lineColor="'#ee2c37'"
:list="[{ name: '销售统计' }, { name: '门店统计' }]"
:scrollable="false"
:current="tabIndex1"
></uv-tabs>
<template v-if="tabIndex1 == 0">
<List0 :list="list"></List0>
</template>
<template v-if="tabIndex1 == 1">
<List1 :list="list"></List1>
</template>
</view>
</view>
</template>
<script setup>
import CuNavbar from '@/components/cu-navbar/index'
import { computed, reactive, ref } from 'vue'
import { timeFormat } from '@climblee/uv-ui/libs/function/index'
import { onShow } from '@dcloudio/uni-app'
import { http } from '@/utils/request'
import List0 from './components/list0.vue'
import List1 from './components/list1.vue'
const tabIndex1 = ref(0)
const tabIndex = ref(0)
const tabsList = ref(generateTimeArray())
const list = ref([])
const currentTabs = computed(() => tabsList.value[tabIndex.value])
const tabsList = ref([
{
name: '昨日',
},
{
name: '本周',
},
{
name: '上周',
},
{
name: '本月',
},
{
name: '上月',
},
])
const dropDownData = reactive({
area: {
label: '全部区域',
@ -134,9 +143,31 @@ const dropDownData = reactive({
})
const result = ref([])
const ledger = ref({
expenditure: '0',
sales: '0',
sales_growth_rate: '0',
})
const activeName = ref('area')
onShow(() => {
getCount()
getList()
})
const getCount = async () => {
const resData = await http.get('/statistics/ledger', {
params: {
start_at: currentTabs.value.start,
end_at: currentTabs.value.end,
before_start_at: currentTabs.value.start,
before_end_at: currentTabs.value.end,
},
})
ledger.value = resData
}
const selectMenu = (e) => {
const { name, active, type } = e
activeName.value = name
@ -150,4 +181,75 @@ const selectMenu = (e) => {
dropDownData[activeName.value].activeIndex = 0
}
}
function generateTimeRange(name, start, end) {
start = timeFormat(start, 'yyyy-mm-dd')
end = timeFormat(end, 'yyyy-mm-dd')
return { name, start, end }
}
function getStartOfWeek(date) {
const dayOfWeek = date.getDay()
const diff = date.getDate() - dayOfWeek + (dayOfWeek === 0 ? -6 : 1) //
return new Date(date.setDate(diff))
}
function getStartOfMonth(date) {
return new Date(date.getFullYear(), date.getMonth(), 1)
}
function generateTimeArray() {
const today = new Date()
const yesterday = new Date(today)
yesterday.setDate(today.getDate() - 1)
const currentWeekStart = getStartOfWeek(today) //
const currentWeekEnd = new Date(today)
currentWeekEnd.setDate(currentWeekStart.getDate() + 6)
const lastWeekStart = new Date(currentWeekStart)
lastWeekStart.setDate(currentWeekStart.getDate() - 7)
const lastWeekEnd = new Date(currentWeekEnd)
lastWeekEnd.setDate(currentWeekEnd.getDate() - 7)
const currentMonthStart = getStartOfMonth(today) //
const currentMonthEnd = new Date(today.getFullYear(), today.getMonth() + 1, 0)
const lastMonthStart = new Date(currentMonthStart)
lastMonthStart.setMonth(lastMonthStart.getMonth() - 1)
const lastMonthEnd = new Date(currentMonthEnd)
lastMonthEnd.setMonth(lastMonthEnd.getMonth() - 1)
return [
generateTimeRange('昨日', yesterday, yesterday),
generateTimeRange('本周', currentWeekStart, currentWeekEnd),
generateTimeRange('上周', lastWeekStart, lastWeekEnd),
generateTimeRange('本月', currentMonthStart, currentMonthEnd),
generateTimeRange('上月', lastMonthStart, lastMonthEnd),
]
}
const tabChange = (e) => {
list.value = []
tabIndex.value = e.index
getCount()
getList()
}
const tabChange1 = (e) => {
list.value = []
tabIndex1.value = e.index
getList()
}
const getList = async () => {
const url = tabIndex1.value == 0 ? '/statistics/sales' : '/statistics/stores'
const resData = await http.get(url, {
params: {
start_at: currentTabs.value.start,
end_at: currentTabs.value.end,
},
})
list.value = resData
}
</script>

View File

@ -22,14 +22,14 @@
<view class="">{{ item.job.name }}</view>
</view>
<template v-if="options?.includes(item.promotion_status)">
<!-- <template v-if="options?.includes(item.promotion_status)">
<view class="py-10rpx">
<uv-line color="#f5f5f5"></uv-line>
</view>
<view class="flex justify-end items-center">
<uv-button type="primary" size="mini">去提交</uv-button>
</view>
</template>
</template> -->
</view>
</template>
<script setup>

View File

@ -109,7 +109,24 @@ const data = {
name: '已取消',
color: '#999999'
}
]
],
shore_task_status: [{
value: 1,
name: '未开始',
color: '#f56c6c'
}, {
value: 2,
name: '待完成',
color: '#f56c6c'
}, {
value: 3,
name: '已完成',
color: '#3c9cff'
}, {
value: 4,
name: '未完成',
color: '#999999'
}]
}
export default function (value, status, key) {
if (!status) {