parent
a9fb79b9f5
commit
24f34e8f8c
|
|
@ -32,7 +32,7 @@
|
||||||
<text class="u-m-r-24">{{data.name}}</text>
|
<text class="u-m-r-24">{{data.name}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-font-32">
|
<view class="u-font-32">
|
||||||
<text v-if="data.typeEnum=='单规格'">¥</text>
|
<text v-if="data.typeEnum=='单规格'||data.typeEnum=='normal'">¥</text>
|
||||||
<text>{{data.lowPrice}}</text>
|
<text>{{data.lowPrice}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,13 @@
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
|
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
|
||||||
:placeholder="pageData.search.placeholder" v-model="pageData.query.name"
|
:placeholder="pageData.search.placeholder" v-model="pageData.query.name"
|
||||||
|
@clear="searchFunc"
|
||||||
@confirm="searchFunc">
|
@confirm="searchFunc">
|
||||||
<template #prefixIcon>
|
<template #prefixIcon>
|
||||||
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
|
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
|
||||||
</template>
|
</template>
|
||||||
</uni-easyinput>
|
</uni-easyinput>
|
||||||
<button type="text" @click="searchFunc()">搜索</button>
|
<button type="text" @click="searchFunc">搜索</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex states1 u-row-between u-font-28">
|
<view class="u-flex states1 u-row-between u-font-28">
|
||||||
|
|
@ -36,13 +37,12 @@
|
||||||
<view class="goods-list u-p-30">
|
<view class="goods-list u-p-30">
|
||||||
<template v-if="pageData.bindGoodsList.length">
|
<template v-if="pageData.bindGoodsList.length">
|
||||||
<view class="u-m-b-32" v-for="(item,index) in pageData.bindGoodsList" :key="index">
|
<view class="u-m-b-32" v-for="(item,index) in pageData.bindGoodsList" :key="index">
|
||||||
<my-goods isBind @radioClick="goodsRadioClick" :index="index"
|
<my-goods isBind @radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
|
||||||
:data="item" @del="goodsDel" :showChecked="showChecked"
|
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||||
:showDetail="pageData.showGoodsDetail"></my-goods>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="pageData.hasAjax&&!pageData.bindGoodsList.length">
|
<template v-if="pageData.hasAjax&&!pageData.bindGoodsList.length">
|
||||||
<my-img-empty tips="暂无绑定商品"></my-img-empty>
|
<my-img-empty :tips="isSearch?'未搜索到相关绑定商品':'暂无绑定商品' "></my-img-empty>
|
||||||
</template>
|
</template>
|
||||||
<view style="height: 100rpx;"></view>
|
<view style="height: 100rpx;"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -52,9 +52,9 @@
|
||||||
<view class="bg-fff border-r-18 u-p-t-16 u-p-b-16 box-shadow">
|
<view class="bg-fff border-r-18 u-p-t-16 u-p-b-16 box-shadow">
|
||||||
<template v-if="pageData.goodsList.length">
|
<template v-if="pageData.goodsList.length">
|
||||||
<view class="" v-for="(item,index) in pageData.goodsList" :key="index">
|
<view class="" v-for="(item,index) in pageData.goodsList" :key="index">
|
||||||
<my-goods @goodsClick="goodsClick"
|
<my-goods @goodsClick="goodsClick" @radioClick="goodsRadioClick" :index="index" :data="item"
|
||||||
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
|
@del="goodsDel" :showChecked="showChecked"
|
||||||
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
:showDetail="pageData.showGoodsDetail"></my-goods>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="pageData.hasAjax&&!pageData.goodsList.length">
|
<template v-if="pageData.hasAjax&&!pageData.goodsList.length">
|
||||||
|
|
@ -118,7 +118,9 @@
|
||||||
tbProductGroupPost
|
tbProductGroupPost
|
||||||
} from "@/http/yskApi/shop.js"
|
} from "@/http/yskApi/shop.js"
|
||||||
|
|
||||||
import {hasPermission} from '@/commons/utils/hasPermission.js';
|
import {
|
||||||
|
hasPermission
|
||||||
|
} from '@/commons/utils/hasPermission.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
returnAllCategory
|
returnAllCategory
|
||||||
|
|
@ -154,17 +156,7 @@
|
||||||
categoryName: '',
|
categoryName: '',
|
||||||
hasAjax: false
|
hasAjax: false
|
||||||
})
|
})
|
||||||
watch(() => pageData.query.categoryId, (newval) => {
|
|
||||||
getGoodsList()
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(()=>pageData.stateCurrent,(newval)=>{
|
|
||||||
if(newval){
|
|
||||||
setGoodsList()
|
|
||||||
}else{
|
|
||||||
init()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
function isGroundingChange(e) {
|
function isGroundingChange(e) {
|
||||||
const {
|
const {
|
||||||
|
|
@ -194,20 +186,26 @@
|
||||||
|
|
||||||
function setCategory(category) {
|
function setCategory(category) {
|
||||||
pageData.query.categoryId = category.id
|
pageData.query.categoryId = category.id
|
||||||
|
console.log(pageData.query.categoryId );
|
||||||
pageData.categoryName = category.name
|
pageData.categoryName = category.name
|
||||||
}
|
}
|
||||||
|
|
||||||
let $goodsList=[]
|
let $goodsList = []
|
||||||
function setGoodsList(){
|
|
||||||
pageData.goodsList = $goodsList.filter(v=>!pageData.bindGoodsList.find(bindGoods=>bindGoods.id==v.id))
|
function setGoodsList() {
|
||||||
|
pageData.goodsList = $goodsList.filter(v => {
|
||||||
|
return !pageData.bindGoodsList.find(bindGoods => bindGoods.id == v.id)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGoodsList() {
|
function getGoodsList() {
|
||||||
$tbProductV2(pageData.query).then(res => {
|
$tbProductV2(pageData.query).then(res => {
|
||||||
pageData.hasAjax = true
|
pageData.hasAjax = true
|
||||||
pageData.totalElements = res.totalElements
|
pageData.totalElements = res.totalElements
|
||||||
$goodsList=res.content.map(v=>{
|
$goodsList = res.content.map(v => {
|
||||||
return {
|
return {
|
||||||
...v,checked:false
|
...v,
|
||||||
|
checked: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setGoodsList()
|
setGoodsList()
|
||||||
|
|
@ -219,21 +217,16 @@
|
||||||
})
|
})
|
||||||
async function getGroupBindGoods() {
|
async function getGroupBindGoods() {
|
||||||
const res = await productListGet(option.id)
|
const res = await productListGet(option.id)
|
||||||
pageData.bindGoodsList = res
|
pageData.bindGoodsList = res.filter(v=>{
|
||||||
|
return pageData.query.categoryId===''?true:(v.categoryId==pageData.query.categoryId)&&(v.name.includes(pageData.query.name))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const option = reactive({})
|
const option = reactive({})
|
||||||
async function init() {
|
async function init() {
|
||||||
const res = await productListGet(option.id)
|
await getGroupBindGoods()
|
||||||
pageData.bindGoodsList = res
|
|
||||||
getGoodsList()
|
getGoodsList()
|
||||||
}
|
}
|
||||||
onLoad((opt) => {
|
onLoad((opt) => {
|
||||||
tbProductGroupGet({
|
|
||||||
page: 0,
|
|
||||||
size: 999,
|
|
||||||
sort: 'id',
|
|
||||||
shopId: uni.getStorageSync('shopId')
|
|
||||||
})
|
|
||||||
Object.assign(option, opt)
|
Object.assign(option, opt)
|
||||||
init()
|
init()
|
||||||
// $tbShopCategory({
|
// $tbShopCategory({
|
||||||
|
|
@ -263,28 +256,30 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const res=await hasPermission('允许修改分组')
|
const res = await hasPermission('允许修改分组')
|
||||||
if(!res){
|
if (!res) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log(pageData.goodsList);
|
console.log(pageData.goodsList);
|
||||||
await tbProductGroupPut({
|
await tbProductGroupPut({
|
||||||
...option,
|
...option,
|
||||||
shopId:uni.getStorageSync('shopId'),
|
shopId: uni.getStorageSync('shopId'),
|
||||||
productIds:[...pageData.bindGoodsList.map(v=>v.id),...pageData.goodsList.filter(v=>v.checked).map(v=>v.id)]
|
productIds: [...pageData.bindGoodsList.map(v => v.id), ...pageData.goodsList.filter(v => v.checked)
|
||||||
|
.map(v => v.id)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
pageData.stateCurrent=0
|
pageData.stateCurrent = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateGroup(){
|
function updateGroup() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除商品
|
//删除商品
|
||||||
async function goodsDel(index) {
|
async function goodsDel(index) {
|
||||||
const res=await hasPermission('允许修改分组')
|
const res = await hasPermission('允许修改分组')
|
||||||
if(!res){
|
if (!res) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const goods = pageData.bindGoodsList[index]
|
const goods = pageData.bindGoodsList[index]
|
||||||
|
|
@ -296,8 +291,8 @@
|
||||||
pageData.bindGoodsList.splice(index, 1)
|
pageData.bindGoodsList.splice(index, 1)
|
||||||
tbProductGroupPut({
|
tbProductGroupPut({
|
||||||
...option,
|
...option,
|
||||||
shopId:uni.getStorageSync('shopId'),
|
shopId: uni.getStorageSync('shopId'),
|
||||||
productIds:pageData.bindGoodsList.map(v=>v.id)
|
productIds: pageData.bindGoodsList.map(v => v.id)
|
||||||
})
|
})
|
||||||
} else if (res.cancel) {}
|
} else if (res.cancel) {}
|
||||||
}
|
}
|
||||||
|
|
@ -307,6 +302,7 @@
|
||||||
|
|
||||||
function statesTableClick(index) {
|
function statesTableClick(index) {
|
||||||
pageData.stateCurrent = index
|
pageData.stateCurrent = index
|
||||||
|
console.log(pageData.stateCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -342,9 +338,19 @@
|
||||||
return getChechkedGoodsList().length ? true : false
|
return getChechkedGoodsList().length ? true : false
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchFunc() {
|
|
||||||
|
let isSearch=ref(false)
|
||||||
|
async function searchFunc() {
|
||||||
|
isSearch.value=true
|
||||||
console.log('searchFunc');
|
console.log('searchFunc');
|
||||||
|
if (pageData.stateCurrent) {
|
||||||
getGoodsList()
|
getGoodsList()
|
||||||
|
} else {
|
||||||
|
const res = await productListGet(option.id)
|
||||||
|
pageData.bindGoodsList = res.filter(v=>{
|
||||||
|
return v.name.includes(pageData.query.name)&&(pageData.query.categoryId===''?true:v.categoryId==pageData.query.categoryId)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let showChecked = ref(false)
|
let showChecked = ref(false)
|
||||||
|
|
@ -407,6 +413,21 @@
|
||||||
pageData.category = cate
|
pageData.category = cate
|
||||||
getGoodsList()
|
getGoodsList()
|
||||||
}
|
}
|
||||||
|
watch(() => pageData.query.categoryId, (newval) => {
|
||||||
|
if(pageData.stateCurrent==1){
|
||||||
|
getGoodsList()
|
||||||
|
}else{
|
||||||
|
getGroupBindGoods()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(() => pageData.stateCurrent, (newval) => {
|
||||||
|
if (newval==1) {
|
||||||
|
getGoodsList()
|
||||||
|
} else {
|
||||||
|
getGroupBindGoods()
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
page {
|
page {
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
<view class="block">
|
<view class="block">
|
||||||
<view class="">
|
<view class="">
|
||||||
<uni-forms-item label="分类名称" required name="name">
|
<uni-forms-item label="分类名称" required name="name">
|
||||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle"
|
||||||
v-model="category.name" placeholder="输入分类名称" />
|
:inputBorder="inputBorder" v-model="category.name" placeholder="输入分类名称" />
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</view>
|
</view>
|
||||||
<template v-if="option.type=='edit'">
|
<template v-if="option.type=='edit'">
|
||||||
|
|
@ -26,6 +26,35 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-forms-item>
|
</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>
|
</view>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -36,6 +65,9 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom" ref="bottom"></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>
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -90,6 +122,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 表单样式
|
// 表单样式
|
||||||
const placeholderStyle = ref('font-size:28rpx;')
|
const placeholderStyle = ref('font-size:28rpx;')
|
||||||
//表单边框
|
//表单边框
|
||||||
|
|
@ -123,6 +156,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) {
|
function toTimer(timer, index) {
|
||||||
console.log(timer);
|
console.log(timer);
|
||||||
uni.setStorageSync('timer', timer.map(v => {
|
uni.setStorageSync('timer', timer.map(v => {
|
||||||
|
|
@ -184,6 +242,8 @@
|
||||||
productIds: [],
|
productIds: [],
|
||||||
saleTime: [],
|
saleTime: [],
|
||||||
useTime: 0,
|
useTime: 0,
|
||||||
|
saleEndTime:'',
|
||||||
|
saleStartTime:'',
|
||||||
shopId: uni.getStorageSync('shopId')
|
shopId: uni.getStorageSync('shopId')
|
||||||
}
|
}
|
||||||
const categoryChild = ref({
|
const categoryChild = ref({
|
||||||
|
|
@ -549,6 +609,13 @@
|
||||||
background: #F9F9F9;
|
background: #F9F9F9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.timesel {
|
||||||
|
border: 1px solid #eee;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.option-item {
|
.option-item {
|
||||||
margin-bottom: 34rpx;
|
margin-bottom: 34rpx;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-24 u-p-l-54 ">
|
<view class="u-m-t-24 u-p-l-54 ">
|
||||||
<view class="u-flex-1 u-flex">
|
<view class="u-flex-1 u-flex u-col-top">
|
||||||
<view class="color-666">分组名</view>
|
<view class="color-666 no-wrap">分组名</view>
|
||||||
<view class="color-333 u-m-l-60">{{data.name}}</view>
|
<view class="color-333 u-m-l-60">{{data.name}}</view>
|
||||||
<view class="u-flex u-m-l-16 " @click="editName">
|
<view class="u-flex u-m-l-16 " @click="editName">
|
||||||
<image src="/pageGoodsGroup/static/image/icon-edit.svg" class="icon-edit" mode=""></image>
|
<image src="/pageGoodsGroup/static/image/icon-edit.svg" class="icon-edit" mode=""></image>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,183 @@
|
||||||
|
<template>
|
||||||
|
<up-popup :show="popShow" @close="close" @open="open" mode="center" :round="9">
|
||||||
|
<view class="u-p-32 box u-font-28">
|
||||||
|
<view class="u-flex u-relative u-row-center">
|
||||||
|
<view class="u-font-32">编辑</view>
|
||||||
|
<view class="u-absolute close">
|
||||||
|
<up-icon @click="close" :size="16" color="#000" name="close-circle-fill"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-36">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="">
|
||||||
|
售卖时间管控
|
||||||
|
</view>
|
||||||
|
<my-switch v-model="category.useTime"></my-switch>
|
||||||
|
</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>
|
||||||
|
<view class="u-m-t-38">
|
||||||
|
<view class="u-m-b-32">
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-t-60">
|
||||||
|
<my-button type="primary" shape="circle" @tap="save">
|
||||||
|
<view class="u-font-32">
|
||||||
|
保存
|
||||||
|
</view>
|
||||||
|
</my-button>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<up-datetime-picker @cancel="timeCancel" @confirm="timeConfirm" :show="time.show" v-model="time.val" mode="time"></up-datetime-picker>
|
||||||
|
</view>
|
||||||
|
</up-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
watch,
|
||||||
|
onMounted,
|
||||||
|
computed
|
||||||
|
} from 'vue';
|
||||||
|
import infoBox from '@/commons/utils/infoBox.js'
|
||||||
|
const props = defineProps({
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
name: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const category =reactive({
|
||||||
|
useTime: 0,
|
||||||
|
saleEndTime:'',
|
||||||
|
saleStartTime:'',
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
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.val=key=='start'?category.saleStartTime:category.saleEndTime
|
||||||
|
time.show=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeShowRecoders(show) {
|
||||||
|
recoders.show = show
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = ref(props.item)
|
||||||
|
const emits = defineEmits(['update:show', 'save'])
|
||||||
|
const form = reactive({
|
||||||
|
note: ''
|
||||||
|
})
|
||||||
|
let popShow = ref(props.show)
|
||||||
|
let name = ref('')
|
||||||
|
|
||||||
|
watch(() => props.item.name, (newval) => {
|
||||||
|
name.value = newval
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(() => props.show, (newval) => {
|
||||||
|
popShow.value = newval
|
||||||
|
if (newval) {
|
||||||
|
data.value = props.item
|
||||||
|
console.log(props.item);
|
||||||
|
Object.assign(category,props.item)
|
||||||
|
console.log(props.item);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const isSku = computed(() => {
|
||||||
|
// return data.value.typeEnum == '多规格'
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
watch(() => popShow.value, (newval) => {
|
||||||
|
emits('update:show', newval)
|
||||||
|
})
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
popShow.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function open() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function save() {
|
||||||
|
if(category.useTime){
|
||||||
|
if(!category.saleStartTime){
|
||||||
|
return infoBox.showToast('请选择起始时间')
|
||||||
|
}
|
||||||
|
if(!category.saleEndTime){
|
||||||
|
return infoBox.showToast('请选择结束时间')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emits('save', {
|
||||||
|
...data.value,...category
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.box {
|
||||||
|
width: 600rpx;
|
||||||
|
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timesel {
|
||||||
|
border: 1px solid #eee;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.close {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.number {
|
||||||
|
color: #EE4646;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
<edit-sort @save="updataGroup" :item="popup.selData" v-model:show="popup.sort.show"></edit-sort>
|
<edit-sort @save="updataGroup" :item="popup.selData" v-model:show="popup.sort.show"></edit-sort>
|
||||||
<edit-name @save="updataGroup" :item="popup.selData" v-model:show="popup.name.show"></edit-name>
|
<edit-name @save="updataGroup" :item="popup.selData" v-model:show="popup.name.show"></edit-name>
|
||||||
|
<edit-time @save="updataGroup" :item="popup.selData" v-model:show="popup.time.show"></edit-time>
|
||||||
|
|
||||||
<up-action-sheet :round="10" @select="actionSelect" @close="actionsHide" cancelText="取消" :actions="actions.list"
|
<up-action-sheet :round="10" @select="actionSelect" @close="actionsHide" cancelText="取消" :actions="actions.list"
|
||||||
:show="actions.show"></up-action-sheet>
|
:show="actions.show"></up-action-sheet>
|
||||||
|
|
@ -44,6 +45,7 @@
|
||||||
import infoBox from "@/commons/utils/infoBox.js"
|
import infoBox from "@/commons/utils/infoBox.js"
|
||||||
import editSort from './components/edit-sort.vue';
|
import editSort from './components/edit-sort.vue';
|
||||||
import editName from './components/edit-name.vue';
|
import editName from './components/edit-name.vue';
|
||||||
|
import editTime from './components/edit-time.vue';
|
||||||
import {
|
import {
|
||||||
tbProductGroupGet,
|
tbProductGroupGet,
|
||||||
tbProductGroupDelete,
|
tbProductGroupDelete,
|
||||||
|
|
@ -66,7 +68,13 @@
|
||||||
name: '管理商品',
|
name: '管理商品',
|
||||||
color: '#333',
|
color: '#333',
|
||||||
fontSize: '16'
|
fontSize: '16'
|
||||||
}],
|
},
|
||||||
|
{
|
||||||
|
name: '售卖时间',
|
||||||
|
color: '#333',
|
||||||
|
fontSize: '16'
|
||||||
|
}
|
||||||
|
],
|
||||||
show: false,
|
show: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -82,6 +90,9 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (e.name == '售卖时间') {
|
||||||
|
return popupShow(actions.selIndex, 'time', true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function actionsHide() {
|
function actionsHide() {
|
||||||
|
|
@ -106,6 +117,9 @@
|
||||||
},
|
},
|
||||||
name:{
|
name:{
|
||||||
show: false
|
show: false
|
||||||
|
},
|
||||||
|
time:{
|
||||||
|
show: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -119,6 +133,7 @@
|
||||||
const res = await $productCategory.update(e)
|
const res = await $productCategory.update(e)
|
||||||
popup.sort.show = false;
|
popup.sort.show = false;
|
||||||
popup.name.show = false;
|
popup.name.show = false;
|
||||||
|
popup.time.show = false;
|
||||||
pageData.list[popup.selIndex] = e
|
pageData.list[popup.selIndex] = e
|
||||||
infoBox.showToast('更新成功')
|
infoBox.showToast('更新成功')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue