同步代码
This commit is contained in:
231
pageGoodsGroup/index/components/category.vue
Normal file
231
pageGoodsGroup/index/components/category.vue
Normal file
@@ -0,0 +1,231 @@
|
||||
<template>
|
||||
<view class=" goods">
|
||||
<view class="u-flex u-font-24 u-col-center u-row-between u-p-b-16 border-bottom">
|
||||
<view class="u-flex u-col-center">
|
||||
<view class="u-font-24">
|
||||
<text>排序</text>
|
||||
<text class="u-m-l-12">{{data.sort}}</text>
|
||||
</view>
|
||||
<view class="u-flex u-m-l-16 " @click="editSort">
|
||||
<image src="/pageGoodsGroup/static/image/icon-edit.svg" class="icon-edit" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class="u-m-r-14 color-999">是否启用</view>
|
||||
<up-switch :activeValue="1" :inactiveValue="0" v-model="isShow" @change="isShowChange" :size="18"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24 u-p-l-54 ">
|
||||
<view class="u-flex-1 u-flex u-col-top">
|
||||
<view class="color-666 no-wrap">分组名</view>
|
||||
<view class="color-333 u-m-l-60">{{data.name}}</view>
|
||||
<view class="u-flex u-m-l-16 " @click="editName">
|
||||
<image src="/pageGoodsGroup/static/image/icon-edit.svg" class="icon-edit" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-24">
|
||||
<view class="color-666">售卖时间</view>
|
||||
<view class="color-main u-m-l-32" v-if="data.saleStartTime&&data.saleEndTime">
|
||||
<text>{{data.saleStartTime}}</text>
|
||||
<text>-</text>
|
||||
<text>{{data.saleEndTime}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-24 u-flex u-row-right">
|
||||
<view class="btn-default btn" @click="del">删除</view>
|
||||
<view class="btn-primary btn u-m-l-38" @click="toEdit">编辑</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
watchEffect
|
||||
} from 'vue';
|
||||
import mySwitch from '@/components/my-components/my-switch.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
ColorMain
|
||||
} from '@/commons/color.js'
|
||||
|
||||
const emits = defineEmits(['changeClick','edit', 'editName','editSort', 'del', 'isShowChange'])
|
||||
|
||||
const props = defineProps({
|
||||
index: {
|
||||
type: Number
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
isShow:true
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
let isShow = ref(props.data.isShow)
|
||||
|
||||
function isShowChange() {
|
||||
console.log(isShow.value);
|
||||
emits('isShowChange', {
|
||||
...props.data,
|
||||
isShow: isShow.value
|
||||
})
|
||||
}
|
||||
|
||||
let isSellNone = ref(true)
|
||||
isSellNone.value = props.isSellNone
|
||||
|
||||
function isSellNoneChange() {
|
||||
console.log(isSellNone.value);
|
||||
console.log('isSellNoneChange');
|
||||
}
|
||||
|
||||
let checked = ref(false)
|
||||
|
||||
function radioClick() {
|
||||
console.log(props.index);
|
||||
emits('radioClick', props.index)
|
||||
}
|
||||
|
||||
function changeClick() {
|
||||
emits('changeClick', props.index)
|
||||
}
|
||||
|
||||
function useTypeClick() {
|
||||
emits('useTypeClick', props.index)
|
||||
}
|
||||
function del() {
|
||||
emits('del', props.index)
|
||||
}
|
||||
function editName() {
|
||||
emits('editName', props.index)
|
||||
}
|
||||
//携带参数type edit跳转到商品添加页面,编辑与添加同一页面,根据type值来判断
|
||||
function editSort() {
|
||||
emits('editSort', props.index)
|
||||
}
|
||||
function toEdit() {
|
||||
emits('edit', props.index)
|
||||
// uni.setStorageSync('cateItem', props.data)
|
||||
// go.to('PAGES_CATEGORY_EDIT', {
|
||||
// type: 'edit',
|
||||
// })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$imgSize: 126rpx;
|
||||
$price-color: #F02C45;
|
||||
|
||||
.btn {
|
||||
padding: 6rpx 28rpx;
|
||||
border-radius: 100rpx;
|
||||
font-size: 24rpx;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
border-color: $my-main-color;
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
.btn-default {
|
||||
border-color: #999;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: $price-color;
|
||||
}
|
||||
|
||||
.h-100 {
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: $imgSize;
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.icon-arrow-right {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.stock {
|
||||
padding-right: 46rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.icon-edit {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
|
||||
.stock::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
display: block;
|
||||
width: 16rpx;
|
||||
border: 2rpx solid #333333;
|
||||
}
|
||||
|
||||
.goods {
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
background-color: #fff;
|
||||
padding: 32rpx 28rpx 32rpx 28rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.skus {
|
||||
background: #F9F9F9;
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
padding: 28rpx 42rpx;
|
||||
|
||||
.sku {
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
padding: 6rpx 40rpx;
|
||||
}
|
||||
|
||||
.skds {
|
||||
gap: 10rpx 50rpx;
|
||||
}
|
||||
|
||||
.skd {
|
||||
padding: 14rpx 40rpx;
|
||||
background: #F0F2F5;
|
||||
border-radius: 4rpx;
|
||||
position: relative;
|
||||
color: #666;
|
||||
overflow: hidden;
|
||||
|
||||
.tag {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
font-size: 12rpx;
|
||||
right: 0;
|
||||
padding: 2rpx 4rpx;
|
||||
border-radius: 0rpx 4rpx 4rpx 4rpx;
|
||||
}
|
||||
|
||||
.tag-primary {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
128
pageGoodsGroup/index/components/edit-name.vue
Normal file
128
pageGoodsGroup/index/components/edit-name.vue
Normal file
@@ -0,0 +1,128 @@
|
||||
<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>修改分组名称:</view>
|
||||
<view class="u-m-t-38">
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="name">
|
||||
</up-input>
|
||||
</view>
|
||||
</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>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit
|
||||
} from '@/http/yskApi/goods.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
name:''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
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
|
||||
}
|
||||
})
|
||||
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() {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
name:name.value
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 556rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
128
pageGoodsGroup/index/components/edit-sort.vue
Normal file
128
pageGoodsGroup/index/components/edit-sort.vue
Normal file
@@ -0,0 +1,128 @@
|
||||
<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>修改排序:</view>
|
||||
<view class="u-m-t-38">
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="sort">
|
||||
</up-input>
|
||||
</view>
|
||||
</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>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit
|
||||
} from '@/http/yskApi/goods.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
sort:''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
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 sort=ref('')
|
||||
|
||||
watch(()=>props.item.sort,(newval)=>{
|
||||
sort.value=newval
|
||||
})
|
||||
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = 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() {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
sort:sort.value
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 556rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
183
pageGoodsGroup/index/components/edit-time.vue
Normal file
183
pageGoodsGroup/index/components/edit-time.vue
Normal file
@@ -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>
|
||||
Reference in New Issue
Block a user