库存限制修改

This commit is contained in:
Aaron
2021-07-14 18:26:59 +08:00
16 changed files with 377 additions and 241 deletions

View File

@ -2,7 +2,7 @@ ENV = 'development'
# 接口地址 # 接口地址
# VUE_APP_BASE_API = 'http://8.129.208.109:8001' # VUE_APP_BASE_API = 'http://8.129.208.109:8001'
VUE_APP_BASE_API = 'http://www.itxzz.top' VUE_APP_BASE_API = 'http://itxzz.51vip.biz'
# VUE_APP_BASE_API = 'https://app2.yixiang.co' # VUE_APP_BASE_API = 'https://app2.yixiang.co'
VUE_APP_WS_API = 'ws://8.129.208.109:8001' VUE_APP_WS_API = 'ws://8.129.208.109:8001'

View File

@ -8,6 +8,10 @@
<template v-if="device!=='mobile'"> <template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" /> <search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom">
<Github class="right-menu-item hover-effect" />
</el-tooltip>
<el-tooltip content="全屏缩放" effect="dark" placement="bottom"> <el-tooltip content="全屏缩放" effect="dark" placement="bottom">
<screenfull id="screenfull" class="right-menu-item hover-effect" /> <screenfull id="screenfull" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>

View File

@ -25,7 +25,7 @@ export default {
}, },
data() { data() {
return { return {
title: '乐享美酒-后台管理', title: 'YSHOP-后台管理',
logo: Logo logo: Logo
} }
} }

View File

@ -78,7 +78,7 @@ export default {
beforeInit() { beforeInit() {
return true return true
}, },
getQueryParame: function() { getQueryParame() {
return { return {
page: this.page, page: this.page,
size: this.size, size: this.size,

View File

@ -2,7 +2,7 @@ module.exports = {
/** /**
* @description 网站标题 * @description 网站标题
*/ */
title: '乐享美酒', title: 'YSHOP-3.2',
/** /**
* @description 是否显示 tagsView * @description 是否显示 tagsView
*/ */
@ -42,9 +42,9 @@ module.exports = {
/** /**
* 底部文字支持html语法 * 底部文字支持html语法
*/ */
footerTxt: '', footerTxt: '© 2019-2021 YSHOP <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">All Rights Reserved</a>',
/** /**
* 备案号 * 备案号
*/ */
caseNumber: '' caseNumber: '豫ICP备17049587-2号'
} }

View File

@ -40,7 +40,7 @@
<MaterialList v-model="form.sliderImageArr" style="width: 500px" type="image" :num="4" :width="150" :height="150" /> <MaterialList v-model="form.sliderImageArr" style="width: 500px" type="image" :num="4" :width="150" :height="150" />
</el-form-item> </el-form-item>
<el-form-item label="库存"> <el-form-item label="库存">
<el-input-number v-model="form.stock" /> <el-input-number v-model="form.stock" maxlength="7"/>
</el-form-item> </el-form-item>
<el-form-item label="销量"> <el-form-item label="销量">
<el-input-number v-model="form.sales" /> <el-input-number v-model="form.sales" />

View File

@ -1,12 +1,12 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card :bordered="false"> <el-card :bordered="false">
<el-form ref="formValidate" :rules="ruleValidate" :model="formValidate" label-width="130px" > <el-form ref="formValidate" :rules="ruleValidate" :model="formValidate" label-width="130px">
<el-row :gutter="24"> <el-row :gutter="24">
<!-- 商品信息--> <!-- 商品信息-->
<el-col :span="24"> <el-col :span="24">
<el-form-item label="选择商品:" prop="good"> <el-form-item label="选择商品:" prop="good">
<cgood v-model="form1.good" ></cgood> <cgood v-model="form1.good"></cgood>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -16,7 +16,7 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="拼团简介" prop="info"> <el-form-item label="拼团简介" prop="info">
<el-input v-model="formValidate.info" @input="onInput()" style="width: 500px;" placeholder="请输入拼团简介"/> <el-input v-model="formValidate.info" @input="onInput()" style="width: 500px;" placeholder="请输入拼团简介"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -24,13 +24,19 @@
<el-input v-model="formValidate.unitName" @input="onInput()" style="width: 500px;" placeholder="请输入单位"/> <el-input v-model="formValidate.unitName" @input="onInput()" style="width: 500px;" placeholder="请输入单位"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24">
<el-form-item label="商品原价">
<!-- oneFormValidate[0].cost-->
<el-input type="text" style="width: 500px;" disabled v-model="formValidate.productPrice" />
</el-form-item>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="拼团开始时间" prop="startTime"> <el-form-item label="拼团开始时间" prop="startTime">
<template> <template>
<el-date-picker <el-date-picker
v-model="formValidate.startTime" v-model="formValidate.startTime"
type="datetime" type="datetime"
placeholder="选择日期时间" placeholder="选择日期时间"
/> />
</template> </template>
</el-form-item> </el-form-item>
@ -39,84 +45,89 @@
<el-form-item label="拼团结束时间" prop="stopTime"> <el-form-item label="拼团结束时间" prop="stopTime">
<template> <template>
<el-date-picker <el-date-picker
v-model="formValidate.stopTime" v-model="formValidate.stopTime"
type="datetime" type="datetime"
placeholder="选择日期时间" placeholder="选择日期时间"
/> />
</template> </template>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="活动状态" prop="isShow"> <el-form-item label="活动状态" prop="isShow">
<el-radio v-model="formValidate.isShow" :label="1">开启</el-radio> <el-radio v-model="formValidate.isShow" :label="1">开启</el-radio>
<el-radio v-model="formValidate.isShow" :label="0" style="width: 200px;">关闭</el-radio> <el-radio v-model="formValidate.isShow" :label="0" style="width: 200px;">关闭</el-radio>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="产品主图片" prop="image"> <el-form-item label="产品主图片" prop="image">
<single-pic v-model="formValidate.image" style="width: 500px" type="image" :num="1" :width="150" :height="150" /> <single-pic v-model="formValidate.image" style="width: 500px" type="image" :num="1" :width="150"
:height="150"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="产品轮播图" prop="slider_image"> <el-form-item label="产品轮播图" prop="slider_image">
<MaterialList v-model="formValidate.slider_image" style="width: 500px" type="image" :num="4" :width="150" :height="150" /> <MaterialList v-model="formValidate.slider_image" style="width: 500px" type="image" :num="4" :width="150"
:height="150"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="拼团时效(小时)" prop="effectiveTime"> <el-form-item label="拼团时效(小时)" prop="effectiveTime">
<el-input-number v-model="formValidate.effectiveTime" style="width: 500px;" /> <el-input-number v-model="formValidate.effectiveTime" style="width: 500px;"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="拼团人数" prop="people"> <el-form-item label="拼团人数" prop="people">
<el-input-number :min="1" :max="99" v-model="formValidate.people" /> <el-input-number :min="1" :max="99" v-model="formValidate.people"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="商品规格:" props="spec_type"> <el-form-item label="商品规格:" props="spec_type">
<el-radio-group v-model="formValidate.spec_type" @change="changeSpec" :disabled="true"> <el-radio-group v-model="formValidate.spec_type" @change="changeSpec" :disabled="true">
<el-radio :label="0" class="radio">单规格</el-radio> <el-radio :label="0" class="radio">单规格</el-radio>
<el-radio :label="1">多规格{{formValidate.spec_typ}}</el-radio> <el-radio :label="1">多规格{{ formValidate.spec_typ }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 多规格设置--> <!-- 多规格设置-->
<el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24" v-if="manyFormValidate.length && formValidate.header.length!==0 && attrs.length!==0"> <el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24"
v-if="manyFormValidate.length && formValidate.header.length!==0 && attrs.length!==0">
<!-- 多规格表格--> <!-- 多规格表格-->
<el-col :span="24"> <el-col :span="24">
<el-form-item label="商品属性:" class="labeltop"> <el-form-item label="商品属性:" class="labeltop">
<el-table :data="manyFormValidate" size="small" style="width: 90%;"> <el-table :data="manyFormValidate" size="small" style="width: 90%;">
<el-table-column type="myindex" v-for="(item,index) in formValidate.header" :key="index" :label="item.title" :property="item.slot" align="center"> <el-table-column type="myindex" v-for="(item,index) in formValidate.header" :key="index"
:label="item.title" :property="item.slot" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.column.property == 'pic'"> <div v-if="scope.column.property == 'pic'">
<single-pic v-model="scope.row[scope.column.property]" type="image" :num="1" :width="60" :height="60" align="center"/> <single-pic v-model="scope.row[scope.column.property]" type="image" :num="1" :width="60"
:height="60" align="center"/>
</div> </div>
<div v-else-if="scope.column.property.indexOf('value') != -1" > <div v-else-if="scope.column.property.indexOf('value') != -1">
{{ scope.row[scope.column.property] }} {{ scope.row[scope.column.property] }}
</div> </div>
<div v-else-if="scope.column.property == 'pink_price'||scope.column.property == 'pink_stock'" > <div v-else-if="scope.column.property == 'pink_price'||scope.column.property == 'pink_stock'">
<el-input v-model="scope.row[scope.column.property]" align="center"/> <el-input v-model="scope.row[scope.column.property]" align="center"/>
</div> </div>
<div v-else-if="scope.column.property == 'action'" align="center" > <div v-else-if="scope.column.property == 'action'" align="center">
<a :disabled="true" align="center">不可删除</a> <a :disabled="true" align="center">不可删除</a>
</div> </div>
<div v-else> <div v-else>
<el-input v-model="scope.row[scope.column.property]" :disabled="true" align="center"/> <el-input v-model="scope.row[scope.column.property]" :disabled="true" align="center"/>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-col> </el-col>
<!-- 单规格表格--> <!-- 单规格表格-->
<el-col :xl="23" :lg="24" :md="24" :sm="24" :xs="24" v-if="formValidate.spec_type === 0"> <el-col :xl="23" :lg="24" :md="24" :sm="24" :xs="24" v-if="formValidate.spec_type === 0">
<el-form-item > <el-form-item>
<el-table :data="oneFormValidate" size="small" style="width: 90%;"> <el-table :data="oneFormValidate" size="small" style="width: 90%;">
<el-table-column prop="pic" label="图片" align="center"> <el-table-column prop="pic" label="图片" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<single-pic v-model="scope.row.pic" type="image" :num="1" :width="60" :height="60" /> <single-pic v-model="scope.row.pic" type="image" :num="1" :width="60" :height="60"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="bar_code" label="商品编号" align="center"> <el-table-column prop="bar_code" label="商品编号" align="center">
@ -141,18 +152,18 @@
</el-table-column> </el-table-column>
<el-table-column prop="stock" label="库存" align="center"> <el-table-column prop="stock" label="库存" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="text" v-model="scope.row.stock" :disabled="true"/> <el-input type="text" v-model="scope.row.stock" maxlength="7" :disabled="true"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="stock" label="拼团价" align="center"> <el-table-column prop="stock" label="拼团价" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="text" v-model="scope.row.pink_price" /> <el-input type="text" v-model="scope.row.pink_price"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="stock" label="拼团库存" align="center"> <el-table-column prop="stock" label="拼团库存" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="text" v-model="scope.row.pink_stock" /> <el-input type="text" v-model="scope.row.pink_stock" maxlength="7"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="weight" label="重量KG" align="center "> <el-table-column prop="weight" label="重量KG" align="center ">
@ -176,7 +187,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="运费模板:" prop="temp_id"> <el-form-item label="运费模板:" prop="temp_id">
<div class="acea-row"> <div class="acea-row">
<el-select v-model="formValidate.temp_id" class="mr20" :disabled="true"> <el-select v-model="formValidate.temp_id" class="mr20" :disabled="true">
<el-option v-for="(item,index) in templateList" :value="item.id" :key="index" :label="item.name"> <el-option v-for="(item,index) in templateList" :value="item.id" :key="index" :label="item.name">
</el-option> </el-option>
</el-select> </el-select>
@ -187,7 +198,8 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="商品详情:"> <el-form-item label="商品详情:">
<ueditor-wrap v-model="formValidate.description" :config="myConfig" @beforeInit="addCustomDialog" style="width: 90%;"></ueditor-wrap> <ueditor-wrap v-model="formValidate.description" :config="myConfig" @beforeInit="addCustomDialog"
style="width: 90%;"></ueditor-wrap>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -201,8 +213,8 @@
<script> <script>
import cgood from '@/views/components/good' import cgood from '@/views/components/good'
import { getInfo, isFormatAttrForActivity } from '@/api/yxStoreProduct' import {getInfo, isFormatAttrForActivity} from '@/api/yxStoreProduct'
import { add, edit,getCombinationInfo, onsaleCombination, delCombination } from '@/api/yxStoreCombination' import {add, edit, getCombinationInfo, onsaleCombination, delCombination} from '@/api/yxStoreCombination'
import editor from '../../components/Editor' import editor from '../../components/Editor'
import picUpload from '@/components/pic-upload' import picUpload from '@/components/pic-upload'
import mulpicUpload from '@/components/mul-pic-upload' import mulpicUpload from '@/components/mul-pic-upload'
@ -211,8 +223,9 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import MaterialList from '@/components/material' import MaterialList from '@/components/material'
import singlePic from '@/components/singlematerial' import singlePic from '@/components/singlematerial'
import UeditorWrap from 'vue-ueditor-wrap'; import UeditorWrap from 'vue-ueditor-wrap';
export default { export default {
components: { editor, picUpload, mulpicUpload, Treeselect, MaterialList, UeditorWrap, singlePic,cgood }, components: {editor, picUpload, mulpicUpload, Treeselect, MaterialList, UeditorWrap, singlePic, cgood},
data() { data() {
return { return {
spinShow: false, spinShow: false,
@ -229,7 +242,7 @@ export default {
pink_price: 0, pink_price: 0,
weight: 0, weight: 0,
volume: 0, volume: 0,
integral:0 integral: 0
} }
], ],
// 规格数据 // 规格数据
@ -247,13 +260,13 @@ export default {
serverUrl: '' serverUrl: ''
}, },
form1: { form1: {
good:{ good: {
productId: null, productId: null,
storeName: null, storeName: null,
image: null, image: null,
otPrice: null, otPrice: null,
price: null, price: null,
} }
}, },
formValidate: { formValidate: {
@ -265,8 +278,9 @@ export default {
merId: '', merId: '',
image: '', image: '',
images: '', images: '',
imageArr:[], imageArr: [],
sliderImageArr: [], sliderImageArr: [],
productPrice:0,
title: '', title: '',
attr: '', attr: '',
people: 1, people: 1,
@ -306,7 +320,7 @@ export default {
ot_price: 0, ot_price: 0,
stock: 0, stock: 0,
bar_code: '', bar_code: '',
integral:0 integral: 0
} }
], ],
header: [], header: [],
@ -335,7 +349,7 @@ export default {
volume: 0, volume: 0,
brokerage: 0, brokerage: 0,
brokerage_two: 0, brokerage_two: 0,
integral:0 integral: 0
} }
], ],
images: [], images: [],
@ -344,37 +358,37 @@ export default {
tableIndex: 0, tableIndex: 0,
ruleValidate: { ruleValidate: {
title: [ title: [
{ required: true, message: '请输入拼团名称', trigger: 'blur' } {required: true, message: '请输入拼团名称', trigger: 'blur'}
], ],
info: [ info: [
{ required: true, message: '请输入拼团简介', trigger: 'blur' } {required: true, message: '请输入拼团简介', trigger: 'blur'}
], ],
unitName: [ unitName: [
{ required: true, message: '请输入单位', trigger: 'blur' } {required: true, message: '请输入单位', trigger: 'blur'}
], ],
startTime: [ startTime: [
{ required: true, message: '请选择开团时间', trigger: 'blur' } {required: true, message: '请选择开团时间', trigger: 'blur'}
], ],
stopTime: [ stopTime: [
{ required: true, message: '请选择开团结束时间', trigger: 'blur' } {required: true, message: '请选择开团结束时间', trigger: 'blur'}
], ],
isShow: [ isShow: [
{ required: true, message: '请选择活动状态', trigger: 'change' } {required: true, message: '请选择活动状态', trigger: 'change'}
], ],
temp_id: [ temp_id: [
{ required: true, message: '请选择运费模板', trigger: 'change', type: 'number' } {required: true, message: '请选择运费模板', trigger: 'change', type: 'number'}
], ],
price: [ price: [
{ required: true, message: '请输入拼团价格', trigger: 'blur' } {required: true, message: '请输入拼团价格', trigger: 'blur'}
], ],
people: [ people: [
{ required: true, message: '请选择拼团人数', trigger: 'change', type: 'number' } {required: true, message: '请选择拼团人数', trigger: 'change', type: 'number'}
], ],
spec_type: [ spec_type: [
{ required: true, message: '请选择商品规格', trigger: 'change'} {required: true, message: '请选择商品规格', trigger: 'change'}
], ],
effectiveTime: [ effectiveTime: [
{ required: true, message: '请选择拼团时效', trigger: 'blur'} {required: true, message: '请选择拼团时效', trigger: 'blur'}
] ]
}, },
attrs: [] attrs: []
@ -387,34 +401,34 @@ export default {
// } // }
// }, // },
'formValidate.slider_image': function(val) { 'formValidate.slider_image': function (val) {
if (val && Array.isArray(val)) { if (val && Array.isArray(val)) {
this.formValidate.images = val.join(',') this.formValidate.images = val.join(',')
} }
}, },
'form1.good.productId': { 'form1.good.productId': {
handler(val,oldVal){ handler(val, oldVal) {
console.info("val:"+val) console.info("val:" + val)
console.info("oldval:"+oldVal) console.info("oldval:" + oldVal)
if(val){ if (val) {
this.getInfoChooseGood (val) this.getInfoChooseGood(val)
} }
}, },
}, },
}, },
mounted () { mounted() {
this.getInfo(); this.getInfo();
}, },
methods: { methods: {
onInput(){ onInput() {
this.$forceUpdate(); this.$forceUpdate();
}, },
confirm () { confirm() {
let that = this; let that = this;
that.createBnt = true; that.createBnt = true;
if (that.formValidate.selectRule.trim().length <= 0) { if (that.formValidate.selectRule.trim().length <= 0) {
return this.$message({ return this.$message({
message:'请选择属性', message: '请选择属性',
type: 'error' type: 'error'
}); });
} }
@ -425,19 +439,19 @@ export default {
}); });
}, },
// 删除表格中的属性 // 删除表格中的属性
delAttrTable (index) { delAttrTable(index) {
this.manyFormValidate.splice(index, 1); this.manyFormValidate.splice(index, 1);
}, },
// 添加按钮 // 添加按钮
addBtn () { addBtn() {
this.clearAttr(); this.clearAttr();
this.createBnt = false; this.createBnt = false;
this.showIput = true; this.showIput = true;
}, },
// 立即生成 // 立即生成
generate (data) { generate(data) {
isFormatAttrForActivity(data===null?this.formValidate.productId:data, { attrs: this.attrs }).then(res => { isFormatAttrForActivity(data === null ? this.formValidate.productId : data, {attrs: this.attrs}).then(res => {
this.manyFormValidate = res.value; this.manyFormValidate = res.value;
let headerdel = { let headerdel = {
title: '操作', title: '操作',
@ -461,25 +475,25 @@ export default {
}) })
}, },
// 取消 // 取消
offAttrName () { offAttrName() {
this.showIput = false; this.showIput = false;
this.createBnt = true; this.createBnt = true;
}, },
clearAttr () { clearAttr() {
this.formDynamic.attrsName = ''; this.formDynamic.attrsName = '';
this.formDynamic.attrsVal = ''; this.formDynamic.attrsVal = '';
}, },
// 删除规格 // 删除规格
handleRemoveRole (index) { handleRemoveRole(index) {
this.attrs.splice(index, 1); this.attrs.splice(index, 1);
this.manyFormValidate.splice(index, 1); this.manyFormValidate.splice(index, 1);
}, },
// 删除属性 // 删除属性
handleRemove2 (item, index) { handleRemove2(item, index) {
item.splice(index, 1); item.splice(index, 1);
}, },
// 添加规则名称 // 添加规则名称
createAttrName () { createAttrName() {
if (this.formDynamic.attrsName && this.formDynamic.attrsVal) { if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
let data = { let data = {
value: this.formDynamic.attrsName, value: this.formDynamic.attrsName,
@ -501,7 +515,7 @@ export default {
} }
}, },
// 添加属性 // 添加属性
createAttr (num, idx) { createAttr(num, idx) {
if (num) { if (num) {
this.attrs[idx].detail.push(num); this.attrs[idx].detail.push(num);
var hash = {}; var hash = {};
@ -515,21 +529,21 @@ export default {
}, },
// 改变规格 // 改变规格
changeSpec () { changeSpec() {
}, },
// 详情选择商品生成规格用 // 详情选择商品生成规格用
getInfoChooseGood (id) { getInfoChooseGood(id) {
let that = this; let that = this;
let cid = that.$route.params.id || 0; let cid = that.$route.params.id || 0;
getInfo(id==null?0:id).then(async res => { getInfo(id == null ? 0 : id).then(async res => {
let data = res.productInfo; let data = res.productInfo;
if(data){ if (data) {
that.attrs = data.items || []; that.attrs = data.items || [];
//that.formValidate = data; //that.formValidate = data;
Object.keys(that.formValidate).forEach(key=>{ Object.keys(that.formValidate).forEach(key => {
if(data[key]) that.formValidate[key] = data[key]; if (data[key]) that.formValidate[key] = data[key];
}) })
that.formValidate.id = cid; that.formValidate.id = cid;
//that.formValidate.id = 0; //that.formValidate.id = 0;
@ -541,12 +555,13 @@ export default {
// that.formValidate.people = 0 // that.formValidate.people = 0
// that.formValidate.effectiveTime = 0 // that.formValidate.effectiveTime = 0
that.oneFormValidate = [data.attr]; that.oneFormValidate = [data.attr];
that.formValidate.productPrice = that.oneFormValidate[0].cost
that.formValidate.header = []; that.formValidate.header = [];
that.generate(null); that.generate(null);
that.manyFormValidate = data.attrs; that.manyFormValidate = data.attrs;
if(data.spec_type === 0){ if (data.spec_type === 0) {
that.manyFormValidate = []; that.manyFormValidate = [];
}else { } else {
that.createBnt = true; that.createBnt = true;
that.oneFormValidate = [ that.oneFormValidate = [
{ {
@ -560,10 +575,10 @@ export default {
ot_price: 0, ot_price: 0,
stock: 0, stock: 0,
bar_code: '', bar_code: '',
weight:0, weight: 0,
volume:0, volume: 0,
brokerage:0, brokerage: 0,
brokerage_two:0 brokerage_two: 0
} }
] ]
} }
@ -578,26 +593,27 @@ export default {
}, },
// 详情 // 详情
getInfo () { getInfo() {
let that = this; let that = this;
let id = that.$route.params.id || 0; let id = that.$route.params.id || 0;
that.formValidate.id = id; that.formValidate.id = id;
getCombinationInfo(id).then(async res => { getCombinationInfo(id).then(async res => {
let data = res.productInfo; let data = res.productInfo;
if(data){ if (data) {
let cate_id = parseInt(data.cate_id) || 0; let cate_id = parseInt(data.cate_id) || 0;
this.attrs = data.items || []; this.attrs = data.items || [];
that.formValidate = data; that.formValidate = data;
that.formValidate.cate_id = cate_id; that.formValidate.cate_id = cate_id;
that.oneFormValidate = [data.attr]; that.oneFormValidate = [data.attr];
that.formValidate.productPrice = that.oneFormValidate[0].cost
that.formValidate.header = []; that.formValidate.header = [];
that.generate(data.productId); that.generate(data.productId);
that.manyFormValidate = data.attrs; that.manyFormValidate = data.attrs;
that.form1.good.productId = data.productId; that.form1.good.productId = data.productId;
that.form1.good.image = data.image that.form1.good.image = data.image
if(data.spec_type === 0){ if (data.spec_type === 0) {
that.manyFormValidate = []; that.manyFormValidate = [];
}else { } else {
that.createBnt = true; that.createBnt = true;
that.oneFormValidate = [ that.oneFormValidate = [
{ {
@ -611,10 +627,10 @@ export default {
ot_price: 0, ot_price: 0,
stock: 0, stock: 0,
bar_code: '', bar_code: '',
weight:0, weight: 0,
volume:0, volume: 0,
brokerage:0, brokerage: 0,
brokerage_two:0 brokerage_two: 0
} }
] ]
} }
@ -630,35 +646,35 @@ export default {
// 提交 // 提交
handleSubmit (name) { handleSubmit(name) {
this.$refs[name].validate((valid) => { this.$refs[name].validate((valid) => {
if (valid) { if (valid) {
if(this.formValidate.spec_type ===0 ){ if (this.formValidate.spec_type === 0) {
this.formValidate.attrs = this.oneFormValidate; this.formValidate.attrs = this.oneFormValidate;
this.formValidate.header = []; this.formValidate.header = [];
this.formValidate.items = []; this.formValidate.items = [];
}else{ } else {
this.formValidate.items = this.attrs; this.formValidate.items = this.attrs;
this.formValidate.attrs = this.manyFormValidate; this.formValidate.attrs = this.manyFormValidate;
} }
if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){ if (this.formValidate.spec_type === 1 && this.manyFormValidate.length === 0) {
return this.$message.warning('请点击生成规格!'); return this.$message.warning('请点击生成规格!');
} }
edit(this.formValidate).then(async res => { add(this.formValidate).then(async res => {
this.$message({ this.$message({
message:'操作成功', message: '操作成功',
type: 'success' type: 'success'
}); });
setTimeout(() => { setTimeout(() => {
this.$router.push({ path: '/activity/combination' }); this.$router.push({path: '/activity/combination'});
}, 500); }, 500);
}).catch(res => { }).catch(res => {
this.$message.error(res.msg); this.$message.error(res.msg);
}) })
} else { } else {
if(!this.formValidate.store_name || !this.formValidate.cate_id || !this.formValidate.keyword if (!this.formValidate.store_name || !this.formValidate.cate_id || !this.formValidate.keyword
|| !this.formValidate.unit_name || !this.formValidate.store_info || !this.formValidate.unit_name || !this.formValidate.store_info
|| !this.formValidate.image || !this.formValidate.slider_image){ || !this.formValidate.image || !this.formValidate.slider_image) {
this.$message.warning("请填写完整商品信息!"); this.$message.warning("请填写完整商品信息!");
} }
} }
@ -666,12 +682,12 @@ export default {
}, },
// 表单验证 // 表单验证
validate (prop, status, error) { validate(prop, status, error) {
if (status === false) { if (status === false) {
this.$message.warning(error); this.$message.warning(error);
} }
}, },
addCustomDialog () { addCustomDialog() {
window.UE.registerUI('yshop', function (editor, uiName) { window.UE.registerUI('yshop', function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({ let dialog = new window.UE.ui.Dialog({
iframeUrl: '/yshop/materia/index', iframeUrl: '/yshop/materia/index',
@ -705,34 +721,43 @@ export default {
</script> </script>
<style scoped lang="stylus"> <style scoped lang="stylus">
.submission .submission
margin-left 10px; margin-left 10px;
.color-list .tip{
color: #c9c9c9; .color-list .tip {
} color: #c9c9c9;
.color-list .color-item{ }
height: 30px;
line-height: 30px; .color-list .color-item {
padding: 0 10px; height: 30px;
color:#fff; line-height: 30px;
margin-right :10px; padding: 0 10px;
} color: #fff;
.color-list .color-item.blue{ margin-right: 10px;
background-color: #1E9FFF; }
}
.color-list .color-item.yellow{ .color-list .color-item.blue {
background-color: rgb(254, 185, 0); background-color: #1E9FFF;
} }
.color-list .color-item.green{
background-color: #009688; .color-list .color-item.yellow {
} background-color: rgb(254, 185, 0);
.columnsBox }
margin-right 10px
.priceBox .color-list .color-item.green {
width 100% background-color: #009688;
.rulesBox }
display flex
flex-wrap: wrap; .columnsBox
.curs margin-right 10px
cursor pointer
.priceBox
width 100%
.rulesBox
display flex
flex-wrap: wrap;
.curs
cursor pointer
</style> </style>

View File

@ -147,7 +147,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="stock" label="库存" align="center"> <el-table-column prop="stock" label="库存" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="text" v-model="scope.row.stock" :disabled="true"/> <el-input type="text" v-model="scope.row.stock" maxlength="7" :disabled="true"/>
</template> </template>
</el-table-column> </el-table-column>
@ -158,7 +158,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="stock" label="秒杀库存" align="center"> <el-table-column prop="stock" label="秒杀库存" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="text" v-model="scope.row.seckill_stock" /> <el-input type="text" v-model="scope.row.seckill_stock" maxlength="7"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="weight" label="重量KG" align="center "> <el-table-column prop="weight" label="重量KG" align="center ">
@ -222,6 +222,7 @@ export default {
components: { editor, picUpload, mulpicUpload, Treeselect, MaterialList, UeditorWrap, singlePic,cgood }, components: { editor, picUpload, mulpicUpload, Treeselect, MaterialList, UeditorWrap, singlePic,cgood },
data() { data() {
return { return {
isAdd:false,// 是否是添加
spinShow: false,myTimes: [], spinShow: false,myTimes: [],
// 批量设置表格data // 批量设置表格data
oneFormBatch: [ oneFormBatch: [
@ -401,15 +402,20 @@ export default {
if(val){ if(val){
this.getInfoChooseGood (val) this.getInfoChooseGood (val)
} }
}, },
}, },
}, },
mounted () { mounted () {
this.getInfo(), this.getInfo(),
initData('api/yxSystemGroupData',{ groupName: 'yshop_seckill_time' }).then(res => { initData('api/yxSystemGroupData',{ groupName: 'yshop_seckill_time',status:1 }).then(res => {
this.myTimes = res.content this.myTimes = res.content
}) })
if(this.$route.params.id){
this.isAdd = false
} else {
this.isAdd = true
}
}, },
methods: { methods: {
onInput(){ onInput(){
@ -604,6 +610,7 @@ export default {
that.form1.good.image = data.image that.form1.good.image = data.image
that.generate(data.productId); that.generate(data.productId);
that.manyFormValidate = data.attrs; that.manyFormValidate = data.attrs;
console.log(data)
if(data.spec_type === 0){ if(data.spec_type === 0){
that.manyFormValidate = []; that.manyFormValidate = [];
}else { }else {
@ -653,17 +660,35 @@ export default {
if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){ if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){
return this.$message.warning('请点击生成规格!'); return this.$message.warning('请点击生成规格!');
} }
edit(this.formValidate).then(async res => {
this.$message({
message:'操作成功', // 判断是否是添加
type: 'success' if(this.isAdd){
}); console.log(this.formValidate)
setTimeout(() => { add(this.formValidate).then(res=>{
this.$router.push({ path: '/activity/seckill' }); this.$message({
}, 500); message:'操作成功',
}).catch(res => { type: 'success'
this.$message.error(res.msg); });
}) setTimeout(() => {
this.$router.push({ path: '/activity/seckill' });
}, 500);
}).catch(res => {
this.$message.error(res.msg);
})
}else{
add(this.formValidate).then(async res => {
this.$message({
message:'操作成功',
type: 'success'
});
setTimeout(() => {
this.$router.push({ path: '/activity/seckill' });
}, 500);
}).catch(res => {
this.$message.error(res.msg);
})
}
} else { } else {
if(!this.formValidate.store_name || !this.formValidate.cate_id || !this.formValidate.keyword if(!this.formValidate.store_name || !this.formValidate.cate_id || !this.formValidate.keyword
|| !this.formValidate.unit_name || !this.formValidate.store_info || !this.formValidate.unit_name || !this.formValidate.store_info

View File

@ -2,11 +2,24 @@
<div class="login"> <div class="login">
<div style="display:flex;justify-content:space-between;align-items: center;"> <div style="display:flex;justify-content:space-between;align-items: center;">
<div style="padding: 0 60px 0 0"> <div style="padding: 0 60px 0 0">
<h3 style="color: #ffffff;font-size: 24px;padding: 0;margin-bottom: 10px">
YSHOP单商户B2C电商系统
</h3>
<ul style="margin: 0;color: #ffffff;font-size: 15px;line-height: 25px;padding-left: 20px">
<li>Springboot2</li>
<li>MybatisPlus</li>
<li>SpringSecurity</li>
<li>Jwt</li>
<li>Redis</li>
<li>Vue</li>
</ul>
<h3 style="color: #ffffff;">
官网:https://www.yixiang.co
</h3>
</div> </div>
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" label-position="left" label-width="0px" class="login-form"> <el-form ref="loginForm" :model="loginForm" :rules="loginRules" label-position="left" label-width="0px" class="login-form">
<h3 class="title"> <h3 class="title">
乐享美酒管理后台 YSHOP后台管理系统-3.2
</h3> </h3>
<el-form-item prop="username"> <el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号"> <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">

View File

@ -2,32 +2,34 @@
<div class="app-container"> <div class="app-container">
<div class="head-container"> <div class="head-container">
<div v-if="crud.props.searchToggle"> <div v-if="crud.props.searchToggle">
<el-input v-model="query.filter" clearable size="small" placeholder="全表模糊搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> <el-input v-model="query.filter" clearable size="small" placeholder="全表模糊搜索" style="width: 200px;"
<rrOperation :crud="crud" /> class="filter-item" @keyup.enter.native="crud.toQuery"/>
<rrOperation :crud="crud"/>
</div> </div>
<crudOperation> <crudOperation>
<el-button <el-button
slot="left" slot="left"
class="filter-item" class="filter-item"
type="danger" type="danger"
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:loading="delLoading" :loading="delLoading"
:disabled="crud.selections.length === 0" :disabled="crud.selections.length === 0"
@click="doDelete(crud.selections)" @click="doDelete(crud.selections)"
> >
强退 强退
</el-button> </el-button>
</crudOperation> </crudOperation>
</div> </div>
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;"
<el-table-column type="selection" width="55" /> @selection-change="crud.selectionChangeHandler">
<el-table-column v-if="columns.visible('userName')" prop="userName" label="用户名" /> <el-table-column type="selection" width="55"/>
<el-table-column v-if="columns.visible('nickName')" prop="nickName" label="用户昵称" /> <el-table-column v-if="columns.visible('userName')" prop="userName" label="用户名"/>
<el-table-column v-if="columns.visible('ip')" prop="ip" label="登录IP" /> <el-table-column v-if="columns.visible('nickName')" prop="nickName" label="用户昵称"/>
<el-table-column v-if="columns.visible('address')" :show-overflow-tooltip="true" prop="address" label="登录地点" /> <el-table-column v-if="columns.visible('ip')" prop="ip" label="登录IP"/>
<el-table-column v-if="columns.visible('browser')" prop="browser" label="浏览器" /> <el-table-column v-if="columns.visible('address')" :show-overflow-tooltip="true" prop="address" label="登录地点"/>
<el-table-column v-if="columns.visible('browser')" prop="browser" label="浏览器"/>
<el-table-column v-if="columns.visible('loginTime')" prop="loginTime" label="登录时间"> <el-table-column v-if="columns.visible('loginTime')" prop="loginTime" label="登录时间">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.loginTime) }}</span> <span>{{ parseTime(scope.row.loginTime) }}</span>
@ -36,15 +38,17 @@
<el-table-column label="操作" width="100px" fixed="right"> <el-table-column label="操作" width="100px" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover <el-popover
:ref="scope.$index" :ref="scope.$index"
v-permission="['admin']" v-permission="['admin']"
placement="top" placement="top"
width="180" width="180"
> >
<p>确定强制退出该用户吗</p> <p>确定强制退出该用户吗</p>
<div style="text-align: right; margin: 0"> <div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.$index].doClose()">取消</el-button> <el-button size="mini" type="text" @click="$refs[scope.$index].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="delMethod(scope.row.key, scope.$index)">确定</el-button> <el-button :loading="delLoading" type="primary" size="mini" @click="delMethod(scope.row, scope.$index)">
确定
</el-button>
</div> </div>
<el-button slot="reference" size="mini" type="text">强退</el-button> <el-button slot="reference" size="mini" type="text">强退</el-button>
</el-popover> </el-popover>
@ -52,22 +56,22 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<!--分页组件--> <!--分页组件-->
<pagination /> <pagination/>
</div> </div>
</template> </template>
<script> <script>
import { delT } from '@/api/monitor/online' import {delT} from '@/api/monitor/online'
import CRUD, { presenter, header, crud } from '@crud/crud' import CRUD, {presenter, header, crud} from '@crud/crud'
import rrOperation from '@crud/RR.operation' import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation' import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
// crud交由presenter持有 // crud交由presenter持有
const defaultCrud = CRUD({ url: 'auth/online', title: '在线用户', query: { type: 1 }}) const defaultCrud = CRUD({url: 'auth/online', title: '在线用户', query: {type: 1}})
export default { export default {
name: 'OnlineUser', name: 'OnlineUser',
components: { pagination, crudOperation, rrOperation }, components: {pagination, crudOperation, rrOperation},
mixins: [presenter(defaultCrud), header(), crud()], mixins: [presenter(defaultCrud), header(), crud()],
data() { data() {
return { return {
@ -97,16 +101,19 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.delMethod(datas) this.delMethod(datas)
}).catch(() => {}) }).catch(() => {
})
}, },
// 踢出用户 // 踢出用户
delMethod(key, index) { delMethod(data, index) {
const ids = [] const ids = []
if (key instanceof Array) { if (data instanceof Array) {
key.forEach(val => { data.forEach(val => {
ids.push(val.key) ids.push(data.nickName + ":" + data.key)
}) })
} else ids.push(key) } else {
ids.push(data.nickName + ":" + data.key)
}
this.delLoading = true this.delLoading = true
delT(ids).then(() => { delT(ids).then(() => {
this.delLoading = false this.delLoading = false

View File

@ -54,7 +54,6 @@
<udOperation <udOperation
:data="scope.row" :data="scope.row"
:permission="permission" :permission="permission"
:disabled-dle="scope.row.id === 1"
msg="确定删除吗,如果存在下级节点则一并删除,此操作不能撤销!" msg="确定删除吗,如果存在下级节点则一并删除,此操作不能撤销!"
/> />
</template> </template>

View File

@ -67,7 +67,7 @@
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<span :class="attr.check ? 'check':''">库存:</span>&nbsp; <span :class="attr.check ? 'check':''">库存:</span>&nbsp;
<el-input v-model="attr.sales" placeholder="库存" style="width: 60%" :number="true" /> <el-input v-model="attr.sales" placeholder="库存" style="width: 60%" :number="true" maxlength="7"/>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<span :class="attr.check ? 'check':''">成本价:</span>&nbsp; <span :class="attr.check ? 'check':''">成本价:</span>&nbsp;

View File

@ -164,7 +164,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="stock" label="库存" align="center"> <el-table-column prop="stock" label="库存" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="text" v-model="scope.row.stock"/> <el-input type="text" v-model="scope.row.stock" maxlength="7"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="bar_code" label="商品编号" align="center"> <el-table-column prop="bar_code" label="商品编号" align="center">

View File

@ -21,6 +21,12 @@
<el-table-column prop="id" label="ID" /> <el-table-column prop="id" label="ID" />
<el-table-column prop="map.time" label="开启时间(整数小时)" /> <el-table-column prop="map.time" label="开启时间(整数小时)" />
<el-table-column prop="map.continued" label="持续时间(整数小时)" /> <el-table-column prop="map.continued" label="持续时间(整数小时)" />
<el-table-column prop="map.status" label="状态">
<template slot-scope="scope">
<el-tag v-show="scope.row.status == 1" type="success">开启</el-tag>
<el-tag v-show="scope.row.status == 2" type="danger">关闭</el-tag>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center"> <el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" /> <el-button v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" />
@ -75,7 +81,7 @@ export default {
beforeInit() { beforeInit() {
this.url = 'api/yxSystemGroupData' this.url = 'api/yxSystemGroupData'
const sort = 'id,desc' const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_seckill_time' } this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_seckill_time'}
return true return true
}, },
subDelete(id) { subDelete(id) {
@ -107,7 +113,8 @@ export default {
id: data.id, id: data.id,
groupName: data.groupName, groupName: data.groupName,
time: data.map.time, time: data.map.time,
continued: data.map.continued continued: data.map.continued,
status:data.map.status
} }
_this.dialog = true _this.dialog = true
} }

View File

@ -1,11 +1,18 @@
<template> <template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px"> <el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog"
:title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px"> <el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px">
<el-form-item label="开启时间(整数小时)"> <el-form-item label="开启时间(整数小时)">
<el-input v-model="form.time" style="width: 270px;" /> <el-input v-model="form.time" style="width: 270px;"/>
</el-form-item> </el-form-item>
<el-form-item label="持续时间(整数小时)"> <el-form-item label="持续时间(整数小时)">
<el-input v-model="form.continued" style="width: 270px;" /> <el-input v-model="form.continued" style="width: 270px;"/>
</el-form-item>
<el-form-item label="是否开启">
<el-radio-group v-model="form.status">
<el-radio :label="1">开启</el-radio>
<el-radio :label="2">关闭</el-radio>
</el-radio-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -17,10 +24,11 @@
</template> </template>
<script> <script>
import { add, edit } from '@/api/yxSystemGroupData' import {add, edit} from '@/api/yxSystemGroupData'
import picUpload from '@/components/pic-upload' import picUpload from '@/components/pic-upload'
export default { export default {
components: { picUpload }, components: {picUpload},
props: { props: {
isAdd: { isAdd: {
type: Boolean, type: Boolean,
@ -34,10 +42,10 @@ export default {
id: '', id: '',
groupName: 'yshop_seckill_time', groupName: 'yshop_seckill_time',
time: 5, time: 5,
status:2, //默认关闭
continued: 2 continued: 2
}, },
rules: { rules: {}
}
} }
}, },
methods: { methods: {
@ -45,6 +53,9 @@ export default {
this.resetForm() this.resetForm()
}, },
doSubmit() { doSubmit() {
if (parseInt(this.form.continued) + parseInt(this.form.time) > 24) {
return this.$message.error("开启+持续时间不能超过24小时")
}
this.loading = true this.loading = true
if (this.isAdd) { if (this.isAdd) {
this.doAdd() this.doAdd()
@ -87,7 +98,8 @@ export default {
id: '', id: '',
groupName: 'yshop_seckill_time', groupName: 'yshop_seckill_time',
time: 5, time: 5,
continued: 2 continued: 2,
status:2 //默认关闭
} }
} }
} }

View File

@ -2,44 +2,61 @@
<div> <div>
<el-form ref="form" :model="form" :rules="rules" style="margin-top: 6px;" size="small" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" style="margin-top: 6px;" size="small" label-width="100px">
<el-form-item label="邮件标题" prop="subject"> <el-form-item label="邮件标题" prop="subject">
<el-input v-model="form.subject" style="width: 646px" /> <el-input v-model="form.subject" style="width: 646px"/>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-for="(domain, index) in tos" v-for="(domain, index) in tos"
:key="domain.key" :key="domain.key"
:label="'收件邮箱' + (index === 0 ? '': index)" :label="'收件邮箱' + (index === 0 ? '': index)"
> >
<el-input v-model="domain.value" style="width: 550px" /> <el-input v-model="domain.value" style="width: 550px"/>
<el-button icon="el-icon-plus" @click="addDomain" /> <el-button icon="el-icon-plus" @click="addDomain"/>
<el-button style="margin-left:0;" icon="el-icon-minus" @click.prevent="removeDomain(domain)" /> <el-button style="margin-left:0;" icon="el-icon-minus" @click.prevent="removeDomain(domain)"/>
</el-form-item> </el-form-item>
<div ref="editor" class="editor" /> <el-form-item label="邮件内容">
<el-button :loading="loading" style="margin-left:1.6%;" size="medium" type="primary" @click="doSubmit">发送邮件</el-button> <ueditor-wrap v-model="form.content" :config="myConfig" @beforeInit="addCustomDialog"
style="width: 90%;"></ueditor-wrap>
</el-form-item>
<div ref="editor" class="editor"/>
<el-button :loading="loading" style="margin-left:1.6%;" size="medium" type="primary" @click="doSubmit">发送邮件
</el-button>
</el-form> </el-form>
</div> </div>
</template> </template>
<script> <script>
import { send } from '@/api/tools/email' import {send} from '@/api/tools/email'
import { upload } from '@/utils/upload' import {upload} from '@/utils/upload'
import { validEmail } from '@/utils/validate' import {validEmail} from '@/utils/validate'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
import E from 'wangeditor' import UeditorWrap from 'vue-ueditor-wrap';
export default { export default {
name: 'Index', name: 'Index',
data() { data() {
return { return {
loading: false, form: { subject: '', tos: [], content: '' }, myConfig: {
autoHeightEnabled: false, // 编辑器不自动被内容撑高
initialFrameHeight: 500, // 初始容器高度
initialFrameWidth: '100%', // 初始容器宽度
UEDITOR_HOME_URL: '/UEditor/',
serverUrl: ''
},
loading: false, form: {subject: '', tos: [], content: ''},
tos: [{ tos: [{
value: '' value: ''
}], }],
rules: { rules: {
subject: [ subject: [
{ required: true, message: '标题不能为空', trigger: 'blur' } {required: true, message: '标题不能为空', trigger: 'blur'}
] ]
} }
} }
}, },
components: {
UeditorWrap
},
computed: { computed: {
...mapGetters([ ...mapGetters([
'imagesUploadApi' 'imagesUploadApi'
@ -51,7 +68,7 @@ export default {
// 自定义菜单配置 // 自定义菜单配置
editor.customConfig.zIndex = 10 editor.customConfig.zIndex = 10
// 文件上传 // 文件上传
editor.customConfig.customUploadImg = function(files, insert) { editor.customConfig.customUploadImg = function (files, insert) {
// files 是 input 中选中的文件列表 // files 是 input 中选中的文件列表
// insert 是获取图片 url 后,插入到编辑器的方法 // insert 是获取图片 url 后,插入到编辑器的方法
files.forEach(image => { files.forEach(image => {
@ -68,6 +85,30 @@ export default {
editor.create() editor.create()
}, },
methods: { methods: {
addCustomDialog () {
window.UE.registerUI('yshop', function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({
iframeUrl: '/yshop/materia/index',
editor: editor,
name: uiName,
title: '上传图片',
cssRules: 'width:1200px;height:500px;padding:20px;'
});
this.dialog = dialog;
var btn = new window.UE.ui.Button({
name: 'dialog-button',
title: '上传图片',
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`,
onclick: function () {
dialog.render();
dialog.open();
}
});
return btn;
}, 37);
},
removeDomain(item) { removeDomain(item) {
var index = this.tos.indexOf(item) var index = this.tos.indexOf(item)
if (index !== -1 && this.tos.length !== 1) { if (index !== -1 && this.tos.length !== 1) {
@ -91,7 +132,7 @@ export default {
this.form.tos = [] this.form.tos = []
if (valid) { if (valid) {
let sub = false let sub = false
this.tos.forEach(function(data, index) { this.tos.forEach(function (data, index) {
if (data.value === '') { if (data.value === '') {
_this.$message({ _this.$message({
message: '收件邮箱不能为空', message: '收件邮箱不能为空',
@ -108,7 +149,9 @@ export default {
sub = true sub = true
} }
}) })
if (sub) { return false } if (sub) {
return false
}
this.loading = true this.loading = true
send(this.form).then(res => { send(this.form).then(res => {
this.$notify({ this.$notify({
@ -131,12 +174,13 @@ export default {
</script> </script>
<style scoped> <style scoped>
.editor{ .editor {
text-align:left; text-align: left;
margin: 20px; margin: 20px;
width: 730px; width: 730px;
} }
::v-deep .w-e-text-container {
height: 360px !important; ::v-deep .w-e-text-container {
} height: 360px !important;
}
</style> </style>