|
|
@@ -0,0 +1,758 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="商品分类" prop="cateId">
|
|
|
+ <treeselect
|
|
|
+ v-model="queryParams.cateId"
|
|
|
+ style="width:205.4px"
|
|
|
+ :options="categoryOptions"
|
|
|
+ :normalizer="normalizer"
|
|
|
+ placeholder="请选择分类"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="商品名称" prop="productName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.productName"
|
|
|
+ placeholder="请输入商品名称"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="商品编号" prop="barCode">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.barCode"
|
|
|
+ placeholder="请输入商品编号"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属公司">
|
|
|
+ <el-select
|
|
|
+ style="width: 240px"
|
|
|
+ v-model="companyId"
|
|
|
+ multiple
|
|
|
+ placeholder="请选择企业"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in companyOptions"
|
|
|
+ :key="item.companyId"
|
|
|
+ :label="item.companyName"
|
|
|
+ :value="item.companyId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="cyan" icon="el-icon-search" size="mini" @click="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="['store:pickupGoods:add']"
|
|
|
+ >新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ size="mini"
|
|
|
+ :disabled="single"
|
|
|
+ @click="handleUpdate"
|
|
|
+ v-hasPermi="['store:pickupGoods:edit']"
|
|
|
+ >修改</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ size="mini"
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleDelete"
|
|
|
+ v-hasPermi="['store:pickupGoods:remove']"
|
|
|
+ >删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table height="500" border v-loading="loading" :data="pickupGoodsList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="ID" align="center" prop="productId" />
|
|
|
+ <el-table-column label="商品图片" align="center" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-popover placement="right" title="" trigger="hover">
|
|
|
+ <img slot="reference" :src="scope.row.image" width="100">
|
|
|
+ <img :src="scope.row.image" style="max-width: 150px;">
|
|
|
+ </el-popover>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="商品名称" show-overflow-tooltip align="center" prop="productName" />
|
|
|
+ <el-table-column label="分类" align="center" prop="cateName" />
|
|
|
+ <el-table-column label="所属公司" align="center" prop="companyName" />
|
|
|
+ <el-table-column label="售价" align="center" prop="price">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.price != null">{{ scope.row.price.toFixed(2) }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="原价" align="center" prop="otPrice">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.otPrice != null">{{ scope.row.otPrice.toFixed(2) }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="销量" align="center" prop="sales" />
|
|
|
+ <el-table-column label="库存" align="center" prop="stock" />
|
|
|
+ <el-table-column label="类型" align="center" prop="productType">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag v-for="item in productTypeOptions" :key="item.dictValue" v-if="scope.row.productType == item.dictValue">
|
|
|
+ {{ item.dictLabel }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="状态" align="center" prop="isShow">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag :type="getStatusType(scope.row)">
|
|
|
+ {{ getStatusText(scope.row) }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <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)"
|
|
|
+ v-hasPermi="['store:pickupGoods:edit']"
|
|
|
+ >修改</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ v-hasPermi="['store:pickupGoods:remove']"
|
|
|
+ >删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total > 0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 添加或修改自提商品对话框 -->
|
|
|
+ <el-dialog :title="title" v-if="open" :fullscreen="isFullscreen" :visible.sync="open" width="1000px" append-to-body :show-close="false">
|
|
|
+ <template v-slot:title>
|
|
|
+ <div style="display: flex; justify-content: space-between; align-items: center;">
|
|
|
+ <span>{{ title }}</span>
|
|
|
+ <div>
|
|
|
+ <el-button type="text" @click="handleFullScreen" size="middle">
|
|
|
+ <i class="el-icon-full-screen"></i>
|
|
|
+ </el-button>
|
|
|
+ <el-button type="text" @click="open = false">
|
|
|
+ <i class="el-icon-close"></i>
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="商品名称" prop="productName">
|
|
|
+ <el-input v-model="form.productName" placeholder="请输入商品名称" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="商品分类" prop="cateId">
|
|
|
+ <treeselect v-model="form.cateId" :options="categoryOptions" :normalizer="normalizer" placeholder="请选择分类" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="是否药品" prop="isDrug">
|
|
|
+ <el-radio-group v-model="form.isDrug">
|
|
|
+ <el-radio v-for="item in isDrugOptions" :key="item.dictValue" :label="item.dictValue">
|
|
|
+ {{ item.dictLabel }}
|
|
|
+ </el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <div v-if="form.isDrug === '1'">
|
|
|
+ <el-form-item label="药品展示图" prop="drugImage">
|
|
|
+ <Material v-model="drugImageArr" type="image" :num="1" :width="150" :height="150" />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="商品简介" prop="productInfo">
|
|
|
+ <el-input v-model="form.productInfo" type="textarea" :rows="2" placeholder="请输入商品简介" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-form-item label="商品图片" prop="image">
|
|
|
+ <Material v-model="imageArr" type="image" :num="1" :width="150" :height="150" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="轮播图" prop="sliderImage">
|
|
|
+ <Material v-model="photoArr" type="image" :num="10" :width="150" :height="150" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="商品规格">
|
|
|
+ <el-table :data="oneFormValidate" size="small" border class="spec-table">
|
|
|
+ <el-table-column prop="image" label="图片" align="center" width="90">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <single-img v-model="scope.row.image" type="image" :num="1" :width="60" :height="60" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="price" label="售价" align="center" min-width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" v-model="scope.row.price" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="cost" label="成本价" align="center" min-width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" v-model="scope.row.cost" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="otPrice" label="原价" align="center" min-width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" v-model="scope.row.otPrice" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="stock" label="库存" align="center" min-width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" v-model="scope.row.stock" maxlength="7" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="barCode" label="商品编号" min-width="130" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" v-model="scope.row.barCode" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="weight" label="重量(KG)" align="center" min-width="110">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" v-model="scope.row.weight" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="volume" label="体积(m³)" align="center" min-width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" v-model="scope.row.volume" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="integral" label="所需积分" align="center" min-width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" v-model="scope.row.integral" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="商品详情" prop="description" class="editor-form-item">
|
|
|
+ <div class="editor-box">
|
|
|
+ <editor ref="myeditor" @on-text-change="updateText" />
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="商品状态" prop="isShow">
|
|
|
+ <el-radio-group v-model="form.isShow">
|
|
|
+ <el-radio :label="item.dictValue" v-for="item in isShowOptions" :key="item.dictValue">{{ item.dictLabel }}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="是否热卖" prop="isHot">
|
|
|
+ <el-radio-group v-model="form.isHot">
|
|
|
+ <el-radio :label="item.dictValue" v-for="item in isHotOptions" :key="item.dictValue">{{ item.dictLabel }}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="精品推荐" prop="isBest">
|
|
|
+ <el-radio-group v-model="form.isBest">
|
|
|
+ <el-radio :label="item.dictValue" v-for="item in isBestOptions" :key="item.dictValue">{{ item.dictLabel }}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="商城展示" prop="isDisplay">
|
|
|
+ <el-radio-group v-model="form.isDisplay">
|
|
|
+ <el-radio :label="item.dictValue" v-for="item in isDisplayOptions" :key="item.dictValue">{{ item.dictLabel }}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="排序" prop="sort">
|
|
|
+ <el-input-number :min="0" v-model="form.sort" placeholder="请输入排序" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="销量" prop="sales">
|
|
|
+ <el-input-number :min="0" v-model="form.sales" placeholder="请输入销量" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="限购数量" prop="purchaseLimit">
|
|
|
+ <el-input-number
|
|
|
+ :min="0"
|
|
|
+ v-model="form.purchaseLimit"
|
|
|
+ placeholder="请输入限购数量"
|
|
|
+ :controls="true"
|
|
|
+ @input="handlePurchaseLimitInput"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-form-item label="推广分类" prop="tuiCateId">
|
|
|
+ <el-select style="width: 240px" v-model="form.tuiCateId" placeholder="请选择推广分类" clearable size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="item in productTuiCateOptions"
|
|
|
+ :key="item.dictValue"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="商品类型" prop="productType">
|
|
|
+ <el-select style="width: 240px" v-model="form.productType" placeholder="请选择商品类型" clearable size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="item in productTypeOptions"
|
|
|
+ :key="item.dictValue"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属公司" prop="companyIds">
|
|
|
+ <el-select style="width: 240px" v-model="form.companyIds" multiple placeholder="请选择企业" clearable size="small">
|
|
|
+ <div style="padding: 0 20px; display: flex; justify-content: space-between; line-height: 34px;">
|
|
|
+ <el-button type="text" size="mini" @click="form.companyIds = companyOptions.map(item => item.companyId)">全选</el-button>
|
|
|
+ <el-button type="text" size="mini" @click="form.companyIds = companyOptions.map(item => item.companyId).filter(id => !form.companyIds.includes(id))">反选</el-button>
|
|
|
+ <el-button type="text" size="mini" @click="form.companyIds = []">清空</el-button>
|
|
|
+ </div>
|
|
|
+ <el-option
|
|
|
+ v-for="item in companyOptions"
|
|
|
+ :key="item.companyId"
|
|
|
+ :label="item.companyName"
|
|
|
+ :value="item.companyId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </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 {
|
|
|
+ listPickupGoods,
|
|
|
+ getPickupGoods,
|
|
|
+ delPickupGoods,
|
|
|
+ addOrEditPickupGoods
|
|
|
+} from '@/api/hisStore/pickupGoods'
|
|
|
+import { getAllStoreProductCategory } from '@/api/hisStore/storeProductCategory'
|
|
|
+import { getCompanyList } from '@/api/company/company'
|
|
|
+import Treeselect from '@riophae/vue-treeselect'
|
|
|
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
+import Editor from '@/components/Editor/wang'
|
|
|
+import Material from '@/components/Material'
|
|
|
+import singleImg from '@/components/Material/single'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'PickupGoods',
|
|
|
+ components: {
|
|
|
+ Treeselect,
|
|
|
+ Editor,
|
|
|
+ Material,
|
|
|
+ singleImg
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ imageArr(val) {
|
|
|
+ this.form.image = val.join(',')
|
|
|
+ },
|
|
|
+ photoArr(val) {
|
|
|
+ this.form.sliderImage = val.join(',')
|
|
|
+ },
|
|
|
+ drugImageArr(val) {
|
|
|
+ this.form.drugImage = val.join(',')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isDrugOptions: [
|
|
|
+ { dictValue: '0', dictLabel: '否' },
|
|
|
+ { dictValue: '1', dictLabel: '是' }
|
|
|
+ ],
|
|
|
+ productTuiCateOptions: [],
|
|
|
+ productTypeOptions: [],
|
|
|
+ isDisplayOptions: [],
|
|
|
+ isBestOptions: [],
|
|
|
+ isHotOptions: [],
|
|
|
+ isShowOptions: [],
|
|
|
+ categoryOptions: [],
|
|
|
+ companyOptions: [],
|
|
|
+ companyId: null,
|
|
|
+ photoArr: [],
|
|
|
+ imageArr: [],
|
|
|
+ drugImageArr: [],
|
|
|
+ oneFormValidate: [
|
|
|
+ {
|
|
|
+ image: '',
|
|
|
+ price: 0,
|
|
|
+ cost: 0,
|
|
|
+ otPrice: 0,
|
|
|
+ stock: 0,
|
|
|
+ barCode: '',
|
|
|
+ weight: 0,
|
|
|
+ volume: 0,
|
|
|
+ integral: 0
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ loading: true,
|
|
|
+ ids: [],
|
|
|
+ single: true,
|
|
|
+ multiple: true,
|
|
|
+ showSearch: true,
|
|
|
+ isFullscreen: false,
|
|
|
+ total: 0,
|
|
|
+ pickupGoodsList: [],
|
|
|
+ title: '',
|
|
|
+ open: false,
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ cateId: null,
|
|
|
+ productName: null,
|
|
|
+ barCode: null,
|
|
|
+ companyIds: null
|
|
|
+ },
|
|
|
+ form: {},
|
|
|
+ rules: {
|
|
|
+ image: [{ required: true, message: '商品图片不能为空', trigger: 'blur' }],
|
|
|
+ sliderImage: [{ required: true, message: '轮播图不能为空', trigger: 'blur' }],
|
|
|
+ productName: [{ required: true, message: '商品名称不能为空', trigger: 'blur' }],
|
|
|
+ cateId: [{ required: true, message: '分类不能为空', trigger: 'blur' }],
|
|
|
+ companyIds: [{ required: true, type: 'array', min: 1, message: '所属公司不能为空', trigger: 'change' }],
|
|
|
+ drugImage: [{
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (this.form.isDrug === '1' && !value) {
|
|
|
+ callback(new Error('药品展示图不能为空'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: 'blur'
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getDicts('store_product_tui_cate').then(response => {
|
|
|
+ this.productTuiCateOptions = response.data
|
|
|
+ })
|
|
|
+ this.getDicts('store_product_enable').then(response => {
|
|
|
+ this.isBestOptions = response.data
|
|
|
+ this.isHotOptions = response.data
|
|
|
+ this.isDisplayOptions = response.data
|
|
|
+ })
|
|
|
+ this.getDicts('store_product_type').then(response => {
|
|
|
+ this.productTypeOptions = response.data
|
|
|
+ })
|
|
|
+ this.getDicts('store_product_is_show').then(response => {
|
|
|
+ this.isShowOptions = response.data
|
|
|
+ })
|
|
|
+ getCompanyList().then(response => {
|
|
|
+ this.companyOptions = response.data
|
|
|
+ })
|
|
|
+ this.getTreeselect()
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getStatusText(row) {
|
|
|
+ const option = this.isShowOptions.find(item => item.dictValue == row.isShow)
|
|
|
+ return option ? option.dictLabel : '未知状态'
|
|
|
+ },
|
|
|
+ getStatusType(row) {
|
|
|
+ const statusMap = {
|
|
|
+ 0: 'warning',
|
|
|
+ 1: 'success',
|
|
|
+ 2: 'danger'
|
|
|
+ }
|
|
|
+ return statusMap[row.isShow] || 'info'
|
|
|
+ },
|
|
|
+ handleFullScreen() {
|
|
|
+ this.isFullscreen = !this.isFullscreen
|
|
|
+ },
|
|
|
+ handlePurchaseLimitInput(value) {
|
|
|
+ if (value !== null && value !== undefined && value !== '') {
|
|
|
+ if (isNaN(value) || value < 0) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.form.purchaseLimit = null
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.form.purchaseLimit = Math.floor(Number(value))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateText(text) {
|
|
|
+ this.form.description = text
|
|
|
+ },
|
|
|
+ normalizer(node) {
|
|
|
+ if (node.children && !node.children.length) {
|
|
|
+ delete node.children
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ id: node.cateId,
|
|
|
+ label: node.cateName,
|
|
|
+ children: node.children
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getTreeselect() {
|
|
|
+ getAllStoreProductCategory().then(response => {
|
|
|
+ this.categoryOptions = []
|
|
|
+ this.categoryOptions = this.handleTree(response.data, 'cateId', 'pid')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ this.loading = true
|
|
|
+ listPickupGoods(this.queryParams).then(response => {
|
|
|
+ this.pickupGoodsList = response.rows
|
|
|
+ this.total = response.total
|
|
|
+ this.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+ this.open = false
|
|
|
+ this.reset()
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ productId: null,
|
|
|
+ image: null,
|
|
|
+ sliderImage: null,
|
|
|
+ productName: null,
|
|
|
+ productInfo: null,
|
|
|
+ cateId: null,
|
|
|
+ sort: null,
|
|
|
+ sales: null,
|
|
|
+ isShow: '0',
|
|
|
+ isHot: '0',
|
|
|
+ isBest: '0',
|
|
|
+ description: null,
|
|
|
+ isDisplay: '1',
|
|
|
+ specType: 0,
|
|
|
+ productType: '1',
|
|
|
+ companyIds: [],
|
|
|
+ isDrug: '0',
|
|
|
+ drugImage: null,
|
|
|
+ purchaseLimit: null,
|
|
|
+ tuiCateId: null
|
|
|
+ }
|
|
|
+ this.drugImageArr = []
|
|
|
+ this.resetForm('form')
|
|
|
+ this.oneFormValidate = [
|
|
|
+ {
|
|
|
+ image: '',
|
|
|
+ price: 0,
|
|
|
+ cost: 0,
|
|
|
+ otPrice: 0,
|
|
|
+ stock: 0,
|
|
|
+ barCode: '',
|
|
|
+ weight: 0,
|
|
|
+ volume: 0,
|
|
|
+ integral: 0
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ this.photoArr = []
|
|
|
+ this.imageArr = []
|
|
|
+ },
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1
|
|
|
+ if (this.companyId && this.companyId.length) {
|
|
|
+ this.queryParams.companyIds = this.companyId.join(',')
|
|
|
+ } else {
|
|
|
+ this.queryParams.companyIds = null
|
|
|
+ }
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm('queryForm')
|
|
|
+ this.companyId = null
|
|
|
+ this.queryParams.companyIds = null
|
|
|
+ this.handleQuery()
|
|
|
+ },
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.productId)
|
|
|
+ this.single = selection.length !== 1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ },
|
|
|
+ handleAdd() {
|
|
|
+ this.reset()
|
|
|
+ this.open = true
|
|
|
+ this.title = '添加自提商品'
|
|
|
+ this.$nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ if (this.$refs.myeditor) {
|
|
|
+ this.$refs.myeditor.setText('')
|
|
|
+ }
|
|
|
+ }, 300)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset()
|
|
|
+ const productId = row.productId || this.ids
|
|
|
+ getPickupGoods(productId).then(response => {
|
|
|
+ this.form = response.data
|
|
|
+ this.form.isShow = response.data.isShow != null ? response.data.isShow.toString() : '0'
|
|
|
+ this.form.isHot = response.data.isHot != null ? response.data.isHot.toString() : '0'
|
|
|
+ this.form.isBest = response.data.isBest != null ? response.data.isBest.toString() : '0'
|
|
|
+ this.form.productType = response.data.productType != null ? response.data.productType.toString() : '1'
|
|
|
+ this.form.isDisplay = response.data.isDisplay != null ? response.data.isDisplay.toString() : '1'
|
|
|
+ if (this.form.tuiCateId != null) {
|
|
|
+ this.form.tuiCateId = response.data.tuiCateId.toString()
|
|
|
+ }
|
|
|
+ this.form.isDrug = response.data.isDrug === 0 ? '0' : (response.data.isDrug ? response.data.isDrug.toString() : '0')
|
|
|
+ if (this.form.drugImage != null) {
|
|
|
+ this.drugImageArr = this.form.drugImage.split(',')
|
|
|
+ }
|
|
|
+ if (this.form.companyIds != null && response.data.companyIds && response.data.companyIds.length > 0) {
|
|
|
+ this.form.companyIds = response.data.companyIds.split(',').map(Number)
|
|
|
+ }
|
|
|
+ if (response.values && response.values.length) {
|
|
|
+ this.oneFormValidate = response.values
|
|
|
+ } else if (response.data.values && response.data.values.length) {
|
|
|
+ this.oneFormValidate = response.data.values
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ if (this.$refs.myeditor) {
|
|
|
+ if (this.form.description == null) {
|
|
|
+ this.$refs.myeditor.setText('')
|
|
|
+ } else {
|
|
|
+ this.$refs.myeditor.setText(this.form.description)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 300)
|
|
|
+ if (this.form.image != null) {
|
|
|
+ this.imageArr = this.form.image.split(',')
|
|
|
+ }
|
|
|
+ if (this.form.sliderImage != null) {
|
|
|
+ this.photoArr = this.form.sliderImage.split(',')
|
|
|
+ }
|
|
|
+ this.open = true
|
|
|
+ this.title = '修改自提商品'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ submitForm() {
|
|
|
+ if (this.form.isDrug !== '1') {
|
|
|
+ this.form.drugImage = null
|
|
|
+ }
|
|
|
+ this.$refs['form'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.form.specType = 0
|
|
|
+ this.form.items = []
|
|
|
+ this.form.values = this.oneFormValidate
|
|
|
+ const params = { ...this.form }
|
|
|
+ if (params.companyIds != null && params.companyIds.length) {
|
|
|
+ params.companyIds = params.companyIds.join(',')
|
|
|
+ }
|
|
|
+ addOrEditPickupGoods(params).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess(this.form.productId ? '修改成功' : '新增成功')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDelete(row) {
|
|
|
+ const productIds = row.productId || this.ids
|
|
|
+ this.$confirm('是否确认删除自提商品编号为"' + productIds + '"的数据项?', '警告', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ return delPickupGoods(productIds)
|
|
|
+ }).then(() => {
|
|
|
+ this.getList()
|
|
|
+ this.msgSuccess('删除成功')
|
|
|
+ }).catch(() => {})
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.spec-table {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.editor-form-item {
|
|
|
+ margin-bottom: 22px;
|
|
|
+
|
|
|
+ ::v-deep .el-form-item__content {
|
|
|
+ line-height: normal;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.editor-box {
|
|
|
+ width: 100%;
|
|
|
+ border: 1px solid #dcdfe6;
|
|
|
+ border-radius: 4px;
|
|
|
+ overflow: hidden;
|
|
|
+ background: #fff;
|
|
|
+
|
|
|
+ ::v-deep .myedit {
|
|
|
+ min-height: 350px;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep .w-e-toolbar {
|
|
|
+ flex-wrap: wrap;
|
|
|
+ border: none !important;
|
|
|
+ border-bottom: 1px solid #dcdfe6 !important;
|
|
|
+ background-color: #fafafa !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep .w-e-text-container {
|
|
|
+ min-height: 300px !important;
|
|
|
+ height: auto !important;
|
|
|
+ border: none !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep .w-e-text {
|
|
|
+ min-height: 280px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep .w-e-menu-panel,
|
|
|
+ ::v-deep .w-e-panel-container {
|
|
|
+ z-index: 3000 !important;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|