This commit is contained in:
2024-09-10 10:49:08 +08:00
parent b5fd06b800
commit dd4f5938da
6391 changed files with 722800 additions and 0 deletions

View File

@@ -0,0 +1,250 @@
<template>
<my-model ref="model" :borderRadius="18" :title="title" iconColor="#000" @close="resetForm">
<template #desc>
<view class="u-text-left u-p-30 ">
<view class="u-m-t-40 ">
<view>班名次</view>
<view class="u-p-l-32 border u-m-t-24 u-flex-1">
<uni-easyinput paddingNone :inputBorder="false" v-model="form.name"
placeholder="请输入班次名称"></uni-easyinput>
</view>
</view>
<template v-if="active!=1">
<view class="u-m-t-40 " @tap="timePickerShow(form.start,'start')">
<view>开始时间</view>
<view class="u-p-l-32 border lh35 u-flex u-m-t-24 u-flex-1">
<view class="u-flex">
<image src="/pageWorkControl/static/images/icon-time.svg" class="icon-time" mode=""></image>
</view>
<view class="u-m-l-12">
<text v-if="!form.start" class="color-666">请选择开始时间</text>
<text v-else>{{form.start}}</text>
</view>
</view>
</view>
<view class="u-m-t-40 " @tap="timePickerShow(form.end,'end')">
<view>结束时间</view>
<view class="u-p-l-32 border lh35 u-flex u-m-t-24 u-flex-1">
<view class="u-flex">
<image src="/pageWorkControl/static/images/icon-time.svg" class="icon-time" mode=""></image>
</view>
<view class="u-m-l-12">
<text v-if="!form.end" class="color-666">请选择结束时间</text>
<text v-else>{{form.end}}</text>
</view>
</view>
</view>
</template>
</view>
</template>
<template #btn>
<view class="u-p-30">
<view class="u-m-t-10">
<my-button @tap="confirm" shape="circle" showShadow>{{props.title==='添加'?'添加':'提交'}}</my-button>
<my-button type="cancel" bgColor="#fff" @tap="close">取消</my-button>
</view>
</view>
</template>
</my-model>
<my-pickerview autoClear :isLink="false" mode="time" @confirm="timeConfirm" :showTitle="false" ref="timePicker"
:defaultIndex="times.defaultIndex"
></my-pickerview>
</template>
<script setup>
import {
reactive,
nextTick,
ref
} from 'vue';
import myPickerview from '@/components/my-components/my-pickerview'
import myModel from '@/components/my-components/my-model.vue'
import myButton from '@/components/my-components/my-button.vue'
const props = defineProps({
active:{
type:[String,Number],
default:1
},
mode:{
//time none
type:String,
default:'none'
},
title: {
type: String,
default: ''
},
data: {
type: Array,
default: []
}
})
function timeConfirm(e){
form[times.selType]=e.join(':')
}
const times=reactive({
defaultIndex:[0,0],
selType:'',
})
const timePicker = ref(null)
function timePickerShow(time,timeshowKey){
times.selType=timeshowKey
const date=new Date()
if(time===''){
times.defaultIndex=[date.getHours(),date.getMinutes()]
}else{
console.log(time.split(':').map(v=>parseInt(v)));
times.defaultIndex=time.split(':').map(v=>parseInt(v))
}
timePicker.value.open()
}
function currentPriceChange(newval){
nextTick(()=>{
form.discount=(newval*100/form.price).toFixed()
})
}
function discountChange(newval){
nextTick(()=>{
form.currentPrice=(form.price*newval/100).toFixed(2)
})
}
const $form = {
name:'',
start:'',
end:'',
}
const form = reactive({
...$form
})
function resetForm() {
Object.assign(form, {
...$form
})
}
const model = ref(null)
function open(item) {
if(item){
Object.assign(form,item)
}
model.value.open()
emits('open')
}
function close() {
model.value.close()
resetForm()
emits('close')
}
const emits = defineEmits(['confirm','close','open'])
function confirm() {
const {
name,start,end
} = form
if(!name){
return uni.showToast({
title:'请输入班次名',
icon:'none'
})
}
if(props.active==0){
if(!start){
return uni.showToast({
title:'请选择开始时间',
icon:'none'
})
}
if(!end){
return uni.showToast({
title:'请选择结束时间',
icon:'none'
})
}
}
emits('confirm',{...form})
close()
}
defineExpose({
open,
close
})
</script>
<style lang="scss">
.lh35{
line-height: 35px;
}
.icon-time{
width: 28rpx;
height: 28rpx;
}
.border{
border-radius: 8rpx;
}
.lh34 {
line-height: 34rpx;
}
.tag {
background-color: #fff;
border: 1px solid #E5E5E5;
line-height: inherit;
font-size: 24rpx;
color: #666666;
padding: 6rpx 20rpx;
border-radius: 8rpx;
&.active {
border-color: #E6F0FF;
color: $my-main-color;
}
}
.hover-class {
background-color: #E5E5E5;
}
.discount {
.u-absolute {
top: 0;
bottom: 0;
right: 0;
}
}
.bg1 {
background: #F7F7FA;
}
.tab {
padding: 0 80rpx;
}
.border {
border: 1px solid #E5E5E5;
border-radius: 4rpx;
}
.input-box {
padding: 22rpx 32rpx;
font-size: 28rpx;
color: #666;
}
.placeholder-class {
font-size: 28rpx;
}
</style>

View File

@@ -0,0 +1,235 @@
<template>
<view class="min-page bg-gray u-p-30 u-font-28 color-333">
<view class="bg-fff border-r-12 default-box-padding">
<view class="font-bold">交班模式</view>
<view class="u-m-t-24">
<radio-group @change="jiaobanModelChange">
<label class="radio u-m-r-60" v-for="(item,index) in jiaobanModel.list" :key="index">
<radio :value="''+index" :checked="index == jiaobanModel.active" class="scale7 " />
<text>{{item.label}}</text>
</label>
</radio-group>
</view>
</view>
<template v-if="jiaobanModel.active==0">
<view v-for="(item,index) in bancis.timeList" :key="index" >
<view class="bg-fff u-m-t-32 border-r-12 default-box-padding">
<view class="color-666">班次</view>
<view class="u-flex u-m-t-24 u-p-b-24 border-bottom u-row-between" @tap="addBanciOpen(item,index)">
<view class="">
<text>{{item.name}}</text>
<text></text>
<text>{{item.start}}</text>
<text>-</text>
<text>{{item.end}}</text>
</view>
<view class="u-flex">
<uni-icons type="right" color="#999"></uni-icons>
</view>
</view>
<view class="u-flex u-m-t-28" @tap="listDel(bancis.timeList,index)">
<view class="u-flex">
<uni-icons size="20" type="minus-filled" :color="$colorRed"></uni-icons>
</view>
<view class="u-m-l-12 red">删除</view>
</view>
</view>
</view>
</template>
<template v-if="jiaobanModel.active==1">
<view v-for="(item,index) in bancis.list" :key="index">
<view class="bg-fff u-m-t-32 border-r-12 default-box-padding">
<view class="color-666">班次</view>
<view class="u-flex u-m-t-24 u-p-b-24 border-bottom u-row-between" @tap="addBanciOpen(item,index)">
<view class="">
{{item.name}}
</view>
<view class="u-flex">
<uni-icons type="right" color="#999"></uni-icons>
</view>
</view>
<view class="u-flex u-m-t-28" @tap="listDel(bancis.list,index)">
<view class="u-flex">
<uni-icons size="20" type="minus-filled" :color="$colorRed"></uni-icons>
</view>
<view class="u-m-l-12 red">删除</view>
</view>
</view>
</view>
</template>
<view class="bg-fff u-flex u-m-t-32 border-r-12 default-box-padding" @tap="addBanciOpen">
<uni-icons type="plus-filled" :color="color.ColorMain" size="20"></uni-icons>
<view class="u-m-l-16">添加选项</view>
</view>
<view class="bg-fff u-m-t-32 border-r-18 default-box-padding">
<view class="" v-for="(radios,index) in radioGroups" :key="index">
<view class="font-bold">{{radios.title}}</view>
<view class="u-m-t-24 u-p-b-24 u-m-b-24" :class="{'border-bottom':index<radioGroups.length-1}">
<radio-group @change="radioGroupChange($event,radios)">
<label class="radio u-m-r-60" v-for="(item,itemindex) in radios.list" :key="itemindex">
<radio :value="''+itemindex" :checked="itemindex === radios.active" class="scale7 " />
<text>{{item.label}}</text>
</label>
</radio-group>
</view>
</view>
</view>
</view>
<view class="u-fixed bottom u-flex bg-fff ">
<view class="u-flex-1">
<my-button bgColor="#333" color="#fff" borderRadius="100rpx 0 0 100rpx" shape="circle" plain type="primary"
@tap="back">返回</my-button>
</view>
<view class="u-flex-1">
<my-button @tap="confirm" borderRadius="0 100rpx 100rpx 0" shape="circle" type="primary">确定</my-button>
</view>
</view>
<add-banci @confirm="addBanciConfirm" :active="jiaobanModel.active" :title="refAddBanciTitle" ref="refAddBanci"></add-banci>
</template>
<script setup>
import color from '@/commons/color.js'
import myButton from '@/components/my-components/my-button';
import addBanci from './components/add-banci';
import {
reactive, ref
} from 'vue';
const refAddBanci=ref(null)
const refAddBanciTitle=ref('添加')
function addBanciOpen(item,index){
bancis.selIndex=index
refAddBanciTitle.value=item.hasOwnProperty('name')?'编辑':'添加'
refAddBanci.value.open(item.hasOwnProperty('name')?item:null)
}
function addBanciConfirm(e){
console.log(e);
if(refAddBanciTitle.value==='添加'){
if(jiaobanModel.active==1){
bancis.list.push(e)
}else{
bancis.timeList.push(e)
}
}
}
function listDel(list,index){
uni.showModal({
title: '提示',
content: '确定删除【'+list[index].name+'】吗?',
success: function (res) {
if (res.confirm) {
list.splice(index,1)
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
const $colorRed = '#EB4F4F'
const bancis = reactive({
selIndex:'',
timeList: [{
name: '测试',
start: '6:00',
end: '12:00'
}],
list: [{
name: '早班'
},
{
name: '中班'
},
{
name: '晚班'
}
]
})
function back() {
uni.navigateBack()
}
function confirm() {
}
const jiaobanModel = reactive({
list: [{
label: '按时间段',
value: 0
},
{
label: '自定义',
value: 1
},
],
active: 1
})
const radioBasicArr = [{
label: '统计',
value: 0
},
{
label: '不统计',
value: 1
},
]
function returnRadioGroups(arr) {
return arr.map(v => {
return {
title: v,
active: 0,
list: [...radioBasicArr],
}
})
}
const textlists = [
'订单数', '订单额', '订单微信支付金额', '订单余额支付金额', '订单线下支付金额', '订单支付宝金额',
'堂食订单数', '堂食订单金额', '自取订单数', '自取订单金额', '外卖订单数', '外卖订单金额', '退款订单数',
'成功退款金额', '微信成功退款金额', '余额成功退款金额', '线下成功退款金额', '支付宝成功退款金额', '充值数',
'充值金额', '开通会员数', '开通会员金额', '配送费', '收银笔数', '收银金额', '订单满减优惠金额', '订单积分兑换金额',
'订单优惠券减免金额', '订单会员优惠金额', '充值赠送金额', '堂食退款金额', '外卖退款金额', '自取退款金额', '配送费退款',
'配送费总额', '微信到账金额', '支付宝到账金额', '收银支付宝金额', '收银余额支付金额', '收银微信支付金额'
]
const radioGroups = reactive(returnRadioGroups(textlists))
function radioGroupChange(e, item) {
console.log(e);
console.log(item);
item.active = e.detail.value
console.log(radioGroups);
}
function jiaobanModelChange(e) {
jiaobanModel.active = e.detail.value
}
</script>
<style scoped lang="scss">
$red: #EB4F4F;
.red {
color: $red;
}
.bottom {
background-color: transparent;
bottom: 84rpx;
left: 28rpx;
right: 28rpx;
}
</style>