Merge branch 'dev' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into dwb
This commit is contained in:
commit
e8299f8d12
|
|
@ -30,10 +30,11 @@ export function getbinding(data) {
|
||||||
* 获取应用中心列表
|
* 获取应用中心列表
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function appCenterGet() {
|
export function appCenterGet(params) {
|
||||||
return request({
|
return request({
|
||||||
url: "/api/appCenter",
|
url: "/api/appCenter",
|
||||||
method: "get"
|
method: "get",
|
||||||
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -313,6 +313,7 @@ export default {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: block;
|
display: block;
|
||||||
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
|
|
@ -376,6 +377,8 @@ export default {
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
line-height: 16px;
|
||||||
|
padding: 6px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btm {
|
.btm {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<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="consumeAmount">
|
<el-form-item label="消费赠送积分" prop="consumeAmount">
|
||||||
<el-input v-model="form.consumeAmount" style="width: 250px;"
|
<el-input v-model="form.consumeAmount" style="width: 250px;"
|
||||||
@input="inputFilterInt($event, 'consumeAmount')">
|
@input="inputFilterInt($event, 'consumeAmount')">
|
||||||
<template slot="prepend">每消费</template>
|
<template slot="prepend">每消费</template>
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,9 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发放数量" prop="number" style="width: 100%;">
|
<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-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> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
<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="使用门槛" prop="fullAmount">
|
<el-form-item label="使用门槛" prop="fullAmount">
|
||||||
全额满<el-input v-model="form.fullAmount" oninput="value= value.replace(/[^\d|\.]/g, '')" placeholder="" style="width: 100px;margin: 0 23px;"><template slot="suffix">元</template></el-input>可用
|
金额满<el-input v-model="form.fullAmount" oninput="value= value.replace(/[^\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="有效期类型" style="width: 100%;">
|
<el-form-item label="有效期类型" style="width: 100%;">
|
||||||
<el-radio-group v-model="form.validityType">
|
<el-radio-group v-model="form.validityType">
|
||||||
|
|
@ -158,9 +158,9 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发放数量" prop="number" style="width: 100%;">
|
<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-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> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="赠送商品" prop="products">
|
<el-form-item label="赠送商品" prop="products">
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,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"
|
||||||
|
|
@ -130,7 +130,7 @@ export default {
|
||||||
resetQuery: null,
|
resetQuery: null,
|
||||||
tableData: {
|
tableData: {
|
||||||
data: [],
|
data: [],
|
||||||
page: 0,
|
page: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
loading: false,
|
loading: false,
|
||||||
total: 0
|
total: 0
|
||||||
|
|
@ -146,7 +146,7 @@ export default {
|
||||||
*/
|
*/
|
||||||
async getTableData() {
|
async getTableData() {
|
||||||
// eslint-disable-next-line no-unused-vars, prefer-const
|
// eslint-disable-next-line no-unused-vars, prefer-const
|
||||||
console.log(this.couponId)
|
// console.log(this.couponId)
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars, prefer-const
|
// eslint-disable-next-line no-unused-vars, prefer-const
|
||||||
let res = await queryReceive({
|
let res = await queryReceive({
|
||||||
|
|
@ -168,8 +168,13 @@ export default {
|
||||||
* 时间选择监听
|
* 时间选择监听
|
||||||
*/
|
*/
|
||||||
queryTimeChange(e) {
|
queryTimeChange(e) {
|
||||||
this.query.startTime = e[0]
|
if (e) {
|
||||||
this.query.endTime = e[1]
|
this.query.startTime = e[0]
|
||||||
|
this.query.endTime = e[1]
|
||||||
|
} else {
|
||||||
|
this.query.startTime = ''
|
||||||
|
this.query.endTime = ''
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -200,7 +205,8 @@ export default {
|
||||||
},
|
},
|
||||||
// 分页回调
|
// 分页回调
|
||||||
paginationChange(e) {
|
paginationChange(e) {
|
||||||
this.tableData.page = e - 1
|
this.tableData.page = e
|
||||||
|
this.query.page = e
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<el-drawer title="订单详情" size="50%" :visible.sync="drawer" direction="rtl" v-loading="loading" >
|
<el-drawer
|
||||||
|
title="订单详情"
|
||||||
|
size="50%"
|
||||||
|
:visible.sync="drawer"
|
||||||
|
direction="rtl"
|
||||||
|
v-loading="loading"
|
||||||
|
>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="title" style="text-align: center;">【收银订单】</div>
|
<div class="title" style="text-align: center">【收银订单】</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="info_content">
|
<div class="info_content">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
|
|
@ -72,15 +78,20 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div>打包费:{{ detail.packFee || "-" }}</div>
|
<div>打包费:{{ detail.packFee || "-" }}</div>
|
||||||
<div>订单原价:¥{{ detail.originAmount }}</div>
|
<div>订单原价:¥{{ detail.originAmount }}</div>
|
||||||
<div>优惠金额:¥{{ detail.userCouponAmount || "-" }}</div>
|
<div>优惠金额:¥{{ youHuiJinE }}</div>
|
||||||
<div>
|
<div>
|
||||||
实收金额:<span style="color: red;">¥{{ detail.payAmount }}</span>
|
实收金额:<span style="color: red">¥{{ detail.payAmount }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div>
|
<div>
|
||||||
退款金额:¥{{ detail.refundAmount }}
|
退款金额:¥{{ detail.refundAmount }}
|
||||||
<span style="color: #FF9731;cursor: pointer;" v-if="detail.isRefund" @click="type = '3'">退款详情></span>
|
<span
|
||||||
|
style="color: #ff9731; cursor: pointer"
|
||||||
|
v-if="detail.isRefund"
|
||||||
|
@click="type = '3'"
|
||||||
|
>退款详情></span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div>支付方式:{{ detail.payType }}</div>
|
<div>支付方式:{{ detail.payType }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -100,20 +111,26 @@
|
||||||
</div> -->
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div style="margin-bottom: 16px;font-size:16px;">商品信息</div>
|
<div style="margin-bottom: 16px; font-size: 16px">商品信息</div>
|
||||||
<el-table :data="detail.detailList">
|
<el-table :data="detail.detailList">
|
||||||
<el-table-column label="商品">
|
<el-table-column label="商品">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<div class="shop_info">
|
<div class="shop_info">
|
||||||
<el-image v-if="scope.row.productSkuId!='-999'" :src="scope.row.productImg" style="width: 40px;height: 40px;"></el-image>
|
<el-image
|
||||||
|
v-if="scope.row.productSkuId != '-999'"
|
||||||
|
:src="scope.row.productImg"
|
||||||
|
style="width: 40px; height: 40px"
|
||||||
|
></el-image>
|
||||||
<div class="packeFee" v-else>
|
<div class="packeFee" v-else>
|
||||||
<span>
|
<span>
|
||||||
{{ scope.row.productName ||'客座费'}}
|
{{ scope.row.productName || "客座费" }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">{{ scope.row.productName }}</span>
|
<span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">{{
|
||||||
<span style="color: #999;">{{
|
scope.row.productName
|
||||||
|
}}</span>
|
||||||
|
<span style="color: #999">{{
|
||||||
scope.row.productSkuName
|
scope.row.productSkuName
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -121,29 +138,37 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="数量">
|
<el-table-column label="数量">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope"> x{{ scope.row.num }} </template>
|
||||||
x{{ scope.row.num }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="单价">
|
<el-table-column label="单价">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope"> ¥{{ scope.row.price }}/ </template>
|
||||||
¥{{ scope.row.price }}/
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="小计">
|
<el-table-column label="小计">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope"> ¥{{ scope.row.priceAmount }} </template>
|
||||||
¥{{ scope.row.priceAmount }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作">
|
<el-table-column label="操作">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<template v-if="scope.row.status!='unpaid'">
|
<template v-if="detail.status != 'unpaid'">
|
||||||
<el-button v-if="canTuikuan(scope.row)" type="text" size="mini" @click="tuikuan(scope.row)"><span >退款</span></el-button>
|
<el-button
|
||||||
|
v-if="canTuikuan(scope.row)"
|
||||||
|
type="text"
|
||||||
|
size="mini"
|
||||||
|
@click="tuikuan(scope.row)"
|
||||||
|
><span>退款</span></el-button
|
||||||
|
>
|
||||||
<span class="color-999" v-if="isTui(scope.row)">已退款</span>
|
<span class="color-999" v-if="isTui(scope.row)">已退款</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="scope.row.status=='unpaid'">
|
<template v-if="detail.status == 'unpaid'">
|
||||||
<el-button v-if="canTuicai(scope.row)" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button>
|
<el-button
|
||||||
<span class="color-999" v-if="scope.row=='return'">已退菜</span>
|
v-if="canTuicai(scope.row)"
|
||||||
|
type="text"
|
||||||
|
size="mini"
|
||||||
|
@click="tuiCai(scope.row)"
|
||||||
|
><span>退菜</span></el-button
|
||||||
|
>
|
||||||
|
<span class="color-999" v-if="scope.row == 'return'"
|
||||||
|
>已退菜</span
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -211,13 +236,13 @@
|
||||||
<!-- </el-tabs> -->
|
<!-- </el-tabs> -->
|
||||||
</div>
|
</div>
|
||||||
<return-cart
|
<return-cart
|
||||||
:modal="false"
|
:modal="false"
|
||||||
ref="refReturnCart"
|
ref="refReturnCart"
|
||||||
:max="selGoods.num"
|
:max="selGoods.num"
|
||||||
@confirm="refReturnCartConfirm"
|
@confirm="refReturnCartConfirm"
|
||||||
></return-cart>
|
></return-cart>
|
||||||
<return-money
|
<return-money
|
||||||
:modal="false"
|
:modal="false"
|
||||||
ref="refReturnMoney"
|
ref="refReturnMoney"
|
||||||
:max="selGoods.num"
|
:max="selGoods.num"
|
||||||
:goods="selGoods"
|
:goods="selGoods"
|
||||||
|
|
@ -232,12 +257,10 @@ import dayjs from "dayjs";
|
||||||
import { tbOrderInfoDetail, tbOrderInfoData } from "@/api/order";
|
import { tbOrderInfoDetail, tbOrderInfoData } from "@/api/order";
|
||||||
import returnCart from "@/views/tool/Instead/components/return-cart.vue";
|
import returnCart from "@/views/tool/Instead/components/return-cart.vue";
|
||||||
import returnMoney from "@/views/tool/Instead/components/return-money.vue";
|
import returnMoney from "@/views/tool/Instead/components/return-money.vue";
|
||||||
import {
|
import { $returnCart, $returnOrder } from "@/api/table";
|
||||||
$returnCart,$returnOrder
|
import * as $util from "../order_goods_util.js";
|
||||||
} from "@/api/table";
|
|
||||||
import * as $util from '../order_goods_util.js'
|
|
||||||
export default {
|
export default {
|
||||||
components: { returnCart,returnMoney },
|
components: { returnCart, returnMoney },
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -247,27 +270,27 @@ export default {
|
||||||
detail: "",
|
detail: "",
|
||||||
loading: false,
|
loading: false,
|
||||||
refoundList: [],
|
refoundList: [],
|
||||||
selGoods:{num:1}
|
selGoods: { num: 1 },
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
orderTypeFilter(t) {
|
orderTypeFilter(t) {
|
||||||
if (t) {
|
if (t) {
|
||||||
return t && orderEnum.orderType.find(item => item.key == t).label;
|
return t && orderEnum.orderType.find((item) => item.key == t).label;
|
||||||
} else {
|
} else {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sendTypeFilter(t) {
|
sendTypeFilter(t) {
|
||||||
if (t) {
|
if (t) {
|
||||||
return orderEnum.sendType.find(item => item.key == t).label;
|
return orderEnum.sendType.find((item) => item.key == t).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;
|
return t && orderEnum.status.find((item) => item.key == t).label;
|
||||||
} else {
|
} else {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
@ -278,45 +301,85 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
watch:{
|
watch: {
|
||||||
drawer:function(newval){
|
drawer: function (newval) {
|
||||||
if(!newval){
|
if (!newval) {
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
vipDiscountAmount() {
|
||||||
|
if (!this.detail.memberId) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (this.detail.status == "unpaid") {
|
||||||
|
return this.detail.detailList
|
||||||
|
.filter((v) => !$util.isTui(v) && v.productId != "-999")
|
||||||
|
.reduce((prve, cur) => {
|
||||||
|
if (!cur.isMember) {
|
||||||
|
return prve + 0;
|
||||||
|
} else {
|
||||||
|
const memberPrice = cur.memberPrice ? cur.memberPrice : cur.price;
|
||||||
|
return prve + (cur.price - memberPrice) * cur.num;
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
.toFixed(2);
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
},
|
||||||
|
youHuiJinE() {
|
||||||
|
console.log(this.vipDiscountAmount);
|
||||||
|
const discountAmount=this.detail.discountAmount;
|
||||||
|
const calcDiscountAmount=(this.detail.originAmount*(1-this.detail.discountRatio)).toFixed(2);
|
||||||
|
console.log(this.detail.originAmount*(1-this.detail.discountRatio))
|
||||||
|
const n = $util.numSum([
|
||||||
|
this.vipDiscountAmount,
|
||||||
|
(discountAmount?discountAmount:calcDiscountAmount),
|
||||||
|
this.detail.productCouponDiscountAmount,
|
||||||
|
this.detail.fullCouponDiscountAmount,
|
||||||
|
this.detail.pointsDiscountAmount,
|
||||||
|
]);
|
||||||
|
if (n * 1 <= 0) {
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
close(){
|
close() {
|
||||||
console.log('drawer close')
|
console.log("drawer close");
|
||||||
this.$emit('close');
|
this.$emit("close");
|
||||||
},
|
},
|
||||||
isTui(item){
|
isTui(item) {
|
||||||
return $util.isTui(item);
|
return $util.isTui(item);
|
||||||
},
|
},
|
||||||
canTuikuan(item){
|
canTuikuan(item) {
|
||||||
return $util.canTuiKuan(this.detail,item);
|
return $util.canTuiKuan(this.detail, item);
|
||||||
},
|
},
|
||||||
canTuicai(item){
|
canTuicai(item) {
|
||||||
return $util.canTuicai(this.detail,item);
|
return $util.canTuicai(this.detail, item);
|
||||||
},
|
},
|
||||||
async refReturnMoneyConfirm(e){
|
async refReturnMoneyConfirm(e) {
|
||||||
const res = await $returnOrder({
|
const res = await $returnOrder({
|
||||||
...e,
|
...e,
|
||||||
orderId:this.detail.id,
|
orderId: this.detail.id,
|
||||||
orderDetails:[{
|
orderDetails: [
|
||||||
id:this.selGoods.id,
|
{
|
||||||
num:e.num
|
id: this.selGoods.id,
|
||||||
}]
|
num: e.num,
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
this.$message.success("退款成功");
|
this.$message.success("退款成功");
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
update(){
|
update() {
|
||||||
this.tbOrderInfoDetail(this.detail.id);
|
this.tbOrderInfoDetail(this.detail.id);
|
||||||
},
|
},
|
||||||
async refReturnCartConfirm(e){
|
async refReturnCartConfirm(e) {
|
||||||
const res = await $returnCart({
|
const res = await $returnCart({
|
||||||
...e,
|
...e,
|
||||||
cartId: this.selGoods.cartId,
|
cartId: this.selGoods.cartId,
|
||||||
|
|
@ -325,13 +388,13 @@ export default {
|
||||||
this.$message.success("退菜成功");
|
this.$message.success("退菜成功");
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
tuikuan(item){
|
tuikuan(item) {
|
||||||
this.selGoods=item;
|
this.selGoods = item;
|
||||||
console.log(item);
|
console.log(item);
|
||||||
this.$refs.refReturnMoney.open(item);
|
this.$refs.refReturnMoney.open(item);
|
||||||
},
|
},
|
||||||
tuiCai(item){
|
tuiCai(item) {
|
||||||
this.selGoods=item;
|
this.selGoods = item;
|
||||||
console.log(item);
|
console.log(item);
|
||||||
this.$refs.refReturnCart.open(item);
|
this.$refs.refReturnCart.open(item);
|
||||||
},
|
},
|
||||||
|
|
@ -348,7 +411,7 @@ export default {
|
||||||
source: this.detail.id,
|
source: this.detail.id,
|
||||||
page: 0,
|
page: 0,
|
||||||
pageSize: 500,
|
pageSize: 500,
|
||||||
orderType: "0"
|
orderType: "0",
|
||||||
});
|
});
|
||||||
this.refoundList = res.content;
|
this.refoundList = res.content;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -371,23 +434,23 @@ export default {
|
||||||
this.type = "1";
|
this.type = "1";
|
||||||
this.detail = "";
|
this.detail = "";
|
||||||
this.tbOrderInfoDetail(obj.id);
|
this.tbOrderInfoDetail(obj.id);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.packeFee{
|
.packeFee {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
background: #3f9eff;
|
background: #3f9eff;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.shop_info {
|
.shop_info {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ export function canTuicai(orderInfo,item){
|
||||||
return orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'&& item.status!='return'
|
return orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'&& item.status!='return'
|
||||||
}
|
}
|
||||||
export function canTuiKuan(orderInfo,item){
|
export function canTuiKuan(orderInfo,item){
|
||||||
return orderInfo.status!='unpaid'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding'
|
// return orderInfo.status!='unpaid'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding'
|
||||||
|
return orderInfo.status=='closed'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding' && !item.userCouponId
|
||||||
}
|
}
|
||||||
export function isTui(item){
|
export function isTui(item){
|
||||||
return item.status=='return'||item.status=='refund'||item.status=='refunding'
|
return item.status=='return'||item.status=='refund'||item.status=='refunding'
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="u-p-15">
|
<div class="u-p-15">
|
||||||
<div class="u-m-t-20">
|
<div class="u-m-t-20">
|
||||||
<el-form label-width="90px" label-position="left">
|
<el-form label-width="90px" label-position="left">
|
||||||
<el-form-item label="应付金额">
|
<el-form-item label="总价">
|
||||||
<div class="color-red u-font-18 font-600">¥{{ form.money }}</div>
|
<div class="color-red u-font-18 font-600">¥{{ form.money }}</div>
|
||||||
<!-- <el-input :value="form.money" disabled> </el-input> -->
|
<!-- <el-input :value="form.money" disabled> </el-input> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
v-for="(item, index) in list"
|
v-for="(item, index) in list"
|
||||||
:key="index"
|
:key="index"
|
||||||
:type="sel === item.payType ? 'primary' : ''"
|
:type="sel === item.payType ? 'primary' : ''"
|
||||||
|
:disabled="disabledPayType.includes(item.payType)"
|
||||||
>
|
>
|
||||||
{{ item.payName }}
|
{{ item.payName }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
@ -30,6 +31,10 @@ export default {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
disabledPayType:{
|
||||||
|
type:Array,
|
||||||
|
default:()=>[]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -38,6 +43,10 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
disabledPayType(){
|
||||||
|
const item = this.list.find(v=>!this.disabledPayType.includes(v.payType))
|
||||||
|
this.sel=item.payType
|
||||||
|
},
|
||||||
sel(newval) {
|
sel(newval) {
|
||||||
console.log(newval);
|
console.log(newval);
|
||||||
this.$emit("input", newval);
|
this.$emit("input", newval);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,456 @@
|
||||||
|
<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" :selectable="goodsCoupSelectableHandle"> </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="商品信息" 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 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, String],
|
||||||
|
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: {
|
||||||
|
goodsCoupSelectableHandle(row,index){
|
||||||
|
console.log(row,index);
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
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) {
|
||||||
|
const oldval=this.quansSelArr;
|
||||||
|
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>
|
||||||
|
|
@ -16,11 +16,7 @@
|
||||||
:data="quans.fullReductionCoupon"
|
:data="quans.fullReductionCoupon"
|
||||||
@cell-click="fullReductionCouponClick"
|
@cell-click="fullReductionCouponClick"
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column type="index" label="">
|
||||||
type="index"
|
|
||||||
label=""
|
|
||||||
v-if="quans.fullReductionCoupon.length > 0"
|
|
||||||
>
|
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
@change="fullReductionCouponClick(scope.row)"
|
@change="fullReductionCouponClick(scope.row)"
|
||||||
|
|
@ -63,11 +59,16 @@
|
||||||
@cell-click="productCouponClick"
|
@cell-click="productCouponClick"
|
||||||
empty-text="无可用商品券"
|
empty-text="无可用商品券"
|
||||||
:data="quans.productCoupon"
|
:data="quans.productCoupon"
|
||||||
tooltip-effect="dark"
|
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@selection-change="productCouponChange"
|
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55"> </el-table-column>
|
<el-table-column>
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-checkbox
|
||||||
|
@change="productCouponClick(scope.row)"
|
||||||
|
:value="scope.row.checked"
|
||||||
|
></el-checkbox>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column type="index" width="50" label="#">
|
<el-table-column type="index" width="50" label="#">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="name" label="券名称"> </el-table-column>
|
<el-table-column prop="name" label="券名称"> </el-table-column>
|
||||||
|
|
@ -90,13 +91,13 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="discountAmount" label="抵扣">
|
<!-- <el-table-column prop="discountAmount" label="抵扣">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<span class="color-red">
|
<span class="color-red">
|
||||||
¥{{ scope.row.discountAmount }}
|
¥{{ scope.row.discountAmount }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column label="券类型">
|
<el-table-column label="券类型">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||||
|
|
@ -104,6 +105,11 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="useRestrictions" label="描述">
|
<el-table-column prop="useRestrictions" label="描述">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<!-- <el-table-column prop="useRestrictions" label="是否可用">
|
||||||
|
<template v-slot="scope">
|
||||||
|
{{ scope.row.use ? "可以" : "不可用" }}
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
@ -118,23 +124,32 @@
|
||||||
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品信息">
|
<el-table-column label="商品信息" width="120">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<div class="u-flex" v-if="scope.row.type == 2">
|
<div class="u-flex" v-if="scope.row.type == 2">
|
||||||
<el-image
|
<div class="u-flex">
|
||||||
:src="scope.row.productCover"
|
<el-image
|
||||||
style="width: 40px; height: 40px"
|
:src="scope.row.productCover"
|
||||||
:preview-src-list="[scope.row.productCover]"
|
fit="cover"
|
||||||
></el-image>
|
style="width: 40px; height: 40px"
|
||||||
<div class="u-m-l-10">{{ scope.row.productName }}</div>
|
: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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="discountAmount" label="抵扣">
|
<el-table-column prop="discountAmount" label="抵扣">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<span class="color-red">
|
<span class="color-red" v-if="scope.row.type == 1">
|
||||||
¥{{ scope.row.discountAmount }}
|
¥{{ scope.row.discountAmount }}
|
||||||
</span>
|
</span>
|
||||||
|
<span class="color-red" v-if="scope.row.type == 2">
|
||||||
|
¥{{ returnProDiscount(scope.row, scope.row.index) }}
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="useRestrictions" label="描述">
|
<el-table-column prop="useRestrictions" label="描述">
|
||||||
|
|
@ -147,9 +162,22 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<div class="u-flex u-m-t-20">
|
</div>
|
||||||
<span class="">抵扣:</span>
|
<div class="u-flex u-row-between u-m-t-20">
|
||||||
<span class="color-red font-bold">{{ AllCouponPrice }}</span>
|
<div class="u-flex">
|
||||||
|
<span>抵扣金额:</span>
|
||||||
|
<span class="color-red">¥{{ AllCouponPrice }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="u-flex u-relative">
|
||||||
|
<span>支付金额:</span>
|
||||||
|
<span class="color-red">¥{{ payPrice }}</span>
|
||||||
|
<div
|
||||||
|
class="u-absolute u-flex line-th color-999"
|
||||||
|
style="right: 0; bottom: 100%"
|
||||||
|
v-if="orderPrice * 1 != payPrice * 1"
|
||||||
|
>
|
||||||
|
<span class="">¥{{ orderPrice }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-row-center u-m-t-50">
|
<div class="u-flex u-row-center u-m-t-50">
|
||||||
|
|
@ -165,11 +193,21 @@
|
||||||
<script>
|
<script>
|
||||||
import { $activateByOrderId } from "@/api/table";
|
import { $activateByOrderId } from "@/api/table";
|
||||||
import {
|
import {
|
||||||
returnProductCouponAllPrice,returnProductCoupon,
|
returnNewGoodsList,
|
||||||
returnProductCouponPrice,
|
returnFullReductionCouponAllPrice,
|
||||||
returnFullReductionCouponAllPrice,returnNewGoodsList
|
returnCouponAllPrice,
|
||||||
} from "../util";
|
returnProductCoupon,
|
||||||
|
returnCanUseFullReductionCoupon,
|
||||||
|
returnCoupCanUse,
|
||||||
|
returnProductCouponAllPrice,
|
||||||
|
returnGoodsPayPriceMap,
|
||||||
|
returnProductCoupAllPrice,
|
||||||
|
} from "../quan_util.js";
|
||||||
let $originFullReductionCoupon = [];
|
let $originFullReductionCoupon = [];
|
||||||
|
//可以抵扣的商品列表
|
||||||
|
let canDikouGoodsArr = [];
|
||||||
|
//商品数量从0到n每一个对应的价格
|
||||||
|
let $goodsPayPriceMap = {};
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
|
|
@ -188,14 +226,10 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
orderPrice: {
|
|
||||||
type: Number,
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
propSelCoup: [],
|
orderPrice: 0,
|
||||||
fullReductionCouponSel: {
|
fullReductionCouponSel: {
|
||||||
id: "",
|
id: "",
|
||||||
},
|
},
|
||||||
|
|
@ -223,32 +257,59 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
goodsDiscount() {
|
goodsDiscount() {
|
||||||
const coupArr = this.quansSelArr.filter((v) => v.type == 2);
|
const coupArr = this.quansSelArr.filter((v) => v.type == 2);
|
||||||
return returnProductCouponAllPrice(coupArr, this.goodsArr, this.vipUser);
|
return returnProductCouponAllPrice(
|
||||||
|
coupArr,
|
||||||
|
canDikouGoodsArr,
|
||||||
|
this.vipUser
|
||||||
|
);
|
||||||
},
|
},
|
||||||
fullReductionCouponDiscount() {
|
fullReductionCouponDiscount() {
|
||||||
const coupArr = this.quansSelArr.filter((v) => v.type == 1);
|
const coupArr = this.quansSelArr.filter((v) => v.type == 1);
|
||||||
return returnFullReductionCouponAllPrice(coupArr);
|
return returnFullReductionCouponAllPrice(coupArr);
|
||||||
},
|
},
|
||||||
AllCouponPrice() {
|
AllCouponPrice() {
|
||||||
return (
|
return returnCouponAllPrice(
|
||||||
this.goodsDiscount * 1 +
|
this.quansSelArr,
|
||||||
this.fullReductionCouponDiscount * 1
|
canDikouGoodsArr,
|
||||||
).toFixed(2);
|
this.vipUser
|
||||||
|
);
|
||||||
|
},
|
||||||
|
payPrice() {
|
||||||
|
const pay = this.orderPrice - this.AllCouponPrice;
|
||||||
|
return (pay < 0 ? 0 : pay).toFixed(2);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
delQuan(row) {
|
returnProDiscount(row) {
|
||||||
if (row.type == 2) {
|
console.log(row);
|
||||||
const index = this.quansSelArr.findIndex((item) => item.id == row.id);
|
//相同商品抵扣券数组
|
||||||
this.quansSelArr.splice(index, 1);
|
const arr = this.quans.productCoupon.filter((v) => v.proId == row.proId);
|
||||||
this.$refs.table1.toggleRowSelection(row, false);
|
const index = arr.findIndex((v) => v.id == row.id);
|
||||||
|
if (index != -1) {
|
||||||
|
return returnProductCoupAllPrice(
|
||||||
|
$goodsPayPriceMap[row.proId],
|
||||||
|
index,
|
||||||
|
row.num
|
||||||
|
).toFixed(2);
|
||||||
} else {
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
goodsCoupSelectableHandle(row, index) {
|
||||||
|
console.log(row, index);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
delQuan(row) {
|
||||||
|
const index = this.quansSelArr.findIndex((item) => item.id == row.id);
|
||||||
|
if (row.type == 2 && index != -1) {
|
||||||
|
this.quansSelArr.splice(index, 1);
|
||||||
|
const proIndex=this.quans.productCoupon.findIndex((v) => v.id == row.id);
|
||||||
|
this.quans.productCoupon[proIndex].checked = false;
|
||||||
|
}
|
||||||
|
if (row.type == 1 && index != -1) {
|
||||||
this.fullReductionCouponSel = { id: "" };
|
this.fullReductionCouponSel = { id: "" };
|
||||||
this.quansSelArr.splice(0, 1);
|
this.quansSelArr.splice(0, 1);
|
||||||
}
|
}
|
||||||
if (index != -1) {
|
|
||||||
const row = this.quansSelArr.find;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
this.quansSelArr = [];
|
this.quansSelArr = [];
|
||||||
|
|
@ -256,64 +317,12 @@ export default {
|
||||||
this.$refs.table1.clearSelection();
|
this.$refs.table1.clearSelection();
|
||||||
},
|
},
|
||||||
filterFullReductionCoupon() {
|
filterFullReductionCoupon() {
|
||||||
this.quans.fullReductionCoupon = $originFullReductionCoupon.filter(
|
this.quans.fullReductionCoupon = returnCanUseFullReductionCoupon(
|
||||||
(v) => this.orderPrice - this.goodsDiscount >= v.fullAmount
|
$originFullReductionCoupon,
|
||||||
|
this.payPrice,
|
||||||
|
this.fullReductionCouponSel
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
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) {
|
fullReductionCouponClick(row) {
|
||||||
if (row.id == this.fullReductionCouponSel.id) {
|
if (row.id == this.fullReductionCouponSel.id) {
|
||||||
this.fullReductionCouponSel = { id: "" };
|
this.fullReductionCouponSel = { id: "" };
|
||||||
|
|
@ -330,30 +339,85 @@ export default {
|
||||||
if (!this.fullReductionCouponSel.id) {
|
if (!this.fullReductionCouponSel.id) {
|
||||||
return;
|
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) {
|
productCouponClick(item) {
|
||||||
this.$refs.table1.toggleRowSelection(row);
|
if (!item.use) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const hasSelNum = this.quansSelArr
|
||||||
|
.filter((v) => v.type == 2 && v.proId == item.proId)
|
||||||
|
.reduce((a, b) => {
|
||||||
|
return a + b.num;
|
||||||
|
}, 0);
|
||||||
|
const maxSelNum = $goodsPayPriceMap[item.proId].length;
|
||||||
|
const coupMaxUseNum = Math.min(item.num, maxSelNum - hasSelNum);
|
||||||
|
const canUseNum = Math.min(maxSelNum, coupMaxUseNum);
|
||||||
|
|
||||||
|
if (this.fullReductionCouponSel.id && !item.checked) {
|
||||||
|
const goodsQuan = this.quans.productCoupon.filter((v) => v.checked);
|
||||||
|
const fullReductionCoupon = this.fullReductionCouponSel.id
|
||||||
|
? [this.fullReductionCouponSel]
|
||||||
|
: [];
|
||||||
|
|
||||||
|
let coupArr = [...goodsQuan, { ...item, num: canUseNum }];
|
||||||
|
const payPrice =
|
||||||
|
this.orderPrice -
|
||||||
|
returnCouponAllPrice(coupArr, canDikouGoodsArr, this.vipUser);
|
||||||
|
console.log(payPrice);
|
||||||
|
if (payPrice <= 0) {
|
||||||
|
return this.$confirm(
|
||||||
|
"选择该商品券后支付金额将为0,继续选择将取消选择的满减券",
|
||||||
|
"提示",
|
||||||
|
{
|
||||||
|
confirmButtonText: "继续选择",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
this.fullReductionCouponSel = {
|
||||||
|
id: "",
|
||||||
|
};
|
||||||
|
this.quansSelArr.splice(0, 1);
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
if (this.fullReductionCouponSel.fullAmount > payPrice) {
|
||||||
|
this.$confirm(
|
||||||
|
"选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券",
|
||||||
|
"提示",
|
||||||
|
{
|
||||||
|
confirmButtonText: "继续选择",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
this.fullReductionCouponSel = {
|
||||||
|
id: "",
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item.checked = !item.checked;
|
||||||
|
if (!item.checked) {
|
||||||
|
console.log(index);
|
||||||
|
const index = this.quansSelArr.findIndex((v) => v.id == item.id);
|
||||||
|
this.quansSelArr.splice(index, 1);
|
||||||
|
} else {
|
||||||
|
this.quansSelArr.push({ ...item, num: canUseNum });
|
||||||
|
}
|
||||||
|
const CheckedArr = this.quans.productCoupon.filter((v) => v.checked);
|
||||||
|
if (CheckedArr.length <= 0) {
|
||||||
|
return this.quans.productCoupon.map((v) => {
|
||||||
|
v.use = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const noCheckedArr = this.quans.productCoupon.filter((v) => !v.checked);
|
||||||
|
noCheckedArr.map((v) => {
|
||||||
|
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleCurrentChange(val) {
|
handleCurrentChange(val) {
|
||||||
this.currentRow = val;
|
this.currentRow = val;
|
||||||
|
|
@ -369,49 +433,48 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
this.$emit("confirm", [...this.quansSelArr]);
|
this.$emit("confirm", [...this.quansSelArr], $goodsPayPriceMap);
|
||||||
this.close();
|
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) {
|
async open(data, propSelCoup) {
|
||||||
this.propSelCoup = [...propSelCoup] || [];
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
this.orderPrice = data.orderPrice;
|
||||||
|
this.quansSelArr = [...propSelCoup];
|
||||||
|
$goodsPayPriceMap = returnGoodsPayPriceMap(this.goodsArr || []);
|
||||||
if (data.memberId) {
|
if (data.memberId) {
|
||||||
let quansRes = await $activateByOrderId({
|
let quansRes = await $activateByOrderId({
|
||||||
orderId: data.id,
|
orderId: data.id,
|
||||||
memberId: data.memberId,
|
memberId: data.memberId,
|
||||||
});
|
});
|
||||||
quansRes.fullReductionCoupon = quansRes.fullReductionCoupon.filter(
|
quansRes.fullReductionCoupon = quansRes.fullReductionCoupon.filter(
|
||||||
(v) => {
|
(v) =>this.orderPrice<=0?false:(v.use && this.orderPrice * 1 >= v.fullAmount * 1)
|
||||||
return this.orderPrice >= v.fullAmount && v.use;
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
const canDikouGoodsArr = returnNewGoodsList(this.goodsArr|| [])
|
const selFullReductionCoupon = this.quansSelArr.find(
|
||||||
|
(v) => v.type == 1
|
||||||
|
);
|
||||||
|
this.fullReductionCouponSel = selFullReductionCoupon
|
||||||
|
? selFullReductionCoupon
|
||||||
|
: { id: "" };
|
||||||
|
this.quans.fullReductionCoupon = quansRes.fullReductionCoupon;
|
||||||
|
canDikouGoodsArr = returnNewGoodsList(this.goodsArr || []);
|
||||||
$originFullReductionCoupon = quansRes.fullReductionCoupon;
|
$originFullReductionCoupon = quansRes.fullReductionCoupon;
|
||||||
this.quans.productCoupon = quansRes.productCoupon.map(v=>{
|
this.quans.productCoupon = quansRes.productCoupon
|
||||||
const coup = returnProductCoupon(v, canDikouGoodsArr,this.vipUser)
|
.map((v) => {
|
||||||
return coup
|
const calcCoup = returnProductCoupon(
|
||||||
}).filter(v=>v.use)
|
v,
|
||||||
|
canDikouGoodsArr,
|
||||||
|
this.vipUser
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...calcCoup,
|
||||||
|
checked: this.quansSelArr.find((selCoup) => selCoup.id == v.id)
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
|
use:this.orderPrice<=0?false:calcCoup.use
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter((v) => v.use);
|
||||||
// this.quans = quans;
|
// this.quans = quans;
|
||||||
this.filterFullReductionCoupon();
|
|
||||||
this.quansSelArr = this.propSelCoup;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.setSelectCoupon();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.show = true;
|
this.show = true;
|
||||||
|
|
@ -428,6 +491,9 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.line-th {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
.codeImg {
|
.codeImg {
|
||||||
width: 160px;
|
width: 160px;
|
||||||
border: 1px solid rgb(220, 223, 230);
|
border: 1px solid rgb(220, 223, 230);
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ export default {
|
||||||
this.goods = item?item:this.goods;
|
this.goods = item?item:this.goods;
|
||||||
console.log(item)
|
console.log(item)
|
||||||
this.show = true;
|
this.show = true;
|
||||||
if (item != "-999") {
|
if (item.productId != "-999") {
|
||||||
this.number = 1;
|
this.number = 1;
|
||||||
} else {
|
} else {
|
||||||
this.number = item.num;
|
this.number = item.num;
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,18 @@
|
||||||
<div class="u-flex color-999 u-m-t-4">
|
<div class="u-flex color-999 u-m-t-4">
|
||||||
{{ goods.productSkuName||'' }}
|
{{ goods.productSkuName||'' }}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex u-row-between u-p-b-16 u-m-t-10 border-bottom">
|
<div class="u-p-b-16 border-bottom">
|
||||||
<span>退款数量</span>
|
<div class="flex u-row-between">
|
||||||
<div class="u-flex">
|
<span>退款数量</span>
|
||||||
<number-box v-model="number" :min="1" :max="max"></number-box>
|
<div class="u-flex" v-if="!isSeatFee">
|
||||||
|
<number-box v-model="number" :min="1" :max="max"></number-box>
|
||||||
|
</div>
|
||||||
|
<div class="u-flex" v-else>
|
||||||
|
{{ number }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="u-font-12 color-999 u-m-t-8" v-if="isSeatFee">
|
||||||
|
<div><span class="color-red">*</span><span>客座费只能全退</span> </div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-m-t-12 u-font-12 color-999">菜品已点数量 {{ max }} 份</div>
|
<div class="u-m-t-12 u-font-12 color-999">菜品已点数量 {{ max }} 份</div>
|
||||||
|
|
@ -25,7 +33,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-m-t-12 ">
|
<div class="u-flex u-m-t-12 ">
|
||||||
<span>退款金额</span>
|
<span>退款金额</span>
|
||||||
<span class="color-red font-bold">¥{{ goods.price * number|to2 }}</span>
|
<span class="color-red font-bold">¥{{ tuikuanJine }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-m-t-26">
|
<div class="u-m-t-26">
|
||||||
<div><span>退款原因</span> <span class="color-red">*</span></div>
|
<div><span>退款原因</span> <span class="color-red">*</span></div>
|
||||||
|
|
@ -57,6 +65,8 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import numberBox from "./number-box.vue";
|
import numberBox from "./number-box.vue";
|
||||||
|
import {returnIsSeatFee} from '../util.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { numberBox },
|
components: { numberBox },
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -64,12 +74,6 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
goods: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
max: {
|
max: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 1,
|
default: 1,
|
||||||
|
|
@ -87,8 +91,20 @@ export default {
|
||||||
{ label: "等待时间过长", checked: false },
|
{ label: "等待时间过长", checked: false },
|
||||||
],
|
],
|
||||||
note: "",
|
note: "",
|
||||||
|
goods:{
|
||||||
|
productId: -999
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed:{
|
||||||
|
tuikuanJine(){
|
||||||
|
const danjia=(this.goods.priceAmount||0)/this.goods.num
|
||||||
|
return (danjia*this.number).toFixed(2);
|
||||||
|
},
|
||||||
|
isSeatFee(){
|
||||||
|
return returnIsSeatFee(this.goods)
|
||||||
|
}
|
||||||
|
},
|
||||||
filters:{
|
filters:{
|
||||||
to2(val){
|
to2(val){
|
||||||
return val.toFixed(2);
|
return val.toFixed(2);
|
||||||
|
|
@ -112,9 +128,15 @@ export default {
|
||||||
}
|
}
|
||||||
this.note = tag + "," + this.note;
|
this.note = tag + "," + this.note;
|
||||||
},
|
},
|
||||||
open(note) {
|
open(item) {
|
||||||
|
this.goods = item?item:this.goods;
|
||||||
|
console.log(item)
|
||||||
this.show = true;
|
this.show = true;
|
||||||
this.number = 1;
|
if (item.productId != "-999") {
|
||||||
|
this.number = 1;
|
||||||
|
} else {
|
||||||
|
this.number = item.num;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
|
|
|
||||||
|
|
@ -962,25 +962,34 @@
|
||||||
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
{{ scope.row.type == 1 ? "优惠券" : "商品券" }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品信息">
|
<el-table-column label="商品信息" width="120">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<div class="u-flex" v-if="scope.row.type == 2">
|
<div class="u-flex" v-if="scope.row.type == 2">
|
||||||
<el-image
|
<div class="u-flex">
|
||||||
:src="scope.row.productCover"
|
<el-image
|
||||||
style="width: 40px; height: 40px"
|
:src="scope.row.productCover"
|
||||||
:preview-src-list="[scope.row.productCover]"
|
fit="cover"
|
||||||
></el-image>
|
style="width: 40px; height: 40px"
|
||||||
<div class="u-m-l-10">
|
:preview-src-list="[scope.row.productCover]"
|
||||||
{{ scope.row.productName }}
|
></el-image>
|
||||||
|
</div>
|
||||||
|
<div class="u-p-l-10">
|
||||||
|
<div class="">{{ scope.row.productName }}</div>
|
||||||
|
<div class="">x{{ scope.row.num || "" }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="discountAmount" label="抵扣">
|
<el-table-column prop="discountAmount" label="抵扣">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<span class="color-red">
|
<span class="color-red" v-if="scope.row.type == 1">
|
||||||
¥{{ scope.row.discountAmount }}
|
¥{{ scope.row.discountAmount }}
|
||||||
</span>
|
</span>
|
||||||
|
<span class="color-red" v-if="scope.row.type == 2">
|
||||||
|
¥{{
|
||||||
|
returnProDiscount(scope.row, scope.row.index)
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="useRestrictions" label="">
|
<el-table-column prop="useRestrictions" label="">
|
||||||
|
|
@ -1007,6 +1016,7 @@
|
||||||
ref="refPayType"
|
ref="refPayType"
|
||||||
v-model="order.payType"
|
v-model="order.payType"
|
||||||
@itemClick="payTypeItemClick"
|
@itemClick="payTypeItemClick"
|
||||||
|
:disabledPayType="disabledPayType"
|
||||||
>
|
>
|
||||||
</pay-type>
|
</pay-type>
|
||||||
<div style="margin-top: 20px">
|
<div style="margin-top: 20px">
|
||||||
|
|
@ -1090,13 +1100,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="detail_form_item">
|
<div class="detail_form_item">
|
||||||
<div class="left">应付金额</div>
|
<div class="left">应付金额</div>
|
||||||
<div class="right redfont">
|
<div class="right redfont">¥{{ yinFuJinE }}</div>
|
||||||
¥{{
|
|
||||||
currentPayMoney - points.toMoney <= 0
|
|
||||||
? 0
|
|
||||||
: (currentPayMoney - points.toMoney) | to2
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1394,7 +1398,7 @@
|
||||||
<quans-pop
|
<quans-pop
|
||||||
ref="refQuans"
|
ref="refQuans"
|
||||||
:vipUser="vipUser"
|
:vipUser="vipUser"
|
||||||
:orderPrice="currentPayMoney"
|
:orderPrice="yinFuJinE"
|
||||||
:goodsArr="createOrder.data.detailList || []"
|
:goodsArr="createOrder.data.detailList || []"
|
||||||
@confirm="quansConfirm"
|
@confirm="quansConfirm"
|
||||||
>
|
>
|
||||||
|
|
@ -1414,9 +1418,7 @@
|
||||||
></return-cart>
|
></return-cart>
|
||||||
|
|
||||||
<!-- 临时菜 -->
|
<!-- 临时菜 -->
|
||||||
<cai-add ref="refPopAddCai"
|
<cai-add ref="refPopAddCai"></cai-add>
|
||||||
|
|
||||||
></cai-add>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -1479,6 +1481,9 @@ import {
|
||||||
returnVipDiscountPrice,
|
returnVipDiscountPrice,
|
||||||
returnCouponAllPrice,
|
returnCouponAllPrice,
|
||||||
} from "./util.js";
|
} from "./util.js";
|
||||||
|
import { returnProductCoupAllPrice } from "./quan_util.js";
|
||||||
|
//商品数量从0到n每一个对应的价格
|
||||||
|
let $goodsPayPriceMap = {};
|
||||||
import { $status } from "@/utils/table.js";
|
import { $status } from "@/utils/table.js";
|
||||||
|
|
||||||
let $originTableList = [];
|
let $originTableList = [];
|
||||||
|
|
@ -1499,6 +1504,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
disabledPayType: [],
|
||||||
//积分抵扣
|
//积分抵扣
|
||||||
points: {
|
points: {
|
||||||
res: {
|
res: {
|
||||||
|
|
@ -1607,6 +1613,7 @@ export default {
|
||||||
total: 0,
|
total: 0,
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
|
status: "",
|
||||||
packFee: {
|
packFee: {
|
||||||
totalNumber: 0,
|
totalNumber: 0,
|
||||||
status: "",
|
status: "",
|
||||||
|
|
@ -1712,6 +1719,9 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isShowVipPrice() {
|
isShowVipPrice() {
|
||||||
|
if (!this.shopInfo.isMemberPrice) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return this.vipUser.isVip ? true : false;
|
return this.vipUser.isVip ? true : false;
|
||||||
},
|
},
|
||||||
coupdiscount() {
|
coupdiscount() {
|
||||||
|
|
@ -1747,14 +1757,15 @@ export default {
|
||||||
const amount = this.createOrder.data.amount || 0;
|
const amount = this.createOrder.data.amount || 0;
|
||||||
const discount = this.createOrder.discount || 1;
|
const discount = this.createOrder.discount || 1;
|
||||||
// const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney)
|
// const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney)
|
||||||
const total = (amount - this.coupdiscount) * this.createOrder.discount;
|
const total = (amount) * this.createOrder.discount - this.coupdiscount;
|
||||||
return total <= 0 ? 0 : total;
|
return total <= 0 ? 0 : total;
|
||||||
},
|
},
|
||||||
yinFuJinE() {
|
yinFuJinE() {
|
||||||
const total = this.currentPayMoney - (this.points.toMoney || 0);
|
const total = this.currentPayMoney - (this.points.toMoney || 0);
|
||||||
if(this.isCreateOrder){
|
console.log(total)
|
||||||
|
if (this.isCreateOrder) {
|
||||||
return total.toFixed(2);
|
return total.toFixed(2);
|
||||||
}else{
|
} else {
|
||||||
return this.allPrice;
|
return this.allPrice;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1966,6 +1977,13 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
yinFuJinE: function (newval) {
|
||||||
|
if (newval <= 0) {
|
||||||
|
this.disabledPayType = ["scanCode", "deposit"];
|
||||||
|
} else {
|
||||||
|
this.disabledPayType = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
"goods.query.categoryId": function (newval) {
|
"goods.query.categoryId": function (newval) {
|
||||||
this.goods.query.page = 1;
|
this.goods.query.page = 1;
|
||||||
this.goods.list = [];
|
this.goods.list = [];
|
||||||
|
|
@ -2033,6 +2051,12 @@ export default {
|
||||||
// this.masterId = masterId;
|
// this.masterId = masterId;
|
||||||
console.log("this.createOrder.data");
|
console.log("this.createOrder.data");
|
||||||
console.log(this.createOrder.data);
|
console.log(this.createOrder.data);
|
||||||
|
if (this.order.status == "finish") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!this.table.tableId&&(this.order.list.length<=0&&this.order.old.list.length<=0)){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
$setUser({
|
$setUser({
|
||||||
tableId: this.table.tableId,
|
tableId: this.table.tableId,
|
||||||
masterId: this.masterId,
|
masterId: this.masterId,
|
||||||
|
|
@ -2045,6 +2069,8 @@ export default {
|
||||||
this.getOrderData().then(() => {
|
this.getOrderData().then(() => {
|
||||||
this.pointsValueChange(this.points.value);
|
this.pointsValueChange(this.points.value);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this.getCart();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -2163,6 +2189,21 @@ export default {
|
||||||
this.open(this.$route.query);
|
this.open(this.$route.query);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
returnProDiscount(row) {
|
||||||
|
console.log(row);
|
||||||
|
//相同商品抵扣券数组
|
||||||
|
const arr = this.quansSelArr.filter((v) => v.proId == row.proId);
|
||||||
|
const index = arr.findIndex((v) => v.id == row.id);
|
||||||
|
if (index != -1) {
|
||||||
|
return returnProductCoupAllPrice(
|
||||||
|
$goodsPayPriceMap[row.proId],
|
||||||
|
index,
|
||||||
|
row.num
|
||||||
|
).toFixed(2);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
lingshicaiShow() {
|
lingshicaiShow() {
|
||||||
this.$refs.refPopAddCai.open();
|
this.$refs.refPopAddCai.open();
|
||||||
},
|
},
|
||||||
|
|
@ -2223,13 +2264,15 @@ export default {
|
||||||
{
|
{
|
||||||
id: this.createOrder.data.id,
|
id: this.createOrder.data.id,
|
||||||
memberId: this.createOrder.data.memberId || this.vipUser.id,
|
memberId: this.createOrder.data.memberId || this.vipUser.id,
|
||||||
|
orderPrice: (this.yinFuJinE * 1 + this.coupdiscount * 1).toFixed(2),
|
||||||
},
|
},
|
||||||
[...this.quansSelArr]
|
[...this.quansSelArr]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
quansConfirm(e) {
|
quansConfirm(e, goodsPayPriceMap) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
this.quansSelArr = [...e];
|
this.quansSelArr = [...e];
|
||||||
|
$goodsPayPriceMap = goodsPayPriceMap;
|
||||||
},
|
},
|
||||||
searchInput(e) {
|
searchInput(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|
@ -2637,7 +2680,7 @@ export default {
|
||||||
if (!canDiscount) {
|
if (!canDiscount) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const amount = this.createOrder.data.amount - this.coupdiscount;
|
const amount = this.createOrder.data.amount;
|
||||||
this.refToggle("refDiscount", true, {
|
this.refToggle("refDiscount", true, {
|
||||||
amount,
|
amount,
|
||||||
discount: this.createOrder.discount * 100,
|
discount: this.createOrder.discount * 100,
|
||||||
|
|
@ -2825,6 +2868,7 @@ export default {
|
||||||
title: "支付成功",
|
title: "支付成功",
|
||||||
type: "success",
|
type: "success",
|
||||||
});
|
});
|
||||||
|
this.order.status = "finish";
|
||||||
this.close();
|
this.close();
|
||||||
// this.reset();
|
// this.reset();
|
||||||
},
|
},
|
||||||
|
|
@ -3055,7 +3099,17 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (key === "returnCart") {
|
if (key === "returnCart") {
|
||||||
const selGoods = this.order.old.list[this.order.old.selIndex];
|
console.log(this.order);
|
||||||
|
let selGoods = undefined;
|
||||||
|
if (this.order.selPlaceNum == -10) {
|
||||||
|
selGoods = { ...this.order.seatFee, num: this.order.seatFee.number };
|
||||||
|
} else {
|
||||||
|
selGoods =
|
||||||
|
this.order.old.list[this.order.selPlaceNum - 1].info[
|
||||||
|
this.order.old.selIndex
|
||||||
|
];
|
||||||
|
}
|
||||||
|
console.log(selGoods);
|
||||||
this.refToggle("refReturnCart", true, selGoods);
|
this.refToggle("refReturnCart", true, selGoods);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -3522,6 +3576,7 @@ export default {
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
// this.goods.list = [];
|
// this.goods.list = [];
|
||||||
|
this.order.status = "";
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.table = "";
|
this.table = "";
|
||||||
this.order.list = [];
|
this.order.list = [];
|
||||||
|
|
@ -3895,7 +3950,6 @@ export default {
|
||||||
this.$router.replace({ path: "/tool/table_list" });
|
this.$router.replace({ path: "/tool/table_list" });
|
||||||
} else {
|
} else {
|
||||||
this.$router.replace({ path: "/tool/Instead/index" });
|
this.$router.replace({ path: "/tool/Instead/index" });
|
||||||
this.$router.go(0);
|
|
||||||
// this.reset();
|
// this.reset();
|
||||||
// this.$router.replace({ path: "/tool/Instead/index" });
|
// this.$router.replace({ path: "/tool/Instead/index" });
|
||||||
}
|
}
|
||||||
|
|
@ -4459,6 +4513,13 @@ input[type="number"]::-webkit-outer-spin-button {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
::v-deep input[aria-hidden="true"] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
::v-deep .categorys .el-tag--plain.el-tag--info {
|
::v-deep .categorys .el-tag--plain.el-tag--info {
|
||||||
border: 1px solid #dcdfe6;
|
border: 1px solid #dcdfe6;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,233 @@
|
||||||
|
export function isTui(item) {
|
||||||
|
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||||
|
}
|
||||||
|
//是否使用会员价
|
||||||
|
export function isUseVipPrice(vipUser,goods){
|
||||||
|
return vipUser.id&&vipUser.isVip&&goods.isMember
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算商品券优惠价格
|
||||||
|
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 ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
||||||
|
return price * coup.num
|
||||||
|
|
||||||
|
}
|
||||||
|
//返回新的商品列表,过滤掉退菜的,退单的商品
|
||||||
|
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
|
||||||
|
}
|
||||||
|
console.log(selCoupNumber,findGoodsTotalNumber);
|
||||||
|
return findGoodsTotalNumber < 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 ? (isUseVipPrice(vipUser,item) ? 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
|
||||||
|
const canUse=coup.use
|
||||||
|
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 returnProductPayPrice(goods,vipUser){
|
||||||
|
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
|
||||||
|
const price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
|
||||||
|
return price
|
||||||
|
}
|
||||||
|
//返回商品券抵扣的商品价格
|
||||||
|
export function returnProductCoupAllPrice(productPriceArr,startIndex,num){
|
||||||
|
return productPriceArr.slice(startIndex,startIndex+num).reduce((prve,cur)=>{
|
||||||
|
let curPrice=0
|
||||||
|
if(typeof cur==='object'){
|
||||||
|
curPrice=cur.memberPrice*1
|
||||||
|
}else{
|
||||||
|
curPrice=cur*1
|
||||||
|
}
|
||||||
|
return prve+curPrice
|
||||||
|
},0)
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回商品券可抵扣的商品数量
|
||||||
|
export function returnProductCanUseNum(productPriceArr,startIndex,num){
|
||||||
|
console.log(productPriceArr);
|
||||||
|
console.log(num);
|
||||||
|
let n=0;
|
||||||
|
for(let i=0;i<num;i++){
|
||||||
|
if(productPriceArr[startIndex*1+i]){
|
||||||
|
n+=1
|
||||||
|
console.log(n);
|
||||||
|
}else{
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回同类商品券在同类商品价格数组里的开始位置
|
||||||
|
export function returnProCoupStartIndex(coupArr,index){
|
||||||
|
return coupArr.slice(0,index).reduce((prve,cur)=>{
|
||||||
|
return prve+cur.num*1
|
||||||
|
},0)
|
||||||
|
}
|
||||||
|
//返回商品数量从0到n每一个对应的价格对照表
|
||||||
|
export function returnGoodsPayPriceMap(goodsArr){
|
||||||
|
return goodsArr.reduce((prve,cur)=>{
|
||||||
|
if(!prve.hasOwnProperty(cur.productId)){
|
||||||
|
prve[cur.productId]=[]
|
||||||
|
}
|
||||||
|
const arr=new Array(cur.num).fill(cur).map(v=>{
|
||||||
|
return {
|
||||||
|
memberPrice:v.memberPrice?v.memberPrice:v.price,
|
||||||
|
price:v.price
|
||||||
|
}
|
||||||
|
})
|
||||||
|
prve[cur.productId].push(...arr)
|
||||||
|
return prve
|
||||||
|
},{})
|
||||||
|
}
|
||||||
|
//计算商品券总优惠价格
|
||||||
|
export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
||||||
|
if (coupArr.length == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//商品分组
|
||||||
|
const goodsMap={}
|
||||||
|
//商品数量从0到n每一个对应的价格
|
||||||
|
const goodsPayPriceMap={}
|
||||||
|
//商品券分组
|
||||||
|
let coupMap={}
|
||||||
|
for(let i in coupArr){
|
||||||
|
const coup=coupArr[i]
|
||||||
|
if(coupMap.hasOwnProperty(coup.proId)){
|
||||||
|
coupMap[coup.proId].push(coup)
|
||||||
|
}else{
|
||||||
|
coupMap[coup.proId]=[coup]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let total=0
|
||||||
|
for(let key in coupMap){
|
||||||
|
const arr=coupMap[key]
|
||||||
|
for(let i in arr){
|
||||||
|
const coup=arr[i]
|
||||||
|
if(!goodsMap.hasOwnProperty(coup.proId)){
|
||||||
|
goodsMap[coup.proId]=goodsArr.filter(v=>v.productId==coup.proId).map(v=>{
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
payPrice:returnProductPayPrice(v,vipUser)
|
||||||
|
}
|
||||||
|
}).sort((a,b)=>{
|
||||||
|
const aPrice=a.payPrice
|
||||||
|
const bPrice=b.payPrice
|
||||||
|
return aPrice-bPrice
|
||||||
|
})
|
||||||
|
goodsPayPriceMap[coup.proId]=goodsMap[coup.proId].reduce((prve,cur)=>{
|
||||||
|
const arr=new Array(cur.num).fill(cur.payPrice)
|
||||||
|
console.log(arr);
|
||||||
|
prve.push(...arr)
|
||||||
|
return prve
|
||||||
|
},[])
|
||||||
|
}
|
||||||
|
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
|
||||||
|
console.log(proCoupStartIndex);
|
||||||
|
const coupNum=Math.min(goodsPayPriceMap[coup.proId].length,coup.num)
|
||||||
|
console.log(coupNum);
|
||||||
|
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return total.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回当前满减券列表可用状态
|
||||||
|
export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
|
||||||
|
return coupArr.map(v => {
|
||||||
|
if (v.id == selCoup.id) {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
const isfullAmount = payPrice >= v.fullAmount * 1
|
||||||
|
if(payPrice<=0){
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
use: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
use: v.use && isfullAmount
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -131,7 +131,7 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
||||||
}
|
}
|
||||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||||
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
const price = item ? (vipUser.isVip ? memberPrice : item.price) : 0;
|
||||||
return price
|
return price*coup.num
|
||||||
|
|
||||||
}
|
}
|
||||||
//返回新的商品列表,过滤掉退菜的,退单的商品
|
//返回新的商品列表,过滤掉退菜的,退单的商品
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue