123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518 |
- <template>
- <div class="app-container">
- <el-form
- :model="queryParams"
- ref="queryForm"
- :inline="true"
- v-show="showSearch"
- label-width="90px"
- >
- <el-form-item label="盲票组名称" prop="title">
- <el-input
- v-model="queryParams.title"
- placeholder="请输入盲票组名称"
- clearable
- size="small"
- style="width: 240px"
- @change="pageParams.pageNum = 1;handleQuery()"
- /><!-- @keyup.enter.native="handleQuery"-->
- </el-form-item>
- <el-form-item label="盲票组类型" prop="type">
- <el-select
- v-model="queryParams.type"
- placeholder="请选择盲票组类型"
- clearable
- size="small"
- @change="pageParams.pageNum = 1;handleQuery()"
- >
- <el-option label="全部" value="" />
- <el-option label="线上票" value="online" />
- <el-option label="线下票" value="offline" />
- </el-select>
- </el-form-item>
- <el-form-item label="盲票组状态" prop="status">
- <el-select
- v-model="queryParams.status"
- placeholder="请选择盲票组状态"
- clearable
- size="small"
- @change="pageParams.pageNum = 1;handleQuery()"
- >
- <el-option label="全部" value="" />
- <el-option label="待出票" value="wait" />
- <el-option label="出票中" value="doing" />
- <el-option label="待上架" value="done" />
- <el-option label="已上架" value="on" />
- <el-option label="已下架" value="off" />
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- icon="el-icon-search"
- size="mini"
- @click="pageParams.pageNum = 1;handleQuery()"
- >搜索</el-button
- >
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
- >重置</el-button
- >
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['business:ticket:add']"
- >添加盲票组</el-button
- >
- </el-col>
- <!--<el-col :span="1.5">
- <el-button
- type="info"
- plain
- icon="el-icon-upload2"
- size="mini"
- @click="handleImport"
- v-hasPermi="['business:ticket:import']"
- >导入</el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="el-icon-download"
- size="mini"
- :loading="exportLoading"
- @click="handleExport"
- v-hasPermi="['business:ticket:export']"
- >导出</el-button
- >
- </el-col>-->
- <el-col :span="1.5">
- <el-button
- type="infor"
- plain
- icon="el-icon-printer"
- size="mini"
- :loading="exportLoading"
- @click="handleExportDraw"
- v-hasPermi="['business:ticket:export']"
- >导出印刷</el-button
- >
- </el-col>
- <right-toolbar
- :showSearch.sync="showSearch"
- @queryTable="getList()"
- ></right-toolbar>
- </el-row>
- <el-table
- ref="table"
- v-loading="loading"
- :data="list"
- @select="handleSelect"
- class="ticket-table" @sort-change="sortChannelId"
- >
- <el-table-column
- type="selection"
- width="55"
- align="center"
- fixed="left"
- />
- <el-table-column label="盲票组ID" prop="boxId" min-width="100" sortable="custom" />
- <el-table-column label="盲票图片" prop="picUrl" min-width="120">
- <template slot-scope="scope">
- <div>
- <el-image
- style="width: 70px; height: 80px"
- :src="scope.row.picUrl"
- :preview-src-list="[scope.row.picUrl]"
- />
- </div>
- </template>
- </el-table-column>
- <el-table-column label="盲票组名称" prop="title" min-width="85" />
- <el-table-column label="盲票组面值" prop="facePrice" min-width="85" sortable="custom" width="110px">
- <template slot-scope="scope">
- <div>¥{{ $numberFormat(scope.row.facePrice) }}</div>
- </template>
- </el-table-column>
- <el-table-column label="盲票总数" prop="quantity" width="100px" sortable="custom">
- <template slot-scope="scope">
- <div>{{ scope.row.quantity }}张</div>
- </template>
- </el-table-column>
- <el-table-column label="已售张数" prop="saleQty" min-width="100" sortable="custom">
- <template slot-scope="scope">
- <div>{{ scope.row.saleQty }}张</div>
- </template>
- </el-table-column>
- <el-table-column label="盲票类型" prop="type" min-width="80">
- <template slot-scope="scope">
- {{ scope.row.type.desc }}
- </template>
- </el-table-column>
- <el-table-column label="采购单价" prop="pkgSalePrice" min-width="100" sortable="custom">
- <template slot-scope="scope">
- <div>¥{{ $numberFormat(scope.row.pkgSalePrice) }}/包</div>
- </template>
- </el-table-column>
- <el-table-column label="预付售票价" prop="pkgPrePrice" min-width="100" sortable="custom">
- <template slot-scope="scope">
- <div>¥{{ $numberFormat(scope.row.pkgPrePrice) }}/包</div>
- </template>
- </el-table-column>
- <el-table-column label="已采购数量" prop="salePkgQty" min-width="110" sortable="custom">
- <template slot-scope="scope">
- <div>{{ scope.row.salePkgQty }}包</div>
- </template>
- </el-table-column>
- <el-table-column label="状态" prop="status" min-width="80">
- <template slot-scope="scope">
- <el-tag
- :type="scope.row.status.value === 'on' ? 'success' : 'info'"
- >{{ scope.row.status.desc }}</el-tag
- >
- </template>
- </el-table-column>
- <el-table-column label="排序" prop="sortWeight" sortable="custom" align="center" width="140px">
- <template slot-scope="{row, $index}">
- <el-input-number v-model="row.sortWeight" @change="handleSortChange($index,row.sortWeight)" controls-position="right" size="small"></el-input-number>
- </template>
- </el-table-column>
- <el-table-column
- label="操作"
- align="center"
- show-overflow-tooltip
- class-name="small-padding fixed-width"
- min-width="150"
- fixed="right"
- >
- <template slot-scope="scope">
- <div>
- <el-button
- v-hasPermi="['business:ticket:query']"
- type="text"
- @click="getDetail(scope.row)"
- >查看</el-button
- >
- <el-button
- v-hasPermi="['business:ticket:edit']"
- type="text"
- @click="setDetail(scope.row)"
- >编辑</el-button
- >
- <el-button
- v-show="
- scope.row.status.value === 'off' ||
- scope.row.status.value === 'done'
- "
- v-hasPermi="['business:ticket:on']"
- type="text"
- @click="setStatus(scope.row, 'on')"
- >上架</el-button
- >
- <el-button
- v-show="scope.row.status.value === 'on'"
- v-hasPermi="['business:ticket:on']"
- type="text"
- @click="setStatus(scope.row, 'off')"
- >下架</el-button
- >
- <el-button
- v-show="scope.row.status.value === 'done'"
- v-hasPermi="['business:ticket:remove']"
- type="text"
- class="del"
- @click="del(scope.row)"
- >删除</el-button
- >
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="pageParams.pageNum"
- :limit.sync="pageParams.pageSize"
- @pagination="getList"
- />
- <!-- 导入 -->
- <ticket-import
- v-if="importShow"
- :dialog-visible="importShow"
- @close="hideDialog"
- />
- </div>
- </template>
- <script>
- import {
- getTicketList,
- exportTicket,
- exportDraw,
- ticketBoxPut,
- ticketBoxRemove, setListData
- } from "@/api/business/ticket";
- import { publicFileGetUrl } from "@/api/common";
- import TicketImport from "./import";
- export default {
- name: "Ticket",
- components: {
- TicketImport,
- },
- data() {
- return {
- sortNum:0,
- loading: false,
- exportLoading: false,
- showSearch: true,
- queryParams: {
- title: "",
- type: "",
- status: "",
- },
- pageParams: {
- pageNum: 1,
- pageSize: 10,
- orderByColumn: '',
- isAsc: 'desc',
- },
- // 总条数
- total: 0,
- list: [],
- ids: [],
- importShow: false,
- };
- },
- watch: {
- $route: {
- handler: function (val, oldVal) {
- if (val.name == "Ticket") {
- this.getList();
- }
- },
- },
- },
- created() {
- this.getList();
- },
- methods: {
- //切换排序
- sortChannelId(row){
- if (row){
- let prop = row.prop == 'channelId' || row.prop == 'commRate' ? ('t1.'+ row.prop) : row.prop;
- this.pageParams.orderByColumn = prop
- this.pageParams.isAsc = row.order=='ascending'?"asc":"desc";
- this.getList()
- }
- },
- //步进器修改
- handleSortChange(index,sortWeight){
- this.list[index].sortWeight = sortWeight
- let data = {
- boxId: this.list[index].boxId,
- sortWeight: this.list[index].sortWeight
- }
- setListData(data)
- },
- // 盲票组列表
- getList() {
- this.loading = true;
- getTicketList( 'pageNum=' + this.pageParams.pageNum + '&pageSize=' + this.pageParams.pageSize + '&orderByColumn='+ this.pageParams.orderByColumn +'&isAsc='+ this.pageParams.isAsc +'&',
- this.queryParams
- )
- .then((res) => {
- this.loading = false;
- if (res.code == 0) {
- res.rows.forEach((item) => {
- let picUrlArr = item.picUrl.split(",");
- item.picUrl = publicFileGetUrl + picUrlArr[0];
- item.status = JSON.parse(item.status);
- item.type = JSON.parse(item.type);
- });
- this.total = res.total;
- this.list = res.rows;
- }
- })
- .catch(() => {
- this.loading = false;
- });
- },
- setStatus(item, status) {
- this.$confirm(
- `确认${status === "on" ? "上架" : "下架"}盲票 “${item.title}” 吗?`,
- `${status === "on" ? "上架" : "下架"}盲票`,
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- ).then(() => {
- ticketBoxPut({
- boxId: item.boxId,
- status,
- }).then((res) => {
- if (res.code === 0) {
- this.$message.success("操作已完成!");
- this.getList();
- }
- });
- });
- },
- del(item) {
- this.$confirm(`确认删除盲票 “${item.title}” 吗?`, "删除盲票", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- ticketBoxRemove({ boxId: item.boxId }).then((res) => {
- if (res.code === 0) {
- this.$message.success("操作已完成!");
- this.getList();
- }
- });
- });
- },
- // 搜索
- handleQuery() {
- this.getList();
- },
- // 重置
- resetQuery() {
- this.resetForm("queryForm");
- this.getList();
- },
- // 添加盲票组
- handleAdd() {
- this.$router.push({ name: "TicketCreate" });
- },
- handleSelect(selection, row) {
- const isSelect = selection.find((item) => item.boxId === row.boxId);
- this.$refs.table.clearSelection();
- if (isSelect) {
- this.$refs.table.toggleRowSelection(row, true);
- this.ids = row.boxId;
- } else {
- this.ids = "";
- }
- },
- // 查看详情
- getDetail(row) {
- this.$router.push({ name: "TicketDetail", query: { id: row.boxId } });
- },
- // 编辑信息
- setDetail(row) {
- this.$router.push({ name: "TicketEdit", query: { id: row.boxId } });
- },
- handleDetail() {},
- handleImport() {
- this.importShow = true;
- },
- hideDialog() {
- this.importShow = false;
- },
- /** 导出按钮操作 */
- handleExport() {
- const boxIds = this.ids || [];
- if (boxIds.length == 0) {
- this.$alert("请选择你要导出的盲票组!", "提示", { type: "warning" });
- } else {
- this.$confirm("是否确认导出所选盲票数据项?", "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.vloading = this.$loading({
- lock: true,
- text: "正在导出.....",
- background: "rgba(0, 0, 0, 0.7)",
- });
- return exportTicket({ ids: boxIds });
- })
- .then((response) => {
- this.vloading.close();
- this.download(response.msg);
- this.exportLoading = false;
- })
- .catch(() => {
- this.vloading.close();
- this.exportLoading = false;
- });
- }
- },
- /** 导出按钮操作 */
- handleExportDraw() {
- const boxIds = this.ids || [];
- if (boxIds.length == 0) {
- this.$alert("请选择你要导出的盲票组!", "提示", { type: "warning" });
- } else {
- this.$confirm("是否确认导出所选盲票数据项?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.vloading = this.$loading({
- lock: true,
- text: "正在导出印刷.....",
- background: "rgba(0, 0, 0, 0.7)",
- });
- return exportDraw({ ids: boxIds });
- })
- .then((response) => {
- this.vloading.close();
- this.download(response.msg);
- this.exportLoading = false;
- })
- .catch(() => {
- this.vloading.close();
- this.exportLoading = false;
- });
- }
- },
- },
- mounted() {},
- destroyed() {},
- };
- </script>
- <style lang="scss">
- .ticket-table {
- thead {
- .el-checkbox {
- display: none !important;
- }
- }
- }
- </style>
|