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,426 @@
<template>
<view class="u-p-30 safe-page">
<myTabs :list="tabsList" @change="tabsChange"></myTabs>
<view class="box">
<view class="basic">
<uni-forms :border="true" label-position="top" err-show-type="undertext" validateTrigger="blur"
label-width="350"
ref="Forms"
:model="FormData" :rules="rules">
<view class="block">
<uni-forms-item label="图片">
<uni-file-picker v-model="FormData.images" file-mediatype="image" mode="grid" :limit="10"
@progress="FileUploadprogress" @success="FileUploadsuccess" @fail="FileUploadail"
@select="FileUploadselect" />
</uni-forms-item>
<uni-forms-item required name="goodsName" label="商品名称" >
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.goodsName" placeholder="请输入商品名称" />
</uni-forms-item>
<uni-forms-item label="产品编码" required>
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.goodsCode" placeholder="请输入商品编码" />
</uni-forms-item>
<uni-forms-item label="商品描述" required>
<uni-easyinput :placeholderStyle="placeholderStyle" type="textarea"
v-model="FormData.goodsDesc" placeholder="请填写商品简述" />
</uni-forms-item>
<uni-forms-item label="商品详情" required>
<uni-easyinput :placeholderStyle="placeholderStyle" type="textarea"
v-model="FormData.goodsDetail" placeholder="请填写商品详情" />
</uni-forms-item>
<uni-forms-item label="所属分类" required>
<view style="display: none;"><uni-easyinput :inputBorder="inputBorder"
v-model="FormData.category" placeholder="请选择所属分类" /></view>
<picker @change="categoryChange" :value="category.defaultCateIndex" :range="category.list">
<view class="u-flex u-row-between lh40">
<view class="color-333">{{category.list[FormData.category]||'分类'}}</view>
<uni-icons type="right"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="规格模式" required>
<uni-data-checkbox v-model="FormData.specificationsPattern"
:localdata="specificationMode" />
</uni-forms-item>
<uni-forms-item label=" " required>
<view class="u-flex u-row-between zuofa" @tap="go.to('PAGES_PRODUCT_GUIGE_ADD')">
<view class="color-333">{{FormData.specificationsGroup||'添加规格组'}}</view>
<uni-icons type="right"></uni-icons>
</view>
</uni-forms-item>
<uni-forms-item label="底价(元)" required>
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.floorPrice" placeholder="请输入底价(元)" />
</uni-forms-item>
<uni-forms-item label="售卖方式" required>
<view style="display: none;"><uni-easyinput :inputBorder="inputBorder"
v-model="FormData.salesMethod" placeholder="请选择售卖方式" /></view>
<picker @change="salesMethodChange" :value="salesMethod.defaultIndex"
:range="salesMethod.list">
<view class="u-flex u-row-between lh40">
<view class="color-333">{{salesMethod.list[FormData.salesMethod]||'售卖方式'}}</view>
<uni-icons type="right"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">库存</view>
<switch :color="ColorMain" :checked="FormData.stock" class="my-switch" />
</view>
</uni-forms-item>
</view>
<view class="block">
<view class="border-top-0">
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">打折设置</view>
<my-switch v-model="FormData.openDiscount" @change="openDiscountChange"></my-switch>
<!-- <switch :color="ColorMain" :checked="openDiscount" class="my-switch" /> -->
</view>
</uni-forms-item>
</view>
<view class="border-top-0 none-label" v-if="FormData.openDiscount">
<uni-forms-item label="" required>
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.discountPrice" type="digit" placeholder="请填写折后价" />
</uni-forms-item>
</view>
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">不参与会员折扣</view>
<switch :color="ColorMain" :checked="FormData.isVipDiscount" class="my-switch" />
</view>
</uni-forms-item>
<uni-forms-item label="会员价(元)" required>
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.vipPrice" type="digit" placeholder="请输入会员价(元)" />
</uni-forms-item>
<uni-forms-item label="包装费(元)" required>
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.packagingFee" type="digit" placeholder="请输入包装费(元)" />
</uni-forms-item>
<uni-forms-item label="重量(千克)" required>
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.weight" type="digit" placeholder="请输入重量(千克)" />
</uni-forms-item>
<uni-forms-item label="赠送积分" required>
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.integral" type="digit" placeholder="请输入赠送积分" />
</uni-forms-item>
</view>
<view class="block">
<view class="border-top-0">
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">每日销量上限</view>
<switch :color="ColorMain" :checked="FormData.stock" class="my-switch" />
</view>
</uni-forms-item>
</view>
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">每单限购</view>
<switch :color="ColorMain" :checked="FormData.isVipDiscount" class="my-switch" />
</view>
</uni-forms-item>
<uni-forms-item label="最低起售(件)" required>
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.vipPrice" type="digit" placeholder="请输入最低起售(件)" />
</uni-forms-item>
<uni-forms-item label="包装费(元)" required>
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.packagingFee" type="digit" placeholder="请输入包装费(元)" />
</uni-forms-item>
<uni-forms-item label="虚拟销量" required>
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.virtualSales" type="digit" placeholder="虚拟销量" />
</uni-forms-item>
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">设为推荐</view>
<switch :color="ColorMain" :checked="FormData.isRecommend" class="my-switch" />
</view>
</uni-forms-item>
</view>
</uni-forms>
<view class="save-btn-box">
<button class="save-btn" @click="save" hover-class="btn-hover-class">保存</button>
</view>
<view class="u-text-center color-red">
<text>删除该商品</text>
</view>
</view>
<view class="stock">
</view>
</view>
</view>
</template>
<script setup>
import {
ColorMain
} from '@/commons/color.js'
import go from '@/commons/utils/go.js';
import {
onLoad
} from '@dcloudio/uni-app';
import {
onBeforeUnmount,
onUnmounted,
reactive,
ref,
watch
} from 'vue';
import myTabs from '@/pageProduct/components/my-tabs.vue'
import mySwitch from '@/pageProduct/components/my-switch.vue'
const rules = {
GoodsName: {
rules: [{
required: true,
errorMessage: '请输入商品名称',
},
{
minLength: 1,
maxLength: 20,
errorMessage: '商品名称长度在 {minLength} 到 {maxLength} 个字符',
}
]
}
}
const tabsList = ['基础设置', '库存设置']
const Forms=ref(null)
// 表单样式
const placeholderStyle = 'font-size:28rpx;'
//规格模板类型
const specificationMode = [{
text: '普通',
value: '普通'
},
{
text: '图片式',
value: '图片式'
},
{
text: '规格模版',
value: '规格模版'
}
]
let myTest = ref(false)
//表单边框
const inputBorder = ref(false)
//表单数据
const FormData = reactive({
goodsName: '',
GoodsNum: '',
images: [],
category: '',
salesMethod: 0,
stock: false,
isVipDiscount: false,
packagingFee: 0,
weight: 0,
integral: 0,
specificationsPattern: '',
specificationsGroup: '',
openDiscount: false,
discountPrice: '',
isVipDiscount: false,
vipPrice: '',
packagingFee: '',
virtualSales: '',
isRecommend: false
})
//售卖方式
const salesMethod = reactive({
list: ['现货', '预售', '仅展示商品'],
defaultIndex: 0,
})
function salesMethodChange(e) {
FormData.salesMethod = e.detail.value
salesMethod.defaultIndex = e.detail.value
}
let option = {
type: 'add'
}
// 判断是否为一个空对象
function isEmpty(obj) {
return obj && JSON.stringify(obj) !== '{}'
}
onLoad((params) => {
if (isEmpty(params)) {
option = params.type ? params : option
}
uni.setNavigationBarTitle({
title: option.type === 'add' ? '添加商品' : '编辑商品'
})
})
function openDiscountChange() {
}
//图片上次
function FileUploadprogress() {
}
function FileUploadsuccess() {
}
function FileUploadail() {
}
function FileUploadselect() {
}
//分类
const category = reactive({
list: ['分类', '分类1', '分类2'],
defaultCateIndex: 0,
})
function categoryChange(e) {
FormData.category = e.detail.value
category.defaultCateIndex = e.detail.value
}
function tabsChange(i) {
console.log(i);
}
function save(){
Forms.value.validate().then(res=>{
console.log(res);
}).catch(err=>{
console.log(err);
})
}
/**
* 监听规格保存,拿到数据
* @param {Boolean} open //控制开启或关闭监听
*/
function watchSpecificationsSave(open = true) {
if (open) {
uni.$on('emitspecificationsSave', function(data) {
console.log(data);
})
} else {
uni.$off('emitspecificationsSave', function(data) {
console.log('emitspecificationsSave remove');
})
}
}
watchSpecificationsSave()
onBeforeUnmount(() => {
watchSpecificationsSave(false)
})
</script>
<style scoped>
page {
background: #F9F9F9;
}
</style>
<style lang="scss" scoped>
.safe-page {
background: #F9F9F9;
}
.my-switch {
transform: scale(0.7);
}
.label-title {
font-size: 28rpx;
font-weight: bold;
font-family: Source Han Sans CN, Source Han Sans CN;
}
.lh40 {
line-height: 40rpx;
}
.box {
margin-top: 70rpx;
font-size: 28rpx;
.block {
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
padding: 12rpx 24rpx;
margin-bottom: 32rpx;
}
}
.save-btn-box {
padding: 64rpx 110rpx 64rpx 110rpx;
}
::v-deep.uni-forms-item {
align-items: inherit;
}
::v-deep .uni-forms-item .uni-forms-item__label {
text-indent: 0;
font-size: 28rpx !important;
font-weight: bold;
color: #333;
}
::v-deep .border-top-0 .uni-forms-item.is-direction-top {
border-color: transparent !important;
}
::v-deep .none-label .uni-forms-item.is-direction-top {
padding: 0!important;
min-height: initial!important;
}
::v-deep .none-label .uni-forms-item .uni-forms-item__label{
padding: 0!important;
}
.save-btn {
background-color: $my-main-color;
color: #fff;
border-radius: 100rpx;
font-size: 28rpx;
}
.btn-hover-class {
opacity: .6;
}
.zuofa {
padding: 28rpx 0;
background: #F9F9F9;
padding-left: 42rpx;
border-radius: 14rpx 14rpx 14rpx 14rpx;
}
::v-deep .uni-input-placeholder {
font-size: 28rpx;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,177 @@
<template>
<view class="mask u-fixed position-all u-flex u-col-bottom" v-if="show" @tap="close">
<view class="bg-fff w-full" @tap.stop="nullFunction">
<view class="u-p-30">
<view class="font-bold u-text-center u-font-32">选择团购券分类</view>
<view class="u-m-t-32 u-flex">
<view class="u-flex-1 u-p-r-16">
<view class="u-m-b-12">分类名称</view>
<uni-easyinput v-model="goods.query.name" placeholder="请输入团购券分类名称" />
</view>
<!-- <view class="u-flex-1 u-p-l-16">
<view class="u-m-b-12">商品分类</view>
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}" placeholder="请选择分类"
popup-title="请选择分类" :localdata="category" v-model="goods.query.categoryId">
</uni-data-picker>
</view> -->
</view>
<view class="u-m-t-32 u-flex u-row-right">
<view class="u-flex-1 u-p-r-16">
<my-button type="cancel" plain @tap="resetQuery">重置</my-button>
</view>
<view class="u-flex-1 u-p-l-16">
<my-button @tap="getGoods">查询</my-button>
</view>
</view>
</view>
<scroll-view :scroll-x="false" scroll-y="true" :style="computedStyle()">
<view class="u-p-l-30 u-p-r-30">
<view class="u-flex u-row-between no-wrap">
<view>
<my-radio @change="radioAllChange" v-model="goods.allChecked" shape="square" :size="20"></my-radio>
</view>
<view>名称</view>
<view>状态</view>
</view>
<view class="u-m-t-12 u-flex u-row-between" v-for="(item,index) in goods.list" :key="index">
<my-radio @change="radioChange" v-model="item.checked" shape="square" :size="20"></my-radio>
<view>
{{item.name}}
</view>
<view>
<my-switch v-model="item.status" disabled></my-switch>
<!-- {{item.status}} -->
</view>
</view>
</view>
</scroll-view>
<view class="u-p-30">
<my-pagination :totalElements="goods.totalElements" :size="goods.query.size" @change="pageChange"></my-pagination>
<view class="u-m-t-20 u-flex">
<view class="u-flex-1 u-p-r-16">
<my-button type="cancel" plain @tap="close">取消</my-button>
</view>
<view class="u-flex-1 u-p-l-16">
<my-button @tap="confrim">确定</my-button>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import myButton from '@/components/my-components/my-button';
import myRadio from '@/components/my-components/my-radio';
import mySwitch from '@/components/my-components/my-switch';
import myPagination from '@/components/my-components/my-pagination'
import $coupon from '@/http/yskApi/couponCategory.js';
$coupon.get()
import {
reactive,
onMounted,
ref,
watch
} from 'vue';
const props = defineProps({
modelValue: {
type: Boolean,
default: false
},
height: {
type: [Number, String],
default: '40vh'
}
})
function nullFunction() {
}
const show = ref(props.modelValue)
function open(arr) {
show.value = true
if(arr){
for(let i in goods.list){
console.log(arr.includes(goods.list[i].id));
goods.list[i].checked=arr.includes(goods.list[i].id)
}
}
}
function close() {
show.value = false
}
function resetQuery() {
Object.assign(goods.query, $quey)
}
function computedStyle() {
return `height:${typeof props.height==='string'?props.height:props.height+'rpx'};`
}
const emits = defineEmits(['update:modelValue','confirm'])
const $quey = {
name: '',
page: 0,
size: 10,
}
const query = reactive({
...$quey
})
const goods=reactive({
list:[],
allChecked:false,
totalElements:0,
query:{
...$quey
}
})
function getGoods() {
$coupon.get(goods.query).then(res=>{
goods.list=res.content.map(v=>{
return {...v,checked:false}
})
goods.allChecked=false
goods.totalElements=res.totalElements
})
}
getGoods()
function pageChange(page){
goods.query.page=page-1
getGoods()
}
function radioChange(newval){
goods.allChecked=goods.list.filter(v=>v.checked).length!=0
}
function radioAllChange(newval){
goods.list.forEach(i=>{i.checked=newval})
}
function confrim(){
const arr= goods.list.filter(v=>v.checked)
console.log(arr);
emits('confirm',arr)
}
defineExpose({open,close})
</script>
<style lang="scss" scoped>
.mask {
background: rgba(51, 51, 51, 0.5);
z-index: 900;
}
.coverImg{
width: 60rpx;
height: 60rpx;
border-radius: 10rpx;
}
</style>

View File

@@ -0,0 +1,197 @@
<template>
<view class="mask u-fixed position-all u-flex u-col-bottom" v-if="show" @tap="close">
<view class="bg-fff w-full" @tap.stop="nullFunction">
<view class="u-p-30">
<view class="font-bold u-text-center">选择商品</view>
<view class="u-m-t-32 u-flex">
<view class="u-flex-1 u-p-r-16">
<view class="u-m-b-12">商品名称</view>
<uni-easyinput v-model="goods.query.name" placeholder="请输入商品名称" />
</view>
<view class="u-flex-1 u-p-l-16">
<view class="u-m-b-12">商品分类</view>
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}" placeholder="请选择分类"
popup-title="请选择分类" :localdata="category" v-model="goods.query.categoryId">
</uni-data-picker>
</view>
</view>
<view class="u-m-t-32 u-flex u-row-right">
<view class="u-flex-1 u-p-r-16">
<my-button type="cancel" plain @tap="resetQuery">重置</my-button>
</view>
<view class="u-flex-1 u-p-l-16">
<my-button @tap="getGoods">查询</my-button>
</view>
</view>
</view>
<scroll-view :scroll-x="false" scroll-y="true" :style="computedStyle()">
<view class="u-p-l-30 u-p-r-30">
<view class="u-flex u-row-between no-wrap">
<view>
<my-radio @change="radioAllChange" v-model="goods.allChecked" shape="square" :size="20"></my-radio>
</view>
<view>商品信息</view>
<view>规格</view>
<!-- <view>是否售尽</view> -->
<!-- <view>是否分销</view> -->
<view>售价</view>
<view>销量/库存</view>
<view>分类名称</view>
</view>
<view class="u-m-t-12 u-flex u-row-between" v-for="(item,index) in goods.list" :key="index">
<my-radio @change="radioChange" v-model="item.checked" shape="square" :size="20"></my-radio>
<view class="u-flex u-flex-col u-row-center u-col-center">
<image lazy-load class="coverImg" :src="item.coverImg" mode=""></image>
<view class="u-m-t-10">{{item.name}}</view>
</view>
<view>
{{item.typeEnum}}
</view>
<view>
{{ item.lowPrice }}
</view>
<view>
{{ item.realSalesNumber }}/{{ item.stockNumber }}
</view>
<view>
{{item.categoryName}}
</view>
</view>
</view>
</scroll-view>
<view class="u-p-30">
<my-pagination :totalElements="goods.totalElements" :size="goods.query.size" @change="pageChange"></my-pagination>
<view class="u-m-t-20 u-flex">
<view class="u-flex-1 u-p-r-16">
<my-button type="cancel" plain @tap="close">取消</my-button>
</view>
<view class="u-flex-1 u-p-l-16">
<my-button @tap="confrim">确定</my-button>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import myButton from '@/components/my-components/my-button';
import myRadio from '@/components/my-components/my-radio';
import myPagination from '@/components/my-components/my-pagination'
import {
$tbProduct
} from '@/http/yskApi/goods.js';
import {
reactive,
onMounted,
ref,
watch
} from 'vue';
const props = defineProps({
modelValue: {
type: Boolean,
default: false
},
height: {
type: [Number, String],
default: '40vh'
},
category: {
type: Array,
default: () => {
return []
}
}
})
function nullFunction() {
}
const show = ref(props.modelValue)
function open(arr) {
show.value = true
if(arr){
for(let i in goods.list){
console.log(arr.includes(goods.list[i].id));
goods.list[i].checked=arr.includes(goods.list[i].id)
}
}
}
function close() {
show.value = false
}
function resetQuery() {
Object.assign(goods.query, $quey)
}
function computedStyle() {
return `height:${typeof props.height==='string'?props.height:props.height+'rpx'};`
}
const emits = defineEmits(['update:modelValue','confirm'])
const $quey = {
categoryId: '',
name: '',
page: 0,
size: 10,
}
const query = reactive({
...$quey
})
const goods=reactive({
list:[],
allChecked:false,
totalElements:0,
query:{
...$quey
}
})
function getGoods() {
$tbProduct(goods.query).then(res=>{
goods.list=res.content.map(v=>{
return {...v,checked:false}
})
goods.allChecked=false
goods.totalElements=res.totalElements
})
}
getGoods()
function pageChange(page){
goods.query.page=page-1
getGoods()
}
function radioChange(newval){
goods.allChecked=goods.list.filter(v=>v.checked).length!=0
}
function radioAllChange(newval){
goods.list.forEach(i=>{i.checked=newval})
}
function confrim(){
const arr= goods.list.filter(v=>v.checked)
emits('confirm',arr)
}
defineExpose({open,close})
</script>
<style lang="scss" scoped>
.mask {
background: rgba(51, 51, 51, 0.5);
z-index: 900;
}
.coverImg{
width: 60rpx;
height: 60rpx;
border-radius: 10rpx;
}
</style>

View File

@@ -0,0 +1,201 @@
<template>
<view class="u-p-30 min-page">
<view class="u-flex">
<view style="width: 210rpx;">
<my-button shape="circle" @click="addTimer">添加定时器</my-button>
</view>
</view>
<view class="list u-m-t-20" v-if="list.length">
<view class="block" v-for="(item,index) in list" :key="index">
<view class="u-flex u-row-between">
<view>定时器{{index+1}}</view>
<uni-icons @click="delTimer(index)" type="trash"></uni-icons>
</view>
<view class="u-flex u-m-t-20 u-row-between">
<view>周期</view>
<view @click="selectAllClick(index)">全选</view>
</view>
<view class="u-m-t-20">
<uni-data-checkbox multiple v-model="item.cycleChecked" :localdata="cycle"></uni-data-checkbox>
</view>
<view class="u-m-t-20">
<view class="u-flex">
<view>上架时间:</view>
<view class="u-flex-1 u-m-l-10">
<picker mode="multiSelector" @change="listingTimeChange($event,index)"
:value="item.listingTime.index" :range="times">
<view class="bg-gray u-p-l-20 u-p-t-6 u-p-b-6 u-p-r-20 ">
{{item.listingTime.value}}
</view>
</picker>
</view>
</view>
<view class="u-flex u-m-t-20">
<view>下架时间:</view>
<view class="u-flex-1 u-m-l-10">
<picker mode="multiSelector" @change="offShelfChange($event,index)"
:value="item.offShelf.index" :range="times">
<view class="bg-gray u-p-l-20 u-p-t-6 u-p-b-6 u-p-r-20 ">
{{item.offShelf.value}}
</view>
</picker>
</view>
</view>
</view>
</view>
</view>
<view class="u-flex u-row-center u-m-t-60">
<my-button width="580" shape="circle" @click="save">保存</my-button>
</view>
</view>
</template>
<script setup>
import {
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
ref
} from 'vue';
import go from '@/commons/utils/go.js';
import myButton from '@/components/my-components/my-button.vue'
//返回一天的时间 时分格式
function returnDayTime() {
return new Array(2).fill(1).map((v, index) => {
if (index === 0) {
return new Array(24).fill(1).map((hour, index) => {
return `0${index}`.slice(-2)
})
}
if (index === 1) {
return new Array(60).fill(1).map((hour, index) => {
return `0${index}`.slice(-2)
})
}
})
}
const times = ref(returnDayTime())
let defaultTimeIndex = ref(0)
function getTime(indexArr) {
const hour = times.value[0][indexArr[0]]
const month = times.value[1][indexArr[1]]
return `${hour}:${month}`
}
//获取$event.detail.value
function getEnentDetailValue(e) {
return e.detail.value
}
function setListTimeValue(index, key, time) {
list.value[index][key].value = time
}
function listingTimeChange(e, index) {
const indexArr = getEnentDetailValue(e)
const time = getTime(indexArr)
setListTimeValue(index, 'listingTime', time)
}
function offShelfChange(e, index) {
const indexArr = getEnentDetailValue(e)
const time = getTime(indexArr)
setListTimeValue(index, 'offShelf', time)
}
const cycle = [{
value: 0,
text: '星期一'
},
{
value: 1,
text: '星期二'
},
{
value: 2,
text: '星期三'
},
{
value: 3,
text: '星期四'
},
{
value: 4,
text: '星期五'
},
{
value: 5,
text: '星期六'
},
{
value: 6,
text: '星期日'
}
]
const ListDataconstructor = {
cycleChecked: [0, 1, 2, 3, 4, 5, 6],
}
function returnBasicTimeConstructor() {
return {
listingTime: {
value: '09:00',
index: [9, 0]
},
offShelf: {
value: '18:00',
index: [18, 0]
}
}
}
const list = ref([returnBasicDataConstructor()])
function returnBasicDataConstructor() {
return {
...ListDataconstructor,
...returnBasicTimeConstructor()
}
}
function addTimer() {
list.value.push(returnBasicDataConstructor())
}
function delTimer(index) {
list.value.splice(index,1)
}
function selectAllClick(index){
list.value[index].cycleChecked=ListDataconstructor.cycleChecked
}
// 触发定时器保存事件将数据给到添加商品页面
function emitTimerSave(){
uni.$emit('timerSave',list.value)
go.back()
}
function save(){
console.log(list.value);
emitTimerSave()
}
onLoad(()=>{
const arr=uni.getStorageSync('timer')
if(arr.length){
list.value=arr
}
})
</script>
<style lang="scss">
.min-page {
background-color: #F9F9F9;
}
.block {
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
padding: 30rpx;
margin-bottom: 20rpx;
}
</style>