Browse Source

拼团后端添加对属性的操作

master
xuwenbo 4 years ago
parent
commit
e98cdb88e8
  1. 7
      src/api/yxStoreCombination.js
  2. 7
      src/api/yxStoreProduct.js
  3. 1023
      src/views/activity/combination/form.vue
  4. 222
      src/views/activity/combination/form1.vue
  5. 21
      src/views/activity/combination/index.vue
  6. 1
      src/views/components/good/index.vue
  7. 20
      src/views/shop/goods/form.vue
  8. 33
      src/views/shop/goods/index.vue

7
src/api/yxStoreCombination.js

@ -15,11 +15,10 @@ export function del(id) {
}) })
} }
export function edit(data) { export function getCombinationInfo(id) {
return request({ return request({
url: 'api/yxStoreCombination', url: 'api/yxStoreCombination/info/' + id,
method: 'put', method: 'get'
data
}) })
} }

7
src/api/yxStoreProduct.js

@ -46,6 +46,13 @@ export function isFormatAttr(id, data) {
}) })
} }
export function isFormatAttrForActivity(id, data) {
return request({
url: 'api/yxStoreProduct/isFormatAttrForActivity/' + id,
method: 'post',
data
})
}
export function setAttr(id, data) { export function setAttr(id, data) {
return request({ return request({
url: 'api/yxStoreProduct/setAttr/' + id, url: 'api/yxStoreProduct/setAttr/' + id,

1023
src/views/activity/combination/form.vue

File diff suppressed because it is too large Load Diff

222
src/views/activity/combination/form1.vue

@ -0,0 +1,222 @@
<template>
<el-form ref="form" :model="form" :rules="rules" :inline="true" size="small" label-width="140px">
<el-form-item label="拼团名称">
<el-input v-model="form.title" style="width: 500px;" />
</el-form-item>
<el-form-item label="拼团简介">
<el-input v-model="form.info" style="width: 500px;" />
</el-form-item>
<el-form-item label="单位">
<el-input v-model="form.unitName" style="width: 500px;" />
</el-form-item>
<el-form-item label="拼团开始时间">
<template>
<el-date-picker
v-model="form.startTime"
type="datetime"
placeholder="选择日期时间"
/>
</template>
</el-form-item>
<el-form-item label="拼团结束时间">
<template>
<el-date-picker
v-model="form.stopTime"
type="datetime"
placeholder="选择日期时间"
/>
</template>
</el-form-item>
<el-form-item label="产品主图片">
<MaterialList v-model="form.imageArr" style="width: 500px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="产品轮播图">
<MaterialList v-model="form.sliderImageArr" style="width: 500px" type="image" :num="4" :width="150" :height="150" />
</el-form-item>
<el-form-item label="拼团时效(单位小时)">
<el-input-number v-model="form.effectiveTime" style="width: 500px;" />
</el-form-item>
<el-form-item label="拼团价">
<el-input-number v-model="form.price" />
</el-form-item>
<el-form-item label="拼团人数">
<el-input-number v-model="form.people" />
</el-form-item>
<el-form-item label="库存">
<el-input-number v-model="form.stock" />
</el-form-item>
<el-form-item label="销量">
<el-input-number v-model="form.sales" />
</el-form-item>
<el-form-item label="排序">
<el-input-number v-model="form.sort" />
</el-form-item>
<el-form-item label="邮费">
<el-input-number v-model="form.postage" />
</el-form-item>
<el-form-item label="是否包邮">
<el-radio v-model="form.isPostage" :label="1"></el-radio>
<el-radio v-model="form.isPostage" :label="0" style="width: 110px;"></el-radio>
</el-form-item>
<el-form-item label="活动状态">
<el-radio v-model="form.isShow" :label="1">开启</el-radio>
<el-radio v-model="form.isShow" :label="0" style="width: 200px;">关闭</el-radio>
</el-form-item>
<el-form-item label="详情">
<editor v-model="form.description" />
</el-form-item>
</el-form>
<!-- <div slot="footer" class="dialog-footer">-->
<!-- <el-button type="text" @click="cancel">取消</el-button>-->
<!-- <el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>-->
<!-- </div>-->
</template>
<script>
import { add, edit } from '@/api/yxStoreCombination'
import editor from '../../components/Editor'
import MaterialList from '@/components/material'
export default {
components: { editor, MaterialList },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
productId: '',
merId: '',
image: '',
images: '',
imageArr: [],
sliderImageArr: [],
title: '',
attr: '',
people: '',
info: '',
price: '',
sort: '',
sales: '',
stock: '',
addTime: '',
isHost: '',
isShow: '',
isDel: 0,
merUse: '',
isPostage: '',
postage: '',
description: '',
startTime: '',
stopTime: '',
effectiveTime: '',
cost: '',
unitName: '',
combination: 1,
browse: 0,
startTimeDate: '',
endTimeDate: ''
},
rules: {
}
}
},
watch: {
'form.imageArr': function(val) {
if (val) {
this.form.image = val.join(',')
}
},
'form.sliderImageArr': function(val) {
if (val) {
this.form.images = val.join(',')
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '操作成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
productId: '',
merId: '',
image: '',
images: '',
imageArr: [],
sliderImageArr: [],
title: '',
attr: '',
people: 0,
info: '',
price: 0,
sort: '',
sales: '',
stock: '',
addTime: '',
isHost: '',
isShow: '',
isDel: '',
combination: '',
merUse: '',
isPostage: '',
postage: '',
description: '',
startTimeDate: '',
endTimeDate: '',
effectiveTime: 24,
cost: '',
browse: '',
unitName: ''
}
}
}
}
</script>
<style scoped>
</style>

21
src/views/activity/combination/index.vue

@ -16,7 +16,11 @@
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
@click="add" @click="add"
>新增</el-button> >
<router-link :to="'/activity/combinationAdd'">
新增
</router-link>
</el-button>
</div> </div>
<el-button <el-button
type="danger" type="danger"
@ -27,7 +31,7 @@
>刷新</el-button> >刷新</el-button>
</div> </div>
<!--表单组件--> <!--表单组件-->
<eForm ref="form" :is-add="isAdd" /> <!-- <eForm ref="form" :is-add="isAdd" />-->
<!--表格渲染--> <!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;"> <el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="id" /> <el-table-column prop="id" label="id" />
@ -61,7 +65,15 @@
</el-table-column> </el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_EDIT','YXSTORECOMBINATION_DELETE'])" label="操作" width="150px" align="center" fixed="right"> <el-table-column v-if="checkPermission(['admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_EDIT','YXSTORECOMBINATION_DELETE'])" label="操作" width="150px" align="center" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-permission="['admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" /> <el-button
size="mini"
type="primary"
icon="el-icon-edit"
>
<router-link :to="'/activity/combinationEdit/'+scope.row.id">
编辑
</router-link>
</el-button>
<el-popover <el-popover
:ref="scope.row.id" :ref="scope.row.id"
v-permission="['admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_DELETE']" v-permission="['admin','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_DELETE']"
@ -94,10 +106,9 @@
import checkPermission from '@/utils/permission' import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud' import initData from '@/mixins/crud'
import { del, onsale } from '@/api/yxStoreCombination' import { del, onsale } from '@/api/yxStoreCombination'
import eForm from './form'
import { formatTimeTwo, parseTime } from '@/utils/index' import { formatTimeTwo, parseTime } from '@/utils/index'
export default { export default {
components: { eForm }, components: { },
mixins: [initData], mixins: [initData],
data() { data() {
return { return {

1
src/views/components/good/index.vue

@ -126,6 +126,7 @@ export default {
this.$set(this.value,"image", data.image) this.$set(this.value,"image", data.image)
this.$set(this.value,"otPrice", data.otPrice) this.$set(this.value,"otPrice", data.otPrice)
this.$set(this.value,"price", data.price) this.$set(this.value,"price", data.price)
this.$set(this.value,"cform",data)
this.dialog = false this.dialog = false
}, },
toSelete() { toSelete() {

20
src/views/shop/goods/form.vue

@ -11,9 +11,9 @@
</el-col> </el-col>
<el-col v-bind="grid2"> <el-col v-bind="grid2">
<el-form-item label="商品分类:" prop="cate_id"> <el-form-item label="商品分类:" prop="cate_id">
<el-select v-model="formValidate.cate_id"> <el-select v-model="formValidate.cate_id" filterable :filter-method="dataFilter" clearable>
<el-option v-for="item in treeSelect" :disabled="item.disabled === 0" <el-option v-for="item in optionsMetaShow" :disabled="item.disabled === 0"
:value="item.value" :key="item.id" :label="item.label"></el-option> :value="item.value" :key="item.id" :label="item.label" ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -532,6 +532,7 @@ export default {
}, },
loading: false, loading: false,
treeSelect: [], treeSelect: [],
optionsMetaShow: [],
tableIndex: 0, tableIndex: 0,
ruleValidate: { ruleValidate: {
store_name: [ store_name: [
@ -578,6 +579,18 @@ export default {
this.getInfo(); this.getInfo();
}, },
methods: { methods: {
dataFilter(val){
this.value=val
if(val){
this.optionsMetaShow=this.treeSelect.filter((item=>{
if (!!~item.label.indexOf(val) || !!~item.label.toUpperCase().indexOf(val.toUpperCase())) {
return true
}
}))
}else{
this.optionsMetaShow=this.treeSelect
}
},
confirm () { confirm () {
let that = this; let that = this;
that.createBnt = true; that.createBnt = true;
@ -729,6 +742,7 @@ export default {
that.treeSelect = res.cateList; that.treeSelect = res.cateList;
that.ruleList = res.ruleList; that.ruleList = res.ruleList;
that.templateList = res.tempList; that.templateList = res.tempList;
that.optionsMetaShow = that.treeSelect
}).catch(res => { }).catch(res => {
console.log('err:'+res) console.log('err:'+res)

33
src/views/shop/goods/index.vue

@ -7,8 +7,8 @@
<el-select v-model="query.type" clearable placeholder="搜索类型" class="filter-item" style="width: 130px"> <el-select v-model="query.type" clearable placeholder="搜索类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" /> <el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" />
</el-select> </el-select>
<el-select v-model="cateId" clearable placeholder="商品分类" class="filter-item" style="width: 130px"> <el-select v-model="cateId" clearable placeholder="商品分类" class="filter-item" filterable :filter-method="dataFilter" style="width: 130px">
<el-option v-for="item in cateList" :disabled="item.disabled === 0" <el-option v-for="item in optionsMetaShow" :disabled="item.disabled === 0"
:value="item.value" :value="item.value"
:key="item.id" :key="item.id"
:label="item.label"></el-option> :label="item.label"></el-option>
@ -36,7 +36,6 @@
</div> </div>
</div> </div>
<!--表单组件--> <!--表单组件-->
<comForm ref="form3" :is-add="isAdd" />
<killForm ref="form4" :is-add="isAdd" /> <killForm ref="form4" :is-add="isAdd" />
<bargainForm ref="form5" :is-add="isAdd" /> <bargainForm ref="form5" :is-add="isAdd" />
<!--表格渲染--> <!--表格渲染-->
@ -86,13 +85,6 @@
<el-dropdown size="mini" split-button type="primary" trigger="click"> <el-dropdown size="mini" split-button type="primary" trigger="click">
操作 操作
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<el-button
size="mini"
type="success"
@click="editC(scope.row)"
>开启拼团</el-button>
</el-dropdown-item>
<el-dropdown-item> <el-dropdown-item>
<el-button <el-button
size="mini" size="mini"
@ -130,15 +122,16 @@ import initData from '@/mixins/crud'
import { del, onsale } from '@/api/yxStoreProduct' import { del, onsale } from '@/api/yxStoreProduct'
import eForm from './form' import eForm from './form'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import comForm from '@/views/activity/combination/form'
import killForm from '@/views/activity/seckill/form' import killForm from '@/views/activity/seckill/form'
import bargainForm from '@/views/activity/bargain/form' import bargainForm from '@/views/activity/bargain/form'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
export default { export default {
components: { eForm, comForm, Treeselect,killForm, bargainForm }, components: { eForm, Treeselect,killForm, bargainForm },
mixins: [initData], mixins: [initData],
data() { data() {
return { return {
dropDownValue: '',
optionsMetaShow: [],
delLoading: false, delLoading: false,
visible: false, visible: false,
queryTypeOptions: [ queryTypeOptions: [
@ -150,10 +143,24 @@ export default {
}, },
created() { created() {
this.$nextTick(() => { this.$nextTick(() => {
this.init() this.init().then(() =>{
this.optionsMetaShow = this.cateList
})
}) })
}, },
methods: { methods: {
dataFilter(val){
this.value=val
if(val){
this.optionsMetaShow=this.cateList.filter((item=>{
if (!!~item.label.indexOf(val) || !!~item.label.toUpperCase().indexOf(val.toUpperCase())) {
return true
}
}))
}else{
this.optionsMetaShow=this.cateList
}
},
checkPermission, checkPermission,
beforeInit() { beforeInit() {
this.url = 'api/yxStoreProduct' this.url = 'api/yxStoreProduct'

Loading…
Cancel
Save