123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- <template>
- <div>
- <div>
- <el-form
- :model="queryForm"
- ref="queryForm"
- :inline="true"
- label-width="88px"
- >
- <el-form-item label="发放标识" prop="issueRemark">
- <el-input
- v-model="queryForm.issueRemark"
- placeholder="请输入标识"
- clearable
- size="small"
-
- />
- </el-form-item>
- <el-form-item label="发放类型" prop="issueType">
- <el-select
- v-model="queryForm.issueType"
- clearable
- placeholder="请选择"
- >
- <el-option label="消费发放" value="1" ></el-option>
- <el-option label="网页 静态二维码" value="2" ></el-option>
- <el-option label="支付成功后的展示位" value="3" ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="发放名称" prop="issueName">
- <el-input
- v-model="queryForm.issueName"
- placeholder="请输入名称"
- clearable
- size="small"
-
- />
- </el-form-item>
- <el-form-item label="创建时间" prop="getCreateTime">
- <el-date-picker
- style="width: 350px"
- v-model="dateRangeCreatedDate"
- size="mini"
- value-format="yyyy-MM-dd HH:mm:ss"
- type="datetimerange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="生效状态" prop="status">
- <el-select
- v-model="queryForm.status"
- clearable
- placeholder="请选择"
- >
- <el-option label="开启" value="1" ></el-option>
- <el-option label="关闭" value="0" ></el-option>
-
- </el-select>
- </el-form-item>
- <el-form-item>
-
- <el-button
- type="cyan"
- icon="el-icon-search"
- size="mini"
- @click="handleQuery"
- >搜索</el-button
- >
- <el-button
- type="info"
- icon="el-icon-refresh"
- size="mini"
- @click="resetQuery"
- >重置</el-button
- >
- </el-form-item>
- </el-form>
- <el-table :data="issueList">
- <af-table-column type="expand">
- <template slot-scope="props">
- <el-table
- :data="props.row.couponList"
- :show-header="false"
- :highlight-current-row="false"
- style="width: 90vw"
- >
- <af-table-column label="名城" align="left">
- <template slot-scope="scope">
- {{ "优惠券:" }}<b>{{ scope.row.couponRemark }}</b>
- </template>
- </af-table-column>
- <af-table-column label="卡片类型" align="left">
- <template slot-scope="scope">
- {{
- scope.row.couponType == 1
- ? "现金劵" + "--面值:" + scope.row.couponAmt + "元"
- : ""
- }}
- {{
- scope.row.couponType == 2
- ? "折扣券" + "--折扣:" + scope.row.couponAmt + "% "
- : ""
- }}
- {{
- scope.row.couponType == 3
- ? "兑换券" + "--商品:" + scope.row.couponName
- : ""
- }}
- </template>
- </af-table-column>
- <af-table-column label="状态" align="center">
- <template slot-scope="scope">
- {{ scope.row.status == "1" ? "启用状态" : "" }}
- {{ scope.row.status == "0" ? "停用状态" : "" }}
- </template>
- </af-table-column>
- </el-table>
- </template>
- </af-table-column>
- <af-table-column label="发放方式id" align="left" prop="id" v-if="false" />
- <af-table-column label="发放方式标识" align="left" prop="issueRemark" />
- <af-table-column label="状态" align="left">
- <template slot-scope="scope">
- {{ scope.row.status == "1" ? "启用" : "" }}
- {{ scope.row.status == "0" ? "停用" : "" }}
- </template>
- </af-table-column>
- <af-table-column label="活动名称" align="left" prop="issueName" />
- <af-table-column label="类型" align="left">
- <template slot-scope="scope">
- {{ scope.row.issueType == "1" ? "消费发放" : "" }}
- {{ scope.row.issueType == "2" ? "网页方式、二维码-静态码" : "" }}
- {{ scope.row.issueType == "3" ? "支付成功后的领取位" : "" }}
- </template>
- </af-table-column>
- <af-table-column label="发放门槛" align="left">
- <template slot-scope="scope">
- {{
- scope.row.issueType == "1"
- ? scope.row.discountThresholdAmt == "0"
- ? "无门槛,消费都发放"
- : "满" + scope.row.discountThresholdAmt + "元发放"
- : ""
- }}
- {{ scope.row.issueType != "1" ? "-------" : "" }}
- </template>
- </af-table-column>
- <af-table-column label="领取限制" align="left">
- <template slot-scope="scope">
- {{ scope.row.issueType == "1" ? "-------" : "" }}
- {{
- scope.row.issueType != "1"
- ? "单个用户能进入这个领取界面" +
- scope.row.giveCount +
- "次,一次可以领取" +
- scope.row.giveLimit +
- "张优惠券"
- : ""
- }}
- </template>
- </af-table-column>
- <af-table-column label="可领取时间段" align="left">
- <template slot-scope="scope">
- {{ translateTime(scope.row) }}
- </template>
- </af-table-column>
-
-
- <af-table-column
- label="操作"
- align="left"
- class-name="small-padding fixed-width"
- width="120px"
- >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-search"
- @click="handlequeryCouponUserList(scope.row.id)"
- >查看优惠券</el-button
- >
- </template>
- </af-table-column>
-
- </el-table>
- <pagination
- :hidden="total > 0 ? false : true"
- :total="total"
- :page.sync="queryForm.pageNum"
- :limit.sync="queryForm.pageSize"
- @pagination="getIssueList"
- :autoScroll="true"
- />
- </div>
- <el-dialog
- :title="title"
- :visible.sync="open"
- width="1200px"
- append-to-body
- status-icon
- >
- <el-table :data="couponUserList">
- <af-table-column label="油站名" align="center" prop="id" v-if="jiBie==0||jiBie==1"/>
- <af-table-column
- v-if="false"
- label="优惠券id"
- align="center"
- prop="id"
- />
- <af-table-column label="用户ID" align="center" prop="unionId" v-if="false" />
- <af-table-column label="油站ID" align="center" prop="stationId" v-if="false" />
- <af-table-column label="发放方式ID" align="center" prop="issueId" v-if="false" />
- <af-table-column label="发放方式标识" align="left" prop="issueRemark" />
- <af-table-column label="活动名称" align="left" prop="issueName" />
-
- <af-table-column label="优惠券ID" align="center" prop="couponId" v-if="false"/>
- <af-table-column
- label="优惠券标识"
- align="left"
- prop="couponRemark"
- fixed="left"
- />
- <af-table-column label="卡片类型" align="left">
- <template slot-scope="scope">
- {{
- scope.row.couponType == 1
- ? "现金劵" + "--面值:" + scope.row.couponAmt + "元"
- : ""
- }}
- {{
- scope.row.couponType == 2
- ? "折扣券" + "--折扣:" + scope.row.couponAmt + "% "
- : ""
- }}
- {{
- scope.row.couponType == 3
- ? "兑换券" + "--商品:" + scope.row.couponName
- : ""
- }}
- </template>
- </af-table-column>
- <af-table-column label="是否使用"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.couponIsUsed == "0" ? "未使用" : "" }}
- {{ scope.row.couponIsUsed == "1" ? "已使用" : "" }}
- {{ scope.row.couponIsUsed == "2" ? "已核销" : "" }}
- </template>
- </af-table-column>
- <af-table-column label="是否有效"
- align="center"
- >
- <template slot-scope="scope">
- {{ scope.row.couponIsEffective == "0" ? "无效" : "" }}
- {{ scope.row.couponIsEffective == "1" ? "有效" : "" }}
- </template>
- </af-table-column>
- <af-table-column label="用户保存id" align="center" prop="userId" v-if="false" />
- <af-table-column label="手机号" align="center" prop="mobilePhone" />
- <af-table-column label="用户名" align="center" prop="blogNickName" />
- <af-table-column label="核销员手机号" align="center" prop="verificationUserPhone" />
- <af-table-column label="优惠券获取时间" align="center" prop="getCouponTime">
- <template slot-scope="scope">
- <span>{{
- parseTime(scope.row.getCouponTime, "{y}-{m}-{d} {h}:{i}:{s}")
- }}</span>
- </template>
- </af-table-column>
- <af-table-column label="优惠券截止时间" align="center" prop="couponEffectiveTime">
- <template slot-scope="scope">
- <span>{{
- parseTime(scope.row.couponEffectiveTime, "{y}-{m}-{d} {h}:{i}:{s}")
- }}</span>
- </template>
- </af-table-column>
-
- </el-table>
- <pagination
- v-show="userTotal > 0"
- :total="userTotal"
- :page.sync="queryCouponUserFrom.pageNum"
- :limit.sync="queryCouponUserFrom.pageSize"
- @pagination="queryCouponUserListByPage"
- />
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- listInfo,
- listIssue,
- queryCouponUserList,
- } from "@/api/coupon";
- export default {
- name: "Coupon_CreateIssue",
- data() {
- return {
- dateRangeCreatedDate: [],
- createForm: {
- issueRemark: "",
- issueName: "",
- showIdList: [],
- availableControl: "0",
- appointedDaysList: [],
- cycleDaysList: [],
- issueType: "",
- discountThresholdAmt: "0",
- couponIssueRelationList: [],
- giveLimit: 9,
- giveCount: 999999,
- },
- couponList: [],
-
- title: "",
- // 是否显示弹出层
- open: false,
- // 总条数
- total: 100,
- // 优惠券总条数
- userTotal: 100,
- // 优惠券的信息
- couponUserList: [],
- // 查询参数
- queryForm: {
- pageNum: 1,
- pageSize: 10, // 初始值只能比10大
- issueName:null,
- issueRemark:null,
- issueType:null,
- levelId:this.levelId,
- CreateTime:null,
- status:null,
- },
- queryCouponUserFrom:{
- levelId:this.levelId,
- issueId:0,
- couponId: null,
- stationId: null,
- pageNum: 1,
- pageSize: 10,
- },
- issueList: [],
- timeSelect: [
- ,
- ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
- [
- "1号",
- "2号",
- "3号",
- "4号",
- "5号",
- "6号",
- "7号",
- "8号",
- "9号",
- "10号",
- "11号",
- "12号",
- "13号",
- "14号",
- "15号",
- "16号",
- "17号",
- "18号",
- "19号",
- "20号",
- "21号",
- "22号",
- "23号",
- "24号",
- "25号",
- "26号",
- "27号",
- "28号",
- "29号",
- "30号",
- "31号",
- ],
- ],
- };
- },
- created() {
- this.init();
- },
- methods: {
- translateTime(row) {
- let timeString = "";
- const availableControleType = row.availableControl;
- if (availableControleType == 0) {
- return "用户一直都可以领取";
- }
- timeString = "用户只能在";
- if (availableControleType == 1) {
- timeString += "每周的";
- }
- if (availableControleType == 2) {
- timeString += "每月的";
- }
- if (availableControleType == 3) {
- timeString += "指定的日期 ";
- }
- if (availableControleType == 1 || availableControleType == 2) {
- row.cycleDaysList.forEach((ele) => {
- timeString += this.timeSelect[availableControleType][ele] + "、";
- });
- } else if (availableControleType == 3) {
- timeString += row.appointedDaysList.toString();
- }
- timeString = timeString.replace(/(、)$/g, "") + "可以领取劵";
- return timeString;
- },
- getIssueList() {
- listIssue(this.addDateRange(this.queryForm, this.dateRangeCreatedDate))
- .then((res) => {
- if (res.code == 200) {
- if (res.rows == null) {
- this.total = 0;
- this.issueList = [];
- } else {
- this.total = res.total;
- this.issueList = res.rows;
- }
- } else {
- throw new Error("");
- }
- })
- .catch((err) => {
- this.msgError("亲,拉取领取方式列表失败~");
- });
- },
- getCoupon() {
- listInfo({
- pageNum: 1,
- pageSize: 1000,
- status: 1,
- })
- .then((res) => {
- if (res.code == 200) {
- if (res.rows == null) {
- this.couponList = [];
- } else {
- this.couponList = res.rows;
- }
- } else {
- throw new Error("");
- }
- })
- .catch((err) => {
- this.msgError("亲,拉取优惠券列表失败~");
- });
- },
- init() {
- this.getCoupon();
- this.getIssueList();
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryForm.pageNum = 1;
- this.queryForm.pageSize=10;
- this.getIssueList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.dateRangeCreatedDate = [];
- this.handleQuery();
- },
- /** 查看优惠券信息 */
- handlequeryCouponUserList(row) {
- console.log(row);
- console.log(this.queryCouponUserFrom.issueId);
- this.queryCouponUserFrom.issueId=row;
-
- queryCouponUserList(
- this.queryCouponUserFrom
- ).then((response) => {
- this.couponUserList = response.rows;
- this.userTotal = response.total;
- this.title = "用户优惠券信息";
- this.open = true;
- });
-
- },
- /** 分页查看信息 */
- queryCouponUserListByPage() {
-
- queryCouponUserList(
- this.queryCouponUserFrom
- ).then((response) => {
- this.couponUserList = response.rows;
- this.userTotal = response.total;
- this.title = "用户优惠券信息";
- this.open = true;
- });
-
- },
- },
- };
- </script>
- <style lang="scss">
- </style>
|