商品分组更新:

增加编辑售卖时间
编辑分组名称
This commit is contained in:
2024-10-15 15:21:50 +08:00
parent a9fb79b9f5
commit 24f34e8f8c
6 changed files with 349 additions and 63 deletions

View File

@@ -7,8 +7,8 @@
<view class="block">
<view class="">
<uni-forms-item label="分类名称" required name="name">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="category.name" placeholder="输入分类名称" />
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="category.name" placeholder="输入分类名称" />
</uni-forms-item>
</view>
<template v-if="option.type=='edit'">
@@ -17,7 +17,7 @@
v-model="category.sort" type="number" placeholder="排序越小越靠前" />
</uni-forms-item>
</template>
<uni-forms-item label="">
<view class="u-flex u-row-between u-col-center">
<view class="label-title">分组状态</view>
@@ -26,6 +26,35 @@
</view>
</view>
</uni-forms-item>
<uni-forms-item label="">
<view class="u-flex u-row-between u-col-center">
<view class="label-title">售卖时间管控</view>
<view class="u-flex">
<my-switch v-model="category.useTime"></my-switch>
</view>
</view>
<view v-if="category.useTime" class="u-flex u-row-between u-col-center u-m-t-30 u-p-b-12">
<view class="u-flex timesel" @click="changeTime('start')">
<up-icon name="clock" size="14"></up-icon>
<view class="u-m-l-20">
<text v-if="!category.saleStartTime" class="color-999">起始时间</text>
<text v-else>{{category.saleStartTime}}</text>
</view>
</view>
<view class="u-p-l-30 u-p-r-30"></view>
<view class="u-flex timesel" @click="changeTime('end')">
<up-icon name="clock" size="14"></up-icon>
<view class="u-m-l-20">
<text v-if="!category.saleEndTime" class="color-999">结束时间</text>
<text>{{category.saleEndTime}}</text>
</view>
</view>
</view>
</uni-forms-item>
<uni-forms-item label="分组排序" required name="name">
<uni-number-box :value="category.sort" />
</uni-forms-item>
</view>
</uni-forms>
</view>
@@ -36,6 +65,9 @@
</view>
</view>
<view class="bottom" ref="bottom"></view>
<up-datetime-picker @cancel="timeCancel" @confirm="timeConfirm" :show="time.show" v-model="time.val" mode="time"></up-datetime-picker>
</view>
</template>
@@ -90,6 +122,7 @@
}
// 表单样式
const placeholderStyle = ref('font-size:28rpx;')
//表单边框
@@ -122,6 +155,31 @@
}
};
}
const time=reactive({
show:false,
val:'',
key:''
})
function timeCancel(){
time.show=false
}
function timeConfirm(e){
console.log(e);
if(time.key=='start'){
category.saleStartTime=e.value
}else{
category.saleEndTime=e.value
}
time.val=''
time.show=false
}
function changeTime(key) {
time.key=key;
time.show=true;
}
function toTimer(timer, index) {
console.log(timer);
@@ -184,6 +242,8 @@
productIds: [],
saleTime: [],
useTime: 0,
saleEndTime:'',
saleStartTime:'',
shopId: uni.getStorageSync('shopId')
}
const categoryChild = ref({
@@ -549,6 +609,13 @@
background: #F9F9F9;
}
.timesel {
border: 1px solid #eee;
border-radius: 10rpx;
padding: 10rpx 20rpx;
flex: 1;
}
.option-item {
margin-bottom: 34rpx;
}