解决冲突
This commit is contained in:
44
src/api/inviteFirend.js
Normal file
44
src/api/inviteFirend.js
Normal file
@@ -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
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -472,3 +472,49 @@ export function $activateByOrderId(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
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -365,3 +365,20 @@ text {
|
|||||||
.filter-gray {
|
.filter-gray {
|
||||||
filter: grayscale(1);
|
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: {
|
cleaning: {
|
||||||
label: "待清台",
|
label: "待清台",
|
||||||
type: "#FAAD14",
|
type: "#FAAD14",
|
||||||
|
},
|
||||||
|
unbind:{
|
||||||
|
label: "未绑定",
|
||||||
|
type: "rgb(221,221,221)",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
97
src/views/application/components/invite_friend/addCoupon.vue
Normal file
97
src/views/application/components/invite_friend/addCoupon.vue
Normal file
@@ -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>
|
||||||
263
src/views/application/components/invite_friend/record.vue
Normal file
263
src/views/application/components/invite_friend/record.vue
Normal file
@@ -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>
|
||||||
374
src/views/application/components/invite_friend/setting.vue
Normal file
374
src/views/application/components/invite_friend/setting.vue
Normal file
@@ -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>
|
||||||
35
src/views/application/invite_friend.vue
Normal file
35
src/views/application/invite_friend.vue
Normal file
@@ -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>
|
||||||
@@ -11,11 +11,11 @@
|
|||||||
<el-input v-model="form.title" placeholder="" style="width: 289px;" />
|
<el-input v-model="form.title" placeholder="" style="width: 289px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="使用门槛">
|
<el-form-item label="使用门槛">
|
||||||
<el-input v-model="form.fullAmount" type="number" placeholder="" style="width: 180px;margin-right: 66px;">
|
<el-input v-model="form.fullAmount" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" placeholder="" style="width: 180px;margin-right: 66px;">
|
||||||
<template slot="prepend">满</template>
|
<template slot="prepend">满</template>
|
||||||
<template slot="append">元</template>
|
<template slot="append">元</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-input v-model="form.discountAmount" type="number" placeholder="" style="width: 180px;">
|
<el-input v-model="form.discountAmount" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" placeholder="" style="width: 180px;">
|
||||||
<template slot="prepend">减</template>
|
<template slot="prepend">减</template>
|
||||||
<template slot="append">元</template>
|
<template slot="append">元</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发放数量" prop="number">
|
<el-form-item label="发放数量" prop="number">
|
||||||
<el-input v-model="form.number" type="number" placeholder="" style="width: 200px;" />
|
<el-input v-model="form.number" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" placeholder="" style="width: 200px;" />
|
||||||
<el-tooltip class="item" effect="dark" content="限用户自行领取,(当库存为 0时,集草等活动仍会赠送)" placement="top-start">
|
<el-tooltip class="item" effect="dark" content="限用户自行领取,(当库存为 0时,集草等活动仍会赠送)" placement="top-start">
|
||||||
<i class="el-icon-question" />
|
<i class="el-icon-question" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@@ -96,16 +96,16 @@
|
|||||||
<el-form-item label="商品券券名" prop="title">
|
<el-form-item label="商品券券名" prop="title">
|
||||||
<el-input v-model="form.title" placeholder="" style="width: 289px;" />
|
<el-input v-model="form.title" placeholder="" style="width: 289px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item />
|
<el-form-item style="margin: 0!important;" />
|
||||||
<el-form-item />
|
<el-form-item style="margin: 0!important;" />
|
||||||
<el-form-item label="发放数量" prop="number">
|
<el-form-item label="发放数量" prop="number">
|
||||||
<el-input v-model="form.number" type="number" placeholder="" style="width: 289px;" />
|
<el-input v-model="form.number" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" placeholder="" style="width: 289px;" />
|
||||||
<el-tooltip class="item" effect="dark" content="限用户自行领取,(当库存为 0时,集草等活动仍会赠送)" placement="top-start">
|
<el-tooltip class="item" effect="dark" content="限用户自行领取,(当库存为 0时,集草等活动仍会赠送)" placement="top-start">
|
||||||
<i class="el-icon-question" />
|
<i class="el-icon-question" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="使用门槛">
|
<el-form-item label="使用门槛">
|
||||||
全额满<el-input v-model="form.fullAmount" placeholder="" style="width: 100px;margin: 0 23px;"><template slot="suffix">元</template></el-input>可用
|
全额满<el-input v-model="form.fullAmount" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" placeholder="" style="width: 100px;margin: 0 23px;"><template slot="suffix">元</template></el-input>可用
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="赠送商品" prop="products">
|
<el-form-item label="赠送商品" prop="products">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -42,20 +42,38 @@
|
|||||||
<el-table v-loading="loading" :data="tableData.data">
|
<el-table v-loading="loading" :data="tableData.data">
|
||||||
|
|
||||||
<el-table-column label="用户ID" prop="id" />
|
<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="receiveTime" />
|
||||||
<el-table-column label="使用时间" prop="useTime" />
|
<el-table-column label="使用时间" prpo="useTime">
|
||||||
<el-table-column label="获得来源" prop="source" />
|
<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">
|
<el-table-column label="状态" align="status">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<div style="display: flex;align-items: center;">
|
<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.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 v-if="scope.row.overNum == 0" style="color: #52C41A;">已使用</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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">
|
<el-table-column label="操作" width="150">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||||
@@ -68,7 +86,6 @@
|
|||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
|
|||||||
@@ -22,11 +22,12 @@
|
|||||||
{{ `领券后${scope.row.validDays}天过期` }}
|
{{ `领券后${scope.row.validDays}天过期` }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column> -->
|
</el-table-column> -->
|
||||||
<el-table-column label="用户领取方式">
|
<!-- <el-table-column label="用户领取方式" prpo="source">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
{{ `无` }}
|
<div>{{ scope.row.source == 'activate' ? '充值活动' :
|
||||||
|
scope.row.source == 'invited' ? '好友分享' : '' }}</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column label="总发放数量" prop="number" />
|
<el-table-column label="总发放数量" prop="number" />
|
||||||
<el-table-column label="已领取" align="center">
|
<el-table-column label="已领取" align="center">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
@@ -57,7 +58,7 @@
|
|||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
:total="tableData.total"
|
:total="tableData.total"
|
||||||
:current-page="tableData.page + 1"
|
:current-page="tableData.page"
|
||||||
:page-size="tableData.size"
|
:page-size="tableData.size"
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
@current-change="paginationChange"
|
@current-change="paginationChange"
|
||||||
@@ -90,7 +91,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
tableData: {
|
tableData: {
|
||||||
data: [],
|
data: [],
|
||||||
page: 0,
|
page: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
loading: false,
|
loading: false,
|
||||||
total: 0
|
total: 0
|
||||||
@@ -108,7 +109,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 重置查询
|
// 重置查询
|
||||||
resetHandle() {
|
resetHandle() {
|
||||||
this.page = 0
|
this.page = 1
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
},
|
},
|
||||||
// 分页大小改变
|
// 分页大小改变
|
||||||
@@ -118,7 +119,8 @@ export default {
|
|||||||
},
|
},
|
||||||
// 分页回调
|
// 分页回调
|
||||||
paginationChange(e) {
|
paginationChange(e) {
|
||||||
this.tableData.page = e - 1
|
console.log(e)
|
||||||
|
this.tableData.page = e
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
},
|
},
|
||||||
// 获取优惠券列表
|
// 获取优惠券列表
|
||||||
|
|||||||
@@ -207,21 +207,24 @@ export default {
|
|||||||
filters: {
|
filters: {
|
||||||
orderTypeFilter(t) {
|
orderTypeFilter(t) {
|
||||||
if (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 {
|
} else {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sendTypeFilter(t) {
|
sendTypeFilter(t) {
|
||||||
if (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 {
|
} else {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
statusFilter(t) {
|
statusFilter(t) {
|
||||||
if (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 {
|
} else {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -625,8 +625,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.routequery = to.query.goods_id
|
this.routequery = to.query.goods_id
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
uploadImgSucess(res, item) {
|
uploadImgSucess(res, item) {
|
||||||
|
|||||||
@@ -33,6 +33,13 @@
|
|||||||
<el-radio :label="0">禁用</el-radio>
|
<el-radio :label="0">禁用</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="排列方式">
|
||||||
|
<el-radio-group v-model="form.sortMode">
|
||||||
|
<el-radio label="0">默认</el-radio>
|
||||||
|
<el-radio label="1">价格由高到低</el-radio>
|
||||||
|
<el-radio label="2">销量由高到低</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="" v-if="form.useTime == 1">
|
<el-form-item label="" v-if="form.useTime == 1">
|
||||||
<!-- <el-time-picker is-range v-model="form.saleTime" value-format="HH:mm" format="HH:mm"
|
<!-- <el-time-picker is-range v-model="form.saleTime" value-format="HH:mm" format="HH:mm"
|
||||||
:picker-options="pickerOptions" range-separator="至" start-placeholder="开始时间"
|
:picker-options="pickerOptions" range-separator="至" start-placeholder="开始时间"
|
||||||
@@ -86,6 +93,7 @@ export default {
|
|||||||
productIds: [],
|
productIds: [],
|
||||||
saleTime: [],
|
saleTime: [],
|
||||||
useTime: 0,
|
useTime: 0,
|
||||||
|
sortMode: '0',
|
||||||
shopId: localStorage.getItem('shopId')
|
shopId: localStorage.getItem('shopId')
|
||||||
},
|
},
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
@@ -192,6 +200,9 @@ export default {
|
|||||||
this.form.name = obj.name
|
this.form.name = obj.name
|
||||||
this.form.sort = obj.sort
|
this.form.sort = obj.sort
|
||||||
this.form.productIds = obj.productIds
|
this.form.productIds = obj.productIds
|
||||||
|
this.form.sortMode = obj.sortMode + ''
|
||||||
|
console.log(obj, '体哦啊是1')
|
||||||
|
console.log(this.form, '体哦啊是1')
|
||||||
// if (obj.saleStartTime != null) {
|
// if (obj.saleStartTime != null) {
|
||||||
// this.$set(this.form, 'saleTime', [obj.saleStartTime, obj.saleEndTime])
|
// this.$set(this.form, 'saleTime', [obj.saleStartTime, obj.saleEndTime])
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<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-form-item label="门店名称" prop="shopName">
|
||||||
<el-input v-model.trim="form.shopName" placeholder="请输入门店名称" style="width: 500px;"></el-input>
|
<el-input v-model.trim="form.shopName" placeholder="请输入门店名称" style="width: 500px;"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -66,16 +66,12 @@
|
|||||||
<el-checkbox label="take-out">允许打包</el-checkbox>
|
<el-checkbox label="take-out">允许打包</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否启用会员价">
|
<!-- <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-group v-model="form.consumeColony">
|
||||||
<el-radio label="all">所有</el-radio>
|
<el-radio label="all">所有</el-radio>
|
||||||
<el-radio label="vip">仅针对会员</el-radio>
|
<el-radio label="vip">仅针对会员</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="联系电话" prop="phone">
|
<el-form-item label="联系电话" prop="phone">
|
||||||
<el-input v-model.trim="form.phone" placeholder="请输入联系电话" style="width: 500px;"></el-input>
|
<el-input v-model.trim="form.phone" placeholder="请输入联系电话" style="width: 500px;"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -127,11 +123,15 @@
|
|||||||
<el-switch v-model.trim="form.isTableFee" :active-value="1" :inactive-value="0" active-text="免餐位费">
|
<el-switch v-model.trim="form.isTableFee" :active-value="1" :inactive-value="0" active-text="免餐位费">
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</el-form-item>
|
</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>
|
<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> -->
|
<!-- <div style="color: #999;">是否允许用户在小程序端支付订单</div> -->
|
||||||
</el-form-item>
|
</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>
|
<el-switch v-model.trim="form.isUseVip" :active-value="1" :inactive-value="0"></el-switch>
|
||||||
<!-- <div style="color: #999;">是否允许用户在小程序端支付订单</div> -->
|
<!-- <div style="color: #999;">是否允许用户在小程序端支付订单</div> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -30,9 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="" v-if="placeNum == 0">
|
<div class="" v-if="placeNum == 0">
|
||||||
<div class="note" v-if="item.note">
|
<div class="note" v-if="item.note">备注:{{ item.note || "" }}</div>
|
||||||
备注:{{ item.note || "" }}
|
|
||||||
</div>
|
|
||||||
<div class="note flex" v-else>
|
<div class="note flex" v-else>
|
||||||
<span>备注:</span>
|
<span>备注:</span>
|
||||||
<span class="el-icon-edit u-font-12" @click="editNote"></span>
|
<span class="el-icon-edit u-font-12" @click="editNote"></span>
|
||||||
@@ -69,15 +67,22 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="color-333 total-price">
|
<div class="color-333 total-price">
|
||||||
<div v-if="item.isGift === 'true' || item.status == 'return'">¥0</div>
|
<template v-if="item.isGift === 'true' || item.status == 'return'">
|
||||||
<div
|
<div>¥0</div>
|
||||||
:class="{
|
<div class="free-price">
|
||||||
'free-price': item.isGift === 'true' || item.status == 'return',
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<span v-if="isSeatFee"> ¥{{ item.totalAmount }}</span>
|
<span v-if="isSeatFee"> ¥{{ item.totalAmount }}</span>
|
||||||
<span v-else> ¥{{ (item.salePrice*item.number+(item.packAmount||0)).toFixed(2) }}</span>
|
<span v-else> ¥{{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -86,6 +91,10 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
isShowVipPrice: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
//是否是餐位费
|
//是否是餐位费
|
||||||
isSeatFee: {
|
isSeatFee: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -133,6 +142,23 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
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() {
|
isActive() {
|
||||||
const isSel =
|
const isSel =
|
||||||
this.selIndex === this.index && this.placeNum === this.selPlaceNum;
|
this.selIndex === this.index && this.placeNum === this.selPlaceNum;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<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="app-container">
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<el-form :model="query" inline>
|
<el-form :model="query" inline>
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="余额" prop="amount"></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">
|
<el-table-column label="操作" width="90" fixed="right">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
@@ -99,6 +99,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { queryAllShopUser, queryAllShopInfo } from "@/api/shop";
|
import { queryAllShopUser, queryAllShopInfo } from "@/api/shop";
|
||||||
|
import { $returnMemberPointsList } from "@/api/table";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
let cacheData = {};
|
let cacheData = {};
|
||||||
export default {
|
export default {
|
||||||
@@ -107,6 +108,7 @@ export default {
|
|||||||
show: false,
|
show: false,
|
||||||
query: {
|
query: {
|
||||||
name: "",
|
name: "",
|
||||||
|
isVip:1
|
||||||
},
|
},
|
||||||
shopInfo: {
|
shopInfo: {
|
||||||
balanceTotal: 0,
|
balanceTotal: 0,
|
||||||
@@ -202,7 +204,6 @@ export default {
|
|||||||
this.tableData.page = e - 1;
|
this.tableData.page = e - 1;
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
},
|
},
|
||||||
// 获取商品列表
|
|
||||||
async getTableData() {
|
async getTableData() {
|
||||||
this.tableData.loading = true;
|
this.tableData.loading = true;
|
||||||
try {
|
try {
|
||||||
|
|||||||
0
src/views/tool/Instead/components/coup.vue
Normal file
0
src/views/tool/Instead/components/coup.vue
Normal file
@@ -154,7 +154,7 @@ export default {
|
|||||||
}
|
}
|
||||||
if (curretnMoney > money) {
|
if (curretnMoney > money) {
|
||||||
this.$message.error("实收金额不能大于总金额");
|
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.reduceMoney = (money - this.form.curretnMoney).toFixed(2);
|
||||||
this.form.discount =toFixedNoRounding( ((this.form.curretnMoney / money) * 100).toFixed(3) );
|
this.form.discount =toFixedNoRounding( ((this.form.curretnMoney / money) * 100).toFixed(3) );
|
||||||
@@ -173,7 +173,7 @@ export default {
|
|||||||
},
|
},
|
||||||
open(data) {
|
open(data) {
|
||||||
console.log(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.form.discount = data.discount?toFixedNoRounding(data.discount.toFixed(3)):100;
|
||||||
this.show = true;
|
this.show = true;
|
||||||
this.init();
|
this.init();
|
||||||
|
|||||||
142
src/views/tool/Instead/components/popup-linshiCai.vue
Normal file
142
src/views/tool/Instead/components/popup-linshiCai.vue
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="添加临时菜"
|
||||||
|
width="410px"
|
||||||
|
:visible.sync="show"
|
||||||
|
@close="reset"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<div>将临时菜添加至购物车,不会影响总商品库</div>
|
||||||
|
<div class="u-m-t-16">
|
||||||
|
<el-form ref="form" :model="form" label-width="80px">
|
||||||
|
<el-form-item label="菜品名称">
|
||||||
|
<el-input v-model="form.name"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="菜品分类">
|
||||||
|
<el-select v-model="form.category" filterable placeholder="选择分类">
|
||||||
|
<el-option
|
||||||
|
v-for="item in category"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="价格">
|
||||||
|
<el-input v-model="form.price" placeholder="请输入价格" type="number">
|
||||||
|
<template slot="append">元</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="单位">
|
||||||
|
<el-select v-model="form.unit" filterable placeholder="选择单位">
|
||||||
|
<el-option
|
||||||
|
v-for="item in units"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="下单数量">
|
||||||
|
<el-input v-model="form.num" placeholder="请输入下单数量" type="number">
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="form.note" placeholder="请输入备注" >
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div slot="footer">
|
||||||
|
<el-button size="medium" @click="close"> 取消 </el-button>
|
||||||
|
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { tbShopCategoryGet,tbShopUnit } from "@/api/shop";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
show: false,
|
||||||
|
form: {
|
||||||
|
name: "",
|
||||||
|
category:'',
|
||||||
|
price: "",
|
||||||
|
unit:'',
|
||||||
|
num:1,
|
||||||
|
note:''
|
||||||
|
},
|
||||||
|
category:[],
|
||||||
|
units:[]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
async getCategory() {
|
||||||
|
const { content } = await tbShopCategoryGet({
|
||||||
|
page: 0,
|
||||||
|
size: 300,
|
||||||
|
sort: "id",
|
||||||
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
});
|
||||||
|
this.category = content.reduce((prve, cur) => {
|
||||||
|
prve.push(cur);
|
||||||
|
return [...prve, ...cur.childrenList];
|
||||||
|
}, []);
|
||||||
|
},
|
||||||
|
async getUnit() {
|
||||||
|
const { content } = await tbShopUnit({
|
||||||
|
page: 0,
|
||||||
|
size: 300,
|
||||||
|
sort: "id",
|
||||||
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
});
|
||||||
|
this.units = content
|
||||||
|
},
|
||||||
|
reset() {},
|
||||||
|
|
||||||
|
open() {
|
||||||
|
this.show = true;
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.show = false;
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
this.$emit("confirm", this.form);
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getCategory()
|
||||||
|
this.getUnit()
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep .el-dialog__body {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
margin-top: 14px;
|
||||||
|
}
|
||||||
|
::v-deep .el-form-item__label {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
input[type="number"]::-webkit-inner-spin-button,
|
||||||
|
input[type="number"]::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
::v-deep .el-input__inner::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
::v-deep .el-input__inner::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
450
src/views/tool/Instead/components/quans.vue
Normal file
450
src/views/tool/Instead/components/quans.vue
Normal file
@@ -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) {
|
open(item) {
|
||||||
this.goods = item?item:this.goods;
|
this.goods = item?item:this.goods;
|
||||||
|
console.log(item)
|
||||||
this.show = true;
|
this.show = true;
|
||||||
if (item != "-999") {
|
if (item != "-999") {
|
||||||
this.number = 1;
|
this.number = 1;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,3 +1,4 @@
|
|||||||
|
import {isTui} from '../../order_manage/order_goods_util.js'
|
||||||
//计算打包费
|
//计算打包费
|
||||||
export function returnPackFee(arr, isOld = true) {
|
export function returnPackFee(arr, isOld = true) {
|
||||||
if (isOld) {
|
if (isOld) {
|
||||||
@@ -113,5 +114,85 @@ export function returnIsSeatFee(item){
|
|||||||
if (!item) {
|
if (!item) {
|
||||||
return false
|
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);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user