release(custom): i

This commit is contained in:
2023-10-10 15:01:00 +08:00
parent a9707c6d94
commit 5b33290de6
78 changed files with 13003 additions and 5230 deletions

View File

@@ -8,33 +8,214 @@
:bordered="false"
remote
/>
<!-- 拒绝 -->
<n-modal v-model:show="isNoteModel">
<n-card
style="width: 500px"
title="拒绝信息"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<n-input v-model:value="notesVal" type="textarea" placeholder="请输入拒绝理由...." />
<div m-auto p-10>
<n-button type="primary" @click="veeify">确定</n-button>
<n-button ml-10 @click="clear">取消</n-button>
</div>
</n-card>
</n-modal>
<!-- 豆子设置 -->
<n-modal v-model:show="isDzModel">
<n-card
style="width: 500px"
title="赠送/比例"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<n-form ref="formRef" :model="nowRow" :rules="rules" label-placement="left">
<n-grid :cols="24">
<n-form-item-gi :span="20" label="赠送豆子" path="pulse_number">
<n-input-number
v-model:value="nowRow.pulse_number"
clearable
:precision="2"
placeholder="请输入赠送豆子数量...."
/>
</n-form-item-gi>
<n-form-item-gi :span="20" label="赠送积分" path="integral">
<n-input-number
v-model:value="nowRow.integral"
clearable
:precision="2"
placeholder="请输入赠送积分数量...."
/>
</n-form-item-gi>
<n-form-item-gi :span="18" label="分佣类型" path="commission_type">
<n-select
v-model:value="nowRow.commission_type"
placeholder="请选择分佣类型"
clearable
:options="[
{
label: '百分比',
value: 1,
},
{
label: '数值',
value: 2,
},
]"
/>
</n-form-item-gi>
<n-form-item-gi :span="20" label="分佣比例" path="commission">
<n-input-number
v-model:value="nowRow.commission"
clearable
placeholder="请输入分佣比例...."
/>
</n-form-item-gi>
<n-form-item-gi :span="12">
<div m-auto p-10>
<n-button type="primary" @click="veeify">确定</n-button>
<n-button ml-10 @click="clear">取消</n-button>
</div>
</n-form-item-gi>
</n-grid>
</n-form>
</n-card>
</n-modal>
<!-- 商品详情 -->
<n-drawer v-model:show="showDrawer" :width="502">
<n-drawer-content title="商品详情" closable>
<n-space vertical>
<div>
<span>商品分类</span>
<span>{{ goodInfo.class_name }}</span>
</div>
<div>
<span>商品名称</span>
<span>{{ goodInfo.name }}</span>
</div>
<div flex items-center>
<span>封面</span>
<n-image width="100" :src="goodInfo.cover" />
</div>
<div flex items-center>
<span>轮播图</span>
<div w-400 overflow-auto>
<n-image
v-for="(url, index) in goodInfo.rotation?.split(',')"
:key="index"
width="100"
:src="url"
/>
</div>
</div>
<div>
<span>商品价格</span>
<span>{{ goodInfo.number }}</span>
</div>
<div>
<span>市场价格</span>
<span>{{ goodInfo.market_num }}</span>
</div>
<div>
<span>商品库存</span>
<span>{{ goodInfo.stock }}</span>
</div>
<div>
<span>商品简介</span>
<span>{{ goodInfo.profile }}</span>
</div>
<div>
<span>商品详情</span>
<div v-html="goodInfo.details"></div>
</div>
</n-space>
</n-drawer-content>
</n-drawer>
</CommonPage>
</template>
<script setup>
import api from './api'
import { NDropdown, NButton } from 'naive-ui'
import { h } from 'vue'
import { NButton, NImage, NSpace, NEllipsis } from 'naive-ui'
import { h, withDirectives, resolveDirective } from 'vue'
const vPerms = resolveDirective('perms')
const loading = ref(false)
const isNoteModel = ref(false)
const isDzModel = ref(false)
const goodInfo = ref({})
const showDrawer = ref(false)
const notesVal = ref('')
const formRef = ref(null)
const rules = {
pulse_number: {
required: true,
type: 'number',
message: '请输入赠送豆子数量',
trigger: 'blur',
},
integral: {
required: true,
type: 'number',
message: '请输入赠送积分数量',
trigger: 'blur',
},
commission_type: {
required: true,
type: 'number',
message: '请选择分佣类型',
trigger: 'change',
},
commission: {
required: true,
type: 'number',
message: '请输入分佣比例',
trigger: 'blur',
},
}
const nowRow = ref({})
const nowKey = ref(null)
const columns = ref([
{
title: '商品名称',
key: 'name',
slot: 'name',
align: 'center',
render: (row) => {
return h(
NEllipsis,
{
style: 'max-width: 200px',
},
{
default: () => row.name,
}
)
},
},
{
title: '商品封面',
slot: 'cover',
align: 'center',
render(row) {
return h('img', {
return h(NImage, {
src: row.cover,
style: {
width: '30px',
height: '30px',
},
width: '30',
})
},
},
@@ -44,7 +225,7 @@ const columns = ref([
align: 'center',
},
{
title: '商品价格',
title: '商品价格(元)',
key: 'number',
align: 'center',
},
@@ -53,52 +234,130 @@ const columns = ref([
key: 'stock',
align: 'center',
},
{
title: '赠送豆子',
key: 'pulse_number',
align: 'center',
},
{
title: '赠送积分',
key: 'integral',
align: 'center',
},
{
title: '分佣类型',
slot: 'commission_type',
align: 'center',
render(row) {
return row.commission_type === 1 ? '百分比' : '数值'
},
},
{
title: '分佣比例',
key: 'commission',
align: 'center',
},
{
title: '商品状态',
slot: 'status',
align: 'center',
render(row) {
return row.status === 0 ? '待审核' : row.status === 1 ? '已审核' : '已拒绝'
return row.status === 3 ? '待审核' : row.status === 1 ? '已审核' : '已拒绝'
},
},
{
title: '备注',
key: 'notes',
align: 'center',
},
{
title: '操作',
slot: 'action',
align: 'center',
render(row) {
const el = []
if (row.status === 0) {
el.push(
let el = []
if (row.status === 3) {
el = [
h(
NDropdown,
NSpace,
{
trigger: 'click',
options: [
{
label: '审核',
key: 1,
},
{
label: '拒绝',
key: 2,
},
],
onSelect: (key) => {
veeify(key, row)
},
justify: 'center',
},
() =>
h(
NButton,
{
type: 'primary',
text: true,
{
default: () => [
withDirectives(
h(
NButton,
{
type: 'primary',
text: true,
onClick: () => {
nowKey.value = 1
nowRow.value = { ...row }
veeify()
},
},
() => '审核通过'
),
[[vPerms, ['/admin/goods/process']]]
),
withDirectives(
h(
NButton,
{
type: 'error',
text: true,
onClick: () => {
nowKey.value = 2
nowRow.value = { ...row }
isNoteModel.value = true
},
},
() => '审核拒绝'
),
[[vPerms, ['/admin/goods/process']]]
),
withDirectives(
h(
NButton,
{
type: 'warning',
text: true,
onClick: () => {
nowKey.value = 3
goodInfo.value = { ...row }
showDrawer.value = true
},
},
() => '商品详情'
),
[[vPerms, ['/admin/goods/process']]]
),
],
}
),
]
} else {
el = [
withDirectives(
h(
NButton,
{
type: 'info',
text: true,
onClick: () => {
nowRow.value = { ...row }
nowKey.value = 3
isDzModel.value = true
},
() => '审核'
)
)
)
},
{
default: () => '赠送/比例',
}
),
[[vPerms, ['/admin/goods/process']]]
),
]
}
return el
@@ -109,9 +368,9 @@ const columns = ref([
const data = ref([])
const pagination = ref({
current: 1,
page: 1,
pageSize: 10,
itamCount: 0,
itemCount: 0,
onChange: (page) => {
pagination.value.page = page
getList()
@@ -131,24 +390,47 @@ const getList = async () => {
loading.value = true
try {
const res = await api.getHotlist({
pageNum: pagination.value.current,
pageNum: pagination.value.page,
pageSize: pagination.value.pageSize,
})
console.log(res)
data.value = res.data.data || []
pagination.value.itemCount = res.data.total
} catch (error) {
$message.error(error.msg)
}
loading.value = false
}
const veeify = async (key, row) => {
const res = await api.getHotStatus({
gid: row.gid,
status: key,
})
console.log(res)
getList()
const clear = () => {
isNoteModel.value = false
isDzModel.value = false
notesVal.value = ''
nowRow.value = {}
}
const veeify = async () => {
let data = {}
if (nowKey.value === 1 || nowKey.value === 2) {
data = {
gid: nowRow.value.gid,
status: nowKey.value,
notes: notesVal.value,
}
await api.getHotStatus(data)
await getList()
clear()
} else {
formRef.value?.validate(async (errors) => {
if (!errors) {
data = {
...nowRow.value,
}
await api.getHotStatus(data)
await getList()
clear()
}
})
}
}
</script>