Merge branch 'test' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into gyq

This commit is contained in:
gyq 2024-11-13 10:23:46 +08:00
commit aacb9d966a
24 changed files with 1830 additions and 280 deletions

View File

@ -417,6 +417,17 @@ export function modityActivate(data) {
});
}
/**
* 新增修改活动 新的
* @returns
*/
export function storageupActivate(data) {
return request({
url: `/shop/storage/upActivate`,
method: "post",
data
});
}
/**
* 活动列表
* @returns

View File

@ -471,4 +471,50 @@ export function $activateByOrderId(data) {
...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
}
});
}

View File

@ -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;
}

View File

@ -0,0 +1,175 @@
<template>
<el-dialog title="选择优惠劵" top="5vh" :visible.sync="dialogVisible">
<div class="head-container">
<el-table ref="table" :data="tableData.list" height="500" v-loading="tableData.loading">
<!-- <el-table-column type="selection" width="55" align="center" v-if="!radio"></el-table-column> -->
<el-table-column label="名称" prop="title" />
<el-table-column label="使用门槛">
<template v-slot="scope">
{{ `${scope.row.fullAmount}${scope.row.discountAmount ? '减' + scope.row.discountAmount + '元' :
''}` }}
</template>
</el-table-column>
<el-table-column label="总发放数量" prop="number" />
<el-table-column label="已使用" prop="useNumber" />
<el-table-column label="剩余" prop="leftNumber" />
<el-table-column label="操作">
<template v-slot="scope">
<el-button type="primary" @click="selectHandle(scope.row)">选择</el-button>
</template>
</el-table-column>
</el-table>
</div>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" @size-change="sizeChange"
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
<span slot="footer" class="dialog-footer" v-if="!radio">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="confirmHandle"> </el-button>
</span>
</el-dialog>
</template>
<script>
import { getTbShopCoupon, delTbShopCoupon } from '@/api/coupon'
export default {
props: {
//
radio: {
type: Boolean,
default: false
}
},
data() {
return {
dialogVisible: false,
searhForm: {
name: '',
category: ''
},
categoryList: [],
tableData: {
page: 0,
size: 10,
total: 0,
loading: false,
list: []
},
goods: []
}
},
methods: {
//
selectHandle(row) {
this.$emit('success', [{ ...row }])
this.close()
},
//
confirmHandle() {
let res = this.$refs.table.selection
this.$emit('success', res)
this.close()
},
//
resetHandle() {
this.searhForm.name = ''
this.searhForm.category = ''
this.tableData.page = 0
this.tableData.size = 10
this.tableData.list = []
this.getTableData()
},
//
sizeChange(e) {
this.tableData.size = e
this.getTableData()
},
//
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
},
//
async getTableData() {
this.tableData.loading = true
try {
const res = await getTbShopCoupon({
page: this.tableData.page,
size: this.tableData.size,
name: this.searhForm.name,
categoryId: this.searhForm.category,
shopId: localStorage.getItem('shopId'),
sort: 'id',
})
this.tableData.list = res.content
this.tableData.total = res.totalElements
if (this.goods.length) {
this.$nextTick(() => {
this.selection()
})
}
setTimeout(() => {
this.tableData.loading = false
}, 500);
} catch (error) {
console.log(error)
}
},
//
async tbShopCategoryGet() {
try {
const res = await getTbShopCoupon({
page: 0,
size: 100,
sort: 'id',
shopId: localStorage.getItem('shopId')
})
this.categoryList = res.content
} catch (error) {
console.log(error)
}
},
async show(goods, categoryId) {
this.dialogVisible = true
if (goods && goods.length) {
this.goods = goods
} else {
this.goods = []
}
this.resetHandle()
console.log(categoryId);
if (categoryId) {
this.searhForm.category = categoryId
}
console.log(this.searhForm);
},
close() {
this.dialogVisible = false
},
selection() {
this.goods.forEach(row => {
this.tableData.list.forEach((item, index) => {
if (row.id == item.id) {
this.$refs.table.toggleRowSelection(this.tableData.list[index]);
}
})
});
}
}
}
</script>
<style scoped lang="scss">
.shop_info {
display: flex;
align-items: center;
span {
margin-left: 10px;
}
}
</style>

View File

@ -30,5 +30,9 @@ export const $status= {
cleaning: {
label: "待清台",
type: "#FAAD14",
},
unbind:{
label: "未绑定",
type: "rgb(221,221,221)",
}
}

View File

@ -6,29 +6,30 @@
</div>
<!-- 优惠券 -->
<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 ref="form" :inline="true" :model="form" :rules="rules" label-width="120px" label-position="left">
<el-form-item label="优惠券券名" prop="title" style="width: 100%;">
<el-input v-model="form.title" placeholder="" style="width: 289px;" />
</el-form-item>
<el-form-item label="使用门槛">
<el-input v-model="form.fullAmount" type="number" placeholder="" style="width: 180px;margin-right: 66px;">
<el-form-item label="使用门槛" prop="fullAmount">
<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="append"></template>
</el-input>
<el-input v-model="form.discountAmount" type="number" placeholder="" style="width: 180px;">
</el-form-item>
<el-form-item label="" prop="discountAmount">
<el-input v-model="form.discountAmount" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" placeholder="" style="width: 180px;">
<template slot="prepend"></template>
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="有效期类型">
<el-form-item label="有效期类型" style="width: 100%;">
<el-radio-group v-model="form.validityType">
<el-radio v-for="item in couponEnum.validityType" :key="item.value" :label="item.value">
{{ item.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.validityType == 'custom'" label="有效时间" prop="validEndTime">
<el-form-item v-if="form.validityType == 'custom'" label="有效时间" prop="validEndTime" style="width: 100%;">
<el-date-picker
v-model="validityTime"
type="daterange"
@ -40,12 +41,12 @@
@change="validityChange"
/>
</el-form-item>
<el-form-item label="有效期(天)" prop="validDays">
<el-form-item label="有效期(天)" prop="validDays" style="width: 100%;">
<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-form-item label="使用门槛" prop="daysToTakeEffect" style="width: 100%;">
<el-input v-model="form.daysToTakeEffect" placeholder="" style="width: 200px;">
<template slot="prepend"></template>
<template slot="append">天生效</template>
@ -54,19 +55,19 @@
<i class="el-icon-question" />
</el-tooltip>
</el-form-item> -->
<el-form-item label="可用周期" prop="userDays">
<el-form-item label="可用周期" prop="userDays" style="width: 100%;">
<el-checkbox-group v-model="form.userDays">
<el-checkbox v-for="(city,index) in couponEnum.cycle" :key="index" :label="city.label" @change="userDayChagne">{{ city.label }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="指定时间段">
<el-form-item label="指定时间段" style="width: 100%;">
<el-radio-group v-model="form.useTimeType">
<el-radio v-for="item in couponEnum.useTimeType" :key="item.value" :label="item.value">
{{ item.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.useTimeType == 'custom'" label="指定时间段" prop="useEndTime">
<el-form-item v-if="form.useTimeType == 'custom'" label="指定时间段" prop="useEndTime" style="width: 100%;">
<el-time-picker
v-model="useTime"
is-range
@ -78,8 +79,8 @@
@change="useTimeChange"
/>
</el-form-item>
<el-form-item label="发放数量" prop="number">
<el-input v-model="form.number" type="number" placeholder="" style="width: 200px;" />
<el-form-item label="发放数量" prop="number" style="width: 100%;">
<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">
<i class="el-icon-question" />
</el-tooltip>
@ -96,16 +97,14 @@
<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-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">
<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>可用
<el-form-item label="使用门槛" prop="fullAmount">
全额满<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 label="赠送商品" prop="products">
<div>
@ -186,6 +185,20 @@ export default {
trigger: 'blur'
}
],
fullAmount: [
{
required: true,
message: '填写满减金额',
trigger: 'blur'
}
],
discountAmount: [
{
required: true,
message: '填写满减金额',
trigger: 'blur'
}
],
number: [
{
required: true,

View File

@ -31,7 +31,7 @@
<el-table-column label="总发放数量" prop="number" />
<el-table-column label="已领取" align="center">
<template v-slot="scope">
<div style="display: flex;align-items: center;">
<div style="display: flex;align-items: center;justify-content: center;">
<div style="width: 30px;">{{ scope.row.number-scope.row.leftNumber }}</div>
<div style="margin: 0 10px;">|</div>
<div style="color: #3F9EFF;cursor: pointer;flex-shrink: 0;" @click="couponDetailsOpen(scope.row)">详情</div>

View File

@ -139,11 +139,11 @@
<template v-slot="scope">
<template v-if="scope.row.status!='unpaid'">
<el-button v-if="canTuikuan(scope.row)" type="text" size="mini" @click="tuikuan(scope.row)"><span >退款</span></el-button>
<span class="color-999" v-else>已退款</span>
<span class="color-999" v-if="isTui(scope.row)">已退款</span>
</template>
<template v-if="scope.row.status=='unpaid'">
<el-button v-if="canTuicai(scope.row)" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button>
<span class="color-999" v-else>已退菜</span>
<span class="color-999" v-if="scope.row=='return'">已退菜</span>
</template>
</template>
</el-table-column>
@ -292,6 +292,9 @@ export default {
console.log('drawer close')
this.$emit('close');
},
isTui(item){
return $util.isTui(item);
},
canTuikuan(item){
return $util.canTuiKuan(this.detail,item);
},

View File

@ -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;
}

View File

@ -437,7 +437,7 @@ export default {
Editor,
addImg,
},
name:'add_shop',
name: 'add_shop',
data() {
const validatordateUsed = (rule, value, callback) => {
if (!this.form.notices.dateUsed) {
@ -602,18 +602,32 @@ export default {
batchNumberForm: {
batchNumber: 0,
},
routequery:''
};
},
mounted() {
this.tbShopUnit();
this.tbShopCategoryGet();
this.changeTypeEnum(0);
if (this.$route.query.goods_id) {
this.tbProductGetDetail();
}
},
methods: {
watch: {
//
$route(to, from) {
console.log(to.query.goods_id)
if (to.query.goods_id) {
if (this.routequery == to.query.goods_id) {
return false;
} else {
this.tbProductGetDetail();
}
this.routequery = to.query.goods_id
}
}
},
methods: {
uploadImgSucess(res, item) {
console.log(res);
console.log(item);

View File

@ -27,12 +27,19 @@
<el-radio :label="0">禁用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="售卖时间管控" >
<el-form-item label="售卖时间管控">
<el-radio-group v-model="form.useTime">
<el-radio :label="1">启用</el-radio>
<el-radio :label="0">禁用</el-radio>
</el-radio-group>
</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-time-picker is-range v-model="form.saleTime" value-format="HH:mm" format="HH:mm"
:picker-options="pickerOptions" range-separator="至" start-placeholder="开始时间"
@ -51,7 +58,7 @@
</el-form-item>
<el-form-item label="分组排序" >
<el-form-item label="分组排序">
<el-input-number v-model="form.sort" controls-position="right" :min="0"></el-input-number>
</el-form-item>
@ -86,6 +93,7 @@ export default {
productIds: [],
saleTime: [],
useTime: 0,
sortMode: '0',
shopId: localStorage.getItem('shopId')
},
pickerOptions: {
@ -182,7 +190,7 @@ export default {
},
async show(obj) {
let res = await hasPermission('允许修改分组');
if ( !res) { return; }
if (!res) { return; }
// if()
this.form.useTime = 0
if (obj && obj.id) {
@ -192,6 +200,9 @@ export default {
this.form.name = obj.name
this.form.sort = obj.sort
this.form.productIds = obj.productIds
this.form.sortMode = obj.sortMode + ''
console.log(obj, '体哦啊是1')
console.log(this.form, '体哦啊是1')
// if (obj.saleStartTime != null) {
// this.$set(this.form, 'saleTime', [obj.saleStartTime, obj.saleEndTime])
// }

View File

@ -298,11 +298,9 @@ export default {
}
},
async mounted() {
console.log(this.$route.query.productId, 'tiaoshi1')
if (this.$route.query.productId) {
this.query.productId = this.$route.query.productId
}
console.log(this.query)
await this.tbShopCategoryGet()
await this.getTableData()
@ -533,7 +531,6 @@ export default {
})
})
console.log(res);
this.tableData.loading = false
this.tableData.data = res.content

View File

@ -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;

View File

@ -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 {

View File

@ -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();

View 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>

View File

@ -0,0 +1,445 @@
<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,returnProductCoupon,
returnProductCouponPrice,
returnFullReductionCouponAllPrice,returnNewGoodsList
} 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) => {
return this.orderPrice >= v.fullAmount && v.use;
}
);
const canDikouGoodsArr = returnNewGoodsList(this.goodsArr|| [])
$originFullReductionCoupon = quansRes.fullReductionCoupon;
this.quans.productCoupon = quansRes.productCoupon.map(v=>{
const coup = returnProductCoupon(v, canDikouGoodsArr,this.vipUser)
return coup
}).filter(v=>v.use)
// 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>

View File

@ -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 one or more lines are too long

View File

@ -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,131 @@ 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 returnCoupCanUse(goodsArr=[],coup,selCoupArr=[]) {
if(!coup.use){
return false
}
const findGoods=goodsArr.filter(v=>v.productId==coup.proId)
if(!findGoods.length){
return false
}
const findGoodsTotalNumber=findGoods.reduce((prve,cur)=>{
return prve+cur.num*1
},0)
const selCoupNumber=selCoupArr.filter(v=>v.proId==coup.proId).reduce((prve,cur)=>{
return prve+cur.num*1
},0)
if(selCoupNumber>=findGoodsTotalNumber){
return false
}
return findGoodsTotalNumber<(coup.num+selCoupNumber)?false:true
}
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
export function returnProductCoupon(coup, goodsArr, vipUser,selCoupArr=[]) {
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 discountAmount=(price*coup.num).toFixed(2)
console.log(discountAmount);
const canUse=!coup.use?false:(discountAmount>0&&returnCoupCanUse(goodsArr,coup,selCoupArr))
// const canUse=discountAmount>0
return { ...coup, discountAmount: discountAmount,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);
}

View File

@ -19,24 +19,26 @@
下载会员充值二维码
</el-button>
<div style="margin-top: 35px; font-size: 16px; color: #333;">
允许充值自定义金额<el-switch v-model="shopInfo.isCustom" active-value="1" inactive-value="0" size="large" @change="customStatusChange"></el-switch>
允许充值自定义金额<el-switch v-model="shopInfo.isCustom" active-value="1" inactive-value="0" size="large"
@change="customStatusChange"></el-switch>
</div>
</div>
<div class="head-container">
<el-table :data="tableData.data" v-loading="tableData.loading">
<el-table-column label="店铺ID" prop="shopId"></el-table-column>
<el-table-column label="最小金额" prop="minNum"></el-table-column>
<el-table-column label="最大金额" prop="maxNum"></el-table-column>
<el-table-column label="赠送金额" prop="handselNum"></el-table-column>
<el-table-column label="赠送类型" prop="handselType">
<el-table-column label="充值金额" prop="amount"></el-table-column>
<el-table-column label="赠送金额" prop="giftAmount"></el-table-column>
<!-- <el-table-column label="赠送金额" prop="handselNum"></el-table-column>
<el-table-column label="是否使用优惠券" prop="isUseCoupon">
<template v-slot="scope">
{{ scope.row.handselType | handselTypeFilter }}
</template>
</el-table-column>
<!-- <el-table-column label="排序" sortable prop="sort"></el-table-column> -->
<el-table-column label="是否启用" prop="isDel">
</el-table-column>
<el-table-column label="排序" sortable prop="sort"></el-table-column> -->
<el-table-column label="赠送积分" prop="giftPoints"></el-table-column>
<el-table-column label="是否使用优惠券" prop="isUseCoupon">
<template v-slot="scope">
<el-switch v-model="scope.row.isDel" active-value="0" inactive-value="1"
<el-switch v-model="scope.row.isUseCoupon" :active-value="1" :inactive-value="0"
@change="statusChange($event, scope.row)"></el-switch>
</template>
</el-table-column>
@ -65,7 +67,7 @@
import handselTypes from './handselTypes'
import addActive from './components/addActive'
import QR from './components/downloadQR.vue'
import { findActivate, modityActivate } from '@/api/shop'
import { findActivate, storageupActivate } from '@/api/shop'
import { tbShopInfo, tbShopInfoPut } from "@/api/user";
import dayjs from 'dayjs'
export default {
@ -104,16 +106,27 @@ export default {
methods: {
//
async statusChange(e, row) {
try {
this.tableData.loading = true
const data = { ...row }
data.status = e
await modityActivate(data)
this.getTableData()
} catch (error) {
console.log(error)
this.tableData.loading = false
if (row.couponName) {
try {
this.tableData.loading = true
const data = { ...row }
data.isUseCoupon = e
console.log(data.isUseCoupon)
await storageupActivate(data)
this.getTableData()
} catch (error) {
console.log(error)
this.tableData.loading = false
}
} else {
console.log(22)
this.$message({
message: '请选择优惠劵',
type: 'warning'
});
return false;
}
},
//
resetHandle() {
@ -151,7 +164,7 @@ export default {
}
console.log(this.shopInfo);
} catch (error) {
console.log(error)
}

View File

@ -2,7 +2,23 @@
<div>
<el-dialog :title="form.id ? '编辑活动' : '添加活动'" :visible.sync="dialogVisible" @close="reset">
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
<el-form-item label="最小金额">
<el-form-item label="充值">
<template>
<div style="display: flex;">
<el-input style="width: 220px;" placeholder="请输入金额" v-model="form.amount">
<template slot="prepend"></template>
<template slot="append"></template>
</el-input>
<el-input style="margin-left: 20px; width: 220px;" placeholder="请输入金额"
v-model="form.giftAmount">
<template slot="prepend"></template>
<template slot="append"></template>
</el-input>
</div>
</template>
</el-form-item>
<!-- <el-form-item label="最小金额">
<el-input-number v-model="form.minNum" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="最大金额">
@ -11,32 +27,46 @@
<el-form-item label="赠送金额">
<el-input-number v-model="form.handselNum" controls-position="right" :min="0"></el-input-number>
</el-form-item>
<!-- <el-form-item label="赠送类型">
<el-form-item label="赠送类型">
<el-select v-model="form.handselType">
<el-option :label="item.label" :value="item.value" v-for="item in handselTypes"
:key="item.value"></el-option>
</el-select>
</el-form-item> -->
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="form.isDel" active-value="0" inactive-value="1"></el-switch>
</el-form-item> -->
<el-form-item label="是否使用优惠券">
<el-switch v-model="form.isUseCoupon" :active-value="1" :inactive-value="0"></el-switch>
</el-form-item>
<el-form-item label="是否赠送商品">
<el-switch v-model="form.isGiftPro" :active-value="1" :inactive-value="0"></el-switch>
<el-form-item label="数量">
<el-input-number v-model="form.num" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="赠送商品">
<el-form-item label="积分">
<template>
<div class="labelboxss">
<div>赠送</div>
<el-input style="width: 140px;margin: 0 15px;" v-model="form.giftPoints"></el-input>
<div>积分</div>
</div>
</template>
</el-form-item>
<el-form-item label="选择优惠劵" v-if="form.isUseCoupon == 1">
<div>
<el-button type="primary" icon="el-icon-plus" @click="$refs.shopListRef.show([...productIds])">
添加商品
<el-button type="primary" icon="el-icon-plus" @click="$refs.coupon.show([...productIds])">
添加优惠劵
</el-button>
</div>
<div class="shop_list">
<div class="item_wrap" style="display: flex;align-items: center;margin-top: 6px;"
v-for="(item, index) in productIds" :key="item.id">
<div class="name">{{ item.name }}</div>
<el-input style="width: 120px;" v-model="item.num" placeholder='请填写数量'
@input="checkIfNum(item)"></el-input>
<el-button type="text" @click="productIds.splice(index, 1)"
style="margin-left: 20px;">删除</el-button>
<div class="name">{{ item.title }}</div>
<!-- <el-input style="width: 120px;" v-model="item.num" placeholder='请填写数量'
@input="checkIfNum(item)"></el-input> -->
<!-- <el-button type="text" @click="productIds.splice(index, 1)"
style="margin-left: 20px;">删除</el-button> -->
<el-button type="text" @click="productIds = []" style="margin-left: 20px;">删除</el-button>
</div>
</div>
</el-form-item>
@ -46,18 +76,18 @@
<el-button type="primary" :loading="loading" @click="onSubmitHandle"> </el-button>
</span>
</el-dialog>
<shopList ref="shopListRef" @success="slectShop" />
<coupon ref="coupon" @success="slectShop" />
</div>
</template>
<script>
import handselTypes from '../handselTypes'
import { modityActivate, activate } from '@/api/shop'
import shopList from '@/components/shopList'
import { activate, storageupActivate } from '@/api/shop'
import coupon from '@/components/coupon'
export default {
components: { shopList },
components: { coupon },
data() {
return {
dialogVisible: false,
@ -70,7 +100,10 @@ export default {
maxNum: 1,
handselNum: 1, //
handselType: 'GD',
isDel: '0'
isDel: '0',
num: 1,
amount: '',
giftAmount: ''
},
productIds: [],
resetForm: '',
@ -97,15 +130,16 @@ export default {
},
methods: {
slectShop(res) {
if (this.productIds.length) {
res.map(async item => {
if (!await this.checkShop(item.id)) {
this.productIds.push({ ...item })
}
})
} else {
this.productIds = res
}
console.log(res, 11)
// if (this.productIds.length) {
// res.map(async item => {
// if (!await this.checkShop(item.id)) {
// this.productIds.push({ ...item })
// }
// })
// } else {
this.productIds = res
// }
},
//
checkShop(id) {
@ -125,21 +159,37 @@ export default {
this.form.config.categoryList = e
},
onSubmitHandle() {
// console.log(this.form)
let arr = []
this.productIds.forEach(ele => {
arr.push({
productId: ele.id,
num: ele.num
})
})
this.form.products = arr
console.log(this.form)
if (this.form.amount == '') {
this.$message({
message: '充值金额不能为空',
type: 'warning'
});
return false;
}
if (this.form.isUseCoupon == 1) {
if (this.productIds.length == 0) {
this.$message({
message: '请选择优惠劵',
type: 'warning'
});
return false;
}
this.form.couponId = this.productIds[0].id
}
// let arr = []
// this.productIds.forEach(ele => {
// arr.push({
// productId: ele.id,
// num: ele.num
// })
// })
this.$refs.form.validate(async valid => {
if (valid) {
try {
this.loading = true
this.form.shopId = localStorage.getItem('shopId')
let res = await modityActivate(this.form)
let res = await storageupActivate(this.form)
this.$emit('success', res)
this.close()
this.$notify({
@ -159,9 +209,13 @@ export default {
this.dialogVisible = true
if (obj && obj.id) {
this.form = { ...obj }
let res = await activate(obj.id)
this.productIds = res
console.log(res, '调试1')
// let res = await activate(obj.id)
// this.productIds = res
if (obj.couponName) {
this.productIds = [{ title: obj.couponName }]
}
console.log(obj, '调试1')
}
},
close() {
@ -174,6 +228,35 @@ export default {
}
</script>
<style scoped lang="scss">
.labelbox {
display: flex;
justify-content: flex-start;
align-items: center;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 12px;
color: #666666;
width: 130px;
background: #F7F7FA;
border-radius: 2px 2px 2px 2px;
border: 1px solid #DDDFE6;
padding: 0 10px;
input {
border: none !important;
}
}
.labelboxss {
display: flex;
justify-content: flex-start;
align-items: center;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 14px;
color: #666666;
}
.shop_list {
// display: flex;/
// flex-wrap: wrap;

View File

@ -25,13 +25,14 @@ export default {
},
methods: {
show() {
this.isshow = true
this.getlist()
},
async getlist() {
let res = await getwxacode({
shopId: localStorage.getItem('shopId')
})
this.isshow = true
this.imgUrl = res
}, downImg() {
// window.location.href()