新功能
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "fuintAdmin",
|
"name": "fuintAdmin",
|
||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
"description": "fuint会员营销系统后台管理端",
|
"description": "手工王国后台管理端",
|
||||||
"author": "FSQ",
|
"author": "FSQ",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -99,3 +99,11 @@ export function updateBookItemStatus(id, status) {
|
|||||||
data: data,
|
data: data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 预约订单详情
|
||||||
|
export function getBookItemInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: `backendApi/bookItem/info/${id}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
30
src/api/look.js
Normal file
30
src/api/look.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 分页查询看看作品
|
||||||
|
export function getLookList(query) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/look/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询作品详情
|
||||||
|
export function getLookInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/look/info/' + id,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新状态
|
||||||
|
export function updateLookStatus(id, status) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/look/updateStatus',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
id,
|
||||||
|
status,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 分页查询积分明细列表
|
// 分页查询银币明细列表
|
||||||
export function getPointList(query) {
|
export function getPointList(query) {
|
||||||
return request({
|
return request({
|
||||||
url: 'backendApi/point/list',
|
url: 'backendApi/point/list',
|
||||||
|
|||||||
84
src/api/raffle.js
Normal file
84
src/api/raffle.js
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getRaffleList(query) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/raffle/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRaffleDetail(id) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/raffle/info',
|
||||||
|
method: 'get',
|
||||||
|
params: { id },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateRaffleStatus(id, status) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/raffle/change',
|
||||||
|
method: 'get',
|
||||||
|
params: { id, status },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function saveRaffle(data) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/raffle/save',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRaffleRecords(query) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/raffle/detail',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function dealRaffle(id) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/raffle/deal',
|
||||||
|
method: 'get',
|
||||||
|
params: { id },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 抽奖类型列表
|
||||||
|
export function getRaffleTypeList(query) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/raffleType/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 抽奖类型详情
|
||||||
|
export function getRaffleTypeInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: `backendApi/raffleType/info/${id}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存抽奖类型
|
||||||
|
export function saveRaffleType(data) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/raffleType/save',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新抽奖类型状态
|
||||||
|
export function updateRaffleTypeStatus(typeId, status) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/raffleType/updateStatus',
|
||||||
|
method: 'post',
|
||||||
|
data: { typeId, status },
|
||||||
|
})
|
||||||
|
}
|
||||||
67
src/api/task.js
Normal file
67
src/api/task.js
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 分页查询任务列表
|
||||||
|
export function getTaskList(query) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/task/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询任务信息
|
||||||
|
export function getTaskInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/task/info/' + id,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新任务状态
|
||||||
|
export function updateTaskStatus(id, status) {
|
||||||
|
const data = {
|
||||||
|
id,
|
||||||
|
status,
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/task/updateStatus',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存任务
|
||||||
|
export function saveTask(data) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/task/save',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询公共任务列表(merchant_id=0,store_id=0)
|
||||||
|
export function getPublicTaskList(query) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/task/publicList',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导入公共任务
|
||||||
|
export function importPublicTask(data) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/task/importPublic',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询任务完成记录
|
||||||
|
export function getTaskRecordList(query) {
|
||||||
|
return request({
|
||||||
|
url: 'backendApi/task/recordList',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 184 KiB |
@ -83,6 +83,10 @@ export default {
|
|||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
role() {
|
role() {
|
||||||
|
const roles = this.$store.getters.roles || []
|
||||||
|
if (roles.includes('admin')) {
|
||||||
|
return '系统管理员'
|
||||||
|
}
|
||||||
if (this.$store.getters.storeName && this.$store.getters.storeId) {
|
if (this.$store.getters.storeName && this.$store.getters.storeId) {
|
||||||
return '店铺管理员'
|
return '店铺管理员'
|
||||||
}
|
}
|
||||||
|
|||||||
7
src/utils/image.js
Normal file
7
src/utils/image.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export const resolveImageUrl = (base, path) => {
|
||||||
|
if (!path) return ''
|
||||||
|
if (/^https?:\/\//i.test(path)) {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
return (base || '') + path
|
||||||
|
}
|
||||||
5
src/utils/upload.js
Normal file
5
src/utils/upload.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export const getUploadFileName = (res) => {
|
||||||
|
if (!res) return ''
|
||||||
|
const data = res.data || res.result || res
|
||||||
|
return data.fileName || data.file || data.path || data.url || ''
|
||||||
|
}
|
||||||
@ -60,7 +60,7 @@
|
|||||||
/>
|
/>
|
||||||
<el-table-column label="图片" align="center" width="200">
|
<el-table-column label="图片" align="center" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<img class="list-img" :src="imagePath + scope.row.logo" />
|
<img class="list-img" :src="getImageUrl(scope.row.logo)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="排序" align="center" prop="sort">
|
<el-table-column label="排序" align="center" prop="sort">
|
||||||
@ -179,6 +179,11 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
if (!path) return ''
|
||||||
|
if (/^https?:\/\//i.test(path)) return path
|
||||||
|
return (this.imagePath || '') + path
|
||||||
|
},
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.innerShowDialog = false
|
this.innerShowDialog = false
|
||||||
},
|
},
|
||||||
|
|||||||
@ -60,7 +60,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="this.form.logo"
|
v-if="this.form.logo"
|
||||||
:src="imagePath + this.form.logo"
|
:src="getImageUrl(this.form.logo)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i v-if="!this.form.logo" class="el-icon-plus"></i>
|
<i v-if="!this.form.logo" class="el-icon-plus"></i>
|
||||||
@ -108,6 +108,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { saveBookCate } from '@/api/book'
|
import { saveBookCate } from '@/api/book'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
export default {
|
export default {
|
||||||
name: 'bookCateForm',
|
name: 'bookCateForm',
|
||||||
props: {
|
props: {
|
||||||
@ -179,6 +180,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
if (!path) return ''
|
||||||
|
if (/^https?:\/\//i.test(path)) return path
|
||||||
|
return (this.imagePath || '') + path
|
||||||
|
},
|
||||||
// 提交
|
// 提交
|
||||||
doSubmit() {
|
doSubmit() {
|
||||||
const app = this
|
const app = this
|
||||||
@ -195,8 +201,10 @@ export default {
|
|||||||
this.$emit('closeDialog', 'bookCateDialog')
|
this.$emit('closeDialog', 'bookCateDialog')
|
||||||
},
|
},
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.form.logo = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.form.logo = fileName
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,7 +79,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="this.form.logo"
|
v-if="this.form.logo"
|
||||||
:src="imagePath + this.form.logo"
|
:src="getImageUrl(this.form.logo)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i v-if="!this.form.logo" class="el-icon-plus"></i>
|
<i v-if="!this.form.logo" class="el-icon-plus"></i>
|
||||||
@ -105,22 +105,13 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="可预约时段" prop="dates">
|
<el-form-item label="可预约时段" prop="dates">
|
||||||
<div class="add-item">
|
<div class="time-item">
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
size="mini"
|
|
||||||
icon="el-icon-plus"
|
|
||||||
@click="addTime()"
|
|
||||||
>添加</el-button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<div class="time-item" v-for="(time, index) in times">
|
|
||||||
<el-time-select
|
<el-time-select
|
||||||
placeholder="起始时间"
|
placeholder="起始时间"
|
||||||
v-model="time.startTime"
|
v-model="timeRange.startTime"
|
||||||
:picker-options="{
|
:picker-options="{
|
||||||
start: '00:00',
|
start: '00:00',
|
||||||
step: '00:15',
|
step: '00:30',
|
||||||
end: '23:59',
|
end: '23:59',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
@ -128,27 +119,61 @@
|
|||||||
-
|
-
|
||||||
<el-time-select
|
<el-time-select
|
||||||
placeholder="结束时间"
|
placeholder="结束时间"
|
||||||
v-model="time.endTime"
|
v-model="timeRange.endTime"
|
||||||
:picker-options="{
|
:picker-options="{
|
||||||
start: '06:00',
|
start: '00:00',
|
||||||
step: '00:15',
|
step: '00:30',
|
||||||
end: '23:59',
|
end: '23:59',
|
||||||
minTime: time.startTime,
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
</el-time-select>
|
</el-time-select>
|
||||||
-
|
-
|
||||||
<el-input-number
|
<el-input-number
|
||||||
style="width: 120px"
|
style="width: 120px"
|
||||||
v-model="time.num"
|
v-model="timeRange.num"
|
||||||
:min="0"
|
:min="1"
|
||||||
/>
|
/>
|
||||||
|
<span class="unit">人</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-tips">提示:只需设置一个可预约时间范围(例如 10:00-22:00)</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="预约费用" prop="priceRules">
|
||||||
|
<div class="add-item">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="mini"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="addPriceRule()"
|
||||||
|
>添加费用</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="time-item" v-for="(rule, index) in priceRules" :key="index">
|
||||||
|
<el-input-number
|
||||||
|
style="width: 140px"
|
||||||
|
v-model="rule.hours"
|
||||||
|
:min="0"
|
||||||
|
:precision="1"
|
||||||
|
controls-position="right"
|
||||||
|
/>
|
||||||
|
<span class="unit">小时</span>
|
||||||
|
<el-input-number
|
||||||
|
style="width: 140px; margin-left: 10px"
|
||||||
|
v-model="rule.price"
|
||||||
|
:min="0"
|
||||||
|
:precision="2"
|
||||||
|
controls-position="right"
|
||||||
|
/>
|
||||||
|
<span class="unit">元</span>
|
||||||
<span
|
<span
|
||||||
class="remove-item el-icon-remove"
|
class="remove-item el-icon-remove"
|
||||||
@click="removeTime(index)"
|
@click="removePriceRule(index)"
|
||||||
></span>
|
></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-tips">提示:请填写起始时段、可预约上限人数</div>
|
<div class="form-tips">提示:可配置任意时长与费用(如 1小时/5元、2小时/8元、7小时/13元)</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -191,6 +216,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { saveBook } from '@/api/book'
|
import { saveBook } from '@/api/book'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
export default {
|
export default {
|
||||||
name: 'bookForm',
|
name: 'bookForm',
|
||||||
props: {
|
props: {
|
||||||
@ -229,24 +255,28 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.form.serviceTimes) {
|
if (this.form.serviceTimes) {
|
||||||
const times = this.form.serviceTimes.split(',')
|
const times = this.form.serviceTimes.split(',')
|
||||||
let timeArr = []
|
const first = times[0].split('-')
|
||||||
for (let i = 0; i < times.length; i++) {
|
if (first && first.length >= 2) {
|
||||||
let am = times[i].split('-')
|
this.timeRange = {
|
||||||
if (am && am.length == 3) {
|
startTime: first[0],
|
||||||
let item = { startTime: am[0], endTime: am[1], num: am[2] }
|
endTime: first[1],
|
||||||
timeArr.push(item)
|
num: first[2] ? Number(first[2]) : 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (timeArr.length > 0) {
|
|
||||||
this.times = timeArr
|
|
||||||
}
|
|
||||||
} else if (this.form.id) {
|
} else if (this.form.id) {
|
||||||
this.times = []
|
this.timeRange = { startTime: '', endTime: '', num: 1 }
|
||||||
} else {
|
} else {
|
||||||
this.times = [
|
this.timeRange = { startTime: '10:00', endTime: '22:00', num: 1 }
|
||||||
{ startTime: '08:30', endTime: '12:00', num: 1 },
|
}
|
||||||
{ startTime: '14:00', endTime: '18:00', num: 1 },
|
if (this.form.priceRules) {
|
||||||
]
|
try {
|
||||||
|
const parsed = JSON.parse(this.form.priceRules)
|
||||||
|
this.priceRules = Array.isArray(parsed) ? parsed : []
|
||||||
|
} catch (e) {
|
||||||
|
this.priceRules = []
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.priceRules = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -255,10 +285,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
dates: [],
|
dates: [],
|
||||||
times: [
|
timeRange: { startTime: '10:00', endTime: '22:00', num: 1 },
|
||||||
{ startTime: '08:30', endTime: '12:00', num: 1 },
|
priceRules: [],
|
||||||
{ startTime: '14:00', endTime: '18:00', num: 1 },
|
|
||||||
],
|
|
||||||
total: 0,
|
total: 0,
|
||||||
// 上传地址
|
// 上传地址
|
||||||
uploadAction: process.env.VUE_APP_SERVER_URL + 'backendApi/file/upload',
|
uploadAction: process.env.VUE_APP_SERVER_URL + 'backendApi/file/upload',
|
||||||
@ -282,16 +310,34 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
if (!path) return ''
|
||||||
|
if (/^https?:\/\//i.test(path)) return path
|
||||||
|
return (this.imagePath || '') + path
|
||||||
|
},
|
||||||
|
addPriceRule() {
|
||||||
|
this.priceRules.push({ hours: 1, price: 0 })
|
||||||
|
},
|
||||||
|
removePriceRule(index) {
|
||||||
|
this.priceRules.splice(index, 1)
|
||||||
|
},
|
||||||
// 提交
|
// 提交
|
||||||
doSubmit() {
|
doSubmit() {
|
||||||
const app = this
|
const app = this
|
||||||
let param = app.form
|
let param = app.form
|
||||||
param.times = app.times
|
param.times = [
|
||||||
|
{
|
||||||
|
startTime: app.timeRange.startTime,
|
||||||
|
endTime: app.timeRange.endTime,
|
||||||
|
num: app.timeRange.num,
|
||||||
|
},
|
||||||
|
]
|
||||||
if (app.dates && app.dates.length > 0) {
|
if (app.dates && app.dates.length > 0) {
|
||||||
param.dates = app.dates.toString()
|
param.dates = app.dates.toString()
|
||||||
} else {
|
} else {
|
||||||
param.dates = ''
|
param.dates = ''
|
||||||
}
|
}
|
||||||
|
param.priceRules = app.priceRules && app.priceRules.length > 0 ? JSON.stringify(app.priceRules) : ''
|
||||||
saveBook(param).then((response) => {
|
saveBook(param).then((response) => {
|
||||||
if (response) {
|
if (response) {
|
||||||
app.$modal.msgSuccess('提交成功!')
|
app.$modal.msgSuccess('提交成功!')
|
||||||
@ -305,21 +351,10 @@ export default {
|
|||||||
this.$emit('closeDialog', 'bookDialog')
|
this.$emit('closeDialog', 'bookDialog')
|
||||||
},
|
},
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.form.logo = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
},
|
if (!fileName) return
|
||||||
// 添加时间段
|
this.form.logo = fileName
|
||||||
addTime() {
|
|
||||||
this.times.push({ startTime: '', endTime: '', num: 1 })
|
|
||||||
},
|
|
||||||
removeTime(index) {
|
|
||||||
const newTimes = []
|
|
||||||
this.times.forEach(function (item, i) {
|
|
||||||
if (index !== i) {
|
|
||||||
newTimes.push(item)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.times = newTimes
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -221,6 +221,7 @@ export default {
|
|||||||
storeId: '',
|
storeId: '',
|
||||||
sort: '',
|
sort: '',
|
||||||
logo: '',
|
logo: '',
|
||||||
|
priceRules: '',
|
||||||
status: 'A',
|
status: 'A',
|
||||||
},
|
},
|
||||||
// 图片根目录
|
// 图片根目录
|
||||||
|
|||||||
@ -56,6 +56,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -111,6 +112,24 @@
|
|||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="签到开始" align="center" prop="checkinStartTime">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="scope.row.checkinStartTime">{{ parseTime(scope.row.checkinStartTime) }}</span>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="签到结束" align="center" prop="checkinEndTime">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="scope.row.checkinEndTime">{{ parseTime(scope.row.checkinEndTime) }}</span>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="签到时长(小时)" align="center" prop="checkinDurationHours">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="scope.row.checkinDurationHours !== null && scope.row.checkinDurationHours !== undefined">{{ scope.row.checkinDurationHours }}</span>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.status ? getName(bookStatusList, scope.row.status) : '-' }}</span>
|
<span>{{ scope.row.status ? getName(bookStatusList, scope.row.status) : '-' }}</span>
|
||||||
@ -127,34 +146,41 @@
|
|||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-success"
|
icon="el-icon-view"
|
||||||
v-if="scope.row.status == 'A'"
|
|
||||||
v-hasPermi="['book:index']"
|
v-hasPermi="['book:index']"
|
||||||
@click="handleConfirm(scope.row)"
|
@click="handleView(scope.row)"
|
||||||
>确认</el-button>
|
>详情</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-error"
|
icon="el-icon-success"
|
||||||
v-if="scope.row.status == 'A'"
|
v-if="scope.row.status == 'A'"
|
||||||
v-hasPermi="['book:index']"
|
v-hasPermi="['book:index']"
|
||||||
@click="handleFail(scope.row)"
|
@click="handleSetProgress(scope.row)"
|
||||||
>失败</el-button>
|
>进行中</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-warning"
|
icon="el-icon-warning"
|
||||||
v-hasPermi="['book:index']"
|
v-hasPermi="['book:index']"
|
||||||
v-if="scope.row.status == 'A'"
|
v-if="scope.row.status == 'A' || scope.row.status == 'B'"
|
||||||
@click="handleCancel(scope.row)"
|
@click="handleCancel(scope.row)"
|
||||||
>取消</el-button>
|
>取消</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-success"
|
icon="el-icon-s-order"
|
||||||
v-hasPermi="['book:index']"
|
v-hasPermi="['book:index']"
|
||||||
v-if="scope.row.status == 'B'"
|
v-if="scope.row.status == 'B'"
|
||||||
@click="completeCancel(scope.row)"
|
@click="handleSetWaitPay(scope.row)"
|
||||||
|
>待付款</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-success"
|
||||||
|
v-hasPermi="['book:index']"
|
||||||
|
v-if="scope.row.status == 'F'"
|
||||||
|
@click="handleComplete(scope.row)"
|
||||||
>完成</el-button>
|
>完成</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -174,11 +200,30 @@
|
|||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
<el-dialog
|
||||||
|
title="预约详情"
|
||||||
|
:visible.sync="detailDialog"
|
||||||
|
width="600px"
|
||||||
|
class="common-dialog"
|
||||||
|
>
|
||||||
|
<el-descriptions :column="2" border>
|
||||||
|
<el-descriptions-item label="预约项目">{{ detailForm.bookName || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="会员ID">{{ detailForm.userId || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="联系人">{{ detailForm.contact || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="手机号">{{ detailForm.mobile || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="预约日期">{{ detailForm.serviceDate || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="预约时段">{{ detailForm.serviceTime || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="签到开始">{{ detailForm.checkinStartTime ? parseTime(detailForm.checkinStartTime) : '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="签到结束">{{ detailForm.checkinEndTime ? parseTime(detailForm.checkinEndTime) : '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="签到时长(小时)">{{ detailForm.checkinDurationHours != null ? detailForm.checkinDurationHours : '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="状态">{{ detailForm.status ? getName(bookStatusList, detailForm.status) : '-' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getBookItemList, updateBookItemStatus } from "@/api/book";
|
import { getBookItemList, updateBookItemStatus, getBookItemInfo } from "@/api/book";
|
||||||
export default {
|
export default {
|
||||||
name: "BookItemList",
|
name: "BookItemList",
|
||||||
data() {
|
data() {
|
||||||
@ -206,7 +251,9 @@ export default {
|
|||||||
userNo: '',
|
userNo: '',
|
||||||
orderSn: '',
|
orderSn: '',
|
||||||
status: ''
|
status: ''
|
||||||
}
|
},
|
||||||
|
detailDialog: false,
|
||||||
|
detailForm: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -230,6 +277,12 @@ export default {
|
|||||||
this.queryParams.page = 1;
|
this.queryParams.page = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
// 导出
|
||||||
|
handleExport() {
|
||||||
|
this.download('/backendApi/bookItem/export', {
|
||||||
|
...this.queryParams,
|
||||||
|
})
|
||||||
|
},
|
||||||
// 重置按钮操作
|
// 重置按钮操作
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.dateRange = [];
|
this.dateRange = [];
|
||||||
@ -259,9 +312,9 @@ export default {
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 确认预约
|
// 设置进行中
|
||||||
handleConfirm(row) {
|
handleSetProgress(row) {
|
||||||
this.$modal.confirm('确认该预约审核通过吗?').then(function() {
|
this.$modal.confirm('确认将该预约设为进行中吗?').then(function() {
|
||||||
return updateBookItemStatus(row.id, 'B');
|
return updateBookItemStatus(row.id, 'B');
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
@ -270,9 +323,9 @@ export default {
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 预约失败
|
// 设置待付款
|
||||||
handleFail(row) {
|
handleSetWaitPay(row) {
|
||||||
this.$modal.confirm('确认该预约失败吗?').then(function() {
|
this.$modal.confirm('确认将该预约设为待付款吗?').then(function() {
|
||||||
return updateBookItemStatus(row.id, 'F');
|
return updateBookItemStatus(row.id, 'F');
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
@ -282,7 +335,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 完成预约
|
// 完成预约
|
||||||
completeCancel(row) {
|
handleComplete(row) {
|
||||||
this.$modal.confirm('确认该预约服务已经完成吗?').then(function() {
|
this.$modal.confirm('确认该预约服务已经完成吗?').then(function() {
|
||||||
return updateBookItemStatus(row.id, 'E');
|
return updateBookItemStatus(row.id, 'E');
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
@ -303,7 +356,17 @@ export default {
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleView(row) {
|
||||||
|
const id = row.id
|
||||||
|
if (!id) return
|
||||||
|
getBookItemInfo(id).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
const info = response.data.mtBookItem || {}
|
||||||
|
this.detailForm = { ...row, ...info }
|
||||||
|
this.detailDialog = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 积分变更对话框 -->
|
<!-- 银币变更对话框 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="无商品收款"
|
title="无商品收款"
|
||||||
:visible.sync="showDialog"
|
:visible.sync="showDialog"
|
||||||
|
|||||||
@ -251,7 +251,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="head">可用积分:</div>
|
<div class="head">可用银币:</div>
|
||||||
<div class="value">
|
<div class="value">
|
||||||
{{ memberInfo.point ? memberInfo.point : '0' }}
|
{{ memberInfo.point ? memberInfo.point : '0' }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -53,7 +53,7 @@
|
|||||||
}}(元)
|
}}(元)
|
||||||
</div>
|
</div>
|
||||||
<div class="value">
|
<div class="value">
|
||||||
可用积分:{{ memberInfo.point ? memberInfo.point : '0' }}
|
可用银币:{{ memberInfo.point ? memberInfo.point : '0' }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -82,7 +82,7 @@
|
|||||||
<div class="goods-list">
|
<div class="goods-list">
|
||||||
<div class="goods-item" v-for="goodsInfo in activeGoodsList">
|
<div class="goods-item" v-for="goodsInfo in activeGoodsList">
|
||||||
<div class="item" @click="clickGoods(goodsInfo)">
|
<div class="item" @click="clickGoods(goodsInfo)">
|
||||||
<img class="image" :src="imagePath + goodsInfo.logo" />
|
<img class="image" :src="getImageUrl(goodsInfo.logo)" />
|
||||||
<div class="goods-name">{{ goodsInfo.name }}</div>
|
<div class="goods-name">{{ goodsInfo.name }}</div>
|
||||||
<div class="goods-price">¥{{ goodsInfo.price }}</div>
|
<div class="goods-price">¥{{ goodsInfo.price }}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -387,6 +387,7 @@ import {
|
|||||||
doPay,
|
doPay,
|
||||||
getMemberInfoById,
|
getMemberInfoById,
|
||||||
} from '@/api/cashier'
|
} from '@/api/cashier'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
import { getOrderInfo } from '@/api/order'
|
import { getOrderInfo } from '@/api/order'
|
||||||
import { getUserId, setUserId, removeUserId } from '@/utils/auth'
|
import { getUserId, setUserId, removeUserId } from '@/utils/auth'
|
||||||
import switchMemberDialog from './components/switchMemberDialog'
|
import switchMemberDialog from './components/switchMemberDialog'
|
||||||
@ -560,6 +561,9 @@ export default {
|
|||||||
this.getCartList()
|
this.getCartList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
initCashier() {
|
initCashier() {
|
||||||
const app = this
|
const app = this
|
||||||
|
|||||||
@ -165,7 +165,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="this.form.image"
|
v-if="this.form.image"
|
||||||
:src="imagePath + this.form.image"
|
:src="getImageUrl(this.form.image)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i v-if="!this.form.image" class="el-icon-plus"></i>
|
<i v-if="!this.form.image" class="el-icon-plus"></i>
|
||||||
@ -243,6 +243,8 @@ import {
|
|||||||
saveArticle,
|
saveArticle,
|
||||||
} from '@/api/article'
|
} from '@/api/article'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
export default {
|
export default {
|
||||||
name: 'ContentArticleIndex',
|
name: 'ContentArticleIndex',
|
||||||
data() {
|
data() {
|
||||||
@ -304,6 +306,9 @@ export default {
|
|||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 查询文章列表
|
// 查询文章列表
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
@ -366,8 +371,10 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 图片上传成功
|
// 图片上传成功
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.form.image = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.form.image = fileName
|
||||||
},
|
},
|
||||||
// 新增按钮操作
|
// 新增按钮操作
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
|
|||||||
@ -93,7 +93,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="图片" align="center" width="200">
|
<el-table-column label="图片" align="center" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<img class="list-img" :src="imagePath + scope.row.image" />
|
<img class="list-img" :src="getImageUrl(scope.row.image)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||||
@ -221,7 +221,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="this.form.image"
|
v-if="this.form.image"
|
||||||
:src="imagePath + this.form.image"
|
:src="getImageUrl(this.form.image)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i v-if="!this.form.image" class="el-icon-plus"></i>
|
<i v-if="!this.form.image" class="el-icon-plus"></i>
|
||||||
@ -279,6 +279,8 @@ import {
|
|||||||
getBannerInfo,
|
getBannerInfo,
|
||||||
saveBanner,
|
saveBanner,
|
||||||
} from '@/api/banner'
|
} from '@/api/banner'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
export default {
|
export default {
|
||||||
name: 'ContentBannerList',
|
name: 'ContentBannerList',
|
||||||
data() {
|
data() {
|
||||||
@ -341,6 +343,9 @@ export default {
|
|||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 查询列表
|
// 查询列表
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
@ -440,7 +445,7 @@ export default {
|
|||||||
this.form = response.data.bannerInfo
|
this.form = response.data.bannerInfo
|
||||||
this.uploadFiles = [
|
this.uploadFiles = [
|
||||||
{
|
{
|
||||||
url: response.data.imagePath + this.form.image,
|
url: resolveImageUrl(response.data.imagePath, this.form.image),
|
||||||
status: 'finished',
|
status: 'finished',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -462,8 +467,10 @@ export default {
|
|||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
},
|
},
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.form.image = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.form.image = fileName
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
140
src/views/content/look/index.vue
Normal file
140
src/views/content/look/index.vue
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" class="main-search" ref="queryForm" size="small" :inline="true" label-width="68px">
|
||||||
|
<el-form-item label="作品标题" prop="title">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.title"
|
||||||
|
placeholder="请输入作品标题"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="状态" clearable>
|
||||||
|
<el-option key="A" label="启用" value="A" />
|
||||||
|
<el-option key="N" label="禁用" value="N" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="lookList">
|
||||||
|
<el-table-column label="ID" prop="id" width="70" />
|
||||||
|
<el-table-column label="封面" align="center" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<img class="list-img" :src="scope.row.cover" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="标题" prop="title" :show-overflow-tooltip="true" min-width="180" />
|
||||||
|
<el-table-column label="作者" prop="author" align="center" width="120" />
|
||||||
|
<el-table-column label="点赞" prop="likes" align="center" width="80" />
|
||||||
|
<el-table-column label="评论" prop="comments" align="center" width="80" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.status"
|
||||||
|
active-value="A"
|
||||||
|
inactive-value="N"
|
||||||
|
@change="handleStatusChange(scope.row)"
|
||||||
|
v-hasPermi="['content:look:edit']"
|
||||||
|
></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="170">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['content:look:edit']"
|
||||||
|
>下架</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.page"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getLookList, updateLookStatus } from '@/api/look'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ContentLookIndex',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: true,
|
||||||
|
total: 0,
|
||||||
|
lookList: [],
|
||||||
|
queryParams: {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
title: '',
|
||||||
|
status: '',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
this.loading = true
|
||||||
|
getLookList(this.queryParams).then((response) => {
|
||||||
|
this.lookList = response.data.dataList.content
|
||||||
|
this.total = response.data.dataList.totalElements
|
||||||
|
this.loading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.page = 1
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm('queryForm')
|
||||||
|
this.handleQuery()
|
||||||
|
},
|
||||||
|
handleStatusChange(row) {
|
||||||
|
updateLookStatus(row.id, row.status).then(() => {
|
||||||
|
this.$modal.msgSuccess('操作成功')
|
||||||
|
}).catch(() => {
|
||||||
|
row.status = row.status === 'A' ? 'N' : 'A'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
this.$modal.confirm('确认下架该作品吗?').then(() => {
|
||||||
|
return updateLookStatus(row.id, 'D')
|
||||||
|
}).then(() => {
|
||||||
|
this.$modal.msgSuccess('下架成功')
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.list-img {
|
||||||
|
width: 72px;
|
||||||
|
height: 72px;
|
||||||
|
border-radius: 6px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="图片" align="center">
|
<el-table-column label="图片" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<img class="list-img" :src="imagePath + scope.row.icon" />
|
<img class="list-img" :src="getImageUrl(scope.row.icon)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@ -124,7 +124,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="this.form.icon"
|
v-if="this.form.icon"
|
||||||
:src="imagePath + this.form.icon"
|
:src="getImageUrl(this.form.icon)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i v-if="!this.form.icon" class="el-icon-plus"></i>
|
<i v-if="!this.form.icon" class="el-icon-plus"></i>
|
||||||
@ -169,6 +169,8 @@ import {
|
|||||||
saveNavigation
|
saveNavigation
|
||||||
} from '@/api/navigation'
|
} from '@/api/navigation'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
export default {
|
export default {
|
||||||
name: 'ContentNavigationIndex',
|
name: 'ContentNavigationIndex',
|
||||||
data() {
|
data() {
|
||||||
@ -203,6 +205,7 @@ export default {
|
|||||||
// 表单参数
|
// 表单参数
|
||||||
form: {
|
form: {
|
||||||
id: '',
|
id: '',
|
||||||
|
oldName: '',
|
||||||
name: '',
|
name: '',
|
||||||
tips: '',
|
tips: '',
|
||||||
url: '',
|
url: '',
|
||||||
@ -222,6 +225,9 @@ export default {
|
|||||||
this.getNavigation()
|
this.getNavigation()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 查询导航栏
|
// 查询导航栏
|
||||||
getNavigation() {
|
getNavigation() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
@ -240,10 +246,13 @@ export default {
|
|||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
id: '',
|
id: '',
|
||||||
|
oldName: '',
|
||||||
name: '',
|
name: '',
|
||||||
|
tips: '',
|
||||||
icon: '',
|
icon: '',
|
||||||
url: '',
|
url: '',
|
||||||
sort: 0
|
sort: 0,
|
||||||
|
status: 'A'
|
||||||
}
|
}
|
||||||
this.resetForm('form')
|
this.resetForm('form')
|
||||||
},
|
},
|
||||||
@ -257,8 +266,10 @@ export default {
|
|||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
// 图片上传成功
|
// 图片上传成功
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.form.icon = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.form.icon = fileName
|
||||||
},
|
},
|
||||||
// 新增按钮操作
|
// 新增按钮操作
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
@ -299,7 +310,7 @@ export default {
|
|||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.form = row;
|
this.form = { ...row, oldName: row.name };
|
||||||
this.title = '修改导航';
|
this.title = '修改导航';
|
||||||
},
|
},
|
||||||
// 状态修改
|
// 状态修改
|
||||||
|
|||||||
766
src/views/content/task/index.vue
Normal file
766
src/views/content/task/index.vue
Normal file
@ -0,0 +1,766 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
class="main-search"
|
||||||
|
ref="queryForm"
|
||||||
|
size="small"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="任务名称" prop="taskName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.taskName"
|
||||||
|
placeholder="请输入任务名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="任务类型" prop="taskType">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.taskType"
|
||||||
|
placeholder="任务类型"
|
||||||
|
clearable
|
||||||
|
style="width: 150px"
|
||||||
|
>
|
||||||
|
<el-option label="完善资料" value="PROFILE" />
|
||||||
|
<el-option label="观看广告" value="AD" />
|
||||||
|
<el-option label="每日登录" value="LOGIN" />
|
||||||
|
<el-option label="完成订单" value="ORDER" />
|
||||||
|
<el-option label="发布作品" value="LOOK" />
|
||||||
|
<el-option label="自定义" value="CUSTOM" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="所属店铺" prop="storeId">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.storeId"
|
||||||
|
placeholder="所属店铺"
|
||||||
|
clearable
|
||||||
|
style="width: 180px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
:key="0"
|
||||||
|
label="公共所有"
|
||||||
|
v-if="!this.$store.getters.storeId"
|
||||||
|
:value="0"
|
||||||
|
/>
|
||||||
|
<el-option
|
||||||
|
v-for="storeInfo in storeList"
|
||||||
|
:key="storeInfo.id"
|
||||||
|
:label="storeInfo.name"
|
||||||
|
:value="storeInfo.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.status"
|
||||||
|
placeholder="状态"
|
||||||
|
clearable
|
||||||
|
style="width: 100px"
|
||||||
|
>
|
||||||
|
<el-option key="A" label="启用" value="A" />
|
||||||
|
<el-option key="N" label="禁用" value="N" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['content:task:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="openImportDialog"
|
||||||
|
v-hasPermi="['content:task:add']"
|
||||||
|
>任务导入</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-tickets"
|
||||||
|
size="mini"
|
||||||
|
@click="openRecordDialog()"
|
||||||
|
v-hasPermi="['content:task:index']"
|
||||||
|
>完成记录</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column label="ID" prop="id" width="70" />
|
||||||
|
<el-table-column label="任务名称" align="center" prop="taskName" min-width="150" />
|
||||||
|
<el-table-column label="任务编码" align="center" prop="taskCode" min-width="120" />
|
||||||
|
<el-table-column label="任务类型" align="center" prop="taskType" width="110">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag size="mini" type="info">{{ getTaskTypeName(scope.row.taskType) }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="所属店铺" align="center" prop="storeId">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="scope.row.storeId && scope.row.storeId > 0">{{ getName(storeList, scope.row.storeId) }}</span>
|
||||||
|
<span v-else>公共所有</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="奖励银币" align="center" prop="rewardPoint" width="100" />
|
||||||
|
<el-table-column label="奖励余额(元)" align="center" prop="rewardBalance" width="120" />
|
||||||
|
<el-table-column label="银币阈值" align="center" prop="pointThreshold" width="100" />
|
||||||
|
<el-table-column label="余额阈值(元)" align="center" prop="balanceThreshold" width="120" />
|
||||||
|
<el-table-column label="指定商品ID" align="center" prop="targetGoodsIds" min-width="140">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.targetGoodsIds || '全部商品' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="每日次数" align="center" prop="dailyLimit" width="100" />
|
||||||
|
<el-table-column label="排序" align="center" prop="sort" width="80" />
|
||||||
|
<el-table-column label="更新时间" align="center" prop="updateTime" width="170">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.updateTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.status"
|
||||||
|
active-value="A"
|
||||||
|
inactive-value="N"
|
||||||
|
@change="handleStatusChange(scope.row)"
|
||||||
|
></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-tickets"
|
||||||
|
v-hasPermi="['content:task:index']"
|
||||||
|
@click="openRecordDialog(scope.row)"
|
||||||
|
>完成记录</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
v-hasPermi="['content:task:edit']"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
v-hasPermi="['content:task:edit']"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.page"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-dialog :title="title" :visible.sync="open" class="common-dialog" width="700px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="任务名称" prop="taskName">
|
||||||
|
<el-input v-model="form.taskName" placeholder="请输入任务名称" maxlength="100" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="任务编码" prop="taskCode">
|
||||||
|
<el-input v-model="form.taskCode" placeholder="请输入任务编码" maxlength="50" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="任务类型" prop="taskType">
|
||||||
|
<el-select v-model="form.taskType" style="width: 100%" placeholder="请选择任务类型" @change="handleTaskTypeChange">
|
||||||
|
<el-option label="完善资料" value="PROFILE" />
|
||||||
|
<el-option label="观看广告" value="AD" />
|
||||||
|
<el-option label="每日登录" value="LOGIN" />
|
||||||
|
<el-option label="完成订单" value="ORDER" />
|
||||||
|
<el-option label="发布作品" value="LOOK" />
|
||||||
|
<el-option label="自定义" value="CUSTOM" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="所属店铺" prop="storeId">
|
||||||
|
<el-select v-model="form.storeId" style="width: 100%" placeholder="所属店铺,空则公共所有">
|
||||||
|
<el-option
|
||||||
|
:key="0"
|
||||||
|
label="公共所有"
|
||||||
|
v-if="!this.$store.getters.storeId"
|
||||||
|
:value="0"
|
||||||
|
/>
|
||||||
|
<el-option
|
||||||
|
v-for="storeInfo in storeList"
|
||||||
|
:key="storeInfo.id"
|
||||||
|
:label="storeInfo.name"
|
||||||
|
:value="storeInfo.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="奖励银币" prop="rewardPoint">
|
||||||
|
<el-input-number v-model="form.rewardPoint" :min="0" :max="99999" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="奖励余额(元)" prop="rewardBalance">
|
||||||
|
<el-input-number v-model="form.rewardBalance" :min="0" :max="99999" :precision="2" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="银币阈值" prop="pointThreshold">
|
||||||
|
<el-input-number v-model="form.pointThreshold" :min="0" :max="99999999" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="余额阈值(元)" prop="balanceThreshold">
|
||||||
|
<el-input-number v-model="form.balanceThreshold" :min="0" :max="999999" :precision="2" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col v-if="isOrderTask" :span="12">
|
||||||
|
<el-form-item label="指定商品ID" prop="targetGoodsIds">
|
||||||
|
<el-input v-model="form.targetGoodsIds" placeholder="多个商品ID用英文逗号分隔;不填=全部商品" maxlength="500" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="isOrderTask ? 12 : 24">
|
||||||
|
<el-form-item label="每日次数" prop="dailyLimit">
|
||||||
|
<el-input-number v-model="form.dailyLimit" :min="1" :max="999" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="跳转链接" prop="jumpUrl">
|
||||||
|
<el-input v-model="form.jumpUrl" placeholder="如:pages/user/index" maxlength="255" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="排序" prop="sort">
|
||||||
|
<el-input-number v-model="form.sort" :min="0" :max="9999" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="任务描述" prop="taskDesc">
|
||||||
|
<el-input v-model="form.taskDesc" type="textarea" :rows="3" placeholder="请输入任务描述" maxlength="500" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio key="A" label="A" value="A">启用</el-radio>
|
||||||
|
<el-radio key="N" label="N" value="N">禁用</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||||
|
<el-button @click="cancel">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="导入公共任务"
|
||||||
|
:visible.sync="importOpen"
|
||||||
|
width="900px"
|
||||||
|
append-to-body
|
||||||
|
@close="closeImportDialog"
|
||||||
|
>
|
||||||
|
<el-form :inline="true" size="small">
|
||||||
|
<el-form-item label="任务名称">
|
||||||
|
<el-input
|
||||||
|
v-model="importQuery.taskName"
|
||||||
|
placeholder="请输入任务名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
@keyup.enter.native="getPublicTasks"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="任务类型">
|
||||||
|
<el-select v-model="importQuery.taskType" placeholder="任务类型" clearable style="width: 150px">
|
||||||
|
<el-option label="完善资料" value="PROFILE" />
|
||||||
|
<el-option label="观看广告" value="AD" />
|
||||||
|
<el-option label="每日登录" value="LOGIN" />
|
||||||
|
<el-option label="完成订单" value="ORDER" />
|
||||||
|
<el-option label="发布作品" value="LOOK" />
|
||||||
|
<el-option label="自定义" value="CUSTOM" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="getPublicTasks">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetImportQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="importLoading"
|
||||||
|
:data="publicTaskList"
|
||||||
|
@selection-change="handleImportSelectionChange"
|
||||||
|
max-height="420"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column label="任务名称" prop="taskName" min-width="180" />
|
||||||
|
<el-table-column label="任务编码" prop="taskCode" min-width="140" />
|
||||||
|
<el-table-column label="任务类型" align="center" prop="taskType" width="110">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag size="mini" type="info">{{ getTaskTypeName(scope.row.taskType) }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="奖励银币" align="center" prop="rewardPoint" width="100" />
|
||||||
|
<el-table-column label="每日次数" align="center" prop="dailyLimit" width="100" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag size="mini" :type="scope.row.status === 'A' ? 'success' : 'info'">
|
||||||
|
{{ scope.row.status === 'A' ? '启用' : '禁用' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="importTotal > 0"
|
||||||
|
:total="importTotal"
|
||||||
|
:page.sync="importQuery.page"
|
||||||
|
:limit.sync="importQuery.pageSize"
|
||||||
|
@pagination="getPublicTasks"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="closeImportDialog">取消</el-button>
|
||||||
|
<el-button type="primary" :disabled="!importTaskIds.length" @click="handleImportSubmit">导入所选</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="任务完成记录"
|
||||||
|
:visible.sync="recordOpen"
|
||||||
|
width="1100px"
|
||||||
|
append-to-body
|
||||||
|
@close="closeRecordDialog"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
:model="recordQuery"
|
||||||
|
ref="recordQueryForm"
|
||||||
|
size="small"
|
||||||
|
:inline="true"
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
|
<el-form-item label="任务名称" prop="taskName">
|
||||||
|
<el-input
|
||||||
|
v-model="recordQuery.taskName"
|
||||||
|
placeholder="请输入任务名称"
|
||||||
|
clearable
|
||||||
|
style="width: 180px"
|
||||||
|
@keyup.enter.native="getTaskRecordListData"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="会员号" prop="userNo">
|
||||||
|
<el-input
|
||||||
|
v-model="recordQuery.userNo"
|
||||||
|
placeholder="请输入会员号"
|
||||||
|
clearable
|
||||||
|
style="width: 160px"
|
||||||
|
@keyup.enter.native="getTaskRecordListData"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="手机号" prop="mobile">
|
||||||
|
<el-input
|
||||||
|
v-model="recordQuery.mobile"
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
clearable
|
||||||
|
style="width: 160px"
|
||||||
|
@keyup.enter.native="getTaskRecordListData"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="任务日期" prop="taskDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="recordQuery.taskDate"
|
||||||
|
type="date"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
placeholder="请选择任务日期"
|
||||||
|
clearable
|
||||||
|
style="width: 160px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleRecordQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetRecordQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table v-loading="recordLoading" :data="recordList">
|
||||||
|
<el-table-column label="ID" prop="id" width="70" />
|
||||||
|
<el-table-column label="任务名称" prop="taskName" min-width="140" />
|
||||||
|
<el-table-column label="任务编码" prop="taskCode" min-width="120" />
|
||||||
|
<el-table-column label="会员号" prop="userNo" min-width="120" />
|
||||||
|
<el-table-column label="称呼" prop="name" min-width="100" />
|
||||||
|
<el-table-column label="手机号" prop="mobile" min-width="120" />
|
||||||
|
<el-table-column label="任务日期" prop="taskDate" width="110" />
|
||||||
|
<el-table-column label="完成次数" prop="completeNum" width="90" />
|
||||||
|
<el-table-column label="领取次数" prop="claimNum" width="90" />
|
||||||
|
<el-table-column label="最近完成时间" prop="lastCompleteTime" width="165">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.lastCompleteTime) || '--' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="最近领取时间" prop="lastClaimTime" width="165">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.lastClaimTime) || '--' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="recordTotal > 0"
|
||||||
|
:total="recordTotal"
|
||||||
|
:page.sync="recordQuery.page"
|
||||||
|
:limit.sync="recordQuery.pageSize"
|
||||||
|
@pagination="getTaskRecordListData"
|
||||||
|
/>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getTaskList, getTaskInfo, saveTask, updateTaskStatus, getPublicTaskList, importPublicTask, getTaskRecordList } from '@/api/task'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ContentTaskIndex',
|
||||||
|
computed: {
|
||||||
|
isOrderTask() {
|
||||||
|
return this.form.taskType === 'ORDER'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: true,
|
||||||
|
title: '',
|
||||||
|
ids: [],
|
||||||
|
multiple: true,
|
||||||
|
showSearch: true,
|
||||||
|
total: 0,
|
||||||
|
list: [],
|
||||||
|
open: false,
|
||||||
|
storeList: [],
|
||||||
|
form: {
|
||||||
|
id: '',
|
||||||
|
taskCode: '',
|
||||||
|
taskName: '',
|
||||||
|
taskType: 'CUSTOM',
|
||||||
|
taskDesc: '',
|
||||||
|
jumpUrl: '',
|
||||||
|
rewardPoint: 0,
|
||||||
|
rewardBalance: 0,
|
||||||
|
pointThreshold: 0,
|
||||||
|
balanceThreshold: 0,
|
||||||
|
targetGoodsIds: '',
|
||||||
|
completeThreshold: 0,
|
||||||
|
dailyLimit: 1,
|
||||||
|
storeId: 0,
|
||||||
|
sort: 0,
|
||||||
|
status: 'A',
|
||||||
|
},
|
||||||
|
queryParams: {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
taskName: '',
|
||||||
|
taskType: '',
|
||||||
|
storeId: '',
|
||||||
|
status: '',
|
||||||
|
},
|
||||||
|
importOpen: false,
|
||||||
|
importLoading: false,
|
||||||
|
publicTaskList: [],
|
||||||
|
importTaskIds: [],
|
||||||
|
importTotal: 0,
|
||||||
|
importQuery: {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
taskName: '',
|
||||||
|
taskType: '',
|
||||||
|
},
|
||||||
|
recordOpen: false,
|
||||||
|
recordLoading: false,
|
||||||
|
recordList: [],
|
||||||
|
recordTotal: 0,
|
||||||
|
recordQuery: {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
taskId: '',
|
||||||
|
taskName: '',
|
||||||
|
userNo: '',
|
||||||
|
mobile: '',
|
||||||
|
taskDate: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
taskName: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
|
||||||
|
taskCode: [{ required: true, message: '任务编码不能为空', trigger: 'blur' }],
|
||||||
|
taskType: [{ required: true, message: '任务类型不能为空', trigger: 'change' }],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getTaskTypeName(taskType) {
|
||||||
|
const map = {
|
||||||
|
PROFILE: '完善资料',
|
||||||
|
AD: '观看广告',
|
||||||
|
LOGIN: '每日登录',
|
||||||
|
ORDER: '完成订单',
|
||||||
|
LOOK: '发布作品',
|
||||||
|
CUSTOM: '自定义',
|
||||||
|
}
|
||||||
|
return map[taskType] || taskType || '--'
|
||||||
|
},
|
||||||
|
handleTaskTypeChange() {
|
||||||
|
if (this.form.taskType !== 'ORDER') {
|
||||||
|
this.form.targetGoodsIds = ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
this.loading = true
|
||||||
|
getTaskList(this.queryParams).then((response) => {
|
||||||
|
this.list = response.data.dataList.content
|
||||||
|
this.total = response.data.dataList.totalElements
|
||||||
|
this.storeList = response.data.storeList
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.page = 1
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm('queryForm')
|
||||||
|
this.handleQuery()
|
||||||
|
},
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map((item) => item.id)
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
handleStatusChange(row) {
|
||||||
|
let text = row.status == 'A' ? '启用' : '禁用'
|
||||||
|
this.$modal
|
||||||
|
.confirm('确认要' + text + '"' + row.taskName + '"吗?')
|
||||||
|
.then(function () {
|
||||||
|
return updateTaskStatus(row.id, row.status)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.$modal.msgSuccess(text + '成功')
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
row.status = row.status === 'N' ? 'A' : 'N'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.reset()
|
||||||
|
this.open = true
|
||||||
|
this.title = '新增任务'
|
||||||
|
},
|
||||||
|
openImportDialog() {
|
||||||
|
this.importOpen = true
|
||||||
|
this.importTaskIds = []
|
||||||
|
this.importQuery.page = 1
|
||||||
|
this.getPublicTasks()
|
||||||
|
},
|
||||||
|
getPublicTasks() {
|
||||||
|
this.importLoading = true
|
||||||
|
getPublicTaskList(this.importQuery).then((response) => {
|
||||||
|
this.publicTaskList = response.data.dataList.content
|
||||||
|
this.importTotal = response.data.dataList.totalElements
|
||||||
|
this.importLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.importLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
resetImportQuery() {
|
||||||
|
this.importQuery = {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
taskName: '',
|
||||||
|
taskType: '',
|
||||||
|
}
|
||||||
|
this.getPublicTasks()
|
||||||
|
},
|
||||||
|
closeImportDialog() {
|
||||||
|
this.importOpen = false
|
||||||
|
this.importLoading = false
|
||||||
|
this.importTaskIds = []
|
||||||
|
},
|
||||||
|
openRecordDialog(row) {
|
||||||
|
this.recordOpen = true
|
||||||
|
this.recordQuery.page = 1
|
||||||
|
if (row && row.id) {
|
||||||
|
this.recordQuery.taskId = row.id
|
||||||
|
this.recordQuery.taskName = row.taskName || ''
|
||||||
|
} else {
|
||||||
|
this.recordQuery.taskId = ''
|
||||||
|
this.recordQuery.taskName = ''
|
||||||
|
}
|
||||||
|
this.getTaskRecordListData()
|
||||||
|
},
|
||||||
|
getTaskRecordListData() {
|
||||||
|
this.recordLoading = true
|
||||||
|
getTaskRecordList(this.recordQuery).then((response) => {
|
||||||
|
this.recordList = response.data.dataList.content
|
||||||
|
this.recordTotal = response.data.dataList.totalElements
|
||||||
|
this.recordLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.recordLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleRecordQuery() {
|
||||||
|
this.recordQuery.page = 1
|
||||||
|
this.getTaskRecordListData()
|
||||||
|
},
|
||||||
|
resetRecordQuery() {
|
||||||
|
this.recordQuery = {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
taskId: '',
|
||||||
|
taskName: '',
|
||||||
|
userNo: '',
|
||||||
|
mobile: '',
|
||||||
|
taskDate: '',
|
||||||
|
}
|
||||||
|
this.getTaskRecordListData()
|
||||||
|
},
|
||||||
|
closeRecordDialog() {
|
||||||
|
this.recordOpen = false
|
||||||
|
this.recordLoading = false
|
||||||
|
this.recordList = []
|
||||||
|
this.recordTotal = 0
|
||||||
|
this.recordQuery = {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
taskId: '',
|
||||||
|
taskName: '',
|
||||||
|
userNo: '',
|
||||||
|
mobile: '',
|
||||||
|
taskDate: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleImportSelectionChange(selection) {
|
||||||
|
this.importTaskIds = selection.map((item) => item.id)
|
||||||
|
},
|
||||||
|
handleImportSubmit() {
|
||||||
|
if (!this.importTaskIds.length) {
|
||||||
|
this.$modal.msgWarning('请先选择要导入的任务')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const storeId = this.$store.getters.storeId || (this.queryParams.storeId === '' ? 0 : this.queryParams.storeId)
|
||||||
|
importPublicTask({
|
||||||
|
taskIds: this.importTaskIds,
|
||||||
|
storeId,
|
||||||
|
}).then((response) => {
|
||||||
|
const importedCount = response.data.importedCount || 0
|
||||||
|
const skippedCount = response.data.skippedCount || 0
|
||||||
|
this.$modal.msgSuccess('导入完成:成功' + importedCount + '条,跳过' + skippedCount + '条')
|
||||||
|
this.closeImportDialog()
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset()
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getTaskInfo(id).then((response) => {
|
||||||
|
this.form = response.data.taskInfo
|
||||||
|
this.open = true
|
||||||
|
this.title = '编辑任务'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
const name = row.taskName
|
||||||
|
this.$modal
|
||||||
|
.confirm('是否确认删除"' + name + '"的数据项?')
|
||||||
|
.then(function () {
|
||||||
|
return updateTaskStatus(row.id, 'D')
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList()
|
||||||
|
this.$modal.msgSuccess('删除成功')
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: '',
|
||||||
|
taskCode: '',
|
||||||
|
taskName: '',
|
||||||
|
taskType: 'CUSTOM',
|
||||||
|
taskDesc: '',
|
||||||
|
jumpUrl: '',
|
||||||
|
rewardPoint: 0,
|
||||||
|
rewardBalance: 0,
|
||||||
|
pointThreshold: 0,
|
||||||
|
balanceThreshold: 0,
|
||||||
|
targetGoodsIds: '',
|
||||||
|
completeThreshold: 0,
|
||||||
|
dailyLimit: 1,
|
||||||
|
storeId: 0,
|
||||||
|
sort: 0,
|
||||||
|
status: 'A',
|
||||||
|
}
|
||||||
|
this.resetForm('form')
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
this.open = false
|
||||||
|
this.reset()
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.form.taskType !== 'ORDER') {
|
||||||
|
this.form.targetGoodsIds = ''
|
||||||
|
}
|
||||||
|
saveTask(this.form).then(() => {
|
||||||
|
this.$modal.msgSuccess(this.form.id ? '修改成功' : '新增成功')
|
||||||
|
this.open = false
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -87,7 +87,7 @@
|
|||||||
<el-table-column label="卡券ID" prop="id" width="66" />
|
<el-table-column label="卡券ID" prop="id" width="66" />
|
||||||
<el-table-column label="图标" align="center" width="150">
|
<el-table-column label="图标" align="center" width="150">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<img class="list-img" :src="imagePath + scope.row.image" />
|
<img class="list-img" :src="getImageUrl(scope.row.image)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="卡券名称" align="center" prop="name">
|
<el-table-column label="卡券名称" align="center" prop="name">
|
||||||
@ -430,11 +430,11 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="领取所需积分" prop="point">
|
<el-form-item label="领取所需银币" prop="point">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.point"
|
v-model="form.point"
|
||||||
style="width: 300px"
|
style="width: 300px"
|
||||||
placeholder="输入0或为空表示不需要积分领取"
|
placeholder="输入0或为空表示不需要银币领取"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -593,11 +593,11 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="领取所需积分" prop="point">
|
<el-form-item label="领取所需银币" prop="point">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.point"
|
v-model="form.point"
|
||||||
style="width: 300px"
|
style="width: 300px"
|
||||||
placeholder="输入0或为空表示不需要积分领取"
|
placeholder="输入0或为空表示不需要银币领取"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -659,7 +659,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="this.form.image"
|
v-if="this.form.image"
|
||||||
:src="imagePath + this.form.image"
|
:src="getImageUrl(this.form.image)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i class="el-icon-plus"></i>
|
<i class="el-icon-plus"></i>
|
||||||
@ -815,6 +815,8 @@ import {
|
|||||||
import { getAllGroupList } from '@/api/coupon/group'
|
import { getAllGroupList } from '@/api/coupon/group'
|
||||||
import { getTotalMember } from '@/api/statistic'
|
import { getTotalMember } from '@/api/statistic'
|
||||||
import { parseTime } from '@/utils/fuint'
|
import { parseTime } from '@/utils/fuint'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
|
|
||||||
// 初始表单
|
// 初始表单
|
||||||
const initForm = {
|
const initForm = {
|
||||||
@ -1018,6 +1020,9 @@ export default {
|
|||||||
this.getTotalMember()
|
this.getTotalMember()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 查询列表
|
// 查询列表
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
@ -1332,8 +1337,10 @@ export default {
|
|||||||
this.storeItem = newStoreItem
|
this.storeItem = newStoreItem
|
||||||
},
|
},
|
||||||
// 上传成功
|
// 上传成功
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.form.image = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.form.image = fileName
|
||||||
},
|
},
|
||||||
handleRemove(file, fileList) {
|
handleRemove(file, fileList) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@ -91,7 +91,7 @@
|
|||||||
<el-table-column label="名称" align="center" prop="name" />
|
<el-table-column label="名称" align="center" prop="name" />
|
||||||
<el-table-column label="图片" align="center" width="200">
|
<el-table-column label="图片" align="center" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<img class="list-img" :src="imagePath + scope.row.logo" />
|
<img class="list-img" :src="getImageUrl(scope.row.logo)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||||
@ -220,7 +220,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="this.form.logo"
|
v-if="this.form.logo"
|
||||||
:src="imagePath + this.form.logo"
|
:src="getImageUrl(this.form.logo)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i class="el-icon-plus"></i>
|
<i class="el-icon-plus"></i>
|
||||||
@ -267,6 +267,8 @@ import {
|
|||||||
saveGoodsCate,
|
saveGoodsCate,
|
||||||
updateGoodsCateStatus,
|
updateGoodsCateStatus,
|
||||||
} from '@/api/goodsCate'
|
} from '@/api/goodsCate'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
export default {
|
export default {
|
||||||
name: 'GoodsCateIndex',
|
name: 'GoodsCateIndex',
|
||||||
data() {
|
data() {
|
||||||
@ -336,6 +338,9 @@ export default {
|
|||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 查询分类列表
|
// 查询分类列表
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
@ -439,7 +444,7 @@ export default {
|
|||||||
getGoodsCateInfo(id).then((response) => {
|
getGoodsCateInfo(id).then((response) => {
|
||||||
this.form = response.data.cateInfo
|
this.form = response.data.cateInfo
|
||||||
this.uploadFiles = [
|
this.uploadFiles = [
|
||||||
{ url: response.data.imagePath + this.form.logo, status: 'finished' },
|
{ url: resolveImageUrl(response.data.imagePath, this.form.logo), status: 'finished' },
|
||||||
]
|
]
|
||||||
this.open = true
|
this.open = true
|
||||||
this.title = '编辑商品分类'
|
this.title = '编辑商品分类'
|
||||||
@ -459,8 +464,10 @@ export default {
|
|||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
},
|
},
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.form.logo = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.form.logo = fileName
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -347,12 +347,15 @@ export default {
|
|||||||
let sn = (Math.random() + 1) * 10000000000000
|
let sn = (Math.random() + 1) * 10000000000000
|
||||||
this.batch.skuNo = sn.toFixed(0)
|
this.batch.skuNo = sn.toFixed(0)
|
||||||
},
|
},
|
||||||
onUploadImgSuccess(file, index) {
|
onUploadImgSuccess(res, index) {
|
||||||
if (!file) {
|
if (!res) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.uploadDomain = file.data.domain
|
const data = res.data || res
|
||||||
this.skuData.skuList[index].logo = file.data.fileName
|
this.uploadDomain = data.domain || this.uploadDomain
|
||||||
|
const fileName = data.fileName || data.file || data.path || data.url || ''
|
||||||
|
if (!fileName) return
|
||||||
|
this.skuData.skuList[index].logo = fileName
|
||||||
this.$emit('skuChange', this.skuData)
|
this.$emit('skuChange', this.skuData)
|
||||||
},
|
},
|
||||||
getTable() {
|
getTable() {
|
||||||
|
|||||||
@ -146,7 +146,7 @@
|
|||||||
>
|
>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="积分抵扣" prop="canUsePoint">
|
<el-form-item label="银币抵扣" prop="canUsePoint">
|
||||||
<el-radio-group v-model="extendForm.canUsePoint">
|
<el-radio-group v-model="extendForm.canUsePoint">
|
||||||
<el-radio key="Y" label="Y" value="Y">可用</el-radio>
|
<el-radio key="Y" label="Y" value="Y">可用</el-radio>
|
||||||
<el-radio key="N" label="N" value="N">不可用</el-radio>
|
<el-radio key="N" label="N" value="N">不可用</el-radio>
|
||||||
@ -366,6 +366,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
import { saveGoods, getGoodsInfo } from '@/api/goods'
|
import { saveGoods, getGoodsInfo } from '@/api/goods'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
import Sku from '../components/Sku'
|
import Sku from '../components/Sku'
|
||||||
export default {
|
export default {
|
||||||
name: 'GoodsForm',
|
name: 'GoodsForm',
|
||||||
@ -536,7 +538,7 @@ export default {
|
|||||||
app.uploadFiles = []
|
app.uploadFiles = []
|
||||||
if (images && images.length > 0) {
|
if (images && images.length > 0) {
|
||||||
images.forEach(function (url) {
|
images.forEach(function (url) {
|
||||||
app.uploadFiles.push({ url: imagePath + url })
|
app.uploadFiles.push({ url: resolveImageUrl(imagePath, url) })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,8 +670,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 文件上传成功
|
// 文件上传成功
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.baseForm.images.push(file.data.fileName)
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.baseForm.images.push(fileName)
|
||||||
},
|
},
|
||||||
// 文件删除处理
|
// 文件删除处理
|
||||||
handleRemove(file) {
|
handleRemove(file) {
|
||||||
|
|||||||
@ -221,7 +221,7 @@
|
|||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="积分" align="center" prop="point">
|
<el-table-column label="银币" align="center" prop="point">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div>
|
<div>
|
||||||
<span>{{ scope.row.point ? scope.row.point : '0.00' }}</span>
|
<span>{{ scope.row.point ? scope.row.point : '0.00' }}</span>
|
||||||
@ -541,7 +541,7 @@
|
|||||||
@close="closeDialog"
|
@close="closeDialog"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 积分充值对话框 -->
|
<!-- 银币充值对话框 -->
|
||||||
<pointRecharge
|
<pointRecharge
|
||||||
:showDialog="openPoint"
|
:showDialog="openPoint"
|
||||||
:userId="userId"
|
:userId="userId"
|
||||||
@ -595,7 +595,7 @@ export default {
|
|||||||
userId: '',
|
userId: '',
|
||||||
// 是否弹层充值
|
// 是否弹层充值
|
||||||
openBalance: false,
|
openBalance: false,
|
||||||
// 是否弹层积分
|
// 是否弹层银币
|
||||||
openPoint: false,
|
openPoint: false,
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
@ -738,7 +738,7 @@ export default {
|
|||||||
this.openBalance = true
|
this.openBalance = true
|
||||||
this.userId = userId.toString()
|
this.userId = userId.toString()
|
||||||
},
|
},
|
||||||
// 积分变更操作
|
// 银币变更操作
|
||||||
handlePoint(userId) {
|
handlePoint(userId) {
|
||||||
this.openPoint = true
|
this.openPoint = true
|
||||||
this.userId = userId.toString()
|
this.userId = userId.toString()
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="this.cardForm.logoUrl"
|
v-if="this.cardForm.logoUrl"
|
||||||
:src="imagePath + this.cardForm.logoUrl"
|
:src="getImageUrl(this.cardForm.logoUrl)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i v-if="!this.cardForm.logoUrl" class="el-icon-plus"></i>
|
<i v-if="!this.cardForm.logoUrl" class="el-icon-plus"></i>
|
||||||
@ -62,7 +62,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="显示积分:" prop="supplyBonus">
|
<el-form-item label="显示银币:" prop="supplyBonus">
|
||||||
<el-radio-group v-model="cardForm.supplyBonus">
|
<el-radio-group v-model="cardForm.supplyBonus">
|
||||||
<el-radio :key="true" :label="true" :value="true">是</el-radio>
|
<el-radio :key="true" :label="true" :value="true">是</el-radio>
|
||||||
<el-radio :key="false" :label="false" :value="false">否</el-radio>
|
<el-radio :key="false" :label="false" :value="false">否</el-radio>
|
||||||
@ -72,10 +72,10 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="跳转外链查看积分URL:" prop="bonusUrl">
|
<el-form-item label="跳转外链查看银币URL:" prop="bonusUrl">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="cardForm.bonusUrl"
|
v-model="cardForm.bonusUrl"
|
||||||
placeholder="请输入跳转外链查看积分URL"
|
placeholder="请输入跳转外链查看银币URL"
|
||||||
maxlength="255"
|
maxlength="255"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -83,10 +83,10 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="积分规则:" prop="bonusRules">
|
<el-form-item label="银币规则:" prop="bonusRules">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="cardForm.bonusRules"
|
v-model="cardForm.bonusRules"
|
||||||
placeholder="请输入积分规则"
|
placeholder="请输入银币规则"
|
||||||
maxlength="100"
|
maxlength="100"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -236,6 +236,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getMemberSetting, saveSetting } from '@/api/member'
|
import { getMemberSetting, saveSetting } from '@/api/member'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
export default {
|
export default {
|
||||||
name: 'memberCard',
|
name: 'memberCard',
|
||||||
@ -287,7 +289,7 @@ export default {
|
|||||||
],
|
],
|
||||||
title: [{ required: true, message: '请输入卡券名称', trigger: 'blur' }],
|
title: [{ required: true, message: '请输入卡券名称', trigger: 'blur' }],
|
||||||
supplyBonus: [
|
supplyBonus: [
|
||||||
{ required: true, message: '请选择是否显示积分', trigger: 'blur' },
|
{ required: true, message: '请选择是否显示银币', trigger: 'blur' },
|
||||||
],
|
],
|
||||||
logoUrl: [{ required: true, message: '请上传图片', trigger: 'blur' }],
|
logoUrl: [{ required: true, message: '请上传图片', trigger: 'blur' }],
|
||||||
color: [
|
color: [
|
||||||
@ -329,6 +331,9 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 查询会员卡信息
|
// 查询会员卡信息
|
||||||
getMemberSetting() {
|
getMemberSetting() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
@ -381,12 +386,16 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 背景图上传处理
|
// 背景图上传处理
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.cardForm.backgroundUrl = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.cardForm.backgroundUrl = fileName
|
||||||
},
|
},
|
||||||
// 商户logo图上传处理
|
// 商户logo图上传处理
|
||||||
handleUploadLogoSuccess(file) {
|
handleUploadLogoSuccess(res) {
|
||||||
this.cardForm.logoUrl = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.cardForm.logoUrl = fileName
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 积分变更对话框 -->
|
<!-- 银币变更对话框 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="积分变更"
|
title="银币变更"
|
||||||
:visible.sync="showDialog"
|
:visible.sync="showDialog"
|
||||||
class="common-dialog"
|
class="common-dialog"
|
||||||
width="700px"
|
width="700px"
|
||||||
@ -18,7 +18,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="可用积分:" prop="balance">
|
<el-form-item label="可用银币:" prop="balance">
|
||||||
<span>{{ memberInfo.point }}</span>
|
<span>{{ memberInfo.point }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -136,7 +136,7 @@ export default {
|
|||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
doRecharge(this.form).then((response) => {
|
doRecharge(this.form).then((response) => {
|
||||||
this.$alert('积分操作成功!')
|
this.$alert('银币操作成功!')
|
||||||
this.$emit('closeDialog', 'point')
|
this.$emit('closeDialog', 'point')
|
||||||
this.reset()
|
this.reset()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -77,7 +77,7 @@
|
|||||||
<el-button @click="cancel">取消</el-button>
|
<el-button @click="cancel">取消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 积分充值对话框 -->
|
<!-- 银币充值对话框 -->
|
||||||
<memberCard
|
<memberCard
|
||||||
:showDialog="openMemberCard"
|
:showDialog="openMemberCard"
|
||||||
@closeDialog="closeDialog"
|
@closeDialog="closeDialog"
|
||||||
|
|||||||
@ -206,7 +206,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="form.logo"
|
v-if="form.logo"
|
||||||
:src="imagePath + form.logo"
|
:src="getImageUrl(form.logo)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i v-if="!form.logo" class="el-icon-plus"></i>
|
<i v-if="!form.logo" class="el-icon-plus"></i>
|
||||||
@ -348,6 +348,8 @@ import {
|
|||||||
getMerchantInfo,
|
getMerchantInfo,
|
||||||
saveMerchant,
|
saveMerchant,
|
||||||
} from '@/api/merchant'
|
} from '@/api/merchant'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
export default {
|
export default {
|
||||||
name: 'MerchantIndex',
|
name: 'MerchantIndex',
|
||||||
data() {
|
data() {
|
||||||
@ -433,6 +435,9 @@ export default {
|
|||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 查询日志
|
// 查询日志
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
@ -560,8 +565,10 @@ export default {
|
|||||||
handleAccount(row) {
|
handleAccount(row) {
|
||||||
this.$router.push({ path: '/system/account/index?merchantId=' + row.id })
|
this.$router.push({ path: '/system/account/index?merchantId=' + row.id })
|
||||||
},
|
},
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.form.logo = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.form.logo = fileName
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,7 +80,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="卡券数量" align="center" prop="couponNum" />
|
<el-table-column label="卡券数量" align="center" prop="couponNum" />
|
||||||
<el-table-column label="赠送积分" align="center" prop="point">
|
<el-table-column label="赠送银币" align="center" prop="point">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.point > 0">{{ scope.row.point }}</span>
|
<span v-if="scope.row.point > 0">{{ scope.row.point }}</span>
|
||||||
<span v-else>无</span>
|
<span v-else>无</span>
|
||||||
@ -191,10 +191,10 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="积分数量" prop="point">
|
<el-form-item label="银币数量" prop="point">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.point"
|
v-model="form.point"
|
||||||
placeholder="请输入赠送积分数量"
|
placeholder="请输入赠送银币数量"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|||||||
@ -87,13 +87,13 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row class="row">
|
<el-row class="row">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<span class="head">使用积分:</span>
|
<span class="head">使用银币:</span>
|
||||||
<span class="control-label">{{
|
<span class="control-label">{{
|
||||||
orderInfo.usePoint ? orderInfo.usePoint : 0
|
orderInfo.usePoint ? orderInfo.usePoint : 0
|
||||||
}}</span>
|
}}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<span class="head">积分金额:</span>
|
<span class="head">银币金额:</span>
|
||||||
<span class="control-label"
|
<span class="control-label"
|
||||||
>¥{{ orderInfo.pointAmount.toFixed(2) }}</span
|
>¥{{ orderInfo.pointAmount.toFixed(2) }}</span
|
||||||
>
|
>
|
||||||
|
|||||||
@ -248,7 +248,7 @@
|
|||||||
<span v-else>0.00</span>
|
<span v-else>0.00</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="积分金额" align="center" prop="pointAmount">
|
<el-table-column label="银币金额" align="center" prop="pointAmount">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="true">{{ scope.row.pointAmount.toFixed(2) }}</span>
|
<span v-if="true">{{ scope.row.pointAmount.toFixed(2) }}</span>
|
||||||
<span v-else>0.00</span>
|
<span v-else>0.00</span>
|
||||||
|
|||||||
@ -13,11 +13,11 @@
|
|||||||
<el-form-item
|
<el-form-item
|
||||||
class="recharge-item"
|
class="recharge-item"
|
||||||
prop="pointNeedConsume"
|
prop="pointNeedConsume"
|
||||||
label="返1积分所需消费金额"
|
label="返1银币所需消费金额"
|
||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.pointNeedConsume"
|
v-model="form.pointNeedConsume"
|
||||||
placeholder="返1积分所需消费金额"
|
placeholder="返1银币所需消费金额"
|
||||||
maxlength="10"
|
maxlength="10"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
<el-form-item
|
<el-form-item
|
||||||
class="recharge-item"
|
class="recharge-item"
|
||||||
prop="canUsedAsMoney"
|
prop="canUsedAsMoney"
|
||||||
label="积分是否可当作现金使用"
|
label="银币是否可当作现金使用"
|
||||||
>
|
>
|
||||||
<el-radio-group v-model="form.canUsedAsMoney">
|
<el-radio-group v-model="form.canUsedAsMoney">
|
||||||
<el-radio key="true" label="true" value="true">是</el-radio>
|
<el-radio key="true" label="true" value="true">是</el-radio>
|
||||||
@ -42,11 +42,11 @@
|
|||||||
<el-form-item
|
<el-form-item
|
||||||
class="recharge-item"
|
class="recharge-item"
|
||||||
prop="exchangeNeedPoint"
|
prop="exchangeNeedPoint"
|
||||||
label="多少积分可抵扣1元现金"
|
label="多少银币可抵扣1元现金"
|
||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.exchangeNeedPoint"
|
v-model="form.exchangeNeedPoint"
|
||||||
placeholder="多少积分可抵扣1元现金"
|
placeholder="多少银币可抵扣1元现金"
|
||||||
maxlength="10"
|
maxlength="10"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -57,11 +57,11 @@
|
|||||||
<el-form-item
|
<el-form-item
|
||||||
class="recharge-item"
|
class="recharge-item"
|
||||||
prop="rechargePointSpeed"
|
prop="rechargePointSpeed"
|
||||||
label="充值返积分倍数"
|
label="充值返银币倍数"
|
||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.rechargePointSpeed"
|
v-model="form.rechargePointSpeed"
|
||||||
placeholder="充值返积分倍数"
|
placeholder="充值返银币倍数"
|
||||||
maxlength="10"
|
maxlength="10"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
250
src/views/raffle/components/raffleType.vue
Normal file
250
src/views/raffle/components/raffleType.vue
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
<template>
|
||||||
|
<div class="type-container">
|
||||||
|
<el-dialog
|
||||||
|
title="抽奖类型"
|
||||||
|
:visible.sync="innerShowDialog"
|
||||||
|
class="common-dialog"
|
||||||
|
width="950px"
|
||||||
|
@close="handleClose"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="form"
|
||||||
|
:model="form"
|
||||||
|
label-width="120px"
|
||||||
|
size="small"
|
||||||
|
:inline="true"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-form-item label="类型名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="form.name"
|
||||||
|
placeholder="请输入类型名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
@keyup.enter.native="getTypeList"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="类型编码" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="form.code"
|
||||||
|
placeholder="请输入类型编码"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
@keyup.enter.native="getTypeList"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="form.status" placeholder="状态" clearable>
|
||||||
|
<el-option key="A" label="启用" value="A" />
|
||||||
|
<el-option key="N" label="禁用" value="N" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
@click="getTypeList"
|
||||||
|
>查询</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
plain
|
||||||
|
size="mini"
|
||||||
|
@click="addType"
|
||||||
|
>新增类型</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table ref="tables" v-loading="loading" :data="typeList">
|
||||||
|
<el-table-column label="ID" prop="id" width="80" />
|
||||||
|
<el-table-column label="类型名称" prop="name" />
|
||||||
|
<el-table-column label="类型编码" prop="code" />
|
||||||
|
<el-table-column label="排序" align="center" prop="sort" width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.sort }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="更新时间" align="center" prop="updateTime" width="160">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.updateTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.status"
|
||||||
|
active-value="A"
|
||||||
|
inactive-value="N"
|
||||||
|
@change="handleStatusChange(scope.row)"
|
||||||
|
></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
width="140"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="page"
|
||||||
|
:limit.sync="pageSize"
|
||||||
|
@pagination="getTypeList"
|
||||||
|
/>
|
||||||
|
</el-dialog>
|
||||||
|
<raffleTypeForm
|
||||||
|
:showDialog="openTypeDialog"
|
||||||
|
:raffleTypeInfo="raffleTypeInfo"
|
||||||
|
:storeList="storeList"
|
||||||
|
@closeDialog="closeDialog"
|
||||||
|
></raffleTypeForm>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import raffleTypeForm from './raffleTypeForm'
|
||||||
|
import {
|
||||||
|
getRaffleTypeList,
|
||||||
|
getRaffleTypeInfo,
|
||||||
|
updateRaffleTypeStatus,
|
||||||
|
} from '@/api/raffle'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'raffleType',
|
||||||
|
components: {
|
||||||
|
raffleTypeForm,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
showDialog: {
|
||||||
|
type: [Boolean],
|
||||||
|
default: () => false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
innerShowDialog: this.showDialog,
|
||||||
|
loading: false,
|
||||||
|
openTypeDialog: false,
|
||||||
|
raffleTypeInfo: null,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
form: { page: 1, pageSize: 10 },
|
||||||
|
storeList: [],
|
||||||
|
typeList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
showDialog(newVal) {
|
||||||
|
this.innerShowDialog = newVal
|
||||||
|
if (newVal) {
|
||||||
|
this.getTypeList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
innerShowDialog(newVal) {
|
||||||
|
if (!newVal) {
|
||||||
|
this.$emit('closeDialog', 'typeDialog')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClose() {
|
||||||
|
this.innerShowDialog = false
|
||||||
|
},
|
||||||
|
handleStatusChange(row) {
|
||||||
|
const text = row.status == 'A' ? '启用' : '禁用'
|
||||||
|
this.$modal
|
||||||
|
.confirm('确认要' + text + '"' + row.name + '"吗?')
|
||||||
|
.then(function () {
|
||||||
|
return updateRaffleTypeStatus(row.id, row.status)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.$modal.msgSuccess(text + '成功')
|
||||||
|
})
|
||||||
|
.catch(function () {
|
||||||
|
row.status = row.status === 'N' ? 'A' : 'N'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getTypeList() {
|
||||||
|
const app = this
|
||||||
|
app.loading = true
|
||||||
|
const params = {
|
||||||
|
page: app.page,
|
||||||
|
pageSize: app.pageSize,
|
||||||
|
name: app.form.name || '',
|
||||||
|
code: app.form.code || '',
|
||||||
|
status: app.form.status || '',
|
||||||
|
}
|
||||||
|
getRaffleTypeList(params)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
app.typeList = response.data.dataList.content || []
|
||||||
|
app.total = response.data.dataList.totalElements || 0
|
||||||
|
app.storeList = response.data.storeList || []
|
||||||
|
}
|
||||||
|
app.loading = false
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
app.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
addType() {
|
||||||
|
this.openTypeDialog = true
|
||||||
|
this.raffleTypeInfo = null
|
||||||
|
},
|
||||||
|
handleUpdate(row) {
|
||||||
|
const id = row.id
|
||||||
|
this.raffleTypeInfo = null
|
||||||
|
getRaffleTypeInfo(id).then((response) => {
|
||||||
|
this.raffleTypeInfo = response.data.raffleTypeInfo
|
||||||
|
this.openTypeDialog = true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
this.$modal
|
||||||
|
.confirm('是否确认删除' + row.name + '"吗?')
|
||||||
|
.then(function () {
|
||||||
|
return updateRaffleTypeStatus(row.id, 'D')
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getTypeList()
|
||||||
|
this.$modal.msgSuccess('删除成功')
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
},
|
||||||
|
closeDialog() {
|
||||||
|
this.openTypeDialog = false
|
||||||
|
this.getTypeList()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
179
src/views/raffle/components/raffleTypeForm.vue
Normal file
179
src/views/raffle/components/raffleTypeForm.vue
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 添加或修改类型对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="showDialog"
|
||||||
|
class="common-dialog"
|
||||||
|
width="700px"
|
||||||
|
:before-close="handleCLose"
|
||||||
|
@close="handleCLose"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="类型名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="form.name"
|
||||||
|
placeholder="请输入类型名称"
|
||||||
|
maxlength="200"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="类型编码" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="form.code"
|
||||||
|
placeholder="请输入类型编码"
|
||||||
|
maxlength="50"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="所属店铺" prop="storeId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.storeId"
|
||||||
|
style="width: 260px"
|
||||||
|
placeholder="所属店铺,空则为公共所有"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
:key="0"
|
||||||
|
label="公共所有"
|
||||||
|
v-if="!this.$store.getters.storeId"
|
||||||
|
:value="0"
|
||||||
|
/>
|
||||||
|
<el-option
|
||||||
|
v-for="storeInfo in storeList"
|
||||||
|
:key="storeInfo.id"
|
||||||
|
:label="storeInfo.name"
|
||||||
|
:value="storeInfo.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="排序" prop="sort">
|
||||||
|
<el-input-number v-model="form.sort" :min="0" />
|
||||||
|
<div class="form-tips">提示:数值越小,排行越靠前</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注信息">
|
||||||
|
<el-input
|
||||||
|
v-model="form.description"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio key="A" label="A" value="A">启用</el-radio>
|
||||||
|
<el-radio key="N" label="N" value="N">禁用</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="doSubmit">确定</el-button>
|
||||||
|
<el-button @click="handleCLose">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { saveRaffleType } from '@/api/raffle'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'raffleTypeForm',
|
||||||
|
props: {
|
||||||
|
showDialog: {
|
||||||
|
type: [Boolean],
|
||||||
|
default: () => false,
|
||||||
|
},
|
||||||
|
storeList: {
|
||||||
|
type: [Array],
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
raffleTypeInfo: {
|
||||||
|
type: [Object],
|
||||||
|
default: () => null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
showDialog(value) {
|
||||||
|
if (value && this.raffleTypeInfo) {
|
||||||
|
this.form = { ...this.raffleTypeInfo }
|
||||||
|
} else {
|
||||||
|
this.form = {
|
||||||
|
name: '',
|
||||||
|
code: '',
|
||||||
|
description: '',
|
||||||
|
storeId: '',
|
||||||
|
sort: 0,
|
||||||
|
status: 'A',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '新增抽奖类型',
|
||||||
|
form: {
|
||||||
|
name: '',
|
||||||
|
code: '',
|
||||||
|
description: '',
|
||||||
|
storeId: '',
|
||||||
|
sort: 0,
|
||||||
|
status: 'A',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '名称不能为空', trigger: 'blur' },
|
||||||
|
{
|
||||||
|
min: 2,
|
||||||
|
max: 200,
|
||||||
|
message: '名称长度必须介于2 和 200 之间',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
code: [
|
||||||
|
{ required: true, message: '编码不能为空', trigger: 'blur' },
|
||||||
|
{
|
||||||
|
min: 2,
|
||||||
|
max: 50,
|
||||||
|
message: '编码长度必须介于2 和 50 之间',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
doSubmit() {
|
||||||
|
const app = this
|
||||||
|
const param = app.form
|
||||||
|
saveRaffleType(param).then((response) => {
|
||||||
|
if (response) {
|
||||||
|
app.$modal.msgSuccess('提交成功!')
|
||||||
|
app.handleCLose()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleCLose() {
|
||||||
|
this.$emit('closeDialog', 'typeDialog')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
441
src/views/raffle/detail.vue
Normal file
441
src/views/raffle/detail.vue
Normal file
@ -0,0 +1,441 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px" v-loading="loading">
|
||||||
|
<el-divider content-position="left">基本信息</el-divider>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="抽奖标题" prop="title">
|
||||||
|
<el-input v-model="form.title" placeholder="请输入抽奖标题" :disabled="viewMode" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="抽奖类型" prop="raffleType">
|
||||||
|
<el-select
|
||||||
|
v-model="form.raffleType"
|
||||||
|
placeholder="请选择抽奖类型"
|
||||||
|
:disabled="viewMode"
|
||||||
|
style="width: 100%;"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in raffleTypeList"
|
||||||
|
:key="item.code"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="所需银币" prop="rafflePoint">
|
||||||
|
<el-input-number v-model="form.rafflePoint" :min="0" :disabled="viewMode" />
|
||||||
|
<span class="ml-2">用户抽奖需要消耗的银币</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="转发奖励银币" prop="forwardPoint">
|
||||||
|
<el-input-number v-model="form.forwardPoint" :min="0" :disabled="viewMode" />
|
||||||
|
<span class="ml-2">用户转发获得的银币</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="抽奖封面图" prop="image">
|
||||||
|
<el-upload
|
||||||
|
class="avatar-uploader"
|
||||||
|
:action="uploadUrl"
|
||||||
|
:headers="uploadHeaders"
|
||||||
|
:show-file-list="false"
|
||||||
|
:on-success="handleImageSuccess"
|
||||||
|
:before-upload="beforeImageUpload"
|
||||||
|
:disabled="viewMode"
|
||||||
|
>
|
||||||
|
<img v-if="form.image" :src="getImageUrl(form.image)" class="avatar">
|
||||||
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="抽奖简介" prop="brief">
|
||||||
|
<el-input v-model="form.brief" type="textarea" :rows="3" placeholder="请输入抽奖简介" :disabled="viewMode" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-form-item label="详细描述" prop="description">
|
||||||
|
<el-input v-model="form.description" type="textarea" :rows="4" placeholder="请输入详细描述" :disabled="viewMode" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-divider content-position="left">特殊奖品设置</el-divider>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="特殊奖品类型" prop="extraType">
|
||||||
|
<el-select v-model="form.extraType" placeholder="请选择特殊奖品类型" :disabled="viewMode">
|
||||||
|
<el-option label="普通奖(L)" value="L"></el-option>
|
||||||
|
<el-option label="特殊奖(S)" value="S"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="特殊奖品" prop="extraPrize">
|
||||||
|
<el-input v-model="form.extraPrize" placeholder="请输入特殊奖品名称" :disabled="viewMode" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="特殊奖品图" prop="extraImage">
|
||||||
|
<el-upload
|
||||||
|
class="avatar-uploader"
|
||||||
|
:action="uploadUrl"
|
||||||
|
:headers="uploadHeaders"
|
||||||
|
:show-file-list="false"
|
||||||
|
:on-success="handleExtraImageSuccess"
|
||||||
|
:before-upload="beforeImageUpload"
|
||||||
|
:disabled="viewMode"
|
||||||
|
>
|
||||||
|
<img v-if="form.extraImage" :src="getImageUrl(form.extraImage)" class="avatar">
|
||||||
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-divider content-position="left">奖品配置</el-divider>
|
||||||
|
|
||||||
|
<el-form-item label="奖品列表">
|
||||||
|
<div v-if="viewMode">
|
||||||
|
<el-table :data="raffleItems" border style="width: 100%">
|
||||||
|
<el-table-column prop="title" label="奖品标题" width="120"></el-table-column>
|
||||||
|
<el-table-column prop="prize" label="奖品名称" width="120"></el-table-column>
|
||||||
|
<el-table-column prop="point" label="银币价值" width="100"></el-table-column>
|
||||||
|
<el-table-column prop="num" label="数量" width="80"></el-table-column>
|
||||||
|
<el-table-column label="图片" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<img :src="getImageUrl(scope.row.image)" class="table-img" v-if="scope.row.image" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<el-button type="primary" size="small" icon="el-icon-plus" @click="addPrizeItem">添加奖品</el-button>
|
||||||
|
<el-table :data="raffleItems" border style="width: 100%; margin-top: 10px">
|
||||||
|
<el-table-column prop="title" label="奖品标题" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.title" placeholder="如:A, B, C" size="small" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="prize" label="奖品名称" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.prize" placeholder="奖品名称" size="small" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="point" label="银币价值" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input-number v-model="scope.row.point" :min="0" size="small" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="num" label="数量" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input-number v-model="scope.row.num" :min="1" size="small" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="图片" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-upload
|
||||||
|
class="inline-uploader"
|
||||||
|
:action="uploadUrl"
|
||||||
|
:headers="uploadHeaders"
|
||||||
|
:show-file-list="false"
|
||||||
|
:on-success="(res) => handlePrizeImageSuccess(res, scope.$index)"
|
||||||
|
:before-upload="beforeImageUpload"
|
||||||
|
>
|
||||||
|
<el-button size="small" type="primary">上传图片</el-button>
|
||||||
|
</el-upload>
|
||||||
|
<img v-if="scope.row.image" :src="getImageUrl(scope.row.image)" class="table-img" style="margin-top: 5px" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" icon="el-icon-delete" @click="removePrizeItem(scope.$index)" style="color: #f56c6c">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item v-if="!viewMode">
|
||||||
|
<el-button type="primary" @click="submitForm">保存</el-button>
|
||||||
|
<el-button @click="cancel">取消</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getRaffleDetail, getRaffleRecords, saveRaffle, getRaffleTypeList } from '@/api/raffle'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RaffleDetail',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
viewMode: false,
|
||||||
|
form: {
|
||||||
|
id: 0,
|
||||||
|
title: '',
|
||||||
|
brief: '',
|
||||||
|
raffleType: '',
|
||||||
|
image: '',
|
||||||
|
rafflePoint: 0,
|
||||||
|
forwardPoint: 0,
|
||||||
|
description: '',
|
||||||
|
extraType: 'L',
|
||||||
|
extraPrize: '',
|
||||||
|
extraImage: '',
|
||||||
|
status: 'A',
|
||||||
|
},
|
||||||
|
raffleItems: [],
|
||||||
|
rules: {
|
||||||
|
title: [{ required: true, message: '请输入抽奖标题', trigger: 'blur' }],
|
||||||
|
brief: [{ required: true, message: '请输入抽奖简介', trigger: 'blur' }],
|
||||||
|
raffleType: [{ required: true, message: '请输入抽奖类型', trigger: 'blur' }],
|
||||||
|
},
|
||||||
|
raffleTypeList: [],
|
||||||
|
imagePath: '',
|
||||||
|
uploadUrl: process.env.VUE_APP_BASE_API + '/backendApi/file/upload',
|
||||||
|
uploadHeaders: {
|
||||||
|
'Access-Token': getToken(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.syncRouteState()
|
||||||
|
this.loadRaffleTypes()
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'$route.query': {
|
||||||
|
handler() {
|
||||||
|
this.syncRouteState()
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
|
syncRouteState() {
|
||||||
|
const id = this.$route.query.id
|
||||||
|
const view = this.$route.query.view
|
||||||
|
this.viewMode = !!view
|
||||||
|
if (id && id !== '0') {
|
||||||
|
this.getDetail(id)
|
||||||
|
} else {
|
||||||
|
this.resetFormState()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
resetFormState() {
|
||||||
|
this.form = {
|
||||||
|
id: 0,
|
||||||
|
title: '',
|
||||||
|
brief: '',
|
||||||
|
raffleType: '',
|
||||||
|
image: '',
|
||||||
|
rafflePoint: 0,
|
||||||
|
forwardPoint: 0,
|
||||||
|
description: '',
|
||||||
|
extraType: 'L',
|
||||||
|
extraPrize: '',
|
||||||
|
extraImage: '',
|
||||||
|
status: 'A',
|
||||||
|
}
|
||||||
|
this.raffleItems = []
|
||||||
|
this.ensureDefaultType()
|
||||||
|
},
|
||||||
|
loadRaffleTypes() {
|
||||||
|
getRaffleTypeList({ page: 1, pageSize: 200, status: 'A' })
|
||||||
|
.then((response) => {
|
||||||
|
if (response.code === 200 && response.data) {
|
||||||
|
const list = response.data.dataList && response.data.dataList.content ? response.data.dataList.content : []
|
||||||
|
this.raffleTypeList = Array.isArray(list) ? list : []
|
||||||
|
} else {
|
||||||
|
this.raffleTypeList = []
|
||||||
|
}
|
||||||
|
this.ensureDefaultType()
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.raffleTypeList = []
|
||||||
|
this.ensureDefaultType()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
ensureDefaultType() {
|
||||||
|
if (this.form && !this.form.raffleType && this.raffleTypeList.length) {
|
||||||
|
this.form.raffleType = this.raffleTypeList[0].code
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getDetail(id) {
|
||||||
|
this.loading = true
|
||||||
|
getRaffleDetail(id).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
const data = response.data.dataList
|
||||||
|
this.imagePath = response.data.imagePath || ''
|
||||||
|
this.form = {
|
||||||
|
id: data.id,
|
||||||
|
title: data.title,
|
||||||
|
brief: data.brief,
|
||||||
|
raffleType: data.raffleType,
|
||||||
|
image: data.image,
|
||||||
|
rafflePoint: data.rafflePoint || 0,
|
||||||
|
forwardPoint: data.forwardPoint || 0,
|
||||||
|
description: data.description,
|
||||||
|
extraType: data.extraType || 'L',
|
||||||
|
extraPrize: data.extraPrize || '',
|
||||||
|
extraImage: data.extraImage || '',
|
||||||
|
status: data.status,
|
||||||
|
}
|
||||||
|
this.ensureDefaultType()
|
||||||
|
getRaffleRecords({ raffleId: id }).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.imagePath = res.data.imagePath || this.imagePath
|
||||||
|
const items = res.data.rafList || []
|
||||||
|
const grouped = {}
|
||||||
|
items.forEach(item => {
|
||||||
|
if (!grouped[item.title]) {
|
||||||
|
grouped[item.title] = {
|
||||||
|
title: item.title,
|
||||||
|
prize: item.prize,
|
||||||
|
point: item.point,
|
||||||
|
image: item.image,
|
||||||
|
num: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item.win === 0) {
|
||||||
|
grouped[item.title].num++
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.raffleItems = Object.values(grouped)
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message.error('获取抽奖奖品失败')
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.error(response.message || '获取抽奖详情失败')
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message.error('获取抽奖详情失败')
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
addPrizeItem() {
|
||||||
|
this.raffleItems.push({
|
||||||
|
title: '',
|
||||||
|
prize: '',
|
||||||
|
point: 0,
|
||||||
|
num: 1,
|
||||||
|
image: '',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
removePrizeItem(index) {
|
||||||
|
this.raffleItems.splice(index, 1)
|
||||||
|
},
|
||||||
|
handleImageSuccess(res) {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.form.image = res.data.path
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleExtraImageSuccess(res) {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.form.extraImage = res.data.path
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handlePrizeImageSuccess(res, index) {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.raffleItems[index].image = res.data.path
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeImageUpload(file) {
|
||||||
|
const isJPG = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif'
|
||||||
|
const isLt2M = file.size / 1024 / 1024 < 2
|
||||||
|
if (!isJPG) {
|
||||||
|
this.$message.error('上传图片只能是 JPG/PNG/GIF 格式!')
|
||||||
|
}
|
||||||
|
if (!isLt2M) {
|
||||||
|
this.$message.error('上传图片大小不能超过 2MB!')
|
||||||
|
}
|
||||||
|
return isJPG && isLt2M
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
this.$refs.form.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.raffleItems.length === 0) {
|
||||||
|
this.$message.warning('请至少添加一个奖品')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.loading = true
|
||||||
|
const data = {
|
||||||
|
...this.form,
|
||||||
|
rafData: this.raffleItems,
|
||||||
|
}
|
||||||
|
saveRaffle(data).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message.success('保存成功')
|
||||||
|
this.$router.push('/raffle/index')
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
this.$router.push('/raffle/index')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.avatar-uploader {
|
||||||
|
border: 1px dashed #d9d9d9;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.avatar-uploader:hover {
|
||||||
|
border-color: #409EFF;
|
||||||
|
}
|
||||||
|
.avatar-uploader-icon {
|
||||||
|
font-size: 28px;
|
||||||
|
color: #8c939d;
|
||||||
|
width: 178px;
|
||||||
|
height: 178px;
|
||||||
|
line-height: 178px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.avatar {
|
||||||
|
width: 178px;
|
||||||
|
height: 178px;
|
||||||
|
display: block;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
.table-img {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.ml-2 {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
303
src/views/raffle/index.vue
Normal file
303
src/views/raffle/index.vue
Normal file
@ -0,0 +1,303 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
class="main-search"
|
||||||
|
ref="queryForm"
|
||||||
|
size="small"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="抽奖标题" prop="title">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.title"
|
||||||
|
placeholder="请输入抽奖标题"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="状态" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="statusInfo in statusList"
|
||||||
|
:key="statusInfo.key"
|
||||||
|
:label="statusInfo.name"
|
||||||
|
:value="statusInfo.key"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
@click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-menu"
|
||||||
|
plain
|
||||||
|
size="mini"
|
||||||
|
@click="openTypeDialog"
|
||||||
|
>抽奖类型管理</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
ref="tables"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="list"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
:default-sort="defaultSort"
|
||||||
|
@sort-change="handleSortChange"
|
||||||
|
>
|
||||||
|
<el-table-column label="ID" prop="id" width="66" />
|
||||||
|
<el-table-column label="图片" align="center" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<img class="list-img" :src="getImageUrl(scope.row.image)" v-if="scope.row.image" />
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="标题" align="center" prop="title">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.title }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="简介" align="center" prop="brief" width="200" show-overflow-tooltip>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.brief }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="抽奖类型" align="center" prop="raffleType">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.raffleType }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="所需银币" align="center" prop="rafflePoint">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.rafflePoint || 0 }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="总数" align="center" prop="allCnt">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.allCnt }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="已抽取" align="center" prop="nowCnt">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.nowCnt }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="点击次数" align="center" prop="click">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.click }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
width="160"
|
||||||
|
prop="createTime"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="scope.row.status === 'A' ? 'success' : 'danger'">
|
||||||
|
{{ scope.row.status === 'A' ? '正常' : '禁用' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-view"
|
||||||
|
@click="handleView(scope.row.id)"
|
||||||
|
>查看</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleEdit(scope.row.id)"
|
||||||
|
>编辑</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-data-line"
|
||||||
|
@click="handleRecord(scope.row.id)"
|
||||||
|
>记录</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
:icon="scope.row.status === 'A' ? 'el-icon-lock' : 'el-icon-unlock'"
|
||||||
|
@click="handleStatus(scope.row)"
|
||||||
|
>
|
||||||
|
{{ scope.row.status === 'A' ? '禁用' : '启用' }}
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.page"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
<raffleType :showDialog="typeDialog" @closeDialog="closeDialog"></raffleType>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getRaffleList, updateRaffleStatus } from '@/api/raffle'
|
||||||
|
import raffleType from './components/raffleType'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RaffleList',
|
||||||
|
components: {
|
||||||
|
raffleType,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
showSearch: true,
|
||||||
|
total: 0,
|
||||||
|
list: [],
|
||||||
|
queryParams: {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
title: '',
|
||||||
|
status: 'A',
|
||||||
|
},
|
||||||
|
defaultSort: { prop: 'createTime', order: 'descending' },
|
||||||
|
statusList: [
|
||||||
|
{ key: 'A', name: '正常' },
|
||||||
|
{ key: 'N', name: '禁用' },
|
||||||
|
],
|
||||||
|
imagePath: '',
|
||||||
|
typeDialog: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
if (!path) return ''
|
||||||
|
if (/^https?:\/\//i.test(path)) {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
return (this.imagePath || '') + path
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
this.loading = true
|
||||||
|
getRaffleList(this.queryParams).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
const dataList = response.data.dataList || {}
|
||||||
|
this.list = dataList.content || dataList.rows || []
|
||||||
|
this.total = dataList.totalElements || dataList.total || 0
|
||||||
|
this.imagePath = response.data.imagePath || ''
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.page = 1
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm('queryForm')
|
||||||
|
this.handleQuery()
|
||||||
|
},
|
||||||
|
handleSelectionChange(selection) {},
|
||||||
|
handleSortChange(column) {
|
||||||
|
this.queryParams.orderByColumn = column.prop
|
||||||
|
this.queryParams.isAsc = column.order
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/raffle/detail',
|
||||||
|
query: { id: 0 },
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleView(id) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/raffle/detail',
|
||||||
|
query: { id, view: true },
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleEdit(id) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/raffle/detail',
|
||||||
|
query: { id },
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleRecord(id) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/raffle/record',
|
||||||
|
query: { raffleId: id },
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleStatus(row) {
|
||||||
|
const status = row.status === 'A' ? 'N' : 'A'
|
||||||
|
const text = status === 'A' ? '启用' : '禁用'
|
||||||
|
this.$confirm('确认要' + text + '该抽奖吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}).then(() => {
|
||||||
|
updateRaffleStatus(row.id, status).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message.success(text + '成功')
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
openTypeDialog() {
|
||||||
|
this.typeDialog = true
|
||||||
|
},
|
||||||
|
closeDialog() {
|
||||||
|
this.typeDialog = false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.list-img {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
228
src/views/raffle/record.vue
Normal file
228
src/views/raffle/record.vue
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-page-header @back="goBack" :content="pageTitle" class="page-header"></el-page-header>
|
||||||
|
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
class="main-search"
|
||||||
|
ref="queryForm"
|
||||||
|
size="small"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="80px"
|
||||||
|
style="margin-top: 20px"
|
||||||
|
>
|
||||||
|
<el-form-item label="会员号" prop="userNo">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.userNo"
|
||||||
|
placeholder="请输入会员号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否中奖" prop="win">
|
||||||
|
<el-select v-model="queryParams.win" placeholder="是否中奖" clearable>
|
||||||
|
<el-option label="已中奖" value="1"></el-option>
|
||||||
|
<el-option label="未中奖" value="0"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="领取状态" prop="deal">
|
||||||
|
<el-select v-model="queryParams.deal" placeholder="领取状态" clearable>
|
||||||
|
<el-option label="已领取" value="1"></el-option>
|
||||||
|
<el-option label="未领取" value="0"></el-option>
|
||||||
|
<el-option label="已换分" value="2"></el-option>
|
||||||
|
<el-option label="已邮寄" value="3"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
@click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
ref="tables"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="list"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column label="ID" prop="id" width="66" />
|
||||||
|
<el-table-column label="会员号" align="center" prop="userNo" width="150" />
|
||||||
|
<el-table-column label="称呼" align="center" prop="name" width="120" />
|
||||||
|
<el-table-column label="奖品标题" align="center" prop="title" width="120" />
|
||||||
|
<el-table-column label="奖品名称" align="center" prop="prize" width="150" />
|
||||||
|
<el-table-column label="奖品图片" align="center" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<img class="table-img" :src="getImageUrl(scope.row.image)" v-if="scope.row.image" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="银币价值" align="center" prop="point" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.point || 0 }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="是否中奖" align="center" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="scope.row.win === 1 ? 'success' : 'info'">
|
||||||
|
{{ scope.row.win === 1 ? '已中奖' : '未中奖' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="领取状态" align="center" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag v-if="scope.row.deal === 0" type="info">未领取</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.deal === 1" type="success">已领取</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.deal === 2" type="warning">已换分</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.deal === 3" type="primary">已邮寄</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="抽奖时间"
|
||||||
|
align="center"
|
||||||
|
width="160"
|
||||||
|
prop="createTime"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.win === 1 && scope.row.deal === 0"
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-check"
|
||||||
|
@click="handleDeal(scope.row.id)"
|
||||||
|
>标记领取</el-button
|
||||||
|
>
|
||||||
|
<span v-else-if="scope.row.win === 1">-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.page"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getRaffleDetail, getRaffleRecords, dealRaffle } from '@/api/raffle'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RaffleRecord',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
showSearch: true,
|
||||||
|
total: 0,
|
||||||
|
list: [],
|
||||||
|
queryParams: {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
raffleId: 0,
|
||||||
|
userNo: '',
|
||||||
|
win: '',
|
||||||
|
deal: '',
|
||||||
|
},
|
||||||
|
imagePath: '',
|
||||||
|
raffleTitle: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
pageTitle() {
|
||||||
|
return this.raffleTitle ? `抽奖记录 - ${this.raffleTitle}` : '抽奖记录'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
const raffleId = this.$route.query.raffleId
|
||||||
|
if (raffleId) {
|
||||||
|
this.queryParams.raffleId = raffleId
|
||||||
|
this.getRaffleInfo(raffleId)
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
|
getRaffleInfo(raffleId) {
|
||||||
|
getRaffleDetail(raffleId).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
const data = response.data.dataList
|
||||||
|
this.raffleTitle = data.title || ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
this.loading = true
|
||||||
|
getRaffleRecords(this.queryParams).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.list = response.data.rafList || []
|
||||||
|
this.imagePath = response.data.imagePath || ''
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.page = 1
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm('queryForm')
|
||||||
|
this.handleQuery()
|
||||||
|
},
|
||||||
|
handleSelectionChange(selection) {},
|
||||||
|
handleDeal(id) {
|
||||||
|
this.$confirm('确认标记为已领取吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}).then(() => {
|
||||||
|
dealRaffle(id).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message.success('标记成功')
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
goBack() {
|
||||||
|
this.$router.push('/raffle/index')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.page-header {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.table-img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -219,7 +219,7 @@
|
|||||||
<el-table-column label="商品条码" prop="goodsNo" />
|
<el-table-column label="商品条码" prop="goodsNo" />
|
||||||
<el-table-column label="主图" align="center" width="100">
|
<el-table-column label="主图" align="center" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<img class="list-img" :src="imagePath + scope.row.logo" />
|
<img class="list-img" :src="getImageUrl(scope.row.logo)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品名称" align="center" prop="name">
|
<el-table-column label="商品名称" align="center" prop="name">
|
||||||
@ -287,6 +287,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getStockList, saveStock, deleteStock, getStockInfo } from '@/api/stock'
|
import { getStockList, saveStock, deleteStock, getStockInfo } from '@/api/stock'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
import selectGoodsDialog from './selectGoodsDialog'
|
import selectGoodsDialog from './selectGoodsDialog'
|
||||||
export default {
|
export default {
|
||||||
name: 'StockIndex',
|
name: 'StockIndex',
|
||||||
@ -345,6 +346,9 @@ export default {
|
|||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 查询分类列表
|
// 查询分类列表
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="主图" align="center" width="100">
|
<el-table-column label="主图" align="center" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<img class="list-img" :src="imagePath + scope.row.logo" />
|
<img class="list-img" :src="getImageUrl(scope.row.logo)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品条码" width="180" prop="goodsNo" />
|
<el-table-column label="商品条码" width="180" prop="goodsNo" />
|
||||||
@ -89,6 +89,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { selectGoodsList } from '@/api/goods'
|
import { selectGoodsList } from '@/api/goods'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
showDialog: {
|
showDialog: {
|
||||||
@ -128,6 +129,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 获取商品列表
|
// 获取商品列表
|
||||||
getGoodsList() {
|
getGoodsList() {
|
||||||
const app = this
|
const app = this
|
||||||
|
|||||||
@ -196,7 +196,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="form.logo"
|
v-if="form.logo"
|
||||||
:src="imagePath + form.logo"
|
:src="getImageUrl(form.logo)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i v-if="!form.logo" class="el-icon-plus"></i>
|
<i v-if="!form.logo" class="el-icon-plus"></i>
|
||||||
@ -311,7 +311,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="form.license"
|
v-if="form.license"
|
||||||
:src="imagePath + form.license"
|
:src="getImageUrl(form.license)"
|
||||||
class="list-img"
|
class="list-img"
|
||||||
/>
|
/>
|
||||||
<i v-if="!form.license" class="el-icon-plus"></i>
|
<i v-if="!form.license" class="el-icon-plus"></i>
|
||||||
@ -324,7 +324,7 @@
|
|||||||
v-if="form.license"
|
v-if="form.license"
|
||||||
class="link"
|
class="link"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
:href="imagePath + form.license"
|
:href="getImageUrl(form.license)"
|
||||||
>(查看大图)</a
|
>(查看大图)</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
@ -489,6 +489,8 @@ import {
|
|||||||
getStoreInfo,
|
getStoreInfo,
|
||||||
saveStore,
|
saveStore,
|
||||||
} from '@/api/store'
|
} from '@/api/store'
|
||||||
|
import { resolveImageUrl } from '@/utils/image'
|
||||||
|
import { getUploadFileName } from '@/utils/upload'
|
||||||
export default {
|
export default {
|
||||||
name: 'StoreList',
|
name: 'StoreList',
|
||||||
components: {
|
components: {
|
||||||
@ -614,6 +616,9 @@ export default {
|
|||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageUrl(path) {
|
||||||
|
return resolveImageUrl(this.imagePath, path)
|
||||||
|
},
|
||||||
// 查询列表
|
// 查询列表
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
@ -747,15 +752,21 @@ export default {
|
|||||||
handleAccount(row) {
|
handleAccount(row) {
|
||||||
this.$router.push({ path: '/system/account/index?storeId=' + row.id })
|
this.$router.push({ path: '/system/account/index?storeId=' + row.id })
|
||||||
},
|
},
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(res) {
|
||||||
this.form.logo = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.form.logo = fileName
|
||||||
},
|
},
|
||||||
handleUploadLicenseSuccess(file) {
|
handleUploadLicenseSuccess(res) {
|
||||||
this.form.license = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
|
if (!fileName) return
|
||||||
|
this.form.license = fileName
|
||||||
},
|
},
|
||||||
handleUploadCertSuccess(file) {
|
handleUploadCertSuccess(res) {
|
||||||
this.form.wxCertPath = file.data.fileName
|
const fileName = getUploadFileName(res)
|
||||||
this.wxCertPath = file.data.fileName
|
if (!fileName) return
|
||||||
|
this.form.wxCertPath = fileName
|
||||||
|
this.wxCertPath = fileName
|
||||||
},
|
},
|
||||||
removeWxCert() {
|
removeWxCert() {
|
||||||
const app = this;
|
const app = this;
|
||||||
|
|||||||
@ -96,7 +96,7 @@
|
|||||||
<span v-else>无折扣</span>
|
<span v-else>无折扣</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="积分加速" align="center" prop="speedPoint">
|
<el-table-column label="银币加速" align="center" prop="speedPoint">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.speedPoint > 0">{{
|
<span v-if="scope.row.speedPoint > 0">{{
|
||||||
scope.row.speedPoint + '倍数'
|
scope.row.speedPoint + '倍数'
|
||||||
@ -251,10 +251,10 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="积分加速" prop="speedPoint">
|
<el-form-item label="银币加速" prop="speedPoint">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.speedPoint"
|
v-model="form.speedPoint"
|
||||||
placeholder="请输入积分加速,积分加速倍数,数字"
|
placeholder="请输入银币加速,银币加速倍数,数字"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ function resolve(dir) {
|
|||||||
|
|
||||||
const CompressionPlugin = require('compression-webpack-plugin')
|
const CompressionPlugin = require('compression-webpack-plugin')
|
||||||
|
|
||||||
const name = process.env.VUE_APP_TITLE || 'fuint会员营销管理系统' // 网页标题
|
const name = process.env.VUE_APP_TITLE || '手工王国' // 网页标题
|
||||||
|
|
||||||
const port = process.env.port || process.env.npm_config_port || 81 // 端口
|
const port = process.env.port || process.env.npm_config_port || 81 // 端口
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user