123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <div>
- <el-dialog
- title="添加券包奖品"
- width="1000px"
- :visible.sync="dialogVisible"
- :before-close="close"
- >
- <div class="dialog-search">
- <div>券名称:</div>
- <el-input
- v-model="title"
- placeholder="请输入券包名称"
- clearable
- size="small"
- style="width: 240px"
- @keyup.enter.native="getCouponList"
- />
- <div class="ge"></div>
- <el-button
- type="primary"
- icon="el-icon-search"
- size="mini"
- @click="getCouponList"
- >查询</el-button
- >
- </div>
- <el-table
- v-loading="loading"
- :data="couponList"
- @selection-change="handleSelectionCouponPkg"
- class="el-table"
- >
- <el-table-column
- type="selection"
- width="55"
- align="center"
- fixed="left"
- />
- <el-table-column label="券包编号" prop="id" />
- <el-table-column label="券包名称" prop="title" min-width="85" />
- <el-table-column label="优惠券数量" prop="couponNum" />
- <el-table-column label="总面值" min-width="85">
- <template slot-scope="scope">
- <div>¥{{ $numberFormat(scope.row.facePrice) }}</div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="couponPkgTotal > 0"
- :total="couponPkgTotal"
- :page.sync="pageParams.pageNum"
- :limit.sync="pageParams.pageSize"
- @pagination="getCouponList"
- />
- <div class="dialog-btn">
- <el-button size="small" @click="close"> 取 消 </el-button>
- <div class="ge"></div>
- <el-button type="primary" size="small" @click="confirmCouponPkg">
- 确 认
- </el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { publicFileGetUrl } from "@/api/common";
- import { getCouponList } from "@/api/business/couponPkg";
- export default {
- name: "CouponAdd",
- props: {
- dialogVisible: {
- type: Boolean,
- default: false,
- },
- },
- data() {
- return {
- loading: false,
- title: "", // 券包名称
- couponList: [], // 券包列表
- couponPkgTotal: 0, // 券包总数
- selectCouponPkgList: [], // 选中券包
- pageParams: {
- pageNum: 1,
- pageSize: 10,
- },
- };
- },
- created() {
- this.getCouponList();
- },
- methods: {
- // 券包列表
- getCouponList() {
- this.loading = true;
- getCouponList(
- "pageNum=" +
- this.pageParams.pageNum +
- "&pageSize=" +
- this.pageParams.pageSize +
- "&",
- { title: this.title, status: 1 }
- ).then((res) => {
- this.couponList = res.rows
- this.couponPkgTotal = res.total;
- this.loading = false;
- });
- },
- // 选中券包
- handleSelectionCouponPkg(e) {
- this.selectCouponPkgList = e.map((item) => {
- return {
- prizeType: "coupon_pkg",
- // quantity: 1,
- id: item.id,
- picUrl: publicFileGetUrl + item.picUrl,
- title: item.title,
- sortWeight: 100
- };
- });
- },
- // 确认选中券包
- confirmCouponPkg() {
- if(!this.selectCouponPkgList.length) {
- this.msgInfo('请选择券包')
- return
- }
- this.$emit("confirmCouponPkg", this.selectCouponPkgList);
- },
- close() {
- this.$emit("close");
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .dialog-search {
- display: flex;
- line-height: 32px;
- margin-bottom: 20px;
- .ge {
- width: 40px;
- }
- }
- .dialog-btn {
- display: flex;
- align-content: center;
- justify-content: flex-end;
- padding: 40px 0 0;
- .ge {
- width: 40px;
- }
- }
- </style>
|