|
@@ -0,0 +1,562 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+
|
|
|
+ <!-- 搜索工作栏 -->
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="商品名称" prop="name">
|
|
|
+ <el-input v-model="queryParams.name" placeholder="请输入商品名称" clearable @keyup.enter.native="handleQuery" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="商品类型" prop="category">
|
|
|
+ <el-input v-model="queryParams.category" placeholder="请输入商品类型" clearable @keyup.enter.native="handleQuery" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="商品状态" prop="state">
|
|
|
+ <el-input v-model="queryParams.state" placeholder="请输入商品状态" clearable @keyup.enter.native="handleQuery" />
|
|
|
+ </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-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
|
|
+ v-hasPermi="['supplier:goods:create']">新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ <!-- <el-col :span="1.5">
|
|
|
+ <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
|
|
+ v-hasPermi="['supplier:goods:export']">导出</el-button>
|
|
|
+ </el-col> -->
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 列表 -->
|
|
|
+ <el-table v-loading="loading" :data="list">
|
|
|
+ <el-table-column label="序号" align="center" prop="id" />
|
|
|
+ <el-table-column label="商品编号" align="center" prop="code" />
|
|
|
+ <el-table-column label="商品名称" align="center" prop="name" />
|
|
|
+ <el-table-column label="商品类型" align="center" prop="category">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <el-tag> {{ getCategoryName(scope.row.category) }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="商品单价" align="center" prop="price" />
|
|
|
+ <el-table-column label="付款方式" align="center" prop="payMethod">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <dict-tag v-for="item in scope.row.payMethod" :type="DICT_TYPE.PAY_METHOD" :value="item" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="价格策略" align="center" prop="priceStrategy">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <dict-tag :type="DICT_TYPE.PRICE_STRATEGY" :value="scope.row.priceStrategy" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="售后策略" align="center" prop="aftersaleStrategy">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <dict-tag :type="DICT_TYPE.AFTERSALE_STRATEGY" :value="scope.row.aftersaleStrategy" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="关键词" align="center" prop="keyword">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <el-tag v-for="item2 in scope.row.keyword"> {{ item2 }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- <el-table-column label="商品详情" align="center" prop="productDetail" /> -->
|
|
|
+ <el-table-column label="商品图片" align="center" prop="picture" />
|
|
|
+ <el-table-column label="商品状态" align="center" prop="state">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <el-switch v-model="scope.row.state" :active-value="0" :inactive-value="1"
|
|
|
+ @change="handleStatusChange(scope.row)" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <!-- <el-table-column label="商品型号" align="center" prop="model" /> -->
|
|
|
+ <!-- <el-table-column label="商品成本" align="center" prop="cost" /> -->
|
|
|
+ <!-- <el-table-column label="单位" align="center" prop="unit" /> -->
|
|
|
+ <!-- <el-table-column label="包装方式" align="center" prop="pack" /> -->
|
|
|
+ <!-- <el-table-column label="自定义策略" align="center" prop="customStrategy" /> -->
|
|
|
+ <!-- <el-table-column label="商品参数" align="center" prop="productParameter" /> -->
|
|
|
+ <!-- <el-table-column label="附件1" align="center" prop="attachmentOne" /> -->
|
|
|
+ <!-- <el-table-column label="附件2" align="center" prop="attachmentTwo" /> -->
|
|
|
+ <!-- <el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
+ </template>
|
|
|
+</el-table-column> -->
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['supplier:goods:update']">修改</el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
|
|
+ v-hasPermi="['supplier:goods:delete']">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <!-- 分页组件 -->
|
|
|
+ <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList" />
|
|
|
+
|
|
|
+ <!-- 对话框(添加 / 修改) -->
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="800px" v-dialogDrag append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="90px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="13">
|
|
|
+ <el-form-item label="商品编号" prop="code">
|
|
|
+ <el-input v-model="form.code" placeholder="自动生成" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="13">
|
|
|
+ <el-form-item label="商品名称" prop="name">
|
|
|
+ <el-input v-model="form.name" placeholder="请输入商品名称" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="13">
|
|
|
+ <el-form-item label="商品品牌" prop="brand">
|
|
|
+ <el-input v-model="form.brand" placeholder="请输入商品品牌" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="13">
|
|
|
+ <el-form-item label="商品型号" prop="model">
|
|
|
+ <el-input v-model="form.model" placeholder="请输入商品型号" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="13">
|
|
|
+ <el-form-item label="商品图片" prop="picture">
|
|
|
+ <!-- <el-input v-model="form.picture" placeholder="请输入商品图片" /> -->
|
|
|
+ <imageUpload v-model="form.picture" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="商品类型" prop="category">
|
|
|
+ <!-- <el-input v-model="form.category" placeholder="请输入商品类型" /> -->
|
|
|
+ <el-cascader v-model="form.category" :options="goodsCategory" :show-all-levels="false"
|
|
|
+ :props="{ label: 'name', value: 'id', children: 'children', checkStrictly: true }" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="商品成本" prop="cost">
|
|
|
+ <el-input-number v-model="form.cost" :precision="2" :step="100" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="商品单价" prop="price">
|
|
|
+ <el-input-number v-model="form.price" :precision="2" :step="100" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="10">
|
|
|
+ <el-form-item label="单位" prop="unit">
|
|
|
+ <el-input v-model="form.unit" placeholder="请输入单位" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="包装方式" prop="pack">
|
|
|
+ <el-select v-model="form.pack" placeholder="请选择包装方式" clearable>
|
|
|
+ <el-option v-for="dict in this.getDictDatas(DICT_TYPE.GOODS_PACK)" :key="dict.value" :label="dict.label"
|
|
|
+ :value="dict.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="付款方式" prop="payMethod">
|
|
|
+ <el-select v-model="form.payMethod" placeholder="请选择付款方式" multiple>
|
|
|
+ <el-option v-for="dict in this.getDictDatas(DICT_TYPE.PAY_METHOD)" :key="dict.value" :label="dict.label"
|
|
|
+ :value="dict.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="价格策略" prop="priceStrategy">
|
|
|
+ <el-select v-model="form.priceStrategy" placeholder="请选择价格策略" clearable>
|
|
|
+ <el-option v-for="dict in this.getDictDatas(DICT_TYPE.PRICE_STRATEGY)" :key="dict.value"
|
|
|
+ :label="dict.label" :value="dict.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- 阶梯价格策略 -->
|
|
|
+ <el-col :span="24" v-if="form.priceStrategy == 2" style="margin-bottom: 20px;">
|
|
|
+ <el-table :data="priceStrategyTableData" style="width: 100%">
|
|
|
+ <el-table-column prop="level" align="center" label="阶梯" />
|
|
|
+ <el-table-column prop="condition" align="center" label="数量条件" />
|
|
|
+ <el-table-column prop="unit" align="center" label="单位" />
|
|
|
+ <el-table-column prop="category" align="center" label="策略类型" />
|
|
|
+ <el-table-column prop="price" align="center" label="价格/RMB(元)" />
|
|
|
+ </el-table>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="售后策略" prop="aftersaleStrategy">
|
|
|
+ <el-select v-model="form.aftersaleStrategy" placeholder="请选择售后策略" clearable>
|
|
|
+ <el-option v-for="dict in this.getDictDatas(DICT_TYPE.AFTERSALE_STRATEGY)" :key="dict.value"
|
|
|
+ :label="dict.label" :value="dict.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="自定义策略" prop="customStrategy">
|
|
|
+ <el-input type="textarea" v-model="form.customStrategy" placeholder="请输入自定义策略" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="关键词" prop="keyword">
|
|
|
+ <!-- <el-input v-model="form.keyword" placeholder="请输入关键词" /> -->
|
|
|
+ <el-tag :key="tag" v-for="tag in form.keyword" closable :disable-transitions="false"
|
|
|
+ @close="handleClose(tag)">
|
|
|
+ {{ tag }}
|
|
|
+ </el-tag>
|
|
|
+ <el-input class="input-new-tag" v-if="inputVisible" v-model="inputValue" ref="saveTagInput" size="small"
|
|
|
+ @keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm">
|
|
|
+ </el-input>
|
|
|
+ <el-button v-else class="button-new-tag" size="small" @click="showInput">+ 新 关键词</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="商品参数" prop="productParameter">
|
|
|
+ <el-input type="textarea" v-model="form.productParameter" placeholder="请输入商品参数" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="商品详情" prop="productDetail">
|
|
|
+ <editor v-model="form.productDetail" :min-height="192" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="附件1" prop="attachmentOne">
|
|
|
+ <!-- <el-input v-model="form.attachmentOne" placeholder="请输入附件1" /> -->
|
|
|
+ <file-upload v-model="form.attachmentOne" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="附件2" prop="attachmentTwo">
|
|
|
+ <!-- <el-input v-model="form.attachmentTwo" placeholder="请输入附件2" /> -->
|
|
|
+ <file-upload v-model="form.attachmentTwo" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <!-- <el-form-item label="商品状态" prop="state">
|
|
|
+ <el-input v-model="form.state" placeholder="请输入商品状态" />
|
|
|
+ </el-form-item> -->
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {
|
|
|
+ createGoods,
|
|
|
+ updateGoods,
|
|
|
+ deleteGoods,
|
|
|
+ getGoods,
|
|
|
+ getGoodsPage,
|
|
|
+ exportGoodsExcel,
|
|
|
+ changeGoodsStatus,
|
|
|
+} from "@/api/supplier/goods";
|
|
|
+import { getGoodsCategoryListAll, } from "@/api/supplier/goodsCategory";
|
|
|
+import { CommonStatusEnum } from "@/utils/constants";
|
|
|
+import Editor from '@/components/Editor';
|
|
|
+import ImageUpload from "@/components/ImageUpload/index";
|
|
|
+import FileUpload from "@/components/FileUpload/index";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "Goods",
|
|
|
+ components: {
|
|
|
+ Editor,
|
|
|
+ ImageUpload,
|
|
|
+ FileUpload,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ goodsCategory: [],
|
|
|
+ categoryList: [],
|
|
|
+ dynamicTags: [],
|
|
|
+ inputVisible: false,
|
|
|
+ inputValue: '',
|
|
|
+ SysCommonStatusEnum: CommonStatusEnum,
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 导出遮罩层
|
|
|
+ exportLoading: false,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 商品列表列表
|
|
|
+ list: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ code: null,
|
|
|
+ name: null,
|
|
|
+ model: null,
|
|
|
+ category: null,
|
|
|
+ cost: null,
|
|
|
+ unit: null,
|
|
|
+ price: null,
|
|
|
+ state: null,
|
|
|
+ pack: null,
|
|
|
+ payMethod: null,
|
|
|
+ priceStrategy: null,
|
|
|
+ aftersaleStrategy: null,
|
|
|
+ customStrategy: null,
|
|
|
+ keyword: null,
|
|
|
+ productParameter: null,
|
|
|
+ productDetail: null,
|
|
|
+ attachmentOne: null,
|
|
|
+ attachmentTwo: null,
|
|
|
+ createTime: [],
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ },
|
|
|
+ priceStrategyTableData: [
|
|
|
+ { level: '1', condition: '0 ≤ 数量 ≤ 1', unit: '个', category: '固定价格', price: '¥100' },
|
|
|
+ { level: '2', condition: '2 ≤ 数量', unit: '个', category: '折扣/固定价格', price: '80%/¥90' },
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ getGoodsCategoryListAll().then(response => {
|
|
|
+ this.categoryList = response.data
|
|
|
+ this.goodsCategory = this.handleTree(this.categoryList, "id");
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ //获得商品类型名称
|
|
|
+ getCategoryName(category) {
|
|
|
+ for (const item of this.categoryList) {
|
|
|
+ if (item.id === category) {
|
|
|
+ return item.name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "未知类型";
|
|
|
+ },
|
|
|
+ // 商品状态修改
|
|
|
+ handleStatusChange(row) {
|
|
|
+ // 此时,row 已经变成目标状态了,所以可以直接提交请求和提示
|
|
|
+ let text = row.state === CommonStatusEnum.ENABLE ? "启用" : "停用";
|
|
|
+ this.$modal
|
|
|
+ .confirm('确认要"' + text + '""' + row.name + '"商品吗?')
|
|
|
+ .then(function () {
|
|
|
+ return changeGoodsStatus(row.id, row.state);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$modal.msgSuccess(text + "成功");
|
|
|
+ this.getList();
|
|
|
+ })
|
|
|
+ .catch(function () {
|
|
|
+ // 异常时,需要将 row.status 状态重置回之前的
|
|
|
+ row.state =
|
|
|
+ row.status === CommonStatusEnum.ENABLE
|
|
|
+ ? CommonStatusEnum.DISABLE
|
|
|
+ : CommonStatusEnum.ENABLE;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 关键词标签
|
|
|
+ handleClose(tag) {
|
|
|
+ this.form.keyword.splice(this.form.keyword.indexOf(tag), 1);
|
|
|
+ },
|
|
|
+ showInput() {
|
|
|
+ this.inputVisible = true;
|
|
|
+ this.$nextTick(_ => {
|
|
|
+ this.$refs.saveTagInput.$refs.input.focus();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleInputConfirm() {
|
|
|
+ let inputValue = this.inputValue;
|
|
|
+ if (inputValue) {
|
|
|
+ this.form.keyword.push(inputValue);
|
|
|
+ }
|
|
|
+ this.inputVisible = false;
|
|
|
+ this.inputValue = '';
|
|
|
+ },
|
|
|
+ /** 查询列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ // 执行查询
|
|
|
+ getGoodsPage(this.queryParams).then(response => {
|
|
|
+ this.list = response.data.list;
|
|
|
+ for (let i = 0; i < this.list.length; i++) {
|
|
|
+ if (this.list[i].keyword) {
|
|
|
+ this.list[i].keyword = this.list[i].keyword.split(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.total = response.data.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 取消按钮 */
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ /** 表单重置 */
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ id: undefined,
|
|
|
+ code: undefined,
|
|
|
+ name: undefined,
|
|
|
+ model: undefined,
|
|
|
+ picture: undefined,
|
|
|
+ category: undefined,
|
|
|
+ cost: undefined,
|
|
|
+ unit: undefined,
|
|
|
+ price: undefined,
|
|
|
+ state: undefined,
|
|
|
+ pack: undefined,
|
|
|
+ payMethod: undefined,
|
|
|
+ priceStrategy: undefined,
|
|
|
+ aftersaleStrategy: undefined,
|
|
|
+ customStrategy: undefined,
|
|
|
+ keyword: [],
|
|
|
+ productParameter: undefined,
|
|
|
+ productDetail: undefined,
|
|
|
+ attachmentOne: undefined,
|
|
|
+ attachmentTwo: undefined,
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNo = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加商品列表";
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const id = row.id;
|
|
|
+ getGoods(id).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ if (this.form.keyword) {
|
|
|
+ this.form.keyword = this.form.keyword.split(",");
|
|
|
+ }
|
|
|
+ if (this.form.payMethod) {
|
|
|
+ this.form.payMethod = this.form.payMethod.split(",");
|
|
|
+ }
|
|
|
+ this.form.priceStrategy = this.form.priceStrategy + "";
|
|
|
+ this.form.aftersaleStrategy = this.form.aftersaleStrategy + "";
|
|
|
+ this.form.pack = this.form.pack + "";
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改商品列表";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (this.form.category != null && this.form.category != "" && this.form.category instanceof Array) {
|
|
|
+ this.form.category = this.form.category[this.form.category.length - 1];
|
|
|
+ }
|
|
|
+ if (this.form.payMethod != null) {
|
|
|
+ let temp = "";
|
|
|
+ for (let i = 0; i < this.form.payMethod.length; i++) {
|
|
|
+ if (!temp) {
|
|
|
+ temp = this.form.payMethod[i];
|
|
|
+ } else {
|
|
|
+ temp = temp + "," + this.form.payMethod[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.payMethod = temp;
|
|
|
+ }
|
|
|
+ if (this.form.keyword != null) {
|
|
|
+ let temp = "";
|
|
|
+ for (let i = 0; i < this.form.keyword.length; i++) {
|
|
|
+ if (!temp) {
|
|
|
+ temp = this.form.keyword[i];
|
|
|
+ } else {
|
|
|
+ temp = temp + "," + this.form.keyword[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.keyword = temp;
|
|
|
+ }
|
|
|
+ if (!valid) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 修改的提交
|
|
|
+ if (this.form.id != null) {
|
|
|
+ updateGoods(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 添加的提交
|
|
|
+ createGoods(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const id = row.id;
|
|
|
+ this.$modal.confirm('是否确认删除商品列表编号为"' + id + '"的数据项?').then(function () {
|
|
|
+ return deleteGoods(id);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => { });
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ // 处理查询参数
|
|
|
+ let params = { ...this.queryParams };
|
|
|
+ params.pageNo = undefined;
|
|
|
+ params.pageSize = undefined;
|
|
|
+ this.$modal.confirm('是否确认导出所有商品列表数据项?').then(() => {
|
|
|
+ this.exportLoading = true;
|
|
|
+ return exportGoodsExcel(params);
|
|
|
+ }).then(response => {
|
|
|
+ this.$download.excel(response, '商品列表.xls');
|
|
|
+ this.exportLoading = false;
|
|
|
+ }).catch(() => { });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+.el-tag+.el-tag {
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.button-new-tag {
|
|
|
+ margin-left: 10px;
|
|
|
+ height: 32px;
|
|
|
+ line-height: 30px;
|
|
|
+ padding-top: 0;
|
|
|
+ padding-bottom: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.input-new-tag {
|
|
|
+ width: 90px;
|
|
|
+ margin-left: 10px;
|
|
|
+ vertical-align: bottom;
|
|
|
+}
|
|
|
+</style>
|