2023-11-02 18:32:07 +08:00
|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<el-card >
|
|
|
|
<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
|
|
|
<el-form-item label="分类名称" prop="categoryName">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.categoryName"
|
|
|
|
placeholder="请输入供应商名称"
|
|
|
|
clearable
|
|
|
|
style="width: 240px;"
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
|
|
<el-select v-model="queryParams.status" style="width: 217px" placeholder="全部" clearable
|
|
|
|
>
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dict.type.zhzt"
|
|
|
|
:key="dict.label"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.label"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
|
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
|
|
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form> -->
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
<el-card style="margin-top: 20px" >
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="primary"
|
|
|
|
icon="el-icon-plus"
|
|
|
|
@click="giftAdd"
|
|
|
|
>新增礼品</el-button>
|
|
|
|
</el-col>
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
</el-row>
|
|
|
|
<el-table ref="tables"
|
|
|
|
v-loading="loading"
|
|
|
|
:data="dataList"
|
2023-11-03 17:59:55 +08:00
|
|
|
:default-sort="defaultSort">
|
|
|
|
<el-table-column label="分类" align="center" prop="categoryId" width="50px"/>
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-table-column label="礼品信息" align="center">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-table-column label="名称" align="center" prop="giftName"/>
|
|
|
|
<el-table-column label="封面图" align="center" prop="coverImage"/>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="兑换信息" align="center">
|
|
|
|
<el-table-column label="兑换方式" align="center" prop="sort65"/>
|
|
|
|
<el-table-column label="兑换方式" align="center" prop="sort67"/>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="配送类型" align="center">
|
|
|
|
<el-table-column label="配送方式" align="center" prop="sort56"/>
|
|
|
|
<el-table-column label="快递费用" align="center" prop="sort55"/>
|
|
|
|
</el-table-column>
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-table-column label="礼品类型" align="center" prop="giftType" />
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-table-column label="礼品库存信息" align="center">
|
|
|
|
<el-table-column label="总库存" align="center" prop="sort23"/>
|
|
|
|
<el-table-column label="已用" align="center" prop="sort12"/>
|
|
|
|
<el-table-column label="可用" align="center" prop="categoryName2"/>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="排序" align="center" prop="sort" />
|
|
|
|
<el-table-column label="状态" align="center" prop="status">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<div slot="reference" class="name-wrapper">
|
|
|
|
<el-tag v-if ="scope.row.status == '启用'" size="medium">启用</el-tag>
|
|
|
|
<el-tag v-if ="scope.row.status == '禁用'" type="danger" size="medium">禁用</el-tag>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime"/>
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-edit"
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
>修改</el-button>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
<pagination
|
|
|
|
v-show="total>0"
|
|
|
|
:total="total"
|
|
|
|
:page.sync="queryParams.page"
|
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
|
@pagination="getList"
|
|
|
|
/>
|
|
|
|
</el-card>
|
|
|
|
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-dialog :title="title" class="d-dialog" :visible.sync="open" width="1000px" append-to-body :close-on-click-modal="false">
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-form ref="form" :model="dataForm" :rules="rules" label-width="80px">
|
|
|
|
<el-row :gutter="24">
|
|
|
|
<el-col :span="15">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-form-item label="礼品名称" prop="giftName">
|
|
|
|
<el-input v-model="dataForm.giftName" placeholder="请输入礼品名称" maxlength="30"/>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="9">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-form-item label="分类" prop="categoryId">
|
|
|
|
<el-select v-model="dataForm.categoryId" placeholder="请选择礼品分类" style="width:100%">
|
|
|
|
<el-option
|
|
|
|
v-for="option in giftCategoryList"
|
|
|
|
:key="option.id"
|
|
|
|
:label="option.categoryName"
|
|
|
|
:value="option.id"
|
|
|
|
></el-option>
|
|
|
|
</el-select>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row :gutter="24">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-col :span="6">
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-form-item label="封面图" >
|
|
|
|
<el-upload
|
|
|
|
:action="uploadAction"
|
|
|
|
list-type="picture-card"
|
|
|
|
:class="{hide:hideUpload}"
|
|
|
|
:file-list="uploadFiles"
|
|
|
|
:auto-upload="true"
|
|
|
|
:show-file-list="false"
|
|
|
|
:headers="uploadHeader"
|
2023-11-03 17:59:55 +08:00
|
|
|
:on-success="handleUploadSuccessCover">
|
2023-11-02 18:32:07 +08:00
|
|
|
<img
|
2023-11-03 17:59:55 +08:00
|
|
|
v-if="this.dataForm.coverImage"
|
|
|
|
:src="imagePath + this.dataForm.coverImage"
|
2023-11-02 18:32:07 +08:00
|
|
|
class="list-img"
|
|
|
|
/>
|
2023-11-03 17:59:55 +08:00
|
|
|
<i v-if="!this.dataForm.coverImage" class="el-icon-plus"></i>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-upload>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-col :span="18">
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-form-item label="礼品图片" >
|
|
|
|
<el-upload
|
2023-11-03 17:59:55 +08:00
|
|
|
:action="uploadAction"
|
|
|
|
list-type="picture-card"
|
|
|
|
:file-list="dataForm.giftImages"
|
|
|
|
:headers="uploadHeader"
|
|
|
|
:auto-upload="true"
|
|
|
|
:on-preview="handlePictureCardPreview"
|
|
|
|
:on-success="handleUploadSuccessGift"
|
|
|
|
style="height: 100px;"
|
|
|
|
:on-remove="handleRemove">
|
|
|
|
<i class="el-icon-plus"></i>
|
|
|
|
</el-upload>
|
|
|
|
<el-dialog :visible.sync="dialogVisible">
|
|
|
|
<img width="100%" :src="dialogImageUrl" alt="">
|
|
|
|
</el-dialog>
|
|
|
|
<!-- <el-upload
|
|
|
|
:action="uploadAction"
|
2023-11-02 18:32:07 +08:00
|
|
|
list-type="picture-card"
|
|
|
|
:class="{hide:hideUpload}"
|
|
|
|
:file-list="uploadFiles"
|
|
|
|
:auto-upload="true"
|
|
|
|
:show-file-list="false"
|
|
|
|
:headers="uploadHeader"
|
2023-11-03 17:59:55 +08:00
|
|
|
:on-success="handleUploadSuccessGift">
|
2023-11-02 18:32:07 +08:00
|
|
|
<img
|
2023-11-03 17:59:55 +08:00
|
|
|
v-if="this.dataForm.giftImages"
|
|
|
|
:src="imagePath + this.dataForm.giftImages"
|
2023-11-02 18:32:07 +08:00
|
|
|
class="list-img"
|
|
|
|
/>
|
2023-11-03 17:59:55 +08:00
|
|
|
<i v-if="!this.dataForm.giftImages" class="el-icon-plus"></i>
|
|
|
|
</el-upload> -->
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
<el-col>
|
|
|
|
<el-col :span="20">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-form-item label="礼品类型" prop="giftType">
|
|
|
|
<el-radio-group v-model="dataForm.giftType" @change="changeGiftType">
|
|
|
|
<el-radio
|
|
|
|
v-for="dict in dict.type.lplx"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value"
|
|
|
|
@change="handleIsopenSelect,changeGiftType"
|
|
|
|
/>
|
|
|
|
</el-radio-group>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row :gutter="24">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item v-if="showList.coupon" label="优惠卷" prop="couponId">
|
|
|
|
<el-select v-model="dataForm.couponId" placeholder="请选择" style="width: 202px;">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dict.type.lplx"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value"
|
|
|
|
></el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item v-if="showList.voucher" label="兑换券" prop="voucherId">
|
|
|
|
<el-select v-model="dataForm.voucherId" placeholder="请选择" style="width: 202px;">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dict.type.lplx"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value"
|
|
|
|
></el-option>
|
|
|
|
</el-select>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-col :span="7">
|
|
|
|
<el-form-item label="礼品数量" prop="supplierName" style="width: 202px;">
|
|
|
|
<el-input-number v-model="dataForm.giftQuantity" controls-position="right" :min="1" :max="10" label=""></el-input-number>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row :gutter="24">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-col :span="8">
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-form-item label="市场价格" prop="supplierName">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-input v-model="dataForm.sort" placeholder="请输入市场价格" maxlength="30" style="width: 202px;">
|
|
|
|
<template slot="append">元</template></el-input>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-col :span="7">
|
|
|
|
<el-form-item label="礼品库存" prop="totalInventory">
|
|
|
|
<el-input v-model="dataForm.totalInventory" placeholder="礼品库存" maxlength="30" style="width: 202px;"/>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
<el-col>
|
|
|
|
<el-col :span="20">
|
|
|
|
<el-form-item label="兑换方式" prop="status">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-radio-group v-model="dataForm.exchangeMethod">
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-radio
|
2023-11-03 17:59:55 +08:00
|
|
|
v-for="dict in dict.type.redemptionMethod"
|
2023-11-02 18:32:07 +08:00
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
@change="handleIsopenSelect"
|
|
|
|
:value="dict.value"/>
|
|
|
|
</el-radio-group>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-row :gutter="24">
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="兑换积分" prop="exchangePoints">
|
|
|
|
<el-input v-model="dataForm.exchangePoints" placeholder="分类名称" maxlength="30" style="width: 202px;">
|
|
|
|
<template slot="append">积分</template>
|
|
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="7">
|
|
|
|
<el-form-item label="加钱比例" prop="moneyRatio" >
|
|
|
|
<el-input v-model="dataForm.moneyRatio" placeholder="分类名称" maxlength="30" style="width: 202px;">
|
|
|
|
<template slot="prepend">1积分=</template>
|
|
|
|
<template slot="append">元</template>
|
|
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
2023-11-02 18:32:07 +08:00
|
|
|
|
|
|
|
|
2023-11-03 17:59:55 +08:00
|
|
|
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-row :gutter="24">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="配送方式" prop="exchangeTimes">
|
|
|
|
<el-checkbox v-for="item in dict.type.shippingMethod" :key="item.value" v-model="moneyRatio" :label="item.id">{{ item.label }}</el-checkbox>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="7">
|
|
|
|
<el-form-item label="快递运费" prop="status">
|
|
|
|
<el-radio-group v-model="dataForm.expressShippingFee">
|
|
|
|
<el-radio
|
|
|
|
v-for="dict in dict.type.expressShippingCosts"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
@change="handleIsopenSelect"
|
|
|
|
:value="dict.value"/>
|
|
|
|
</el-radio-group>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
2023-11-03 17:59:55 +08:00
|
|
|
|
|
|
|
<el-col :span="7">
|
|
|
|
<el-form-item label="运费金额" prop="status">
|
|
|
|
<el-input v-model="dataForm.exchangePoints" placeholder="分类名称" maxlength="30" style="width: 202px;">
|
|
|
|
<template slot="append">元</template>
|
|
|
|
</el-input>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
2023-11-03 17:59:55 +08:00
|
|
|
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-row :gutter="24">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="兑换次数" prop="exchangeTimes">
|
|
|
|
<el-input v-model="dataForm.exchangeTimes" placeholder="分类名称" maxlength="30" style="width: 202px;">
|
|
|
|
<template slot="append">个</template>
|
|
|
|
</el-input>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row :gutter="24">
|
|
|
|
<el-col :span="10">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-form-item label="礼品排序" prop="sort" >
|
|
|
|
<el-input-number v-model="dataForm.sort" :min="1" :max="10" label="" style="width: 202px;"></el-input-number>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
2023-11-03 17:59:55 +08:00
|
|
|
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-row>
|
|
|
|
<el-col>
|
|
|
|
<el-col :span="20">
|
|
|
|
<el-form-item label="礼品状态" prop="status">
|
|
|
|
<el-radio-group v-model="dataForm.status">
|
|
|
|
<el-radio
|
|
|
|
v-for="dict in dict.type.zhzt"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
@change="handleIsopenSelect"
|
|
|
|
:value="dict.value"/>
|
|
|
|
</el-radio-group>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-row :gutter="24">
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-col :span="23">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-form-item label="图文详情" prop="detailedDescription">
|
|
|
|
<!-- <element-tiptap v-model="content" :extensions="extensions" :editor="editor" /> -->
|
|
|
|
<editor></editor>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
2023-11-03 17:59:55 +08:00
|
|
|
</el-row>
|
2023-11-02 18:32:07 +08:00
|
|
|
</el-form>
|
|
|
|
<div slot="footer" class="dialog-footer">
|
2023-11-03 17:59:55 +08:00
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
2023-11-02 18:32:07 +08:00
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
</div>
|
|
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2023-11-03 17:59:55 +08:00
|
|
|
import {getGiftCategoryApi} from "@/api/integral/category";
|
|
|
|
import { editor } from '@/components/Editor/index'
|
2023-11-02 18:32:07 +08:00
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
|
|
name: "gift",
|
2023-11-03 17:59:55 +08:00
|
|
|
dicts: ['zhzt','lplx','redemptionMethod','expressShippingCosts','shippingMethod'],
|
2023-11-02 18:32:07 +08:00
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dataList: [],
|
|
|
|
|
|
|
|
dataForm:{
|
|
|
|
id: null,
|
2023-11-03 17:59:55 +08:00
|
|
|
giftName: '', // 礼品名称
|
|
|
|
categoryId:'', // 分类id
|
|
|
|
coverImage:'', // 封面图
|
|
|
|
giftImages: [], // 礼品图片
|
|
|
|
giftType:"优惠卷", // 礼品类型
|
|
|
|
couponId:'',// 优惠券
|
|
|
|
giftQuantity:'', // 礼品数量
|
|
|
|
totalInventory:'', // 库存
|
|
|
|
exchangeMethod:'积分', // 兑换方式
|
|
|
|
exchangePoints:'', // 兑换积分
|
|
|
|
exchangeTimes:'', // 兑换次数
|
|
|
|
moneyRatio:'', // 价钱比例
|
|
|
|
deliveryMethod:'', // 配送方式
|
|
|
|
detailedDescription:'', // 图文详情
|
2023-11-02 18:32:07 +08:00
|
|
|
categoryName: 1,
|
|
|
|
sort: null,
|
2023-11-03 17:59:55 +08:00
|
|
|
status: '启用'
|
2023-11-02 18:32:07 +08:00
|
|
|
},
|
|
|
|
|
2023-11-03 17:59:55 +08:00
|
|
|
showList: {
|
|
|
|
// 优惠类型展示
|
|
|
|
coupon: 'true',
|
|
|
|
voucher: 'false',
|
|
|
|
goods: 'false',
|
|
|
|
// 兑换方式展示
|
|
|
|
|
|
|
|
},
|
2023-11-02 18:32:07 +08:00
|
|
|
|
|
|
|
// 弹出框标题
|
|
|
|
title:'',
|
|
|
|
// 显示搜索条件
|
|
|
|
showSearch: true,
|
|
|
|
disableInput: false, // 默认不禁用
|
|
|
|
// 是否显示弹出层
|
2023-11-03 17:59:55 +08:00
|
|
|
open: false,
|
2023-11-02 18:32:07 +08:00
|
|
|
// 总条数
|
|
|
|
total: 0,
|
|
|
|
// 查询参数
|
|
|
|
queryParams: {
|
|
|
|
categoryName: 1,
|
|
|
|
status: '',
|
|
|
|
page:null,
|
|
|
|
pageSize:null
|
|
|
|
},
|
|
|
|
dateRange:{},
|
|
|
|
// 遮罩层
|
|
|
|
loading: false,
|
|
|
|
// 默认排序
|
|
|
|
defaultSort: {prop: 'createTime', order: 'descending'},
|
|
|
|
rules: {},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 表单
|
|
|
|
*/
|
2023-11-03 17:59:55 +08:00
|
|
|
giftCategoryList: [], // 查询分类列表
|
2023-11-02 18:32:07 +08:00
|
|
|
|
2023-11-03 17:59:55 +08:00
|
|
|
// 上传地址
|
|
|
|
uploadAction: process.env.VUE_APP_SERVER_URL + 'backendApi/file/upload',
|
|
|
|
uploadHeader: { 'Access-Token' : getToken() },
|
|
|
|
// 隐藏上传
|
|
|
|
hideUpload: false,
|
|
|
|
// 上传文件列表
|
|
|
|
uploadFiles: [
|
|
|
|
{name:"nihao",
|
|
|
|
url:'http://localhost:8008/static/uploadImages/20231103/ffbbe7d3ee1441fdaf706802fa0f176a.png'}
|
|
|
|
],
|
|
|
|
// 图片根目录
|
|
|
|
imagePath: process.env.VUE_APP_SERVER_URL,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dialogImageUrl: "",
|
|
|
|
dialogVisible: false
|
2023-11-02 18:32:07 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
async created() {
|
|
|
|
await this.getList();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getList() {
|
|
|
|
},
|
|
|
|
|
|
|
|
submitForm: function() {
|
2023-11-03 17:59:55 +08:00
|
|
|
console.log("dataForm",this.dataForm)
|
|
|
|
console.log("dialogImageUrl",this.dialogImageUrl)
|
2023-11-02 18:32:07 +08:00
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
if (valid) {
|
|
|
|
if (this.dataForm.id == null) {
|
|
|
|
// 判断是否是新增还是修改
|
2023-11-03 17:59:55 +08:00
|
|
|
// insertGiftCategoryApi(this.dataForm).then(res => {
|
|
|
|
// this.getList()
|
|
|
|
// this.open = false
|
|
|
|
// })
|
2023-11-02 18:32:07 +08:00
|
|
|
} else {
|
2023-11-03 17:59:55 +08:00
|
|
|
// // 判断是否是新增还是修改
|
|
|
|
// updateGiftCategoryApi(this.dataForm).then(res => {
|
|
|
|
// this.getList()
|
|
|
|
// this.open = false
|
|
|
|
// })
|
2023-11-02 18:32:07 +08:00
|
|
|
}
|
|
|
|
}})
|
|
|
|
},
|
2023-11-03 17:59:55 +08:00
|
|
|
|
|
|
|
|
2023-11-02 18:32:07 +08:00
|
|
|
// 新增
|
|
|
|
giftAdd() {
|
2023-11-03 17:59:55 +08:00
|
|
|
// this.dataForm = {}
|
2023-11-02 18:32:07 +08:00
|
|
|
this.dataForm.status = '启用'
|
|
|
|
this.open = true
|
|
|
|
this.title = '添加分类'
|
2023-11-03 17:59:55 +08:00
|
|
|
|
|
|
|
this.selectGiftCategory();
|
2023-11-02 18:32:07 +08:00
|
|
|
},
|
|
|
|
// 取消按钮
|
|
|
|
cancel() {
|
|
|
|
this.open = false;
|
|
|
|
this.reset();
|
|
|
|
},
|
|
|
|
// 搜索按钮操作
|
|
|
|
handleQuery() {
|
|
|
|
this.queryParams.page = 1;
|
|
|
|
this.getList();
|
|
|
|
},
|
|
|
|
// 修改按钮
|
|
|
|
handleUpdate(data) {
|
|
|
|
this.dataForm = data
|
|
|
|
this.open = true
|
|
|
|
this.getList();
|
|
|
|
},
|
|
|
|
resetQuery() {
|
|
|
|
|
|
|
|
},
|
|
|
|
reset(){
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 表单
|
|
|
|
*/
|
|
|
|
// 查询分类
|
2023-11-03 17:59:55 +08:00
|
|
|
// handleUpdate(row) {
|
|
|
|
// this.reset();
|
|
|
|
// const id = row.id || this.ids;
|
|
|
|
// getGoodsCateInfo(id).then(response => {
|
|
|
|
// this.form = response.data.cateInfo;
|
|
|
|
// this.uploadFiles = [{ url: response.data.imagePath + this.form.logo, status: 'finished'}]
|
|
|
|
// this.open = true;
|
|
|
|
// this.title = "编辑商品分类";
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
|
|
|
|
|
|
|
|
// 表单初始化
|
|
|
|
initializeForm() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 分类查询
|
|
|
|
selectGiftCategory() {
|
|
|
|
let queryParams = {pageSize : 1000}
|
|
|
|
getGiftCategoryApi(queryParams).then(response => {
|
|
|
|
this.giftCategoryList = response.data.records;
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 选择礼品类型
|
|
|
|
changeGiftType() {
|
|
|
|
// 点击之后处理
|
|
|
|
},
|
|
|
|
// 点击按钮处理
|
|
|
|
handleIsopenSelect() {
|
|
|
|
// this.$forceUpdate()
|
2023-11-02 18:32:07 +08:00
|
|
|
},
|
|
|
|
|
2023-11-03 17:59:55 +08:00
|
|
|
// 上传封面
|
|
|
|
handleUploadSuccessCover(file) {
|
|
|
|
this.dataForm.coverImage = file.data.fileName;
|
2023-11-02 18:32:07 +08:00
|
|
|
},
|
2023-11-03 17:59:55 +08:00
|
|
|
// 上传详情图
|
|
|
|
handleUploadSuccessGift(file) {
|
|
|
|
|
|
|
|
let newImage = {
|
|
|
|
name: file.data.original,
|
|
|
|
url: process.env.VUE_APP_SERVER_URL + file.data.fileName,
|
|
|
|
type: file.data.type
|
|
|
|
};
|
|
|
|
console.log("giftImages",this.dataForm.giftImages)
|
|
|
|
if (this.dataForm.giftImages == undefined) {
|
|
|
|
this.dataForm.giftImages = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
this.dataForm.giftImages.push(newImage);
|
2023-11-02 18:32:07 +08:00
|
|
|
|
2023-11-03 17:59:55 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
handleRemove(file, fileList) {
|
|
|
|
console.log("file.response.data.fileName",file);
|
|
|
|
|
|
|
|
this.dataForm.giftImages.forEach((image, index) => {
|
|
|
|
if (file.url === image.url) {
|
|
|
|
this.dataForm.giftImages.splice(index, 1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
console.log(file, fileList);
|
|
|
|
},
|
|
|
|
handlePictureCardPreview(file) {
|
|
|
|
console.log(file);
|
|
|
|
this.dialogImageUrl = file.url;
|
|
|
|
this.dialogVisible = true;
|
2023-11-02 18:32:07 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
2023-11-03 17:59:55 +08:00
|
|
|
.d-dialog >>> .el-upload--picture-card {
|
|
|
|
width: 100px;
|
|
|
|
height: 100px;
|
|
|
|
line-height: 100px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.d-dialog >>> .avatar-uploader .el-upload {
|
|
|
|
width: 100px;
|
|
|
|
height: 100px;
|
|
|
|
}
|
|
|
|
.d-dialog >>> .el-upload-list--picture-card .el-upload-list__item {
|
|
|
|
width: 100px;
|
|
|
|
height: 100px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.list-img{
|
|
|
|
width: 100px;
|
|
|
|
height: 100px;
|
2023-11-02 18:32:07 +08:00
|
|
|
}
|
|
|
|
</style>
|