Merge branch 'test' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dwb
This commit is contained in:
commit
964b5a2316
|
|
@ -139,5 +139,6 @@ export default {
|
|||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
import request from "@/utils/request";
|
||||
|
||||
/**
|
||||
* 获取店铺设置
|
||||
* @returns
|
||||
*/
|
||||
export function byShopId() {
|
||||
let shopId = localStorage.getItem("shopId");
|
||||
return request({
|
||||
url: `/tbShopShare/byShopId`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享-新增/编辑
|
||||
* @returns
|
||||
*/
|
||||
export function tbShopShare(data) {
|
||||
return request({
|
||||
url: "/tbShopShare",
|
||||
method: data.id ? "put" : "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请记录
|
||||
* @returns
|
||||
*/
|
||||
export function byShare(data) {
|
||||
let shopId = localStorage.getItem("shopId");
|
||||
return request({
|
||||
url: `/tbShopShare/byShare`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: shopId,
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ export function unittbConsInfo(params) {
|
|||
return request({
|
||||
url: `/api/tbConsInfo`,
|
||||
method: "put",
|
||||
data:params
|
||||
data: params
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
|
@ -411,3 +411,15 @@ export function tbConsInfoinputStock(file) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 供应商出入库记录
|
||||
* @returns
|
||||
*/
|
||||
export function tbProductStockOperatepage(data) {
|
||||
return request({
|
||||
url: `/api/tbProductStockOperate/page`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
|
@ -461,3 +461,60 @@ export function $returnTableDetail(data) {
|
|||
}
|
||||
});
|
||||
}
|
||||
//获取订单可用优惠券
|
||||
export function $activateByOrderId(data) {
|
||||
return request({
|
||||
url: '/api/tbShopCoupon/activateByOrderId',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//会员积分列表
|
||||
export function $returnMemberPointsList(data) {
|
||||
return request({
|
||||
url: '/api/points/member-points/page',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 会员积分账户信息
|
||||
export function $returnMemberPoints(memberId) {
|
||||
return request({
|
||||
url: '/api/points/member-points/'+memberId,
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
//002-获取订单可用积分及抵扣金额(支付页面使用)
|
||||
export function $calcUsablePoints(data) {
|
||||
return request({
|
||||
url: '/api/points/member-points/calc-usable-points',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
// 003-根据积分计算可抵扣金额
|
||||
export function $calcDeDuctionPoints(data) {
|
||||
return request({
|
||||
url: '/api/points/member-points/calc-deduction-amount',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -364,4 +364,21 @@ text {
|
|||
|
||||
.filter-gray {
|
||||
filter: grayscale(1);
|
||||
}
|
||||
.youhui-tips.el-tooltip__popper {
|
||||
background: #fff;
|
||||
min-width: 150px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #ebeef5 !important;
|
||||
padding: 12px;
|
||||
color: #606266;
|
||||
line-height: 1.4;
|
||||
text-align: justify;
|
||||
font-size: 14px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
word-break: break-all;
|
||||
}
|
||||
.youhui-tips.el-tooltip__popper[x-placement^="top"] .popper__arrow:after,
|
||||
.youhui-tips.el-tooltip__popper[x-placement^="top"] .popper__arrow {
|
||||
border-top-color: #fff;
|
||||
}
|
||||
|
|
@ -30,5 +30,9 @@ export const $status= {
|
|||
cleaning: {
|
||||
label: "待清台",
|
||||
type: "#FAAD14",
|
||||
},
|
||||
unbind:{
|
||||
label: "未绑定",
|
||||
type: "rgb(221,221,221)",
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
<el-radio label="仅本店使用"></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="使用方式">
|
||||
<!-- <el-form-item label="使用方式">
|
||||
<el-checkbox-group v-model="form.useTypeList">
|
||||
<el-checkbox label="堂食" name="dine-in" value="dine-in"></el-checkbox>
|
||||
<el-checkbox label="自取" name="takeout" value="takeout"></el-checkbox>
|
||||
|
|
@ -45,9 +45,9 @@
|
|||
<el-form-item label="是否与积分共享">
|
||||
<el-switch v-model="form.withPoints"></el-switch>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="不参与集章">
|
||||
<el-form-item label="不参与集章">
|
||||
<el-switch v-model="form.childShopIdList"></el-switch>
|
||||
</el-form-item> -->
|
||||
</el-form-item> -->
|
||||
<el-form-item label="充值说明">
|
||||
<el-input type="textarea" v-model="form.rechargeDesc"></el-input>
|
||||
</el-form-item>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
<!-- 添加优惠券 -->
|
||||
<template>
|
||||
<el-dialog :title="type == 1 ? '编辑优惠券' : '添加优惠券'" :visible.sync="dialogVisible" @close="reset">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||
<el-form-item label="券名称" prop="couponId">
|
||||
<el-select v-model="form.couponId" placeholder="请选择优惠券">
|
||||
<el-option :label="item.title" :value="item.id" v-for="item in coupons" :key="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number v-model="form.couponNum" :min="1"></el-input-number>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTbShopCoupon } from '@/api/coupon.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
coupons: [],
|
||||
type: 1,
|
||||
form: {
|
||||
couponId: '',
|
||||
couponName: '',
|
||||
couponNum: ''
|
||||
},
|
||||
resetForm: {},
|
||||
rules: {
|
||||
couponId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择优惠券',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form }
|
||||
this.getTbShopCoupon()
|
||||
},
|
||||
methods: {
|
||||
// 提交
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.form.couponName = this.coupons.find(item => item.id == this.form.couponId).title
|
||||
this.$emit('success', { ...this.form })
|
||||
this.close()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取优惠券列表
|
||||
async getTbShopCoupon() {
|
||||
try {
|
||||
const res = await getTbShopCoupon({
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
type: 1,
|
||||
page: 1,
|
||||
size: 100
|
||||
})
|
||||
this.coupons = res.content
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
reset() {
|
||||
this.form = { ...this.resetForm }
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
show(row) {
|
||||
if (row && row.couponId) {
|
||||
this.type = 1
|
||||
this.form = { ...row }
|
||||
} else {
|
||||
this.type = 2
|
||||
}
|
||||
this.dialogVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,263 @@
|
|||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<el-form :model="query" inline label-position="left">
|
||||
<el-form-item>
|
||||
<el-input placeholder="邀请人名称/被邀请人/昵称/手机号" v-model="query.search" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="query.status" placeholder="状态" style="width: 140px;">
|
||||
<el-option :label="item.label" :value="item.value" v-for="item in statusList"
|
||||
:key="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']"
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="queryHandle">查询</el-button>
|
||||
<el-button @click="resetHandle">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="邀请人" prop="invitedName">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.invitedHeadImg" style="width:40px;height:40px;flex-shrink: 0;"
|
||||
:preview-src-list="avatarUrlList1">
|
||||
<div slot="error" class="image-slot">
|
||||
<i class="el-icon-folder-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<span>{{ scope.row.invitedName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="被邀请人" prop="beInvitedName">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.beInvitedHeadImg" style="width:40px;height:40px;flex-shrink: 0;"
|
||||
:preview-src-list="avatarUrlList2">
|
||||
<div slot="error" class="image-slot">
|
||||
<i class="el-icon-folder-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<span>{{ scope.row.beInvitedName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="邀请状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
<template v-if="scope.row.method == 'get' && scope.row.status == 2">
|
||||
<el-tag type="success" disable-transitions>已邀请成功</el-tag>
|
||||
</template>
|
||||
<template v-else-if="scope.row.method == 'use' && scope.row.status == 3">
|
||||
<el-tag type="success" disable-transitions>已邀请成功</el-tag>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-tag type="danger" disable-transitions>未邀请成功</el-tag>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="邀请时间" prop="createTime"></el-table-column>
|
||||
<el-table-column label="生效时间" prop="updateTime">
|
||||
<template v-slot="scope">
|
||||
<template v-if="scope.row.method == 'get'">{{ scope.row.updateTime }}</template>
|
||||
<template v-if="scope.row.method == 'use'">{{ scope.row.rewardTime }}</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 { byShare, byShopId } from '@/api/inviteFirend.js'
|
||||
const statusList = [
|
||||
{
|
||||
value: 0,
|
||||
label: '非新用户'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: '未领取'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '已领取'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: '已使用'
|
||||
},
|
||||
]
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusList,
|
||||
avatarUrlList1: [],
|
||||
avatarUrlList2: [],
|
||||
shareId: '',
|
||||
query: {
|
||||
search: '',
|
||||
status: ''
|
||||
},
|
||||
resetQuery: '',
|
||||
tableData: {
|
||||
list: [],
|
||||
page: 1,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
statusFilter(t) {
|
||||
return statusList.find(item => item.value == t).label
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetQuery = { ...this.query }
|
||||
this.byShopId()
|
||||
},
|
||||
methods: {
|
||||
// 查询
|
||||
queryHandle() {
|
||||
this.getTableData()
|
||||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.query = { ...this.resetQuery }
|
||||
this.page = 1
|
||||
this.size = 30
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页大小改变
|
||||
handleSizeChange(val) {
|
||||
this.tableData.size = val
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取邀请设置
|
||||
async byShopId() {
|
||||
try {
|
||||
const res = await byShopId()
|
||||
this.shareId = res.id
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 获取表格数据
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await byShare({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
search: this.query.search,
|
||||
status: this.query.status,
|
||||
shareId: this.shareId
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
// 头像预览图集合
|
||||
this.avatarUrlList1 = res.content.map(item => item.invitedHeadImg)
|
||||
this.avatarUrlList2 = res.content.map(item => item.beInvitedHeadImg)
|
||||
} 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;
|
||||
|
||||
.item {
|
||||
width: 200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #f5f5f5;
|
||||
padding: 20px;
|
||||
|
||||
.icon_wrap {
|
||||
$size: 34px;
|
||||
$border: 6px;
|
||||
width: $size;
|
||||
height: $size;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: var(--bg-color);
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
width: $size + $border;
|
||||
height: $size + $border;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: var(--bg-color);
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 10px;
|
||||
|
||||
.m {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.t {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,374 @@
|
|||
<template>
|
||||
<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.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<template v-if="form.status">
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="form.title" style="width: 500px;" placeholder="例如:邀请1人可得,双方各得10元优惠券"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="分享封面图" prop="shareImg">
|
||||
<div class="img_list">
|
||||
<div class="item" v-if="form.shareImg">
|
||||
<el-image :src="form.shareImg" style="width: 100%;height: 100%"
|
||||
:preview-src-list="urlList" />
|
||||
<div class="del" @click.stop="form.shareImg = ''">删除</div>
|
||||
</div>
|
||||
<div class="item upload" @click="formImgKey = 'shareImg'; $refs.addImg.show()" v-else>
|
||||
<i class="icon el-icon-plus"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tips">建议尺寸:750*622</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="邀请顶部图" prop="invitedImg">
|
||||
<div class="img_list">
|
||||
<div class="item" v-if="form.invitedImg">
|
||||
<el-image :src="form.invitedImg" style="width: 100%;height: 100%"
|
||||
:preview-src-list="urlList" />
|
||||
<div class="del" @click.stop="form.invitedImg = ''">删除</div>
|
||||
</div>
|
||||
<div class="item upload" @click="formImgKey = 'invitedImg'; $refs.addImg.show()" v-else>
|
||||
<i class="icon el-icon-plus"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tips">建议尺寸:750*622</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="被邀顶部图" prop="beInvitedImg">
|
||||
<div class="img_list">
|
||||
<div class="item" v-if="form.beInvitedImg">
|
||||
<el-image :src="form.beInvitedImg" style="width: 100%;height: 100%"
|
||||
:preview-src-list="urlList" />
|
||||
<div class="del" @click.stop="form.beInvitedImg = ''">删除</div>
|
||||
</div>
|
||||
<div class="item upload" @click="formImgKey = 'beInvitedImg'; $refs.addImg.show()" v-else>
|
||||
<i class="icon el-icon-plus"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tips">建议尺寸:750*622</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动日期" prop="startTime">
|
||||
<el-date-picker v-model="createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']"
|
||||
value-format="yyyy-MM-dd HH:mm:ss" @change="timeChange">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="新用户获得券" prop="newCoupons">
|
||||
<div>
|
||||
<el-button type="primary" @click="addRewardHandle('newCoupons')">添加券</el-button>
|
||||
<div class="tips">新用户的定义:没领过该活动券的都属于新用户,不管有没有下过单和是否第一次登录小程序。</div>
|
||||
</div>
|
||||
<el-table :data="form.newCoupons" border style="width: 600px;">
|
||||
<el-table-column label="券ID" prop="couponId"></el-table-column>
|
||||
<el-table-column label="名称" prop="couponName"></el-table-column>
|
||||
<el-table-column label="数量" prop="couponNum"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text"
|
||||
@click="addRewardHandle('newCoupons', 2, scope.row, scope.$index)">编辑</el-button>
|
||||
<el-button type="text" @click="form.newCoupons.splice(scope.$index, 1)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
<el-form-item label="奖励券" prop="invitedNum">
|
||||
<el-input v-model="form.invitedNum" style="width: 350px;"
|
||||
@input="inputFilterInt($event, 'invitedNum')">
|
||||
<template slot="prepend">用户每邀请</template>
|
||||
<template slot="append">人,可获得奖励券</template>
|
||||
</el-input>
|
||||
<el-button type="primary" @click="addRewardHandle('rewardCoupons')">添加券</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item prop="rewardCoupons">
|
||||
<el-table :data="form.rewardCoupons" border style="width: 600px;">
|
||||
<el-table-column label="券ID" prop="couponId"></el-table-column>
|
||||
<el-table-column label="名称" prop="couponName"></el-table-column>
|
||||
<el-table-column label="数量" prop="couponNum"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text"
|
||||
@click="addRewardHandle('rewardCoupons', 2, scope.row, scope.$index)">编辑</el-button>
|
||||
<el-button type="text"
|
||||
@click="form.rewardCoupons.splice(scope.$index, 1)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
<el-form-item label="奖励获得方法">
|
||||
<el-radio-group v-model="form.getMethod">
|
||||
<el-radio label="get">新用户领取获得</el-radio>
|
||||
<el-radio label="use">仅新用户使用获得会员</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">保存</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<addImg ref="addImg" @successEvent="e => form[formImgKey] = e[0].url" />
|
||||
<AddCoupon ref="AddCoupon" @success="addCouponSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { byShopId, tbShopShare } from '@/api/inviteFirend.js'
|
||||
import addImg from "@/views/product/components/addImages.vue";
|
||||
import AddCoupon from './addCoupon.vue'
|
||||
export default {
|
||||
components: { addImg, AddCoupon },
|
||||
data() {
|
||||
const imgValidate1 = (rule, value, callback) => {
|
||||
if (!this.form.shareImg) {
|
||||
callback(new Error("请上传分享封面图"));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const imgValidate2 = (rule, value, callback) => {
|
||||
if (!this.form.invitedImg) {
|
||||
callback(new Error("请上传邀请顶部图"));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const imgValidate3 = (rule, value, callback) => {
|
||||
if (!this.form.beInvitedImg) {
|
||||
callback(new Error("请上传被邀顶部图"));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const startTimeValidate = (rule, value, callback) => {
|
||||
if (!this.form.startTime) {
|
||||
callback(new Error("请选择活动日期"));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const newCouponsValidate = (rule, value, callback) => {
|
||||
if (!this.form.newCoupons.length) {
|
||||
callback(new Error("请添加新用户获得券"));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const rewardCouponsValidate = (rule, value, callback) => {
|
||||
if (!this.form.rewardCoupons.length) {
|
||||
callback(new Error("请添加奖励券"));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
loading: false,
|
||||
createdAt: [],
|
||||
formImgKey: '',
|
||||
couponKey: '',
|
||||
tableType: '1', // 1添加 2编辑
|
||||
tableEditorIndex: 0, // 编辑时的index
|
||||
form: {
|
||||
status: 1,
|
||||
title: '',
|
||||
shareImg: '',
|
||||
invitedImg: '',
|
||||
beInvitedImg: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
newCoupons: [],
|
||||
invitedNum: '1',
|
||||
rewardCoupons: [],
|
||||
getMethod: 'get'
|
||||
},
|
||||
rules: {
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入标题',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
shareImg: [
|
||||
{
|
||||
required: true,
|
||||
validator: imgValidate1,
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
invitedImg: [
|
||||
{
|
||||
required: true,
|
||||
validator: imgValidate2,
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
beInvitedImg: [
|
||||
{
|
||||
required: true,
|
||||
validator: imgValidate3,
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
startTime: [
|
||||
{
|
||||
required: true,
|
||||
validator: startTimeValidate,
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
newCoupons: [
|
||||
{
|
||||
required: true,
|
||||
validator: newCouponsValidate,
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
invitedNum: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入邀请人数',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
rewardCoupons: [
|
||||
{
|
||||
required: true,
|
||||
validator: rewardCouponsValidate,
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
},
|
||||
urlList: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.byShopId()
|
||||
},
|
||||
methods: {
|
||||
// 添加完成优惠券
|
||||
addCouponSuccess(e) {
|
||||
if (this.tableType == 1) {
|
||||
this.form[this.couponKey].push({ ...e })
|
||||
} else {
|
||||
// this.form[this.couponKey][this.tableEditorIndex] = { ...e }
|
||||
this.$set(this.form[this.couponKey], this.tableEditorIndex, { ...e })
|
||||
}
|
||||
},
|
||||
// 添加奖励券
|
||||
addRewardHandle(key, type = 1, row = {}, index = 0) {
|
||||
this.tableEditorIndex = index
|
||||
this.tableType = type
|
||||
this.couponKey = key
|
||||
if (key == 'rewardCoupons' && !this.form.invitedNum) {
|
||||
this.$refs.form.validateField('invitedNum')
|
||||
return
|
||||
}
|
||||
this.$refs.AddCoupon.show(row)
|
||||
},
|
||||
// 日期回调
|
||||
timeChange(e) {
|
||||
this.form.startTime = e[0]
|
||||
this.form.endTime = e[1]
|
||||
},
|
||||
// 过滤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 tbShopShare(this.form)
|
||||
this.loading = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: `保存成功`,
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
this.loading = false
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取店铺设置
|
||||
async byShopId() {
|
||||
try {
|
||||
const res = await byShopId()
|
||||
if (res.id) {
|
||||
this.form = res
|
||||
this.createdAt = [res.startTime, res.endTime]
|
||||
this.urlList = [res.shareImg, res.invitedImg, res.beInvitedImg]
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.img_list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
|
||||
.item {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
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(255, 0, 0, 0.6);
|
||||
backdrop-filter: blur(3px);
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
transform: translateY(100%);
|
||||
transition: all .2s ease-in-out;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 20px;
|
||||
color: #ddd;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
</el-form-item>
|
||||
<el-form-item>
|
||||
<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-option :label="item.label" :value="item.value" v-for="item in statusList"
|
||||
:key="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
|
@ -54,27 +54,38 @@
|
|||
</div>
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading">
|
||||
<el-table-column label="订单编号" prop="orderNo"></el-table-column>
|
||||
<el-table-column label="用户名" prop="memberName">
|
||||
<el-table-column label="订单编号" prop="orderNo" width="200"></el-table-column>
|
||||
<el-table-column label="用户名" prop="memberName" width="200">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.avatarUrl" style="width:40px;height:40px;flex-shrink: 0;"
|
||||
:preview-src-list="avatarUrlList" />
|
||||
:preview-src-list="avatarUrlList">
|
||||
<div slot="error" class="image-slot">
|
||||
<i class="el-icon-folder-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<span>{{ scope.row.memberName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品" prop="pointsGoodsName">
|
||||
<el-table-column label="商品" prop="pointsGoodsName" width="200">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.goodsImageUrl" style="width:40px;height:40px;flex-shrink: 0;"
|
||||
:preview-src-list="srcList" />
|
||||
:preview-src-list="srcList">
|
||||
<div slot="error" class="image-slot">
|
||||
<i class="el-icon-folder-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<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="payMethod"></el-table-column>
|
||||
<el-table-column label="实际支付时间" prop="payTime" width="200"></el-table-column>
|
||||
<el-table-column label="下单时间" prop="createTime" width="200"></el-table-column>
|
||||
<el-table-column label="领取方式" prop="pickupMethod">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="success" effect="plain" disable-transitions
|
||||
|
|
@ -88,18 +99,27 @@
|
|||
<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>
|
||||
<el-tag type="warning" disable-transitions v-if="scope.row.status == 'unpaid'">待支付</el-tag>
|
||||
<el-tag type="info" disable-transitions v-if="scope.row.status == 'cancel'">已取消</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下单时间" prop="createTime"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<el-table-column label="取消/退款" prop="cancelOrRefundTime" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" icon="el-icon-finished" disabled
|
||||
v-if="scope.row.status == 'done'">已完成</el-button>
|
||||
<template v-else>
|
||||
<template v-if="scope.row.status == 'cancel'">
|
||||
<div>{{ scope.row.cancelOrRefundTime }}</div>
|
||||
<div>{{ scope.row.cancelOrRefundReason }}</div>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template v-slot="scope">
|
||||
<template v-if="scope.row.status == 'waiting'">
|
||||
<el-popconfirm title="确定核销吗?" @confirm="confirmOrder(scope.row.couponCode)">
|
||||
<el-button type="text" icon="el-icon-finished" slot="reference">待核销</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
<el-button type="text" icon="el-icon-finished" disabled v-else>{{
|
||||
scope.row.status | statusFilter }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -114,9 +134,28 @@
|
|||
|
||||
<script>
|
||||
import { exchangeRecordPage, exchangeRecordTotal, recordCheckout } from '@/api/points.js'
|
||||
const statusList = [
|
||||
{
|
||||
value: 'unpaid',
|
||||
label: '待支付'
|
||||
},
|
||||
{
|
||||
value: 'waiting',
|
||||
label: '待自取'
|
||||
},
|
||||
{
|
||||
value: 'done',
|
||||
label: '已完成'
|
||||
},
|
||||
{
|
||||
value: 'cancel',
|
||||
label: '已取消'
|
||||
},
|
||||
]
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusList,
|
||||
srcList: [],
|
||||
avatarUrlList: [],
|
||||
countData: {
|
||||
|
|
@ -141,6 +180,11 @@ export default {
|
|||
},
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
statusFilter(t) {
|
||||
return statusList.find(item => item.value == t).label
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetQuery = { ...this.query }
|
||||
this.getTableData()
|
||||
|
|
|
|||
|
|
@ -4,21 +4,35 @@
|
|||
<el-form-item label="是否消费赠送积分">
|
||||
<el-switch v-model.trim="form.enableRewards" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<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>
|
||||
<template v-if="form.enableRewards">
|
||||
<el-form-item label="适用群体">
|
||||
<el-radio-group v-model="form.rewardsGroup">
|
||||
<el-radio label="all">全部</el-radio>
|
||||
<el-radio label="vip">仅会员</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="费赠送积分" prop="consumeAmount">
|
||||
<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>
|
||||
</template>
|
||||
<el-form-item label="开启下单积分抵扣" style="margin-top: 50px;">
|
||||
<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-form-item label="适用群体">
|
||||
<el-radio-group v-model="form.deductionGroup">
|
||||
<el-radio label="all">全部</el-radio>
|
||||
<el-radio label="vip">仅会员</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单实付抵扣门槛" prop="minPaymentAmount">
|
||||
<el-input v-model="form.minPaymentAmount" style="width: 150px;"
|
||||
@input="inputFilterInt($event, 'minPaymentAmount')">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单最高抵扣比例" prop="maxDeductionRatio">
|
||||
|
|
@ -95,10 +109,12 @@ export default {
|
|||
loading: false,
|
||||
form: {
|
||||
id: '',
|
||||
rewardsGroup: 'all',
|
||||
deductionGroup: 'all',
|
||||
enableRewards: 1,
|
||||
consumeAmount: "",
|
||||
enableDeduction: 1,
|
||||
minDeductionPoint: "",
|
||||
minPaymentAmount: "",
|
||||
maxDeductionRatio: "",
|
||||
equivalentPoints: "",
|
||||
enablePointsMall: 1,
|
||||
|
|
@ -112,7 +128,7 @@ export default {
|
|||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
minDeductionPoint: [
|
||||
minPaymentAmount: [
|
||||
{
|
||||
required: true,
|
||||
message: ' ',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-tabs v-model="activeName" type="card">
|
||||
<el-tab-pane label="基本设置" name="1"></el-tab-pane>
|
||||
<el-tab-pane label="分享设置" name="2"></el-tab-pane>
|
||||
<el-tab-pane label="邀请记录" name="3"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<Setting v-if="activeName == 1" />
|
||||
<Record v-if="activeName == 3" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Setting from './components/invite_friend/setting.vue'
|
||||
import Record from './components/invite_friend/record.vue'
|
||||
export default {
|
||||
name: 'invite_friend',
|
||||
components: {
|
||||
Setting,
|
||||
Record
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: '1'
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
:deep(.el-tabs) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<!-- 优惠券 -->
|
||||
<div v-if="form.type == 1" class="content">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||
<el-form-item label="优惠卷卷名" prop="title">
|
||||
<el-form-item label="优惠券券名" prop="title">
|
||||
<el-input v-model="form.title" placeholder="" style="width: 289px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="使用门槛">
|
||||
|
|
@ -40,11 +40,19 @@
|
|||
@change="validityChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="有效期(天)" prop="validDays">
|
||||
<el-input v-model="form.validDays" placeholder="" style="width: 200px;">
|
||||
<template slot="append">天</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="使用门槛" prop="daysToTakeEffect">
|
||||
<el-input v-model="form.daysToTakeEffect" placeholder="" style="width: 200px;">
|
||||
<template slot="prepend">隔</template>
|
||||
<template slot="append">天生效</template>
|
||||
</el-input>
|
||||
<el-tooltip class="item" effect="dark" content="领取后0天后0点0分" placement="top-start">
|
||||
<i class="el-icon-question" />
|
||||
</el-tooltip>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="可用周期" prop="userDays">
|
||||
<el-checkbox-group v-model="form.userDays">
|
||||
|
|
@ -72,6 +80,9 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="发放数量" prop="number">
|
||||
<el-input v-model="form.number" type="number" placeholder="" style="width: 200px;" />
|
||||
<el-tooltip class="item" effect="dark" content="限用户自行领取,(当库存为 0时,集草等活动仍会赠送)" placement="top-start">
|
||||
<i class="el-icon-question" />
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
|
|
@ -82,11 +93,16 @@
|
|||
<!-- 商品券 -->
|
||||
<div v-if="form.type == 2" class="content">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
||||
<el-form-item label="商品卷卷名" prop="title">
|
||||
<el-form-item label="商品券券名" prop="title">
|
||||
<el-input v-model="form.title" placeholder="" style="width: 289px;" />
|
||||
</el-form-item>
|
||||
<el-form-item />
|
||||
<el-form-item />
|
||||
<el-form-item label="发放数量" prop="number">
|
||||
<el-input v-model="form.number" type="number" placeholder="" style="width: 289px;" />
|
||||
<el-tooltip class="item" effect="dark" content="限用户自行领取,(当库存为 0时,集草等活动仍会赠送)" placement="top-start">
|
||||
<i class="el-icon-question" />
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用门槛">
|
||||
全额满<el-input v-model="form.fullAmount" placeholder="" style="width: 100px;margin: 0 23px;"><template slot="suffix">元</template></el-input>可用
|
||||
|
|
@ -155,6 +171,7 @@ export default {
|
|||
validStartTime: '',
|
||||
validEndTime: '',
|
||||
userDays: [],
|
||||
validDays: '',
|
||||
useTimeType: 'all',
|
||||
useStartTime: '',
|
||||
useEndTime: '',
|
||||
|
|
@ -169,6 +186,20 @@ export default {
|
|||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
number: [
|
||||
{
|
||||
required: true,
|
||||
message: '填写发放数量',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
validDays: [
|
||||
{
|
||||
required: true,
|
||||
message: '填写有效天数',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
daysToTakeEffect: [
|
||||
{
|
||||
required: true,
|
||||
|
|
@ -203,13 +234,6 @@ export default {
|
|||
validator: validateProduct,
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
number: [
|
||||
{
|
||||
required: true,
|
||||
message: '填写发放数量',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
resetForm: ''
|
||||
|
|
@ -228,7 +252,8 @@ export default {
|
|||
* @param item
|
||||
*/
|
||||
tabClick(item) {
|
||||
console.log(item)
|
||||
console.log(this.form)
|
||||
this.form.number = ''
|
||||
this.form.type = item.type
|
||||
this.$refs.form.resetFields()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -42,20 +42,38 @@
|
|||
<el-table v-loading="loading" :data="tableData.data">
|
||||
|
||||
<el-table-column label="用户ID" prop="id" />
|
||||
<el-table-column label="用户名" prop="name" />
|
||||
<el-table-column label="用户名" prpo="name">
|
||||
<template v-slot="scope">
|
||||
<div>{{ scope.row.name ? scope.row.name : '-' }}</div>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="领取时间" prop="receiveTime" />
|
||||
<el-table-column label="使用时间" prop="useTime" />
|
||||
<el-table-column label="获得来源" prop="source" />
|
||||
<el-table-column label="使用时间" prpo="useTime">
|
||||
<template v-slot="scope">
|
||||
<div>{{ scope.row.useTime ? scope.row.useTime : '-' }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="获得来源" prpo="source">
|
||||
<template v-slot="scope">
|
||||
<div>{{ scope.row.source == 'activate' ? '充值活动' :
|
||||
scope.row.source == 'invited' ? '好友分享' : '' }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="status">
|
||||
<template v-slot="scope">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<div v-if="scope.row.overNum == scope.row.num" style="width: 30px;color: #FAAD14;">未使用</div>
|
||||
<div v-if="scope.row.overNum == scope.row.num" style="color: #FAAD14;">未使用</div>
|
||||
<div v-if="scope.row.num!=0&&scope.row.overNum != scope.row.num">{{ scope.row.overNum }}/{{ scope.row.num }}</div>
|
||||
<div v-if="scope.row.overNum == 0" style="color: #52C41A;">已使用</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="使用门店" prop="tableName" />
|
||||
<el-table-column label="使用门店" prpo="useTime">
|
||||
<template v-slot="scope">
|
||||
<div>{{ scope.row.tableName ? scope.row.tableName : '-' }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template v-slot="scope">
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
|
|
@ -68,7 +86,6 @@
|
|||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
|
|
|
|||
|
|
@ -22,11 +22,12 @@
|
|||
{{ `领券后${scope.row.validDays}天过期` }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="用户领取方式">
|
||||
<!-- <el-table-column label="用户领取方式" prpo="source">
|
||||
<template v-slot="scope">
|
||||
{{ `无` }}
|
||||
<div>{{ scope.row.source == 'activate' ? '充值活动' :
|
||||
scope.row.source == 'invited' ? '好友分享' : '' }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="总发放数量" prop="number" />
|
||||
<el-table-column label="已领取" align="center">
|
||||
<template v-slot="scope">
|
||||
|
|
@ -57,7 +58,7 @@
|
|||
<div class="head-container">
|
||||
<el-pagination
|
||||
:total="tableData.total"
|
||||
:current-page="tableData.page + 1"
|
||||
:current-page="tableData.page"
|
||||
:page-size="tableData.size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="paginationChange"
|
||||
|
|
@ -90,7 +91,7 @@ export default {
|
|||
return {
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0
|
||||
|
|
@ -108,7 +109,7 @@ export default {
|
|||
},
|
||||
// 重置查询
|
||||
resetHandle() {
|
||||
this.page = 0
|
||||
this.page = 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页大小改变
|
||||
|
|
@ -118,7 +119,8 @@ export default {
|
|||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
console.log(e)
|
||||
this.tableData.page = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 获取优惠券列表
|
||||
|
|
|
|||
|
|
@ -134,12 +134,11 @@ export default {
|
|||
//携带table id跳转到订单列表页面
|
||||
toTableOrderList(data) {
|
||||
// console.log(data)
|
||||
let date = [this.query.createdAt[0], this.query.createdAt[1]]
|
||||
this.$router.push({
|
||||
path: '/order_manage/order_list',
|
||||
query: {
|
||||
tableName: data.tableName,
|
||||
date: date
|
||||
timeValue: this.timeValue
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -999,10 +999,10 @@ export default {
|
|||
res.map(item => item.saleAmount)
|
||||
];
|
||||
|
||||
console.log(p1);
|
||||
console.log(p2);
|
||||
// console.log(p1);
|
||||
// console.log(p2);
|
||||
|
||||
this.initProduceChart(p1, p2);
|
||||
// this.initProduceChart(p1, p2);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,6 +126,8 @@
|
|||
<el-button type="text" size="mini" round @click="Uppop(scope.row.id)">付款</el-button>
|
||||
<el-button type="text" size="mini"
|
||||
@click="typedialogshowsumbit(scope.row.id)">账单付款记录</el-button>
|
||||
<el-button type="text" size="mini" @click="stockData.size = 10,
|
||||
stockData.page = 0, gettbConsInfoFlowstock(scope.row)">出入库记录</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -172,12 +174,44 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
<!--入库记录 -->
|
||||
<el-dialog title="出入库记录" :visible.sync="variabilityshow" width="75%">
|
||||
<div class="head-container">
|
||||
<el-table ref="table" :data="stockData.data" v-loading="stockData.loading" row-key="id" height="450">
|
||||
<el-table-column label="类型" prop="type">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.type == 'reject' ? '退货出库' : '供应商入库' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.status == 'status' ? '正常 ' : '作废' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark">
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="stockTime">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.stockTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="stockData.total" :current-page="stockData.page + 1" :page-size="stockData.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" @current-change="wstockChange" @size-change="(e) => {
|
||||
stockData.size = e;
|
||||
stockData.page = 0;
|
||||
gettbConsInfoFlowstock();
|
||||
}" />
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
import { tbShopPurveyorTransactInfo, paidAmount, dictDetail, tbShopPurveyorTransactSum, tbShopPurveyorTransacttransactPayInfos } from '@/api/invoicing'
|
||||
import { tbShopPurveyorTransactInfo, paidAmount, dictDetail, tbShopPurveyorTransactSum, tbShopPurveyorTransacttransactPayInfos, tbProductStockOperatepage } from '@/api/invoicing'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -270,7 +304,17 @@ export default {
|
|||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
}
|
||||
},
|
||||
variabilityshow: false,
|
||||
variabilitytitle: '',
|
||||
stockData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0,
|
||||
id: ''
|
||||
},
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
|
|
@ -415,6 +459,34 @@ export default {
|
|||
console.log(error)
|
||||
}
|
||||
},
|
||||
wstockChange(e) {
|
||||
this.stockData.page = e - 1;
|
||||
this.gettbConsInfoFlowstock();
|
||||
},
|
||||
async gettbConsInfoFlowstock(item) {
|
||||
if (item) {
|
||||
this.stockData.id = item.id
|
||||
}
|
||||
this.variabilityshow = true
|
||||
this.stockData.loading = true;
|
||||
let arr = []
|
||||
// if (this.query.createdAt.length) {
|
||||
// arr = [this.query.createdAt[0] + ' 00:00:00', this.query.createdAt[1] + ' 23:59:59']
|
||||
// } else {
|
||||
// arr = []
|
||||
// }
|
||||
let res = await tbProductStockOperatepage({
|
||||
page: this.stockData.page,
|
||||
size: this.stockData.size,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
type: ["cons_in", "cons_out"],//预留耗材id
|
||||
purveyorId: this.stockData.id,//列名
|
||||
createdAt: arr//耗材id
|
||||
})
|
||||
this.stockData.loading = false;
|
||||
this.stockData.data = res.content;
|
||||
this.stockData.total = res.totalElements;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -184,10 +184,8 @@ export default {
|
|||
merchantName: this.loginForm.merchantName,
|
||||
username: this.loginForm.username,
|
||||
}))
|
||||
|
||||
|
||||
// this.$router.push({ path: this.redirect || '/' })
|
||||
window.location.href = './'
|
||||
this.$router.push({ path: this.redirect || '/' })
|
||||
// window.location.replace = './'
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
this.getCode()
|
||||
|
|
|
|||
|
|
@ -207,21 +207,24 @@ export default {
|
|||
filters: {
|
||||
orderTypeFilter(t) {
|
||||
if (t) {
|
||||
return t && orderEnum.orderType.find(item => item.key == t).label;
|
||||
const item= orderEnum.orderType.find(item => item.key == t);
|
||||
return t && item?item.label:'';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
},
|
||||
sendTypeFilter(t) {
|
||||
if (t) {
|
||||
return orderEnum.sendType.find(item => item.key == t).label;
|
||||
const item= orderEnum.sendType.find(item => item.key == t);
|
||||
return item?item.label:'';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
},
|
||||
statusFilter(t) {
|
||||
if (t) {
|
||||
return t && orderEnum.status.find(item => item.key == t).label;
|
||||
const item= orderEnum.status.find(item => item.key == t);
|
||||
return t && item?item.label:'';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
|
|
@ -233,12 +236,10 @@ export default {
|
|||
mounted() {
|
||||
if (this.$route.query.tableName) {
|
||||
this.query.tableName = this.$route.query.tableName
|
||||
console.log(this.$route.query.date,'体哦啊是1111')
|
||||
if(this.$route.query.date[0]){
|
||||
this.query.createdAt = this.$route.query.date
|
||||
}else{
|
||||
this.query.createdAt = []
|
||||
}
|
||||
}
|
||||
if (this.$route.query.timeValue) {
|
||||
this.timeValue = this.$route.query.timeValue
|
||||
this.timeChange(this.timeValue);
|
||||
}
|
||||
if (this.$route.query.orderNo) {
|
||||
this.query.orderNo = this.$route.query.orderNo
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px" label-position="left">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="160px" label-position="left">
|
||||
<el-form-item label="门店名称" prop="shopName">
|
||||
<el-input v-model.trim="form.shopName" placeholder="请输入门店名称" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
|
|
@ -66,16 +66,12 @@
|
|||
<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-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> -->
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input v-model.trim="form.phone" placeholder="请输入联系电话" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
|
|
@ -127,11 +123,15 @@
|
|||
<el-switch v-model.trim="form.isTableFee" :active-value="1" :inactive-value="0" active-text="免餐位费">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启8折活动">
|
||||
<!-- <el-form-item label="是否开启8折活动">
|
||||
<el-switch v-model.trim="form.isOpenYhq" active-value="true" inactive-value="false"></el-switch>
|
||||
<div style="color: #999;">是否允许用户在小程序端支付订单</div>
|
||||
</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-form-item label="是否开启会员余额支付">
|
||||
<el-switch v-model.trim="form.isUseVip" :active-value="1" :inactive-value="0"></el-switch>
|
||||
<!-- <div style="color: #999;">是否允许用户在小程序端支付订单</div> -->
|
||||
</el-form-item>
|
||||
|
|
|
|||
|
|
@ -30,9 +30,7 @@
|
|||
</div>
|
||||
|
||||
<div class="" v-if="placeNum == 0">
|
||||
<div class="note" v-if="item.note">
|
||||
备注:{{ item.note || "" }}
|
||||
</div>
|
||||
<div class="note" v-if="item.note">备注:{{ item.note || "" }}</div>
|
||||
<div class="note flex" v-else>
|
||||
<span>备注:</span>
|
||||
<span class="el-icon-edit u-font-12" @click="editNote"></span>
|
||||
|
|
@ -69,15 +67,22 @@
|
|||
</div>
|
||||
|
||||
<div class="color-333 total-price">
|
||||
<div v-if="item.isGift === 'true' || item.status == 'return'">¥0</div>
|
||||
<div
|
||||
:class="{
|
||||
'free-price': item.isGift === 'true' || item.status == 'return',
|
||||
}"
|
||||
>
|
||||
<span v-if="isSeatFee"> ¥{{ item.totalAmount }}</span>
|
||||
<span v-else> ¥{{ (item.salePrice*item.number+(item.packAmount||0)).toFixed(2) }}</span>
|
||||
</div>
|
||||
<template v-if="item.isGift === 'true' || item.status == 'return'">
|
||||
<div>¥0</div>
|
||||
<div class="free-price">
|
||||
<span v-if="isSeatFee"> ¥{{ item.totalAmount }}</span>
|
||||
<span v-else> ¥{{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-if="isSeatFee">¥{{ item.totalAmount }}</div>
|
||||
<div v-else>
|
||||
<div v-if="isShowVipPrice&&vipAllPrice!=allPrice">¥{{ vipAllPrice }}</div>
|
||||
<div :class="{ 'free-price': isShowVipPrice&&vipAllPrice!=allPrice }">
|
||||
<span> ¥{{ allPrice }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -86,6 +91,10 @@
|
|||
<script>
|
||||
export default {
|
||||
props: {
|
||||
isShowVipPrice: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
//是否是餐位费
|
||||
isSeatFee: {
|
||||
type: Boolean,
|
||||
|
|
@ -133,6 +142,23 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
vipAllPrice() {
|
||||
const item = this.item;
|
||||
const price =
|
||||
this.isShowVipPrice &&
|
||||
item.memberPrice != null &&
|
||||
item.memberPrice != undefined
|
||||
? (item.memberPrice<=0?item.salePrice:item.memberPrice)
|
||||
: item.salePrice;
|
||||
return (price * item.number + (item.packAmount || 0)).toFixed(2);
|
||||
},
|
||||
|
||||
allPrice() {
|
||||
const item = this.item;
|
||||
|
||||
const price = item.salePrice;
|
||||
return (price * item.number + (item.packAmount || 0)).toFixed(2);
|
||||
},
|
||||
isActive() {
|
||||
const isSel =
|
||||
this.selIndex === this.index && this.placeNum === this.selPlaceNum;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-dialog title="选择用户" width="850px" :visible.sync="show">
|
||||
<el-dialog title="选择用户" width="850px" :visible.sync="show" top="20px">
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="余额" prop="amount"></el-table-column>
|
||||
<el-table-column label="积分" prop="totalScore"></el-table-column>
|
||||
<el-table-column label="积分" prop="accountPoints"></el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="90" fixed="right">
|
||||
<template v-slot="scope">
|
||||
|
|
@ -99,6 +99,7 @@
|
|||
|
||||
<script>
|
||||
import { queryAllShopUser, queryAllShopInfo } from "@/api/shop";
|
||||
import { $returnMemberPointsList } from "@/api/table";
|
||||
import dayjs from "dayjs";
|
||||
let cacheData = {};
|
||||
export default {
|
||||
|
|
@ -107,6 +108,7 @@ export default {
|
|||
show: false,
|
||||
query: {
|
||||
name: "",
|
||||
isVip:1
|
||||
},
|
||||
shopInfo: {
|
||||
balanceTotal: 0,
|
||||
|
|
@ -202,7 +204,6 @@ export default {
|
|||
this.tableData.page = e - 1;
|
||||
this.getTableData();
|
||||
},
|
||||
// 获取商品列表
|
||||
async getTableData() {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ export default {
|
|||
}
|
||||
if (curretnMoney > money) {
|
||||
this.$message.error("实收金额不能大于总金额");
|
||||
this.form.curretnMoney = form.money;
|
||||
this.form.curretnMoney = this.form.money;
|
||||
}
|
||||
this.form.reduceMoney = (money - this.form.curretnMoney).toFixed(2);
|
||||
this.form.discount =toFixedNoRounding( ((this.form.curretnMoney / money) * 100).toFixed(3) );
|
||||
|
|
@ -173,7 +173,7 @@ export default {
|
|||
},
|
||||
open(data) {
|
||||
console.log(data);
|
||||
this.form.money = data.amount;
|
||||
this.form.money = data.amount*1;
|
||||
this.form.discount = data.discount?toFixedNoRounding(data.discount.toFixed(3)):100;
|
||||
this.show = true;
|
||||
this.init();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,450 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
width="700px"
|
||||
:title="title"
|
||||
:visible.sync="show"
|
||||
top="20px"
|
||||
@close="reset"
|
||||
>
|
||||
<div class="u-p-15">
|
||||
<div class="">
|
||||
<el-tabs v-model="activeName" @tab-click="tabClick">
|
||||
<el-tab-pane label="优惠券(单选)" name="youhui">
|
||||
<el-table
|
||||
ref="table"
|
||||
empty-text="无可用优惠券"
|
||||
:data="quans.fullReductionCoupon"
|
||||
@cell-click="fullReductionCouponClick"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
label=""
|
||||
v-if="quans.fullReductionCoupon.length > 0"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<el-checkbox
|
||||
@change="fullReductionCouponClick(scope.row)"
|
||||
:value="scope.row.id == fullReductionCouponSel.id"
|
||||
></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column type="index" label="#"> </el-table-column>
|
||||
<el-table-column prop="name" label="券名称"> </el-table-column>
|
||||
<el-table-column label="券类型" width="80">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="discountAmount" label="抵扣">
|
||||
<template v-slot="scope">
|
||||
<span class="color-red">
|
||||
¥{{ scope.row.discountAmount }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="discountAmount" label="限制" width="120">
|
||||
<template v-slot="scope">
|
||||
<div class="u-flex">
|
||||
<span>支付满</span>
|
||||
<span class="color-red no-wrap">
|
||||
{{ scope.row.fullAmount }}
|
||||
</span>
|
||||
<span>元可用</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="useRestrictions" label="描述">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="商品券(多选)" name="goods">
|
||||
<el-table
|
||||
ref="table1"
|
||||
@cell-click="productCouponClick"
|
||||
empty-text="无可用商品券"
|
||||
:data="quans.productCoupon"
|
||||
tooltip-effect="dark"
|
||||
style="width: 100%"
|
||||
@selection-change="productCouponChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55"> </el-table-column>
|
||||
<el-table-column type="index" width="50" label="#">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="券名称"> </el-table-column>
|
||||
|
||||
<el-table-column label="商品信息" width="120">
|
||||
<template v-slot="scope">
|
||||
<div class="u-flex">
|
||||
<div class="u-flex">
|
||||
<el-image
|
||||
:src="scope.row.productCover"
|
||||
fit="cover"
|
||||
style="width: 40px; height: 40px"
|
||||
:preview-src-list="[scope.row.productCover]"
|
||||
></el-image>
|
||||
</div>
|
||||
<div class="u-p-l-10">
|
||||
<div class="">{{ scope.row.productName }}</div>
|
||||
<div class="">x{{ scope.row.num || "" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="discountAmount" label="抵扣">
|
||||
<template v-slot="scope">
|
||||
<span class="color-red">
|
||||
¥{{ scope.row.discountAmount }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="券类型">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="useRestrictions" label="描述">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div v-if="quansSelArr.length > 0">
|
||||
<div class="font-bold u-m-b-10">已选优惠券</div>
|
||||
<el-table empty-text="未选择优惠券" :data="quansSelArr">
|
||||
<el-table-column type="index" width="50" label="#">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="券名称"> </el-table-column>
|
||||
<el-table-column label="券类型" width="80">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="u-flex" v-if="scope.row.type == 2">
|
||||
<el-image
|
||||
:src="scope.row.productCover"
|
||||
style="width: 40px; height: 40px"
|
||||
:preview-src-list="[scope.row.productCover]"
|
||||
></el-image>
|
||||
<div class="u-m-l-10">{{ scope.row.productName }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="discountAmount" label="抵扣">
|
||||
<template v-slot="scope">
|
||||
<span class="color-red">
|
||||
¥{{ scope.row.discountAmount }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="useRestrictions" label="描述">
|
||||
</el-table-column>
|
||||
<el-table-column prop="useRestrictions" label="">
|
||||
<template v-slot="scope">
|
||||
<el-button type="danger" size="mini" @click="delQuan(scope.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="u-flex u-m-t-20">
|
||||
<span class="">抵扣:</span>
|
||||
<span class="color-red font-bold">{{ AllCouponPrice }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-flex u-row-center u-m-t-50">
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm"
|
||||
>确定</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { $activateByOrderId } from "@/api/table";
|
||||
import {
|
||||
returnProductCouponAllPrice,
|
||||
returnProductCouponPrice,
|
||||
returnFullReductionCouponAllPrice,
|
||||
} from "../util";
|
||||
let $originFullReductionCoupon = [];
|
||||
export default {
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: "选择优惠券",
|
||||
},
|
||||
goodsArr: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
vipUser: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
isVip: false,
|
||||
};
|
||||
},
|
||||
},
|
||||
orderPrice: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
propSelCoup: [],
|
||||
fullReductionCouponSel: {
|
||||
id: "",
|
||||
},
|
||||
quansSelArr: [],
|
||||
quans: {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: [],
|
||||
},
|
||||
currentRow: null,
|
||||
multipleSelection: null,
|
||||
fullReductionCouponSelId: "",
|
||||
activeName: "youhui",
|
||||
form: {},
|
||||
show: false,
|
||||
isSetProductCoup: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
activeName(newval) {
|
||||
if (newval == "youhui") {
|
||||
this.filterFullReductionCoupon();
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
goodsDiscount() {
|
||||
const coupArr = this.quansSelArr.filter((v) => v.type == 2);
|
||||
return returnProductCouponAllPrice(coupArr, this.goodsArr, this.vipUser);
|
||||
},
|
||||
fullReductionCouponDiscount() {
|
||||
const coupArr = this.quansSelArr.filter((v) => v.type == 1);
|
||||
return returnFullReductionCouponAllPrice(coupArr);
|
||||
},
|
||||
AllCouponPrice() {
|
||||
return (
|
||||
this.goodsDiscount * 1 +
|
||||
this.fullReductionCouponDiscount * 1
|
||||
).toFixed(2);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
delQuan(row) {
|
||||
if (row.type == 2) {
|
||||
const index = this.quansSelArr.findIndex((item) => item.id == row.id);
|
||||
this.quansSelArr.splice(index, 1);
|
||||
this.$refs.table1.toggleRowSelection(row, false);
|
||||
} else {
|
||||
this.fullReductionCouponSel = { id: "" };
|
||||
this.quansSelArr.splice(0, 1);
|
||||
}
|
||||
if (index != -1) {
|
||||
const row = this.quansSelArr.find;
|
||||
}
|
||||
},
|
||||
reset() {
|
||||
this.quansSelArr = [];
|
||||
this.fullReductionCouponSel = { id: "" };
|
||||
this.$refs.table1.clearSelection();
|
||||
},
|
||||
filterFullReductionCoupon() {
|
||||
this.quans.fullReductionCoupon = $originFullReductionCoupon.filter(
|
||||
(v) => this.orderPrice - this.goodsDiscount >= v.fullAmount
|
||||
);
|
||||
},
|
||||
productCouponChange(val) {
|
||||
if (this.isSetProductCoup) {
|
||||
return;
|
||||
}
|
||||
|
||||
const firstCoup = this.quansSelArr[0];
|
||||
const firstIsDikouQuan = firstCoup ? firstCoup.type == 1 : false;
|
||||
if (firstCoup && firstIsDikouQuan) {
|
||||
if (
|
||||
this.orderPrice -
|
||||
this.fullReductionCouponDiscount -
|
||||
returnProductCouponAllPrice(val, this.goodsArr, this.vipUser) <
|
||||
firstCoup.fullAmount
|
||||
) {
|
||||
this.$confirm(
|
||||
"所选优惠券不满足最低抵扣" + firstCoup.fullAmount + "元要求",
|
||||
"提示",
|
||||
{
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: "放弃选择商品券",
|
||||
cancelButtonText: "删除优惠券",
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
val.map((v) => {
|
||||
this.$refs.table1.toggleRowSelection(v);
|
||||
});
|
||||
})
|
||||
.catch((action) => {
|
||||
if (action == "cancel") {
|
||||
this.quansSelArr.splice(0, 1);
|
||||
this.fullReductionCouponSel = { id: "" };
|
||||
this.quansSelArr = [...val];
|
||||
}
|
||||
if (action == "close") {
|
||||
val.map((v) => {
|
||||
this.$refs.table1.toggleRowSelection(v);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.quansSelArr.splice(
|
||||
val.length <= 0 ? 1 : val.length,
|
||||
this.quansSelArr.length
|
||||
);
|
||||
for (let i in val) {
|
||||
this.$set(this.quansSelArr, i * 1 + 1, { ...val[i] });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.quansSelArr = [...val];
|
||||
}
|
||||
},
|
||||
fullReductionCouponClick(row) {
|
||||
if (row.id == this.fullReductionCouponSel.id) {
|
||||
this.fullReductionCouponSel = { id: "" };
|
||||
this.quansSelArr.splice(0, 1);
|
||||
return;
|
||||
}
|
||||
const dikouQuan = this.quansSelArr[0];
|
||||
this.fullReductionCouponSel = row;
|
||||
if (dikouQuan && dikouQuan.type == 1) {
|
||||
this.$set(this.quansSelArr, 0, row);
|
||||
} else {
|
||||
this.quansSelArr.unshift(row);
|
||||
}
|
||||
if(!this.fullReductionCouponSel.id){
|
||||
return
|
||||
}
|
||||
|
||||
if (
|
||||
this.orderPrice -
|
||||
this.fullReductionCouponDiscount -
|
||||
this.goodsDiscount <
|
||||
this.fullReductionCouponSel.fullAmount
|
||||
) {
|
||||
this.fullReductionCouponSel = { id: "" };
|
||||
this.quansSelArr.splice(0, 1);
|
||||
this.$confirm(
|
||||
"所选优惠券不满足最低抵扣" +
|
||||
this.fullReductionCouponSel.fullAmount +
|
||||
"元要求",
|
||||
"提示",
|
||||
{
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: "确定",
|
||||
type: "warning",
|
||||
}
|
||||
).then(() => {});
|
||||
}
|
||||
},
|
||||
productCouponClick(row) {
|
||||
this.$refs.table1.toggleRowSelection(row);
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.currentRow = val;
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
tabClick() {},
|
||||
init() {},
|
||||
|
||||
changeKey(key, val) {
|
||||
this[key] = val;
|
||||
},
|
||||
|
||||
confirm() {
|
||||
this.$emit("confirm", [...this.quansSelArr]);
|
||||
this.close();
|
||||
},
|
||||
setSelectCoupon() {
|
||||
const dikouQuan = this.propSelCoup.find((v) => v.type == 1);
|
||||
this.fullReductionCouponSel = dikouQuan ? dikouQuan : { id: "" };
|
||||
const productCouArr = this.propSelCoup.filter((v) => v.type == 2);
|
||||
this.quans.productCoupon.map((v) => {
|
||||
for (let i in productCouArr) {
|
||||
this.isSetProductCoup = true;
|
||||
if (v.id == productCouArr[i].id) {
|
||||
this.$refs.table1.toggleRowSelection(v, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.isSetProductCoup = false;
|
||||
},
|
||||
async open(data, propSelCoup) {
|
||||
this.propSelCoup = [...propSelCoup] || [];
|
||||
console.log(data);
|
||||
if (data.memberId) {
|
||||
let quansRes = await $activateByOrderId({
|
||||
orderId: data.id,
|
||||
memberId: data.memberId,
|
||||
});
|
||||
quansRes.fullReductionCoupon = quansRes.fullReductionCoupon.filter(
|
||||
(v) => this.orderPrice >= v.fullAmount
|
||||
);
|
||||
$originFullReductionCoupon = quansRes.fullReductionCoupon;
|
||||
this.quans.productCoupon = quansRes.productCoupon
|
||||
.map((v) => {
|
||||
return {
|
||||
...v,
|
||||
discountAmount: returnProductCouponPrice(
|
||||
v,
|
||||
this.goodsArr,
|
||||
this.vipUser
|
||||
),
|
||||
};
|
||||
})
|
||||
.filter((v) => v.discountAmount > 0);
|
||||
// this.quans = quans;
|
||||
this.filterFullReductionCoupon();
|
||||
this.quansSelArr = this.propSelCoup;
|
||||
this.$nextTick(() => {
|
||||
this.setSelectCoupon();
|
||||
});
|
||||
}
|
||||
|
||||
this.show = true;
|
||||
this.init();
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.number = `${this.value}`;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.codeImg {
|
||||
width: 160px;
|
||||
border: 1px solid rgb(220, 223, 230);
|
||||
height: 160px;
|
||||
}
|
||||
::v-deep .el-input .el-input__inner::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
::v-deep .el-input .el-input__inner::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -113,6 +113,7 @@ export default {
|
|||
},
|
||||
open(item) {
|
||||
this.goods = item?item:this.goods;
|
||||
console.log(item)
|
||||
this.show = true;
|
||||
if (item != "-999") {
|
||||
this.number = 1;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,17 +1,18 @@
|
|||
//计算打包费
|
||||
import {isTui} from '../../order_manage/order_goods_util.js'
|
||||
//计算打包费
|
||||
export function returnPackFee(arr, isOld = true) {
|
||||
if (isOld) {
|
||||
return arr.reduce((a, b) => {
|
||||
const bTotal = b.info
|
||||
.filter((v) => v.isGift !== "true" && v.status !== "return")
|
||||
.reduce((prve, cur) => {
|
||||
return prve + (cur.packFee || cur.packAmount||0);
|
||||
return prve + (cur.packFee || cur.packAmount || 0);
|
||||
}, 0);
|
||||
return a + bTotal;
|
||||
}, 0);
|
||||
} else {
|
||||
return arr.filter(v => v.status !== 'return' && v.isGift !== 'true').reduce((a, b) => {
|
||||
return a + (b.packFee || b.packAmount||0);
|
||||
return a + (b.packFee || b.packAmount || 0);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
|
@ -90,28 +91,108 @@ export function returnGiftArr(arr) {
|
|||
return result
|
||||
}
|
||||
|
||||
export function formatOrderGoodsList(arr){
|
||||
export function formatOrderGoodsList(arr) {
|
||||
const goodsMap = {}
|
||||
for (let i in arr) {
|
||||
const goods = arr[i]
|
||||
if (goods.productName != '客座费') {
|
||||
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||
goodsMap[goods.placeNum||1].push(goods)
|
||||
goodsMap[goods.placeNum || 1].push(goods)
|
||||
} else {
|
||||
goodsMap[goods.placeNum||1] = [goods]
|
||||
goodsMap[goods.placeNum || 1] = [goods]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return Object.entries(goodsMap).map(([key, value]) => ({
|
||||
info: value,
|
||||
placeNum: key||1
|
||||
placeNum: key || 1
|
||||
}))
|
||||
}
|
||||
|
||||
export function returnIsSeatFee(item){
|
||||
if(!item){
|
||||
export function returnIsSeatFee(item) {
|
||||
if (!item) {
|
||||
return false
|
||||
}
|
||||
return item.productId=="-999"
|
||||
return item.productId == "-999"?true:false;
|
||||
}
|
||||
/**
|
||||
* 计算购物车会员优惠价格
|
||||
*/
|
||||
export function returnVipDiscountPrice() {
|
||||
|
||||
}
|
||||
|
||||
//计算商品券优惠价格
|
||||
export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
||||
const item = goodsArr.find(v => v.productId == coup.proId);
|
||||
if(!item){
|
||||
return 0
|
||||
}
|
||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
||||
return price
|
||||
|
||||
}
|
||||
//返回新的商品列表,过滤掉退菜的,退单的商品
|
||||
export function returnNewGoodsList(arr) {
|
||||
let goodsMap={}
|
||||
return arr.filter(v => !isTui(v))
|
||||
}
|
||||
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
|
||||
export function returnProductCoupon(coup, goodsArr, vipUser) {
|
||||
const newGoodsArr = returnNewGoodsList(goodsArr)
|
||||
const item = newGoodsArr.find(v => v.productId == coup.proId);
|
||||
if(!item){
|
||||
return {...coup, discountAmount: 0,use:false}
|
||||
}
|
||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
||||
const canUse=!v.use?false:(discountAmount>0)
|
||||
return { ...coup, discountAmount: price,use:canUse}
|
||||
|
||||
}
|
||||
/**
|
||||
* 根据购物车商品计算商品券抵扣价格以及是否满足可用需求
|
||||
* 1.商品券对应商品数量大于购物车对应商品数量不可用
|
||||
* 2.未在购物车找到相关商品不可用
|
||||
* @param {*} coupArr
|
||||
* @param {*} goodsArr
|
||||
* @param {*} vipUser
|
||||
* @returns
|
||||
*/
|
||||
export function returnProductAllCoup(coupArr, goodsArr, vipUser){
|
||||
return coupArr.map((v) => {
|
||||
return returnProductCoupon(v, goodsArr, vipUser)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
//计算商品券总优惠价格
|
||||
export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
||||
if(coupArr.length == 0){
|
||||
return 0;
|
||||
}
|
||||
return coupArr.reduce((a, b) => {
|
||||
const price = returnProductCouponPrice(b, goodsArr, vipUser)
|
||||
return a + price;
|
||||
}, 0).toFixed(2);
|
||||
|
||||
}
|
||||
//计算满减券总优惠价格
|
||||
export function returnFullReductionCouponAllPrice(coupArr) {
|
||||
if(coupArr.length == 0){
|
||||
return 0;
|
||||
}
|
||||
return coupArr.filter(v => v.type == 1).reduce((a, b) => {
|
||||
const price = b.discountAmount
|
||||
return a + price;
|
||||
}, 0).toFixed(2);
|
||||
|
||||
}
|
||||
//计算优惠券总价格
|
||||
export function returnCouponAllPrice(coupArr, goodsArr, vipUser) {
|
||||
const poductAllprice=returnProductCouponAllPrice(coupArr, goodsArr, vipUser)
|
||||
const pointAllPrice=returnFullReductionCouponAllPrice(coupArr)
|
||||
return (poductAllprice*1+pointAllPrice*1).toFixed(2);
|
||||
}
|
||||
Loading…
Reference in New Issue