127 lines
3.1 KiB
Vue
127 lines
3.1 KiB
Vue
<template>
|
||
<view class="item">
|
||
<view class="u-flex u-row-between">
|
||
<view>#{{index+1}} {{data.name}}</view>
|
||
<view class="color-666 u-font-24 id">ID:{{data.id}}</view>
|
||
</view>
|
||
<view class="u-m-t-16 color-666 u-font-24 u-p-b-20 border-bottom">
|
||
添加时间:
|
||
<uni-dateformat :date="data.createdAt"></uni-dateformat>
|
||
</view>
|
||
<view class="u-m-t-20">
|
||
<view v-for="(spec,specIndex) in data.specList" :key="specIndex">
|
||
<view class="font-bold"> {{spec.name}}</view>
|
||
<view class="u-m-t-16 bg-gray u-flex u-flex-wrap options u-p-20">
|
||
<view class="u-flex option" v-for="(option,optionIndex) in spec.value" :key="optionIndex" @tap="statusClick(optionIndex)">
|
||
{{option}}
|
||
<!-- <view class="sellout" v-if="option.sellOut">已售罄</view>
|
||
<view class="tag-primary tag" v-if="option.status">上架中</view>
|
||
<view class="tag-gray tag" v-else>上架中</view> -->
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
</view>
|
||
<view class="u-m-t-20 u-flex u-row-right btns">
|
||
<my-button @tap="del" :plain="btnProps.plain" :fontSize="btnProps.fontSize" :width="btnProps.width" :height="btnProps.height" type="cancel" :shape="btnProps.shape" >删除</my-button>
|
||
<my-button @tap="edit" :plain="btnProps.plain" :fontSize="btnProps.fontSize" :width="btnProps.width" :height="btnProps.height" :shape="btnProps.shape">编辑</my-button>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { reactive, ref } from 'vue';
|
||
import myButton from "@/components/my-components/my-button.vue"
|
||
import go from '@/commons/utils/go.js'
|
||
const props=defineProps({
|
||
index:{
|
||
type:Number,
|
||
},
|
||
data:{
|
||
type:Object,
|
||
default:()=>{
|
||
return {}
|
||
}
|
||
}
|
||
})
|
||
const emits=defineEmits(['del','edit','statusClick'])
|
||
function del(){
|
||
emits('del',props.index)
|
||
}
|
||
function edit(){
|
||
uni.$emit('edit:spec',props.data)
|
||
uni.setStorageSync('spec',props.data)
|
||
go.to('PAGES_PRODUCT_GUIGE_ADD', {
|
||
type: 'edit'
|
||
})
|
||
// emits('edit',props.index)
|
||
}
|
||
function statusClick(optionIndex){
|
||
emits('statusClick',[props.index,optionIndex])
|
||
}
|
||
const btnProps=reactive({
|
||
shape:'circle',
|
||
width:120,
|
||
height:48,
|
||
fontSize:24,
|
||
plain:true
|
||
})
|
||
|
||
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.btns{
|
||
gap: 0 20rpx;
|
||
}
|
||
.item{
|
||
background: #FFFFFF;
|
||
padding: 30rpx;
|
||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||
margin-bottom: 30rpx;
|
||
.id{
|
||
background: #F4F4F4;
|
||
padding: 6rpx 10rpx;
|
||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||
}
|
||
.options{
|
||
gap: 10rpx 50rpx;
|
||
.option{
|
||
padding: 24rpx 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;
|
||
}
|
||
.sellout{
|
||
position: absolute;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
background-color: rgb(147, 147, 153);
|
||
color: #fff;
|
||
text-align: center;
|
||
font-size: 20rpx;
|
||
}
|
||
.tag-primary{
|
||
background-color: $my-main-color;
|
||
color: #fff;
|
||
}
|
||
.tag-gray{
|
||
background-color: rgb(147, 147, 153);
|
||
color: #fff;
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
</style> |