Commit 882e1f00 by zhangzhen

美团授权功能开发

parent 74494150
...@@ -5,7 +5,7 @@ VUE_APP_TITLE = 凑角管理系统 ...@@ -5,7 +5,7 @@ VUE_APP_TITLE = 凑角管理系统
ENV = 'development' ENV = 'development'
# 凑角管理系统/开发环境 # 凑角管理系统/开发环境
VUE_APP_BASE_API = '/dev-api' VUE_APP_BASE_API = '/prod-api'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true
...@@ -42,3 +42,17 @@ export function delConsumerCoupon(id) { ...@@ -42,3 +42,17 @@ export function delConsumerCoupon(id) {
method: 'delete' method: 'delete'
}) })
} }
export function getAppKey() {
return request({
url: '/common/appKey',
method: 'get'
})
}
export function oauthToken(code) {
return request({
url: `/chessCards/oauthToken?authCode=${code}`,
method: 'get'
})
}
...@@ -86,7 +86,8 @@ ...@@ -86,7 +86,8 @@
v-model="queryParams.startDate" v-model="queryParams.startDate"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="请选择有效期开始"> placeholder="请选择有效期开始"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="有效期结束" prop="endDate"> <el-form-item label="有效期结束" prop="endDate">
...@@ -94,7 +95,8 @@ ...@@ -94,7 +95,8 @@
v-model="queryParams.endDate" v-model="queryParams.endDate"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="请选择有效期结束"> placeholder="请选择有效期结束"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="使用时间" prop="useDate"> <el-form-item label="使用时间" prop="useDate">
...@@ -102,7 +104,8 @@ ...@@ -102,7 +104,8 @@
v-model="queryParams.useDate" v-model="queryParams.useDate"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="请选择使用时间"> placeholder="请选择使用时间"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="删除状态" prop="isDelete"> <el-form-item label="删除状态" prop="isDelete">
...@@ -126,7 +129,8 @@ ...@@ -126,7 +129,8 @@
v-model="queryParams.deleteTime" v-model="queryParams.deleteTime"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="请选择更新时间"> placeholder="请选择更新时间"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -136,27 +140,26 @@ ...@@ -136,27 +140,26 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="primary"--> <!-- type="primary"-->
<!-- plain--> <!-- plain-->
<!-- icon="el-icon-plus"--> <!-- icon="el-icon-plus"-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- @click="handleAdd"--> <!-- @click="handleAdd"-->
<!-- v-hasPermi="['system:consumerCoupon:add']"--> <!-- v-hasPermi="['system:consumerCoupon:add']"-->
<!-- >新增</el-button>--> <!-- >新增</el-button>-->
<!-- </el-col>--> <!-- </el-col>-->
<!-- <el-col :span="1.5">--> <el-col :span="1.5">
<!-- <el-button--> <el-button
<!-- type="success"--> type="success"
<!-- plain--> plain
<!-- icon="el-icon-edit"--> icon="el-icon-edit"
<!-- size="mini"--> size="mini"
<!-- :disabled="single"--> @click="onEmpower"
<!-- @click="handleUpdate"--> >美团授权
<!-- v-hasPermi="['system:consumerCoupon:edit']"--> </el-button>
<!-- >修改</el-button>--> </el-col>
<!-- </el-col>-->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
...@@ -166,7 +169,8 @@ ...@@ -166,7 +169,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:consumerCoupon:remove']" v-hasPermi="['system:consumerCoupon:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
...@@ -176,39 +180,42 @@ ...@@ -176,39 +180,42 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:consumerCoupon:export']" v-hasPermi="['system:consumerCoupon:export']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="consumerCouponList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="consumerCouponList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="ID" align="center" prop="id" /> <el-table-column label="ID" align="center" prop="id"/>
<el-table-column label="用户ID" align="center" prop="consumerId" /> <el-table-column label="用户ID" align="center" prop="consumerId"/>
<el-table-column label="优惠券ID" align="center" prop="couponId" /> <el-table-column label="优惠券ID" align="center" prop="couponId"/>
<el-table-column label="优惠券编码" align="center" prop="couponCode" /> <el-table-column label="优惠券编码" align="center" prop="couponCode"/>
<el-table-column label="优惠券名称" align="center" prop="name" width="240px" /> <el-table-column label="优惠券名称" align="center" prop="name" width="240px"/>
<!-- <el-table-column label="优惠房型" align="center" prop="roomType" />--> <!-- <el-table-column label="优惠房型" align="center" prop="roomType" />-->
<el-table-column label="优惠房型" align="center" prop="roomType" width="240px" > <el-table-column label="优惠房型" align="center" prop="roomType" width="240px">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.roomType.length" style="display: flex;flex-wrap: wrap;width: 100%;"> <div v-if="scope.row.roomType.length" style="display: flex;flex-wrap: wrap;width: 100%;">
<dict-tag style="margin: 0 3px;" v-for="(item ,k) in scope.row.roomType" :key="k" :options="dict.type.store_room_type" :value="item"/> <dict-tag style="margin: 0 3px;" v-for="(item ,k) in scope.row.roomType" :key="k"
:options="dict.type.store_room_type" :value="item"
/>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="优惠开始" align="center" prop="couponTimeStart" /> <el-table-column label="优惠开始" align="center" prop="couponTimeStart"/>
<el-table-column label="优惠结束" align="center" prop="couponTimeEnd" /> <el-table-column label="优惠结束" align="center" prop="couponTimeEnd"/>
<!-- <el-table-column label="优惠券类型" align="center" prop="couponType" />--> <!-- <el-table-column label="优惠券类型" align="center" prop="couponType" />-->
<el-table-column label="优惠券类型" align="center" prop="couponType"> <el-table-column label="优惠券类型" align="center" prop="couponType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.store_coupon_type" :value="scope.row.couponType"/> <dict-tag :options="dict.type.store_coupon_type" :value="scope.row.couponType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="折扣最大时长" align="center" prop="maxDuration" /> <el-table-column label="折扣最大时长" align="center" prop="maxDuration"/>
<el-table-column label="时长" align="center" prop="duration" /> <el-table-column label="时长" align="center" prop="duration"/>
<el-table-column label="门槛金额" align="center" prop="minPrice" /> <el-table-column label="门槛金额" align="center" prop="minPrice"/>
<el-table-column label="减去金额" align="center" prop="subPrice" /> <el-table-column label="减去金额" align="center" prop="subPrice"/>
<!-- <el-table-column label="优惠券来源" align="center" prop="sourceType" />--> <!-- <el-table-column label="优惠券来源" align="center" prop="sourceType" />-->
<el-table-column label="优惠券来源" align="center" prop="sourceType"> <el-table-column label="优惠券来源" align="center" prop="sourceType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.consumer_coupon_source_type" :value="scope.row.sourceType"/> <dict-tag :options="dict.type.consumer_coupon_source_type" :value="scope.row.sourceType"/>
...@@ -235,35 +242,36 @@ ...@@ -235,35 +242,36 @@
<span>{{ parseTime(scope.row.useDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.useDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="使用状态" align="center" prop="useStatus" />--> <!-- <el-table-column label="使用状态" align="center" prop="useStatus" />-->
<el-table-column label="使用状态" align="center" prop="useStatus"> <el-table-column label="使用状态" align="center" prop="useStatus">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.coupon_use_status" :value="scope.row.useStatus"/> <dict-tag :options="dict.type.coupon_use_status" :value="scope.row.useStatus"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="更新者" align="center" prop="deleteBy" /> <el-table-column label="更新者" align="center" prop="deleteBy"/>
<el-table-column label="更新时间" align="center" prop="deleteTime" width="180"> <el-table-column label="更新时间" align="center" prop="deleteTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.deleteTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.deleteTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <el-button--> <!-- <el-button-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- type="text"--> <!-- type="text"-->
<!-- icon="el-icon-edit"--> <!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"--> <!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['system:consumerCoupon:edit']"--> <!-- v-hasPermi="['system:consumerCoupon:edit']"-->
<!-- >修改</el-button>--> <!-- >修改</el-button>-->
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:consumerCoupon:remove']" v-hasPermi="['system:consumerCoupon:remove']"
>删除</el-button> >删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -280,41 +288,42 @@ ...@@ -280,41 +288,42 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户ID" prop="consumerId"> <el-form-item label="用户ID" prop="consumerId">
<el-input v-model="form.consumerId" placeholder="请输入用户ID" /> <el-input v-model="form.consumerId" placeholder="请输入用户ID"/>
</el-form-item> </el-form-item>
<el-form-item label="优惠券ID" prop="couponId"> <el-form-item label="优惠券ID" prop="couponId">
<el-input v-model="form.couponId" placeholder="请输入优惠券ID" /> <el-input v-model="form.couponId" placeholder="请输入优惠券ID"/>
</el-form-item> </el-form-item>
<el-form-item label="优惠券编码" prop="couponCode"> <el-form-item label="优惠券编码" prop="couponCode">
<el-input v-model="form.couponCode" placeholder="请输入优惠券编码" /> <el-input v-model="form.couponCode" placeholder="请输入优惠券编码"/>
</el-form-item> </el-form-item>
<el-form-item label="优惠券名称" prop="name"> <el-form-item label="优惠券名称" prop="name">
<el-input v-model="form.name" placeholder="请输入优惠券名称" /> <el-input v-model="form.name" placeholder="请输入优惠券名称"/>
</el-form-item> </el-form-item>
<el-form-item label="优惠开始" prop="couponTimeStart"> <el-form-item label="优惠开始" prop="couponTimeStart">
<el-input v-model="form.couponTimeStart" placeholder="请输入优惠开始" /> <el-input v-model="form.couponTimeStart" placeholder="请输入优惠开始"/>
</el-form-item> </el-form-item>
<el-form-item label="优惠结束" prop="couponTimeEnd"> <el-form-item label="优惠结束" prop="couponTimeEnd">
<el-input v-model="form.couponTimeEnd" placeholder="请输入优惠结束" /> <el-input v-model="form.couponTimeEnd" placeholder="请输入优惠结束"/>
</el-form-item> </el-form-item>
<el-form-item label="折扣最大时长" prop="maxDuration"> <el-form-item label="折扣最大时长" prop="maxDuration">
<el-input v-model="form.maxDuration" placeholder="请输入折扣最大时长" /> <el-input v-model="form.maxDuration" placeholder="请输入折扣最大时长"/>
</el-form-item> </el-form-item>
<el-form-item label="时长" prop="duration"> <el-form-item label="时长" prop="duration">
<el-input v-model="form.duration" placeholder="请输入时长" /> <el-input v-model="form.duration" placeholder="请输入时长"/>
</el-form-item> </el-form-item>
<el-form-item label="门槛金额" prop="minPrice"> <el-form-item label="门槛金额" prop="minPrice">
<el-input v-model="form.minPrice" placeholder="请输入门槛金额" /> <el-input v-model="form.minPrice" placeholder="请输入门槛金额"/>
</el-form-item> </el-form-item>
<el-form-item label="减去金额(满减券单位:元,折扣为系数)" prop="subPrice"> <el-form-item label="减去金额(满减券单位:元,折扣为系数)" prop="subPrice">
<el-input v-model="form.subPrice" placeholder="请输入减去金额(满减券单位:元,折扣为系数)" /> <el-input v-model="form.subPrice" placeholder="请输入减去金额(满减券单位:元,折扣为系数)"/>
</el-form-item> </el-form-item>
<el-form-item label="有效期开始" prop="startDate"> <el-form-item label="有效期开始" prop="startDate">
<el-date-picker clearable <el-date-picker clearable
v-model="form.startDate" v-model="form.startDate"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="请选择有效期开始"> placeholder="请选择有效期开始"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="有效期结束" prop="endDate"> <el-form-item label="有效期结束" prop="endDate">
...@@ -322,7 +331,8 @@ ...@@ -322,7 +331,8 @@
v-model="form.endDate" v-model="form.endDate"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="请选择有效期结束"> placeholder="请选择有效期结束"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="使用时间" prop="useDate"> <el-form-item label="使用时间" prop="useDate">
...@@ -330,25 +340,27 @@ ...@@ -330,25 +340,27 @@
v-model="form.useDate" v-model="form.useDate"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="请选择使用时间"> placeholder="请选择使用时间"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="删除状态(0:未删除,1:已删除)" prop="isDelete"> <el-form-item label="删除状态(0:未删除,1:已删除)" prop="isDelete">
<el-input v-model="form.isDelete" placeholder="请输入删除状态(0:未删除,1:已删除)" /> <el-input v-model="form.isDelete" placeholder="请输入删除状态(0:未删除,1:已删除)"/>
</el-form-item> </el-form-item>
<el-form-item label="更新者" prop="deleteBy"> <el-form-item label="更新者" prop="deleteBy">
<el-input v-model="form.deleteBy" placeholder="请输入更新者" /> <el-input v-model="form.deleteBy" placeholder="请输入更新者"/>
</el-form-item> </el-form-item>
<el-form-item label="更新时间" prop="deleteTime"> <el-form-item label="更新时间" prop="deleteTime">
<el-date-picker clearable <el-date-picker clearable
v-model="form.deleteTime" v-model="form.deleteTime"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="请选择更新时间"> placeholder="请选择更新时间"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -356,15 +368,27 @@ ...@@ -356,15 +368,27 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="平台授权" :visible.sync="openEmpower" width="80%" append-to-body>
<iframe :src="src" frameborder="0" width="100%" height="700px"></iframe>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listConsumerCoupon, getConsumerCoupon, delConsumerCoupon, addConsumerCoupon, updateConsumerCoupon } from "@/api/system/consumerCoupon"; import {
listConsumerCoupon,
getConsumerCoupon,
delConsumerCoupon,
addConsumerCoupon,
updateConsumerCoupon,
getAppKey, oauthToken
} from '@/api/system/consumerCoupon'
import log from '@/views/monitor/job/log'
export default { export default {
name: "ConsumerCoupon", name: 'ConsumerCoupon',
dicts: ['consumer_coupon_platform_type', 'store_coupon_type','consumer_coupon_source_type','store_room_type','coupon_use_status'], dicts: ['consumer_coupon_platform_type', 'store_coupon_type', 'consumer_coupon_source_type', 'store_room_type', 'coupon_use_status'],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
...@@ -382,7 +406,7 @@ export default { ...@@ -382,7 +406,7 @@ export default {
// 优惠券领取记录表格数据 // 优惠券领取记录表格数据
consumerCouponList: [], consumerCouponList: [],
// 弹出层标题 // 弹出层标题
title: "", title: '',
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 查询参数 // 查询参数
...@@ -409,38 +433,49 @@ export default { ...@@ -409,38 +433,49 @@ export default {
useStatus: null, useStatus: null,
isDelete: null, isDelete: null,
deleteBy: null, deleteBy: null,
deleteTime: null, deleteTime: null
}, },
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
consumerId: [ consumerId: [
{ required: true, message: "用户ID不能为空", trigger: "blur" } { required: true, message: '用户ID不能为空', trigger: 'blur' }
], ],
couponCode: [ couponCode: [
{ required: true, message: "优惠券编码不能为空", trigger: "blur" } { required: true, message: '优惠券编码不能为空', trigger: 'blur' }
], ]
},
src:'',
openEmpower:false
} }
};
}, },
created() { created() {
this.getList(); this.getList()
},
mounted() {
window.addEventListener('message', (data) => {
this.openEmpower = false;
if(data.data.auth_code)
oauthToken(data.data.auth_code).then(res => {
this.$modal.msgSuccess('操作成功')
})
})
}, },
methods: { methods: {
/** 查询优惠券领取记录列表 */ /** 查询优惠券领取记录列表 */
getList() { getList() {
this.loading = true; this.loading = true
listConsumerCoupon(this.queryParams).then(response => { listConsumerCoupon(this.queryParams).then(response => {
this.consumerCouponList = response.rows; this.consumerCouponList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// 表单重置 // 表单重置
reset() { reset() {
...@@ -472,77 +507,101 @@ export default { ...@@ -472,77 +507,101 @@ export default {
deleteBy: null, deleteBy: null,
deleteTime: null, deleteTime: null,
remark: null remark: null
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加优惠券领取记录"; this.title = '添加优惠券领取记录'
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const id = row.id || this.ids const id = row.id || this.ids
getConsumerCoupon(id).then(response => { getConsumerCoupon(id).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改优惠券领取记录"; this.title = '修改优惠券领取记录'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateConsumerCoupon(this.form).then(response => { updateConsumerCoupon(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addConsumerCoupon(this.form).then(response => { addConsumerCoupon(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids
this.$modal.confirm('是否确认删除优惠券领取记录编号为"' + ids + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除优惠券领取记录编号为"' + ids + '"的数据项?').then(function() {
return delConsumerCoupon(ids); return delConsumerCoupon(ids)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {
})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/consumerCoupon/export', { this.download('system/consumerCoupon/export', {
...this.queryParams ...this.queryParams
}, `consumerCoupon_${new Date().getTime()}.xlsx`) }, `consumerCoupon_${new Date().getTime()}.xlsx`)
},
// 美团授权逻辑
onEmpower() {
console.log(window.location.href)
let uri = window.location.href
let appKey = ''
getAppKey().then(res => {
appKey = res.appKey
let state = 'test'
let redirectUrl = encodeURIComponent(uri)
this.src = `https://e.dianping.com/dz-open/merchant/auth?app_key=${appKey}&state=${state}`
this.openEmpower = true;
// window.location.href = url
// let windowDom = window.open(url,'平台授权','width=1440,height=1000')
// windowDom.addEventListener('message',(data)=>{
// if(data.auth_code){
// oauthToken(data.auth_code).then(res=>{
// windowDom.close()
// this.$modal.msgSuccess("操作成功");
// })
// }
// })
})
} }
} }
}; }
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment