美团抖音核销

This commit is contained in:
魏啾 2024-12-02 15:58:31 +08:00
parent 1ec393fcf5
commit a3da940105
4 changed files with 268 additions and 63 deletions

View File

@ -0,0 +1,204 @@
<template>
<div class="app-container">
<div class="head-container">
<el-form :model="query" inline>
<!-- <el-form-item>
<el-input v-model="query.d_order_id" placeholder="订单号"></el-input>
</el-form-item>
<el-form-item>
<el-select v-model="query.status" placeholder="状态">
<el-option label="等待验券" value="0" />
<el-option label="成功" value="1" />
<el-option label="失败" value="2" />
</el-select>
</el-form-item> -->
<el-form-item>
<el-date-picker v-model="query.date" type="date" placeholder="请选择日期" @blur="getTableData()"
@change="getTableData()">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-form-item>
</el-form>
</div>
<div class="head-container">
<el-table border :data="tableData.data">
<!-- <el-table-column label="订单号" prop="couponCode" width="100px"></el-table-column>
<el-table-column label="店铺名称" prop="title" width="100px"></el-table-column> -->
<el-table-column label="套餐名称" prop="dealTitle"></el-table-column>
<!-- <el-table-column label="支付金额"> </el-table-column> -->
<el-table-column label="金额" prop="couponBuyPrice"> </el-table-column>
<el-table-column label="使用时间" prop="couponUseTime"></el-table-column>
<el-table-column label="状态" prop="couponStatusDesc" width="80"> </el-table-column>
<el-table-column label="操作" width="150">
<template v-slot="scope">
<el-button type="primary" v-if="!scope.row.type" @click="showRefund(scope.row)">撤销核销</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="head-container">
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange"></el-pagination>
</div>
</div>
</template>
<script>
import * as $api from "@/api/coup/index.js";
import dayjs from "dayjs";
export default {
data() {
return {
query: {
d_order_id: "",
status: "",
},
resetQuery: "",
tableData: {
data: [],
page: 1,
loading: false,
total: 0,
size: 10
},
payTypes: [
{
value: "wechatPay",
label: "微信支付",
},
{
value: "aliPay",
label: "支付宝支付",
},
],
statusList: [
{
value: "0",
label: "等待验券",
type: "warning",
},
{
value: "1",
label: "成功",
type: "primary",
},
{
value: "2",
label: "失败",
type: "success",
},
],
row: "",
showDialog: false,
refundNumList: [],
refundLoading: false,
refundForm: {
num: "",
orderId: "",
refundAmount: "",
refundDesc: "",
refundReason: "",
},
refundFormRules: {
num: [
{
required: true,
message: " ",
trigger: "change",
},
],
},
};
},
filters: {
timeFilter(s) {
return dayjs(s).format("YYYY-MM-DD HH:mm:ss");
},
},
mounted() {
this.getTableData();
this.resetQuery = { ...this.query };
},
methods: {
statusF(t) {
if (!t) {
return ''
}
return this.statusList[t] ? this.statusList[t].type : '';
},
returnStatus(status) {
return this.statusList[status].label || "";
}, //
showRefund(row) {
this.$confirm("是否确认撤销核销", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
// for(let i in row.douyinCodeGoods){
const item = row
$api.$meituan_fulfilmentcertificatecancel({
couponCode: item.couponCode
}).then(res => {
this.$message.success("撤销核销成功");
this.getTableData();
})
// }
})
.catch(() => { });
},
//
async statusChange(e, row) {
try {
this.tableData.loading = true;
const data = { ...row };
data.status = e;
await tbPrintMachine(data, "put");
this.getTableData();
} catch (error) {
console.log(error);
this.tableData.loading = false;
}
},
//
resetHandle() {
this.query = { ...this.resetQuery };
this.getTableData();
},
//
paginationChange(e) {
this.tableData.page = e;
this.getTableData();
},
//
async getTableData() {
this.tableData.loading = true;
try {
const res = await $api.$meituan_orderlist({
// ...this.query,
date: this.query.date ? dayjs(this.query.date).format("YYYY-MM-DD") : '',
page: this.tableData.page,
size: this.tableData.size,
});
this.tableData.loading = false;
// this.tableData.data = res.list;
this.tableData.data = res.list.map(item => {
// 60
item.couponUseTimes = dayjs(item.couponUseTime).add(60, 'day').format('YYYY-MM-DD HH:mm:ss')
item.type = dayjs().isAfter(dayjs(item.couponUseTime).add(60, 'day'), 'year')
return item
});
this.tableData.total = res.count;
} catch (error) {
console.log(error);
}
},
},
};
</script>

View File

@ -1049,6 +1049,25 @@ export default {
} else {
await tbProductPost(this.form);
}
//
try {
let view = this.$store.state.tagsView.visitedViews[this.$store.state.tagsView.visitedViews.findIndex(item => item.name === 'add_shop')]
//
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
// add_shop
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
this.$router.push(latestView)
} else {
if (view.name === 'Dashboard') {
// to reload home page
this.$router.replace({ path: '/redirect' + view.fullPath })
} else {
this.$router.push('/')
}
}
})
} catch (error) { }
this.$notify({
title: "成功",
message: `${this.form.id ? "编辑" : "添加"}成功`,

View File

@ -2,21 +2,14 @@
<el-dialog title="选择商品" width="450px" :visible.sync="show">
<div class="app-container">
<div class="head-container">
<el-table
:data="tableData"
ref="table"
@selection-change="handleSelectionChange"
@cell-click="cellClick"
>
<el-table :data="tableData" ref="table" @selection-change="handleSelectionChange" @cell-click="cellClick">
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column label="套餐名称" prop="title"></el-table-column>
<el-table-column label="原价" prop="amount"></el-table-column>
</el-table>
<div class="u-flex u-row-center u-m-t-50 gap-20">
<el-button size="medium" @click="close">取消</el-button>
<el-button size="medium" type="primary" @click="confirm"
>确认核销</el-button
>
<el-button size="medium" type="primary" @click="confirm">确认核销</el-button>
</div>
</div>
</div>
@ -89,6 +82,9 @@ export default {
this.types = types ? types : this.types;
this.tableData = res.goods;
this.show = true;
this.$nextTick(() => {
this.$refs.table.toggleAllSelection()
})
},
},
};
@ -103,6 +99,7 @@ export default {
margin-left: 10px;
}
}
::v-deep .el-input--small .el-input__inner {
height: 36px;
line-height: 36px;
@ -150,12 +147,13 @@ export default {
}
}
}
.flex {
display: flex;
align-items: center;
}
.gap-20 {
gap: 20px;
}
</style>

View File

@ -3,40 +3,22 @@
<el-dialog width="400px" :title="title" :visible.sync="show" @close="reset">
<div class="u-p-15">
<div v-if="openSwitch">
<el-button
size="medium"
@click="changeKey('paysSel', index)"
v-for="(item, index) in pays"
:key="index"
:type="paysSel == index ? 'primary' : ''"
>{{ item.text }}</el-button
>
<el-button size="medium" @click="changeKey('paysSel', index)" v-for="(item, index) in pays" :key="index"
:type="paysSel == index ? 'primary' : ''">{{ item.text }}</el-button>
</div>
<div class="u-m-t-20">
<el-alert
:closable="false"
v-if="tips"
:title="tips"
type="warning"
show-icon
>
<el-alert :closable="false" v-if="tips" :title="tips" type="warning" show-icon>
</el-alert>
</div>
<div class="u-m-t-20">
<el-form label-width="90px" label-position="left">
<el-form-item label="券码">
<el-input
v-model="form.code"
@change="codeInputChange"
placeholder="请扫码或者输入券码"
ref="refInputCode"
></el-input>
<el-input v-model="form.code" @change="codeInputChange" placeholder="请扫码或者输入券码"
ref="refInputCode"></el-input>
</el-form-item>
<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
>
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
</div>
</el-form>
</div>
@ -44,10 +26,7 @@
</el-dialog>
<bind-shop ref="refBindShop"></bind-shop>
<choose-goods
ref="refChooseGoods"
@hexiaoSuccess="hexiaoSuccess"
></choose-goods>
<choose-goods ref="refChooseGoods" @hexiaoSuccess="hexiaoSuccess"></choose-goods>
</div>
</template>
<script>
@ -147,6 +126,9 @@ export default {
},
changeKey(key, val) {
this[key] = val;
this.$nextTick(() => {
this.$refs.refInputCode.focus() //
})
},
async confirm() {
@ -154,20 +136,22 @@ export default {
return this.$message.error("请输入或扫付券码");
}
if (this.paysSel == 1) {
if (this.paysSel === 1) {
//
const res = await $Api.$douyin_fulfilmentcertificateprepare({
object_id: this.form.code,
});
if (res.code == 4399) {
this.refBindShopOpen();
}
if (res) {
} else {
console.log(res, 1111)
// if (res.code == 1) {
this.refChooseGoodsOpen(res);
// }
}
return;
}
if (this.paysSel == 0) {
if (this.paysSel === 0) {
//
const res = await $Api.$meituan_searchstorestatus({
});