parent
f4b0414856
commit
9bf1dda6dc
|
|
@ -0,0 +1,109 @@
|
|||
import request from "@/utils/request";
|
||||
// 会员积分
|
||||
|
||||
/**
|
||||
* 基本设置-获取店铺设置
|
||||
* @returns
|
||||
*/
|
||||
export function basicSettingGet() {
|
||||
let shopId = localStorage.getItem("shopId");
|
||||
return request({
|
||||
url: `/api/points/basic-setting/${shopId}`,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 基本设置-保存
|
||||
* @returns
|
||||
*/
|
||||
export function basicSettingPost(data) {
|
||||
return request({
|
||||
url: "/api/points/basic-setting",
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品设置-新增/编辑
|
||||
* @returns
|
||||
*/
|
||||
export function goodsSettingAdd(data) {
|
||||
return request({
|
||||
url: "/api/points/goods-setting",
|
||||
method: data.id ? "put" : "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品设置-删除
|
||||
* @returns
|
||||
*/
|
||||
export function goodsDelete(id) {
|
||||
return request({
|
||||
url: `/api/points/goods-setting/${id}`,
|
||||
method: "DELETE"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品设置-列表
|
||||
* @returns
|
||||
*/
|
||||
export function goodsSettingPage(params) {
|
||||
let shopId = localStorage.getItem("shopId");
|
||||
return request({
|
||||
url: `/api/points/goods-setting/page`,
|
||||
method: "get",
|
||||
params: {
|
||||
...params,
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 兑换记录-列表
|
||||
* @returns
|
||||
*/
|
||||
export function exchangeRecordPage(params) {
|
||||
let shopId = localStorage.getItem("shopId");
|
||||
return request({
|
||||
url: `/api/points/exchange-record/page`,
|
||||
method: "get",
|
||||
params: {
|
||||
...params,
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 兑换记录-统计
|
||||
* @returns
|
||||
*/
|
||||
export function exchangeRecordTotal(params) {
|
||||
let shopId = localStorage.getItem("shopId");
|
||||
return request({
|
||||
url: `/api/points/exchange-record/total`,
|
||||
method: "get",
|
||||
params: {
|
||||
...params,
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 兑换记录-核销
|
||||
* @returns
|
||||
*/
|
||||
export function recordCheckout(data) {
|
||||
return request({
|
||||
url: "/api/points/exchange-record/checkout",
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
|
|
@ -4,18 +4,18 @@
|
|||
<div>
|
||||
<el-form :model="query" inline label-position="left">
|
||||
<el-form-item>
|
||||
<el-input placeholder="订单编号/核销码" v-model="query.name" />
|
||||
<el-input placeholder="订单编号/核销码" v-model="query.keywords" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="query.cateId" placeholder="领取方式" style="width: 140px;">
|
||||
<el-option label="自取" :value="1"></el-option>
|
||||
<el-option label="邮寄" :value="2"></el-option>
|
||||
<el-select v-model="query.pickupMethod" placeholder="领取方式" style="width: 140px;">
|
||||
<el-option label="自取" value="self"></el-option>
|
||||
<el-option label="邮寄" value="post"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="query.cateId" placeholder="状态" style="width: 140px;">
|
||||
<el-option label="自取" :value="1"></el-option>
|
||||
<el-option label="邮寄" :value="2"></el-option>
|
||||
<el-select v-model="query.status" placeholder="状态" style="width: 140px;">
|
||||
<el-option label="待自取" value="waiting"></el-option>
|
||||
<el-option label="已完成" value="done"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button type="primary" @click="queryHandle">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
<i class="icon el-icon-s-goods"></i>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="m">¥1231</div>
|
||||
<div class="m">{{ countData.count }}</div>
|
||||
<div class="t">总订单数</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
<i class="icon el-icon-s-goods"></i>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="m">¥0.00</div>
|
||||
<div class="m">¥{{ countData.totalAmount }}</div>
|
||||
<div class="t">已支付金额</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -54,51 +54,181 @@
|
|||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="订单编号"></el-table-column>
|
||||
<el-table-column label="用户名"></el-table-column>
|
||||
<el-table-column label="商品"></el-table-column>
|
||||
<el-table-column label="使用积分"></el-table-column>
|
||||
<el-table-column label="支付金额"></el-table-column>
|
||||
<el-table-column label="领取方式"></el-table-column>
|
||||
<el-table-column label="状态"></el-table-column>
|
||||
<el-table-column label="下单时间"></el-table-column>
|
||||
<el-table-column label="操作"></el-table-column>
|
||||
<el-table-column label="订单编号" prop="orderNo"></el-table-column>
|
||||
<el-table-column label="用户名" prop="memberName">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.avatarUrl" style="width:40px;height:40px;flex-shrink: 0;" />
|
||||
<span>{{ scope.row.memberName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品" prop="pointsGoodsName">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.goodsImageUrl" style="width:40px;height:40px;flex-shrink: 0;" />
|
||||
<span>{{ scope.row.pointsGoodsName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="使用积分" prop="spendPoints"></el-table-column>
|
||||
<el-table-column label="支付金额" prop="extraPaymentAmount"></el-table-column>
|
||||
<el-table-column label="领取方式" prop="pickupMethod">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="success" effect="plain" disable-transitions
|
||||
v-if="scope.row.pickupMethod == 'self'">自取</el-tag>
|
||||
<el-tag type="info" effect="plain" disable-transitions
|
||||
v-if="scope.row.pickupMethod == 'post'">邮寄
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="warning" disable-transitions v-if="scope.row.status == 'waiting'">待自取</el-tag>
|
||||
<el-tag type="success" disable-transitions v-if="scope.row.status == 'done'">已完成</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下单时间" prop="createTime"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" icon="el-icon-finished" disabled
|
||||
v-if="scope.row.status == 'done'">已完成</el-button>
|
||||
<template v-else>
|
||||
<el-popconfirm title="确定核销吗?" @confirm="confirmOrder(scope.row.couponCode)">
|
||||
<el-button type="text" icon="el-icon-finished" slot="reference">核销</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" @size-change="handleSizeChange" :current-page="tableData.page"
|
||||
:page-size="tableData.size" @current-change="paginationChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { exchangeRecordPage, exchangeRecordTotal, recordCheckout } from '@/api/points.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
countData: {
|
||||
count: 0,
|
||||
totalAmount: 0
|
||||
},
|
||||
query: {
|
||||
name: '',
|
||||
cateId: '',
|
||||
keywords: '',
|
||||
beginDate: '',
|
||||
endDate: '',
|
||||
status: '',
|
||||
pickupMethod: '',
|
||||
createdAt: []
|
||||
},
|
||||
resetQuery: '',
|
||||
tableData: {
|
||||
sort: 'createdAt,desc',
|
||||
list: [],
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetQuery = { ...this.query }
|
||||
this.getTableData()
|
||||
this.exchangeRecordTotal()
|
||||
},
|
||||
methods: {
|
||||
resetHandle() {
|
||||
|
||||
// 核销
|
||||
async confirmOrder(couponCode) {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
await recordCheckout({ couponCode: couponCode })
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '核销成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
this.tableData.loading = false
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
getTableData() {
|
||||
|
||||
// 统计
|
||||
async exchangeRecordTotal() {
|
||||
try {
|
||||
const { count, totalAmount } = await exchangeRecordTotal({
|
||||
keywords: this.query.keywords,
|
||||
beginDate: this.query.createdAt[0] || '',
|
||||
endDate: this.query.createdAt[1] || '',
|
||||
status: this.query.status,
|
||||
pickupMethod: this.query.pickupMethod
|
||||
})
|
||||
this.countData.count = count
|
||||
this.countData.totalAmount = totalAmount
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 查询
|
||||
queryHandle() {
|
||||
this.getTableData()
|
||||
this.exchangeRecordTotal()
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query = { ...this.resetQuery }
|
||||
this.page = 1
|
||||
this.size = 30
|
||||
this.getTableData()
|
||||
this.exchangeRecordTotal()
|
||||
},
|
||||
// 分页大小改变
|
||||
handleSizeChange(val) {
|
||||
this.tableData.size = val
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取表格数据
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await exchangeRecordPage({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
keywords: this.query.keywords,
|
||||
beginDate: this.query.createdAt[0] || '',
|
||||
endDate: this.query.createdAt[1] || '',
|
||||
status: this.query.status,
|
||||
pickupMethod: this.query.pickupMethod
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.goods_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.collect_wrap {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
|
|
|
|||
|
|
@ -2,39 +2,46 @@
|
|||
<div>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px" label-position="left">
|
||||
<el-form-item label="是否消费赠送积分">
|
||||
<el-switch v-model.trim="form.isOpenYhq" :active-value="1" :inactive-value="0"></el-switch>
|
||||
<el-switch v-model.trim="form.enableRewards" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="费赠送积分" v-if="form.isOpenYhq">
|
||||
<el-input v-model="form.num" style="width: 300px;">
|
||||
<el-form-item label="费赠送积分" prop="consumeAmount" v-if="form.enableRewards">
|
||||
<el-input v-model="form.consumeAmount" style="width: 250px;"
|
||||
@input="inputFilterInt($event, 'consumeAmount')">
|
||||
<template slot="prepend">每消费</template>
|
||||
<template slot="append">元赠送1积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="开启下单积分抵扣" style="margin-top: 50px;">
|
||||
<el-switch v-model.trim="form.isOpenYhq" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单积分抵扣门槛">
|
||||
<el-input v-model="form.num" style="width: 300px;">
|
||||
<template slot="append">积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单最高抵扣比例">
|
||||
<el-input v-model="form.num" style="width: 300px;">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单抵扣积分比例">
|
||||
<el-input v-model="form.num" style="width: 300px;">
|
||||
<template slot="prepend">1元等于</template>
|
||||
<template slot="append">积分</template>
|
||||
</el-input>
|
||||
<el-switch v-model.trim="form.enableDeduction" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<template v-if="form.enableDeduction">
|
||||
<el-form-item label="下单积分抵扣门槛" prop="minDeductionPoint">
|
||||
<el-input v-model="form.minDeductionPoint" style="width: 150px;"
|
||||
@input="inputFilterInt($event, 'minDeductionPoint')">
|
||||
<template slot="append">积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单最高抵扣比例" prop="maxDeductionRatio">
|
||||
<el-input v-model="form.maxDeductionRatio" style="width: 150px;"
|
||||
@input="inputFilterInt($event, 'maxDeductionRatio')">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单抵扣积分比例" prop="equivalentPoints">
|
||||
<el-input v-model="form.equivalentPoints" style="width: 220px;"
|
||||
@input="inputFilterInt($event, 'equivalentPoints')">
|
||||
<template slot="prepend">1元等于</template>
|
||||
<template slot="append">积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="开启积分商城" style="margin-top: 50px;">
|
||||
<el-switch v-model.trim="form.isOpenYhq" :active-value="1" :inactive-value="0"></el-switch>
|
||||
<el-switch v-model.trim="form.enablePointsMall" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示样式">
|
||||
<el-form-item label="显示样式" v-if="form.enablePointsMall">
|
||||
<div class="style_wrap">
|
||||
<div class="item style1" :class="{ active: styleActive == 1 }" @click="styleActive = 1">
|
||||
<div class="item style1" :class="{ active: form.browseMode == 'list' }"
|
||||
@click="form.browseMode = 'list'">
|
||||
<div class="row">
|
||||
<div class="cover"></div>
|
||||
<div class="info">
|
||||
|
|
@ -52,7 +59,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item style2" :class="{ active: styleActive == 2 }" @click="styleActive = 2">
|
||||
<div class="item style2" :class="{ active: form.browseMode == 'grid' }"
|
||||
@click="form.browseMode = 'grid'">
|
||||
<div class="row">
|
||||
<div class="cover"></div>
|
||||
<div class="line"></div>
|
||||
|
|
@ -73,22 +81,103 @@
|
|||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary">保存</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">保存</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { basicSettingGet, basicSettingPost } from '@/api/points.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
form: {
|
||||
isOpenYhq: 1,
|
||||
num: ''
|
||||
id: '',
|
||||
enableRewards: 1,
|
||||
consumeAmount: "",
|
||||
enableDeduction: 1,
|
||||
minDeductionPoint: "",
|
||||
maxDeductionRatio: "",
|
||||
equivalentPoints: "",
|
||||
enablePointsMall: 1,
|
||||
browseMode: 'list'
|
||||
},
|
||||
styleActive: 1,
|
||||
rules: {}
|
||||
rules: {
|
||||
consumeAmount: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
minDeductionPoint: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
maxDeductionRatio: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
equivalentPoints: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.basicSettingGet()
|
||||
},
|
||||
methods: {
|
||||
// 过滤input只能输入整数
|
||||
inputFilterInt(e, key) {
|
||||
if (!e) return
|
||||
setTimeout(() => {
|
||||
this.form[key] = e.replace(/[^\d]/g, '')
|
||||
}, 50)
|
||||
},
|
||||
// 提交
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true
|
||||
this.form.shopId = localStorage.getItem('shopId')
|
||||
await basicSettingPost(this.form)
|
||||
this.loading = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `保存成功`,
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取店铺设置
|
||||
async basicSettingGet() {
|
||||
try {
|
||||
const res = await basicSettingGet()
|
||||
if (res.id) {
|
||||
this.form = res
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -106,6 +195,10 @@ export default {
|
|||
border: 1px solid #ddd;
|
||||
$color: #3F9EFF;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: $color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,49 +4,183 @@
|
|||
<el-dialog :title="form.id ? '编辑商品' : '添加商品'" :visible.sync="dialogVisible" @close="reset">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||
<el-form-item label="奖品类型">
|
||||
<el-radio-group v-model="form.registerType">
|
||||
<el-radio label="munchies">实物商品</el-radio>
|
||||
<el-radio label="restaurant">优惠券</el-radio>
|
||||
<el-radio-group v-model="form.goodsCategory">
|
||||
<el-radio label="physical">实物商品</el-radio>
|
||||
<!-- <el-radio label="coupon">优惠券</el-radio> -->
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品图片">
|
||||
<el-form-item label="商品图片" prop="goodsImageUrl">
|
||||
<div class="img_list">
|
||||
<div class="item" v-for="item in form.imgList" :key="item.id">
|
||||
<img class="img" :src="item.url">
|
||||
<div class="item" v-if="form.goodsImageUrl" @click="form.goodsImageUrl = ''">
|
||||
<el-image :src="form.goodsImageUrl" style="width: 100%;height: 100%" />
|
||||
<div class="del">删除</div>
|
||||
</div>
|
||||
<div class="item" @click="$refs.addImg.show()">
|
||||
<div class="item upload" @click="$refs.addImg.show()" v-else>
|
||||
<i class="icon el-icon-plus"></i>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称" prop="goodsName">
|
||||
<el-input v-model="form.goodsName" placeholder="请输入商品名称" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所需积分" prop="requiredPoints">
|
||||
<el-input v-model="form.requiredPoints" style="width: 130px;"
|
||||
@input="inputFilterInt($event, 'requiredPoints')">
|
||||
<template slot="append">积分</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="额外价格" prop="extraPrice">
|
||||
<el-input v-model="form.extraPrice" style="width: 130px;"
|
||||
@input="inputFilterFloat($event, 'extraPrice')">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number v-model="form.quantity" :min="1"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<el-input-number v-model="form.sort" :min="0"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否上架">
|
||||
<el-switch v-model.trim="form.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<addImg ref="addImg" @successEvent="e => form.imgList.push(e[0])" />
|
||||
<addImg ref="addImg" @successEvent="e => form.goodsImageUrl = e[0].url" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { goodsSettingAdd } from '@/api/points.js'
|
||||
import addImg from "@/views/product/components/addImages.vue";
|
||||
export default {
|
||||
components: {
|
||||
addImg
|
||||
},
|
||||
data() {
|
||||
const validateCoverImg = (rule, value, callback) => {
|
||||
if (!this.form.goodsImageUrl) {
|
||||
callback(new Error("请上传商品图片"));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
form: {
|
||||
id: '',
|
||||
registerType: 'munchies',
|
||||
imgList: []
|
||||
goodsCategory: 'physical',
|
||||
goodsName: '',
|
||||
goodsImageUrl: '',
|
||||
requiredPoints: '',
|
||||
extraPrice: 0,
|
||||
quantity: '',
|
||||
status: 1,
|
||||
sort: 0,
|
||||
goodsDescription: ''
|
||||
},
|
||||
rules: {}
|
||||
resetForm: '',
|
||||
rules: {
|
||||
goodsName: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
goodsImageUrl: [
|
||||
{
|
||||
required: true,
|
||||
validator: validateCoverImg,
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
requiredPoints: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
extraPrice: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form }
|
||||
},
|
||||
methods: {
|
||||
reset() {
|
||||
|
||||
// 过滤input只能输入整数
|
||||
inputFilterInt(e, key) {
|
||||
if (!e) return
|
||||
setTimeout(() => {
|
||||
this.form[key] = e.replace(/[^\d]/g, '')
|
||||
}, 50)
|
||||
},
|
||||
show() {
|
||||
// 过滤input只能输入数字,并且最多输入两位小数
|
||||
inputFilterFloat(value, key) {
|
||||
if (!value) return
|
||||
// 去除首位小数点
|
||||
if (value.startsWith('.')) {
|
||||
value = value.slice(1);
|
||||
}
|
||||
// 清除非数字和小数点(除了第一个小数点)
|
||||
value = value.replace(/[^\d.]/g, '');
|
||||
// 确保最多只有一个小数点
|
||||
if (value.split('.').length > 2) {
|
||||
value = value.split('.').slice(0, 2).join('.');
|
||||
}
|
||||
// 限制小数位数为两位
|
||||
if (value.split('.')[1] && value.split('.')[1].length > 2) {
|
||||
value = value.split('.')[0] + '.' + value.split('.')[1].slice(0, 2);
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.form[key] = value
|
||||
}, 50)
|
||||
},
|
||||
// 提交
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true
|
||||
this.form.shopId = localStorage.getItem('shopId')
|
||||
await goodsSettingAdd(this.form)
|
||||
this.loading = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `${this.form.id ? '编辑' : '添加'}成功`,
|
||||
type: 'success'
|
||||
});
|
||||
this.$emit('success')
|
||||
this.close()
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.form = { ...this.resetForm }
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
show(row) {
|
||||
if (row && row.id) {
|
||||
this.form = { ...row }
|
||||
}
|
||||
this.dialogVisible = true
|
||||
}
|
||||
}
|
||||
|
|
@ -62,11 +196,41 @@ export default {
|
|||
.item {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border: 1px dashed #ececec;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #F7F7FA;
|
||||
background-color: #F5F7FA;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
&.upload {
|
||||
border: 1px dashed #ddd;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
|
||||
.del {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.del {
|
||||
width: 100%;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
backdrop-filter: blur(3px);
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
transform: translateY(100%);
|
||||
transition: all .2s ease-in-out;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 100%;
|
||||
|
|
@ -76,7 +240,7 @@ export default {
|
|||
|
||||
.icon {
|
||||
font-size: 20px;
|
||||
color: #DDDFE6;
|
||||
color: #ddd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,21 +3,47 @@
|
|||
<div><el-button type="primary" @click="$refs.ShopAdd.show()">添加商品</el-button></div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="商品"></el-table-column>
|
||||
<el-table-column label="所需积分"></el-table-column>
|
||||
<el-table-column label="额外价格「元」"></el-table-column>
|
||||
<el-table-column label="总数"></el-table-column>
|
||||
<el-table-column label="库存"></el-table-column>
|
||||
<el-table-column label="操作"></el-table-column>
|
||||
<el-table-column label="商品" prop="goodsName">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.goodsImageUrl" style="width:40px;height:40px;flex-shrink: 0;" />
|
||||
<span>{{ scope.row.goodsName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所需积分" prop="requiredPoints"></el-table-column>
|
||||
<el-table-column label="额外价格「元」" prop="extraPrice"></el-table-column>
|
||||
<el-table-column label="累计兑换次数" prop="totalExchangeCount"></el-table-column>
|
||||
<el-table-column label="库存" prop="quantity"></el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="success" disable-transitions v-if="scope.row.status == 1">上架</el-tag>
|
||||
<el-tag type="danger" disable-transitions v-if="scope.row.status == 0">下架</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" icon="el-icon-edit" @click="editorHandle(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle(scope.row.id)">
|
||||
<el-button type="text" icon="el-icon-delete" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" @size-change="handleSizeChange" :current-page="tableData.page"
|
||||
:page-size="tableData.size" @current-change="paginationChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<!-- 添加积分商品/积分 -->
|
||||
<ShopAdd ref="ShopAdd" />
|
||||
<ShopAdd ref="ShopAdd" @success="resetTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ShopAdd from './shop_add.vue'
|
||||
import { goodsSettingPage, goodsDelete } from '@/api/points.js'
|
||||
export default {
|
||||
components: { ShopAdd },
|
||||
data() {
|
||||
|
|
@ -25,12 +51,63 @@ export default {
|
|||
tableData: {
|
||||
sort: 'createdAt,desc',
|
||||
list: [],
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
},
|
||||
methods: {
|
||||
// 编辑 预览
|
||||
editorHandle(row) {
|
||||
this.$refs.ShopAdd.show(row)
|
||||
},
|
||||
// 删除
|
||||
async delTableHandle(id) {
|
||||
try {
|
||||
await goodsDelete(id)
|
||||
this.$message.success('已删除')
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
resetTable() {
|
||||
this.tableData.page = 1
|
||||
this.tableData.size = 30
|
||||
this.getTableData()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.tableData.size = val
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取积分商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await goodsSettingPage({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
goodsName: '',
|
||||
goodsCategory: 'physical',
|
||||
status: ''
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -39,4 +116,10 @@ export default {
|
|||
.head-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.goods_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -16,6 +16,7 @@ import Setting from './components/member_points/setting.vue'
|
|||
import ShopList from './components/member_points/shop_list.vue'
|
||||
import Record from './components/member_points/record.vue'
|
||||
export default {
|
||||
name: "member_points",
|
||||
components: {
|
||||
Setting,
|
||||
ShopList,
|
||||
|
|
@ -23,7 +24,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: '3'
|
||||
activeName: '1'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<div class="head-container">
|
||||
<div class="header_wrap">
|
||||
<!-- <router-link :to="{ name: 'add_shop' }" > -->
|
||||
<el-button type="primary" icon="el-icon-plus" @click="toPath( '/product/add_shop')">添加商品</el-button>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="toPath('/product/add_shop')">添加商品</el-button>
|
||||
<!-- </router-link> -->
|
||||
<el-select v-model="tableData.sort" placeholder="排序" @change="getTableData">
|
||||
<el-option value="createdAt,desc" label="创建时间"></el-option>
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
<div class="cons_wrap" v-if="scope.row.typeEnum">
|
||||
<div v-if="scope.row.conInfos && scope.row.conInfos.length">
|
||||
<el-button type="text" @click="showBindCons(scope.row)">
|
||||
{{ scope.row.conInfos | conInfosFilter }}
|
||||
<span class="cons_span">{{ scope.row.conInfos | conInfosFilter }}</span>
|
||||
<i class="el-icon-edit"></i>
|
||||
</el-button>
|
||||
</div>
|
||||
|
|
@ -189,7 +189,7 @@
|
|||
style="margin-left: 20px !important;">
|
||||
<el-button type="text" icon="el-icon-edit">编辑</el-button>
|
||||
</router-link> -->
|
||||
<el-button type="text" icon="el-icon-edit" @click="toPath( '/product/add_shop' ,scope.row )">编辑</el-button>
|
||||
<el-button type="text" icon="el-icon-edit" @click="toPath('/product/add_shop', scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
|
||||
slot="reference">删除</el-button>
|
||||
|
|
@ -244,6 +244,7 @@ import { tbProductListV2, tbShopCategoryGet, tbProductDelete, tbProductIsHot, up
|
|||
import { hasPermission } from '@/utils/limits.js'
|
||||
|
||||
export default {
|
||||
name: 'product',
|
||||
components: {
|
||||
BindCons,
|
||||
StockHistory
|
||||
|
|
@ -315,14 +316,14 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
// 是否允许修改商品
|
||||
async toPath ( path , row) {
|
||||
async toPath(path, row) {
|
||||
let res = await hasPermission('允许修改商品');
|
||||
if ( !res) { return; }
|
||||
if (!res) { return; }
|
||||
let query = {};
|
||||
if ( row ) {
|
||||
if (row) {
|
||||
query.goods_id = row.id;
|
||||
}
|
||||
this.$router.push({path: path, query: query})
|
||||
this.$router.push({ path: path, query: query })
|
||||
},
|
||||
// 显示修改商品警告线
|
||||
showStockWarningHandle() {
|
||||
|
|
@ -383,12 +384,12 @@ export default {
|
|||
},
|
||||
async changeGrounding(event, row, key) {
|
||||
let text;
|
||||
if (key == 'grounding') { text = "允许上下架商品"}
|
||||
if (key == 'pauseSale') { text = "允许售罄商品"}
|
||||
if (key == 'grounding') { text = "允许上下架商品" }
|
||||
if (key == 'pauseSale') { text = "允许售罄商品" }
|
||||
let res = await hasPermission(text);
|
||||
if ( !res) {
|
||||
if (key == 'grounding') { row.isGrounding = (event == 0 ? 1 : 0);}
|
||||
if (key == 'pauseSale') { row.isPauseSale = (event == 0 ? 1 : 0);}
|
||||
if (!res) {
|
||||
if (key == 'grounding') { row.isGrounding = (event == 0 ? 1 : 0); }
|
||||
if (key == 'pauseSale') { row.isPauseSale = (event == 0 ? 1 : 0); }
|
||||
return;
|
||||
}
|
||||
this.editorForm.key = key
|
||||
|
|
@ -415,7 +416,7 @@ export default {
|
|||
// 修改库存
|
||||
async changePrice(type, row) {
|
||||
let res = await hasPermission('允许修改商品库存');
|
||||
if ( !res) { return; }
|
||||
if (!res) { return; }
|
||||
this.editorVisable = true
|
||||
this.editorForm.key = type
|
||||
this.editorForm.id = row.id
|
||||
|
|
@ -437,7 +438,7 @@ export default {
|
|||
// 显示绑定耗材
|
||||
async showBindCons(item) {
|
||||
let res = await hasPermission('允许修改商品');
|
||||
if ( !res) { return; }
|
||||
if (!res) { return; }
|
||||
// console.log(item);
|
||||
this.$refs.bindCons.show(item)
|
||||
},
|
||||
|
|
@ -562,7 +563,7 @@ export default {
|
|||
// 删除商品
|
||||
async delTableHandle(ids) {
|
||||
let res = await hasPermission('允许修改商品');
|
||||
if ( !res) { return; }
|
||||
if (!res) { return; }
|
||||
try {
|
||||
await tbProductDelete(ids)
|
||||
this.getTableData()
|
||||
|
|
@ -575,6 +576,10 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.cons_span {
|
||||
white-space: break-spaces;
|
||||
}
|
||||
|
||||
.header_wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
|
|
@ -152,6 +152,24 @@
|
|||
<div class="shop_name">{{ shopName }}</div>
|
||||
<img class="content" src="@/assets/images/shop_editor_bg.png" alt="">
|
||||
</div>
|
||||
<div class="ticket_wrap" v-if="tableActive == 'ticket_logo'">
|
||||
<img class="logo" :src="selectItem.value">
|
||||
<img class="ewm" src="@/assets/images/1024.png">
|
||||
<div class="row">
|
||||
<span class="num">123</span>
|
||||
<span>座位号:#A9</span>
|
||||
</div>
|
||||
<div class="row">甜橙马黛茶</div>
|
||||
<div class="row">
|
||||
<span class="sku">加珍珠、加糖</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="b">2020-10-24 13:14:52</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="sku">建议尽快享用,风味更佳</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="editor_wrap">
|
||||
|
|
@ -272,11 +290,11 @@ export default {
|
|||
|
||||
.phone_wrap {
|
||||
width: 100%;
|
||||
height: 686px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
|
||||
.index_bg {
|
||||
padding-bottom: 50px;
|
||||
.bg {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
|
|
@ -363,6 +381,7 @@ export default {
|
|||
.my_bg {
|
||||
background-color: #f5f5f5;
|
||||
height: 100%;
|
||||
padding-bottom: 50px;
|
||||
|
||||
.bg {
|
||||
width: 100%;
|
||||
|
|
@ -481,6 +500,7 @@ export default {
|
|||
height: 100%;
|
||||
background-color: #f5f5f5;
|
||||
padding: 10px;
|
||||
padding-bottom: 400px;
|
||||
|
||||
.card_wrap {
|
||||
background-color: #fff;
|
||||
|
|
@ -616,6 +636,46 @@ export default {
|
|||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.ticket_wrap {
|
||||
padding: 15px;
|
||||
position: relative;
|
||||
|
||||
.ewm {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 15px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 90px;
|
||||
height: 30px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.row {
|
||||
margin-top: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.sku {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.b {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,16 @@
|
|||
<el-checkbox label="take-out">允许打包</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用会员价">
|
||||
<el-switch v-model.trim="form.isMemberPrice" :active-value="1" ::inactive-value="0"></el-switch>
|
||||
<!-- <div style="color: #999;">是否允许用户在小程序端支付订单</div> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="积分群体">
|
||||
<el-radio-group v-model="form.consumeColony">
|
||||
<el-radio label="all">所有</el-radio>
|
||||
<el-radio label="vip">仅针对会员</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input v-model.trim="form.phone" placeholder="请输入联系电话" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
|
|
@ -225,7 +235,8 @@ export default {
|
|||
formLoading: false,
|
||||
form: {
|
||||
eatModel: [],
|
||||
paymentQrcode: ''
|
||||
paymentQrcode: '',
|
||||
consumeColony: 'all'
|
||||
},
|
||||
rules: {
|
||||
shopName: [
|
||||
|
|
|
|||
Loading…
Reference in New Issue