|
|
@@ -1,284 +1,521 @@
|
|
|
<template>
|
|
|
- <div class="app-list-content">
|
|
|
- <x-crud
|
|
|
- class="liu-crud-wrap"
|
|
|
- @load="onLoad"
|
|
|
- >
|
|
|
- <template #slot-tabs>
|
|
|
- <el-tabs
|
|
|
- class="liu-tabs"
|
|
|
- type="border-card"
|
|
|
- v-model="tabIndex"
|
|
|
- @tab-click="tabClick"
|
|
|
- >
|
|
|
- <el-tab-pane
|
|
|
- v-for="(item, index) in tabsData"
|
|
|
- :key="index"
|
|
|
- :label="item.text"
|
|
|
- :name="item.key"
|
|
|
- >
|
|
|
- </el-tab-pane>
|
|
|
- </el-tabs>
|
|
|
- </template>
|
|
|
+ <div class="app-list-content">
|
|
|
+ <x-crud class="liu-crud-wrap" @load="onLoad">
|
|
|
+ <template #slot-tabs>
|
|
|
+ <el-tabs
|
|
|
+ class="liu-tabs"
|
|
|
+ type="border-card"
|
|
|
+ v-model="tabIndex"
|
|
|
+ @tab-click="tabClick"
|
|
|
+ >
|
|
|
+ <el-tab-pane
|
|
|
+ v-for="(item, index) in tabsData"
|
|
|
+ :key="index"
|
|
|
+ :label="item.text"
|
|
|
+ :name="item.key"
|
|
|
+ >
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </template>
|
|
|
|
|
|
- <template #table-column-avatarUrl="{scope}">
|
|
|
- <cl-avatar
|
|
|
- shape="square"
|
|
|
- :size="32"
|
|
|
- :src="scope.row.smallImgList[0]"
|
|
|
- :style="{ margin: 'auto' }"
|
|
|
- ></cl-avatar>
|
|
|
- </template>
|
|
|
+ <template #table-column-avatarUrl="{ scope }">
|
|
|
+ <cl-avatar
|
|
|
+ shape="square"
|
|
|
+ :size="32"
|
|
|
+ :src="scope.row.smallImgList[0]"
|
|
|
+ :style="{ margin: 'auto' }"
|
|
|
+ ></cl-avatar>
|
|
|
+ </template>
|
|
|
|
|
|
- <template #table-column-goodsName="{scope}">
|
|
|
- <span>{{ scope.row.goodsName }}</span>
|
|
|
- </template>
|
|
|
+ <template #table-column-goodsName="{ scope }">
|
|
|
+ <span>{{ scope.row.goodsName }}</span>
|
|
|
+ </template>
|
|
|
|
|
|
- <template #table-column-inTurn="{scope}">
|
|
|
- <span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
|
- <el-input
|
|
|
- ref="sort-input"
|
|
|
- focus
|
|
|
- size="mini"
|
|
|
- v-else
|
|
|
- v-model="scope.row.inTurn"
|
|
|
- @blur="changeSort(scope.row)"
|
|
|
- ></el-input>
|
|
|
- </template>
|
|
|
+ <template #table-column-inTurn="{ scope }">
|
|
|
+ <span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
|
+ <el-input
|
|
|
+ ref="sort-input"
|
|
|
+ focus
|
|
|
+ size="mini"
|
|
|
+ v-else
|
|
|
+ v-model="scope.row.inTurn"
|
|
|
+ @blur="changeSort(scope.row)"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
|
|
|
- <!-- 排序 -->
|
|
|
- <template #table-header-inTurn>
|
|
|
- <div class="set-sort">
|
|
|
- <span>排序</span>
|
|
|
- <el-button
|
|
|
- v-if="!sort.status"
|
|
|
- icon="el-icon-edit-outline"
|
|
|
- size="small"
|
|
|
- type="text"
|
|
|
- @click="showSort"
|
|
|
- class="show"
|
|
|
- ></el-button>
|
|
|
+ <template #slot-modify="{ scope }">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click.native.stop="replaceBtnFn(scope.row.id, scope.row.name)"
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
|
|
|
- <el-button
|
|
|
- class="hide"
|
|
|
- v-else
|
|
|
- size="mini"
|
|
|
- @click="hideSort"
|
|
|
- type="primary"
|
|
|
- >完成</el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template
|
|
|
- #slot-add-goods-btn
|
|
|
- v-if="showAddBtn"
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- @click="add()"
|
|
|
- >添加</el-button>
|
|
|
- </template>
|
|
|
- </x-crud>
|
|
|
+ <!-- 排序 -->
|
|
|
+ <template #table-header-inTurn>
|
|
|
+ <div class="set-sort">
|
|
|
+ <span>排序</span>
|
|
|
+ <el-button
|
|
|
+ v-if="!sort.status"
|
|
|
+ icon="el-icon-edit-outline"
|
|
|
+ size="small"
|
|
|
+ type="text"
|
|
|
+ @click="showSort"
|
|
|
+ class="show"
|
|
|
+ ></el-button>
|
|
|
|
|
|
- </div>
|
|
|
+ <el-button class="hide" v-else size="mini" @click="hideSort" type="primary"
|
|
|
+ >完成</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #slot-add-goods-btn>
|
|
|
+ <el-button type="primary" size="mini" @click="addBtn">添加</el-button>
|
|
|
+ </template>
|
|
|
+ </x-crud>
|
|
|
+
|
|
|
+ <!-- 新增弹窗 -->
|
|
|
+ <el-dialog
|
|
|
+ :title="`${addOrModify == 1 ? '添加' : '修改'}花材`"
|
|
|
+ :visible.sync="addDialog"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ width="600px"
|
|
|
+ >
|
|
|
+ <div class="ad-modal-content">
|
|
|
+ <el-form
|
|
|
+ :model="adForm"
|
|
|
+ :rules="adFormRules"
|
|
|
+ ref="adForm"
|
|
|
+ label-width="100px"
|
|
|
+ class="demo-form"
|
|
|
+ >
|
|
|
+ <el-form-item label="名称" prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model="adForm.name"
|
|
|
+ placeholder="请输入名称"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="别名" prop="alias">
|
|
|
+ <el-input
|
|
|
+ v-model="adForm.alias"
|
|
|
+ placeholder="请输入别名"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="图片" prop="adImg">
|
|
|
+ <cl-upload v-model="adForm.adImg" :success="uploadSuccess"></cl-upload>
|
|
|
+ <p style="font-size: 14px; color: #cccccc">建议上传图片比例 400X400</p>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="分类" prop="classId">
|
|
|
+ <el-select
|
|
|
+ v-model="adForm.className"
|
|
|
+ size="small"
|
|
|
+ placeholder="请选择分类"
|
|
|
+ @change="selClassFn"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in itemClassList"
|
|
|
+ :key="index"
|
|
|
+ :value="item.name"
|
|
|
+ >{{ item.name }}</el-option
|
|
|
+ >
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="大单位" prop="bigUnitId">
|
|
|
+ <el-select
|
|
|
+ v-model="adForm.bigUnitName"
|
|
|
+ size="small"
|
|
|
+ placeholder="请选择单位"
|
|
|
+ @change="selBigUnitFn"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in unitList"
|
|
|
+ :key="index"
|
|
|
+ :value="item.name"
|
|
|
+ >{{ item.name }}</el-option
|
|
|
+ >
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="小单位" prop="samllUnitId">
|
|
|
+ <el-select
|
|
|
+ v-model="adForm.samllUnitName"
|
|
|
+ size="small"
|
|
|
+ placeholder="请选择单位"
|
|
|
+ @change="selSmallUnitFn"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in unitList"
|
|
|
+ :key="index"
|
|
|
+ :value="item.name"
|
|
|
+ >{{ item.name }}</el-option
|
|
|
+ >
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="单位比" prop="ratio">
|
|
|
+ <el-input
|
|
|
+ v-model="adForm.ratio"
|
|
|
+ placeholder="1扎=20支,请输入20"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="库存预警" prop="stockWarning">
|
|
|
+ <el-input
|
|
|
+ v-model="adForm.stockWarning"
|
|
|
+ placeholder="请输入别名"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item label="每扎成本价" prop="cost">
|
|
|
+ <el-input
|
|
|
+ v-model="adForm.cost"
|
|
|
+ placeholder="请输入别名"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item label="每扎加价" prop="addPrice">
|
|
|
+ <el-input
|
|
|
+ v-model="adForm.addPrice"
|
|
|
+ placeholder="请输入价格"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="small" @click="resetForm">取 消</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="addFn">确认</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
|
|
export default {
|
|
|
- name: 'item_list',
|
|
|
- components: {
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- app: null,
|
|
|
- sortLink: '',
|
|
|
- operateData: {},
|
|
|
- tabIndex: '0',
|
|
|
- tabsData: [
|
|
|
- {
|
|
|
- text: '花材列表',
|
|
|
- key: '0'
|
|
|
- }
|
|
|
- ],
|
|
|
- selects: {},
|
|
|
- sort: {
|
|
|
- status: false
|
|
|
- },
|
|
|
- classId: 0,
|
|
|
- showAddBtn: false,
|
|
|
- showItemModal: false,
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {
|
|
|
- },
|
|
|
- methods: {
|
|
|
- selGoodsConfirmFn (item) {
|
|
|
- let param = []
|
|
|
- item.forEach(value => {
|
|
|
- let newObj = {}
|
|
|
- newObj.itemId = value.id
|
|
|
- newObj.classId = this.classId
|
|
|
- newObj.cost = value.cost
|
|
|
- newObj.addPrice = value.addPrice
|
|
|
- newObj.stockWarning = value.stockWarning
|
|
|
- param.push(newObj)
|
|
|
- })
|
|
|
- param = JSON.stringify(param)
|
|
|
- console.log(param)
|
|
|
- this.$service.item.batchAdd({ data: param }).then(res => {
|
|
|
- this.$message.success('操作成功!');
|
|
|
- this.showItemModal = false
|
|
|
- this.$router.go(0)
|
|
|
- }).catch(err => { console.log(err) })
|
|
|
- },
|
|
|
- add () {
|
|
|
- this.showItemModal = true
|
|
|
- },
|
|
|
- tabClick (tab, e) {
|
|
|
- this.app.refresh({ classId: this.classId });
|
|
|
- },
|
|
|
- onLoad ({ ctx, app }) {
|
|
|
- this.app = app;
|
|
|
- if (this.$route.query.classId) {
|
|
|
- this.classId = this.$route.query.classId
|
|
|
- if (this.$route.query.name != '') {
|
|
|
- this.tabsData[0].text = this.$route.query.name
|
|
|
- this.$forceUpdate()
|
|
|
- this.showAddBtn = true
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.showAddBtn = false
|
|
|
- }
|
|
|
- let getItem = () => {
|
|
|
- return this.$service.item.list({ classId: this.classId })
|
|
|
- };
|
|
|
- ctx.service({
|
|
|
- page: getItem
|
|
|
- })
|
|
|
- .set('table', {
|
|
|
- columns: [
|
|
|
- {
|
|
|
- prop: 'id',
|
|
|
- label: 'ID',
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'name',
|
|
|
- label: '名称',
|
|
|
- align: 'center',
|
|
|
- 'min-width': 180
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'stockWarning',
|
|
|
- label: '库存预警',
|
|
|
- align: 'center',
|
|
|
- 'min-width': 100
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'cost',
|
|
|
- label: '每扎成本价',
|
|
|
- align: 'center',
|
|
|
- 'min-width': 100
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'addPrice',
|
|
|
- label: '每扎加价',
|
|
|
- align: 'center',
|
|
|
- 'min-width': 100
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'inTurn',
|
|
|
- label: '排序',
|
|
|
- align: 'center',
|
|
|
- minWidth: 100
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'addTime',
|
|
|
- label: '创建时间',
|
|
|
- align: 'center',
|
|
|
- minWidth: 180
|
|
|
- }
|
|
|
- ],
|
|
|
- op: {
|
|
|
- visible: true,
|
|
|
- props: {
|
|
|
- width: 300,
|
|
|
- align: 'center',
|
|
|
- fixed: 'right',
|
|
|
- label: '操作'
|
|
|
- },
|
|
|
- layout: []
|
|
|
- }
|
|
|
- })
|
|
|
- .set('dict', {
|
|
|
- search: {
|
|
|
- keyWord: 'goodsName'
|
|
|
- }
|
|
|
- })
|
|
|
- .set('search', {
|
|
|
- key: {
|
|
|
- placeholder: '分类名称'
|
|
|
- }
|
|
|
- })
|
|
|
- .set('layout', [
|
|
|
- ['slot-tabs'],
|
|
|
- ['flex1', 'slot-add-goods-btn', 'refresh-btn'],
|
|
|
- ['data-table'],
|
|
|
- ['flex1', 'pagination']
|
|
|
- ])
|
|
|
- .done();
|
|
|
- app.refresh({ classId: this.classId });
|
|
|
- },
|
|
|
+ name: 'item_list',
|
|
|
+ components: {},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ app: null,
|
|
|
+ sortLink: '',
|
|
|
+ operateData: {},
|
|
|
+ tabIndex: '0',
|
|
|
+ tabsData: [
|
|
|
+ {
|
|
|
+ text: '花材列表',
|
|
|
+ key: '0',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ selects: {},
|
|
|
+ sort: {
|
|
|
+ status: false,
|
|
|
+ },
|
|
|
+ classId: 0,
|
|
|
+ addDialog: false,
|
|
|
+ adForm: {
|
|
|
+ name: '',
|
|
|
+ alias: '',
|
|
|
+ classId: '',
|
|
|
+ className: '',
|
|
|
+ adImg: '',
|
|
|
+ bigUnitName: '',
|
|
|
+ bigUnitId: '',
|
|
|
+ smallUnitName: '',
|
|
|
+ smallUnitId: '',
|
|
|
+ stockWarning:'',
|
|
|
+ cost:'',
|
|
|
+ addPrice:''
|
|
|
+ },
|
|
|
+ addOrModify: 1,
|
|
|
+ adFormRules: {
|
|
|
+ name: {
|
|
|
+ required: true,
|
|
|
+ message: '广告图名称不能为空',
|
|
|
+ },
|
|
|
+ adImg: {
|
|
|
+ required: true,
|
|
|
+ message: '广告图片不能为空',
|
|
|
+ },
|
|
|
+ style: {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ const { url, style } = this.adForm;
|
|
|
+ if (style == '0') {
|
|
|
+ if (!url) {
|
|
|
+ //return callback(new Error('链接不能为空'));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!this.goodsData.id) {
|
|
|
+ return callback(new Error('请选择商品'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ callback();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ //分类列表
|
|
|
+ itemClassList: [],
|
|
|
+ unitList: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {},
|
|
|
+ methods: {
|
|
|
+ selClassFn(val) {
|
|
|
+ let index = this.itemClassList.findIndex((e) => e.name == val);
|
|
|
+ this.adForm.classId = this.itemClassList[index].id;
|
|
|
+ },
|
|
|
+ selBigUnitFn(val) {
|
|
|
+ let index = this.unitList.findIndex((e) => e.name == val);
|
|
|
+ this.adForm.bigUnitId = this.unitList[index].id;
|
|
|
+ },
|
|
|
+ selSmallUnitFn(val) {
|
|
|
+ let index = this.unitList.findIndex((e) => e.name == val);
|
|
|
+ this.adForm.smallUnitId = this.unitList[index].id;
|
|
|
+ },
|
|
|
+ getAllClass() {
|
|
|
+ if (!this.$util.isEmpty(this.itemClassList)) {
|
|
|
+ return this.itemClassList;
|
|
|
+ }
|
|
|
+ this.$service.itemClass.getAllClass().then((res) => {
|
|
|
+ this.itemClassList = res.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getAllUnit() {
|
|
|
+ if (!this.$util.isEmpty(this.unitList)) {
|
|
|
+ return this.unitList;
|
|
|
+ }
|
|
|
+ this.$service.unit.getAllUnit().then((res) => {
|
|
|
+ this.unitList = res.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ uploadSuccess() {
|
|
|
+ this.$refs['adForm'].validateField('adImg');
|
|
|
+ },
|
|
|
+ addBtn() {
|
|
|
+ this.getAllClass()
|
|
|
+ this.getAllUnit()
|
|
|
+ this.addDialog = true
|
|
|
+ this.adForm = {
|
|
|
+ name: '',
|
|
|
+ alias: '',
|
|
|
+ adImg: '',
|
|
|
+ bigUnitName: '',
|
|
|
+ bigUnitId: '',
|
|
|
+ smallUnitName: '',
|
|
|
+ smallUnitId: '',
|
|
|
+ stockWarning:'',
|
|
|
+ cost:'',
|
|
|
+ addPrice:''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ selGoodsConfirmFn(item) {
|
|
|
+ let param = [];
|
|
|
+ item.forEach((value) => {
|
|
|
+ let newObj = {};
|
|
|
+ newObj.itemId = value.id;
|
|
|
+ newObj.classId = this.classId;
|
|
|
+ newObj.cost = value.cost;
|
|
|
+ newObj.addPrice = value.addPrice;
|
|
|
+ newObj.stockWarning = value.stockWarning;
|
|
|
+ param.push(newObj);
|
|
|
+ });
|
|
|
+ param = JSON.stringify(param);
|
|
|
+ console.log(param);
|
|
|
+ this.$service.item
|
|
|
+ .batchAdd({ data: param })
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.success('操作成功!');
|
|
|
+ this.$router.go(0);
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ tabClick(tab, e) {
|
|
|
+ this.app.refresh({ classId: this.classId });
|
|
|
+ },
|
|
|
+ onLoad({ ctx, app }) {
|
|
|
+ this.app = app;
|
|
|
+ if (this.$route.query.classId) {
|
|
|
+ this.classId = this.$route.query.classId;
|
|
|
+ if (this.$route.query.name != '') {
|
|
|
+ this.tabsData[0].text = this.$route.query.name;
|
|
|
+ this.$forceUpdate();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let getItem = () => {
|
|
|
+ return this.$service.item.list({ classId: this.classId });
|
|
|
+ };
|
|
|
+ ctx.service({
|
|
|
+ page: getItem,
|
|
|
+ })
|
|
|
+ .set('table', {
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ prop: 'id',
|
|
|
+ label: 'ID',
|
|
|
+ align: 'center',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '名称',
|
|
|
+ align: 'center',
|
|
|
+ 'min-width': 180,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'stockWarning',
|
|
|
+ label: '库存预警',
|
|
|
+ align: 'center',
|
|
|
+ 'min-width': 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'cost',
|
|
|
+ label: '每扎成本价',
|
|
|
+ align: 'center',
|
|
|
+ 'min-width': 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'addPrice',
|
|
|
+ label: '每扎加价',
|
|
|
+ align: 'center',
|
|
|
+ 'min-width': 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'inTurn',
|
|
|
+ label: '排序',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'addTime',
|
|
|
+ label: '创建时间',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 180,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ op: {
|
|
|
+ visible: true,
|
|
|
+ props: {
|
|
|
+ width: 300,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'right',
|
|
|
+ label: '操作',
|
|
|
+ },
|
|
|
+ layout: ['slot-modify'],
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .set('dict', {
|
|
|
+ search: {
|
|
|
+ keyWord: 'goodsName',
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .set('search', {
|
|
|
+ key: {
|
|
|
+ placeholder: '分类名称',
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .set('layout', [
|
|
|
+ ['slot-tabs'],
|
|
|
+ ['flex1', 'slot-add-goods-btn', 'refresh-btn'],
|
|
|
+ ['data-table'],
|
|
|
+ ['flex1', 'pagination'],
|
|
|
+ ])
|
|
|
+ .done();
|
|
|
+ app.refresh({ classId: this.classId });
|
|
|
+ },
|
|
|
|
|
|
- refresh (params) {
|
|
|
- this.app.refresh(params);
|
|
|
- },
|
|
|
+ refresh(params) {
|
|
|
+ this.app.refresh(params);
|
|
|
+ },
|
|
|
|
|
|
- showSort (e) {
|
|
|
- this.sort.status = true;
|
|
|
- },
|
|
|
+ showSort(e) {
|
|
|
+ this.sort.status = true;
|
|
|
+ },
|
|
|
|
|
|
- hideSort (e) {
|
|
|
- this.sort.status = false;
|
|
|
- },
|
|
|
+ hideSort(e) {
|
|
|
+ this.sort.status = false;
|
|
|
+ },
|
|
|
|
|
|
- changeSort (d) {
|
|
|
- this.$service.goods
|
|
|
- .sort({
|
|
|
- inTurn: d.inTurn,
|
|
|
- id: d.id
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.$message.success('修改成功');
|
|
|
- this.refresh();
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- this.$message.error(err);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ changeSort(d) {
|
|
|
+ this.$service.goods
|
|
|
+ .sort({
|
|
|
+ inTurn: d.inTurn,
|
|
|
+ id: d.id,
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$message.success('修改成功');
|
|
|
+ this.refresh();
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ resetForm() {
|
|
|
+ this.goodsData = {};
|
|
|
+ this.$refs['adForm'].resetFields();
|
|
|
+ this.addDialog = false;
|
|
|
+ },
|
|
|
+ addFn() {
|
|
|
+ this.$refs.adForm.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let form = JSON.parse(JSON.stringify(this.adForm));
|
|
|
+ let host = null;
|
|
|
+ if (this.addOrModify == 1) {
|
|
|
+ host = () => {
|
|
|
+ return this.$service.ad.add(form);
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ host = () => {
|
|
|
+ return this.$service.ad.update({
|
|
|
+ id: this.modifyData.id,
|
|
|
+ ...form,
|
|
|
+ });
|
|
|
+ };
|
|
|
+ }
|
|
|
+ host().then((res) => {
|
|
|
+ this.$message.success('操作成功!');
|
|
|
+ this.resetForm();
|
|
|
+ this.app.refresh({ type: this.tabIndex });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.short-link {
|
|
|
- color: $mainColor;
|
|
|
- margin-left: 10px;
|
|
|
- cursor: pointer;
|
|
|
+ color: $mainColor;
|
|
|
+ margin-left: 10px;
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
.set-sort {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- .el-button {
|
|
|
- margin-left: 10px;
|
|
|
- }
|
|
|
- .show {
|
|
|
- font-size: 16px;
|
|
|
- }
|
|
|
- .hide {
|
|
|
- padding: 2px 5px;
|
|
|
- }
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ .el-button {
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+ .show {
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+ .hide {
|
|
|
+ padding: 2px 5px;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|