代客下单结账增加积分优惠券支付
This commit is contained in:
189
src/views/tool/Instead/components/quans.vue
Normal file
189
src/views/tool/Instead/components/quans.vue
Normal file
@@ -0,0 +1,189 @@
|
||||
<template>
|
||||
<el-dialog width="600px" :title="title" :visible.sync="show">
|
||||
<div class="u-p-15">
|
||||
<div class="">
|
||||
<el-tabs v-model="activeName" @tab-click="tabClick">
|
||||
<el-tab-pane label="优惠券(单选)" name="youhui">
|
||||
<el-table
|
||||
empty-text="无可用优惠券"
|
||||
:data="quans.fullReductionCoupon"
|
||||
@cell-click="fullReductionCouponClick"
|
||||
>
|
||||
<el-table-column type="index" width="80" label="">
|
||||
<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" 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 prop="useRestrictions" label="描述">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="商品券(多选)" name="goods">
|
||||
<el-table
|
||||
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="80">
|
||||
<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 prop="useRestrictions" label="描述">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</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";
|
||||
export default {
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: "选择优惠券",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fullReductionCouponSel: {
|
||||
id: "",
|
||||
},
|
||||
productCouponSelArr: [],
|
||||
quansSelArr: [],
|
||||
quans: {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: [],
|
||||
},
|
||||
currentRow: null,
|
||||
multipleSelection: null,
|
||||
fullReductionCouponSelId: "",
|
||||
activeName: "youhui",
|
||||
form: {},
|
||||
show: false,
|
||||
};
|
||||
},
|
||||
watch: {},
|
||||
methods: {
|
||||
productCouponChange(val) {
|
||||
this.productCouponSelArr = val;
|
||||
if (this.productCouponSelArr.length > 0) {
|
||||
this.productCouponSelArr.length = val.length + 1;
|
||||
for (let i in val) {
|
||||
this.quansSelArr[i + 1] = val[i];
|
||||
}
|
||||
} else {
|
||||
this.quansSelArr = val;
|
||||
}
|
||||
},
|
||||
fullReductionCouponClick(row) {
|
||||
if (this.fullReductionCouponSel.id == row.id) {
|
||||
this.fullReductionCouponSel = { id: "" };
|
||||
this.quansSelArr.shift();
|
||||
|
||||
} else {
|
||||
this.fullReductionCouponSel = row;
|
||||
this.quansSelArr.unshift(row);
|
||||
}
|
||||
console.log(this.quansSelArr)
|
||||
},
|
||||
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();
|
||||
},
|
||||
async open(data) {
|
||||
console.log(data);
|
||||
if (data.memberId) {
|
||||
let quans = await $activateByOrderId({
|
||||
orderId: data.id,
|
||||
memberId: data.memberId,
|
||||
});
|
||||
quans.fullReductionCoupon = quans.fullReductionCoupon.filter(
|
||||
(v) => v.use
|
||||
);
|
||||
quans.productCoupon = quans.productCoupon.filter((v) => v.use);
|
||||
this.quans = quans;
|
||||
}
|
||||
|
||||
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>
|
||||
Reference in New Issue
Block a user