Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-07-17 18:29:45 +08:00
5 changed files with 2253 additions and 1295 deletions

View File

@@ -33,49 +33,51 @@
},
"dependencies": {
"@unocss/eslint-config": "^0.55.7",
"@vueuse/core": "^10.6.1",
"@vueuse/core": "^10.11.0",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
"axios": "^1.6.2",
"dayjs": "^1.11.10",
"echarts": "^5.4.3",
"axios": "^1.7.2",
"dayjs": "^1.11.11",
"echarts": "^5.5.1",
"file-saver": "^2.0.5",
"jszip": "^3.10.1",
"lodash-es": "^4.17.21",
"md-editor-v3": "^4.9.0",
"md-editor-v3": "^4.17.3",
"mockjs": "^1.1.0",
"pinia": "^2.1.7",
"vite": "^4.5.0",
"vite": "^4.5.3",
"vue": "3.3.4",
"vue-echarts": "^6.6.1",
"vue-router": "^4.2.5",
"vue-echarts": "^6.7.3",
"vue-router": "^4.4.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@iconify/json": "^2.2.150",
"@iconify/vue": "^4.1.1",
"@iconify/json": "^2.2.228",
"@iconify/vue": "^4.1.2",
"@unocss/preset-rem-to-px": "^0.55.7",
"@vitejs/plugin-vue": "^4.5.1",
"@vue/compiler-sfc": "^3.3.9",
"@vitejs/plugin-vue": "^4.6.2",
"@vue/compiler-sfc": "^3.4.32",
"@zclzone/eslint-config": "^0.0.4",
"chalk": "^5.3.0",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"cz-customizable": "^7.0.0",
"dotenv": "^16.3.1",
"cz-customizable": "^7.1.0",
"dotenv": "^16.4.5",
"esno": "^0.17.0",
"fs-extra": "^11.2.0",
"husky": "^8.0.3",
"lint-staged": "^13.3.0",
"naive-ui": "^2.35.0",
"rollup-plugin-visualizer": "^5.9.3",
"sass": "^1.69.5",
"naive-ui": "^2.39.0",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.77.8",
"unocss": "0.55.0",
"unplugin-auto-import": "^0.16.7",
"unplugin-icons": "^0.16.6",
"unplugin-vue-components": "^0.25.2",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-html": "^3.2.2",
"vite-plugin-mock": "^2.9.8",
"vite-plugin-svg-icons": "^2.0.1"
},

3383
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,4 +3,5 @@ import { request } from '@/utils'
export default {
getHotlist: (data) => request.post('/goods', data),
getHotStatus: (data) => request.post('/goods/process', data),
updateType: (data) => request.post('/goods/edit/activity', data),
}

View File

@@ -1,13 +1,48 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<CommonPage show-footer :title="$route.title">
<n-grid class="mb-10" x-gap="12">
<n-gi span="12" mt-10 flex items-center>
<span w-100>筛选条件:</span>
<n-input-group>
<n-select
v-model:value="queryParams.selectKey"
:style="{ width: '20%' }"
:options="selectOptions"
placeholder="请选择"
/>
<n-input v-model:value="queryParams.word" :style="{ width: '30%' }" />
</n-input-group>
</n-gi>
<n-gi span="24" mt-10 flex items-center>
<n-button type="primary" @click="getList">查询</n-button>
<n-button ml-10 @click="clear">重置</n-button>
</n-gi>
<n-gi span="24" mt-10 flex items-center>
<n-button strong secondary type="primary" @click="changeGoodsType(0)">
设为普通商品
</n-button>
<n-button strong secondary ml-10 type="warning" @click="changeGoodsType(1)">
设为活动商品
</n-button>
<n-button strong secondary ml-10 type="info" @click="changeGoodsType(2)">
设为兑换商品
</n-button>
<n-button strong secondary ml-10 type="error" @click="changeGoodsType(3)">
设为摇球机活动商品
</n-button>
</n-gi>
</n-grid>
<n-data-table
:loading="loading"
:columns="columns"
:data="data"
:pagination="pagination"
:bordered="false"
:row-key="(row) => row.gid"
remote
@update:checked-row-keys="handleCheck"
/>
<!-- 拒绝 -->
<n-modal v-model:show="isNoteModel">
@@ -152,7 +187,7 @@
<script setup>
import api from './api'
import { NButton, NImage, NSpace, NEllipsis } from 'naive-ui'
import { NButton, NImage, NSpace, NEllipsis, NTag } from 'naive-ui'
import { h, withDirectives, resolveDirective } from 'vue'
const vPerms = resolveDirective('perms')
@@ -171,6 +206,33 @@ const notesVal = ref('')
const formRef = ref(null)
const selectOptions = ref([
{
label: '商品名称',
value: 0,
},
])
const queryParams = ref({
selectKey: 0,
word: '',
checkedRowKeysRef: [],
})
const handleCheck = (row) => {
queryParams.value.checkedRowKeysRef = row
}
const changeGoodsType = async (type) => {
if (queryParams.value.checkedRowKeysRef.length === 0) return $message.info('没有选中商品')
await api.updateType({
type: type,
gid: queryParams.value.checkedRowKeysRef,
})
getList()
queryParams.value.checkedRowKeysRef = []
}
const rules = {
pulse: {
required: true,
@@ -202,6 +264,9 @@ const nowRow = ref({})
const nowKey = ref(null)
const columns = ref([
{
type: 'selection',
},
{
title: '商品名称',
slot: 'name',
@@ -243,6 +308,40 @@ const columns = ref([
)
},
},
{
title: '商品类型',
slot: 'type',
align: 'center',
render(row) {
const obj = {
0: {
type: 'success',
text: '普通商品',
},
1: {
type: 'warning',
text: '活动商品',
},
2: {
type: 'info',
text: '兑换商品',
},
3: {
type: 'error',
text: '摇球机活动商品',
},
}
return h(
NTag,
{
type: obj[row.type].type,
},
{
default: () => obj[row.type].text,
}
)
},
},
{
title: '商品价格(元)',
key: 'number',
@@ -411,6 +510,7 @@ const getList = async () => {
const res = await api.getHotlist({
pageNum: pagination.value.page,
pageSize: pagination.value.pageSize,
name: queryParams.value.word,
})
data.value = res.data.data || []
pagination.value.itemCount = res.data.total

View File

@@ -85,6 +85,7 @@
<n-button v-perms="['/admin/qrcode/edit']" mr-10 type="warning" @click="openModal(2)">
修改二维码
</n-button>
<n-button mr-10 type="info" @click="saveCode">下载二维码</n-button>
<!-- <n-button mr-10 type="primary" @click="openModal(1)">新增二维码</n-button> -->
<!-- <n-button mr-10 type="warning" @click="openModal(3)">修改二维码</n-button> -->
<n-button type="primary" @click="getList">搜索</n-button>
@@ -147,6 +148,8 @@
<script setup>
import { NButton } from 'naive-ui'
import JSZip from 'jszip'
import { saveAs } from 'file-saver'
import api from '../api'
import { ref, resolveDirective, withDirectives } from 'vue'
@@ -464,6 +467,27 @@ const handleValidateClick = (e) => {
}
})
}
// 下载二维码
const saveCode = async () => {
if (checkedRowKeysRef.value.length === 0) return $message.error('请选择二维码')
const zip = new JSZip()
data.value.forEach((item) => {
checkedRowKeysRef.value.forEach((id) => {
if (item.qid === id) {
const imageData = item.url.split(',')[1]
zip.file(`${item.qid}.png`, imageData, {
base64: true,
})
}
})
})
const content = await zip.generateAsync({ type: 'blob' })
saveAs(content, '二维码.zip')
}
</script>
<style lang="scss" scoped></style>