yshop3.0-RC2版本

This commit is contained in:
hupeng
2020-07-09 15:59:53 +08:00
parent 329d1e1de3
commit 3dd6eff302
327 changed files with 133884 additions and 2020 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,8 +15,11 @@
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
>
<router-link :to="'/shop/goodsAdd'">
新增
</router-link>
</el-button>
<el-button
type="danger"
class="filter-item"
@ -27,8 +30,6 @@
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<eAttr ref="form2" :is-attr="isAttr" />
<comForm ref="form3" :is-add="isAdd" />
<killForm ref="form4" :is-add="isAdd" />
<bargainForm ref="form5" :is-add="isAdd" />
@ -53,34 +54,32 @@
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="205px" align="center">
<el-table-column label="操作" width="265px" align="center">
<template slot-scope="scope">
<el-button slot="reference" type="danger" size="mini" @click="attr(scope.row)">规格属性</el-button>
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
>
<router-link :to="'/shop/goodsEdit/'+scope.row.id">
编辑
</router-link>
</el-button>
<el-popover
:ref="scope.row.id"
placement="top"
width="180"
>
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini">删除</el-button>
</el-popover>
<el-dropdown size="mini" split-button type="primary" trigger="click">
操作
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="edit(scope.row)"
>编辑</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-popover
:ref="scope.row.id"
placement="top"
width="180"
>
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini">删除</el-button>
</el-popover>
</el-dropdown-item>
<el-dropdown-item>
<el-button
size="mini"
@ -124,12 +123,11 @@ import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del, onsale } from '@/api/yxStoreProduct'
import eForm from './form'
import eAttr from './attr'
import comForm from '@/views/activity/combination/form'
import killForm from '@/views/activity/seckill/form'
import bargainForm from '@/views/activity/bargain/form'
export default {
components: { eForm, eAttr, comForm, killForm, bargainForm },
components: { eForm, comForm, killForm, bargainForm },
mixins: [initData],
data() {
return {

View File

@ -18,7 +18,6 @@
>刷新</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="商品id" />
@ -42,7 +41,11 @@
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_EDIT','YXSTOREPRODUCT_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-permission="['admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" />
<el-button v-permission="['admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_EDIT']" size="mini" type="primary" icon="el-icon-edit">
<router-link :to="'/shop/goodsEdit/'+scope.row.id">
编辑
</router-link>
</el-button>
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE']"

View File

@ -1,47 +1,8 @@
<template>
<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="80px">
<el-form-item label="用户ID">
<el-input v-model="form.uid" style="width: 370px;" />
</el-form-item>
<el-form-item label="订单ID">
<el-input v-model="form.oid" style="width: 370px;" />
</el-form-item>
<el-form-item label="唯一id">
<el-input v-model="form.unique" style="width: 370px;" />
</el-form-item>
<el-form-item label="产品id">
<el-input v-model="form.productId" style="width: 370px;" />
</el-form-item>
<el-form-item label="某种商品类型(普通商品、秒杀商品)">
<el-input v-model="form.replyType" style="width: 370px;" />
</el-form-item>
<el-form-item label="商品分数">
<el-input v-model="form.productScore" style="width: 370px;" />
</el-form-item>
<el-form-item label="服务分数">
<el-input v-model="form.serviceScore" style="width: 370px;" />
</el-form-item>
<el-form-item label="评论内容">
<el-input v-model="form.comment" style="width: 370px;" />
</el-form-item>
<el-form-item label="评论图片">
<el-input v-model="form.pics" style="width: 370px;" />
</el-form-item>
<el-form-item label="评论时间">
<el-input v-model="form.addTime" style="width: 370px;" />
</el-form-item>
<el-form-item label="管理员回复内容">
<el-input v-model="form.merchantReplyContent" style="width: 370px;" />
</el-form-item>
<el-form-item label="管理员回复时间">
<el-input v-model="form.merchantReplyTime" style="width: 370px;" />
</el-form-item>
<el-form-item label="0未删除1已删除">
<el-input v-model="form.isDel" style="width: 370px;" />
</el-form-item>
<el-form-item label="0未回复1已回复">
<el-input v-model="form.isReply" style="width: 370px;" />
<el-form-item label="回复内容">
<el-input v-model="form.merchantReplyContent" style="width: 370px;" rows="5" type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">

View File

@ -32,13 +32,25 @@
<div v-else>无图</div>
</template>
</el-table-column>
<el-table-column prop="addTime" label="评论时间">
<el-table-column prop="createTime" label="评论时间">
<template slot-scope="scope">
<span>{{ formatTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="merchantReplyTime" label="回复时间">
<template slot-scope="scope">
<span>{{ formatTime(scope.row.merchantReplyTime) }}</span>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSTOREPRODUCTREPLY_ALL','YXSTOREPRODUCTREPLY_EDIT','YXSTOREPRODUCTREPLY_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button
v-permission="['admin','YXSTOREPRODUCTREPLY_ALL','YXSTOREPRODUCTREPLY_EDIT']"
size="mini"
type="primary"
@click="edit(scope.row)"
>
回复</el-button>
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTOREPRODUCTREPLY_ALL','YXSTOREPRODUCTREPLY_DELETE']"

View File

@ -0,0 +1,260 @@
<template>
<el-dialog :close-on-click-modal="false"
:visible.sync="addressView"
append-to-body
class="modal"
title="选择城市" width="950px">
<el-row :gutter="24" type="flex">
<el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24" class="item">
<div class="acea-row row-right row-middle">
<el-checkbox v-model="iSselect" @change="allCheckbox">全选</el-checkbox>
<div class="empty" @click="empty">清空</div>
</div>
</el-col>
</el-row>
<el-row :gutter="24" :loading="loading" >
<el-col :xl="6" :lg="6" :md="6" :sm="8" :xs="6" class="item" v-for="(item,index) in cityList" :key="index">
<div @mouseenter="enter(index)" @mouseleave="leave()">
<el-checkbox v-model="item.checked" :label="item.name" @change="checkedClick(index)">{{item.name}}</el-checkbox>
<span class="red">({{(item.count || 0) + '/' + item.children.length}})</span>
<div class="city" v-show="activeCity===index">
<div class="checkBox">
<div class="arrow"></div>
<div>
<el-checkbox v-model="city.checked" :label="city.name" @change="primary(index,indexn)"
class="itemn" v-for="(city,indexn) in item.children"
:key="indexn">{{city.name}}</el-checkbox>
</div>
</div>
</div>
</div>
</el-col>
</el-row>
<div slot="footer">
<el-button @click="close">取消</el-button>
<el-button type="primary" @click="confirm">确定</el-button>
</div>
</el-dialog>
</template>
<script>
import crudYxShippingTemplates from '@/api/yxShippingTemplates'
import CRUD, {presenter, header, form, crud} from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import MaterialList from "@/components/material";
export default {
name: 'city',
props: {
type: {
type: Number,
default: 0
}
},
components: {crudOperation, rrOperation, udOperation, MaterialList},
mixins: [header(), crud()],
data () {
return {
iSselect: false,
addressView: false,
cityList: [],
activeCity: -1,
loading: false
}
},
methods: {
enter (index) {
this.activeCity = index;
},
leave () {
this.activeCity = null;
},
getCityList () {
this.loading = true;
crudYxShippingTemplates.getCity().then(res => {
this.loading = false;
this.cityList = res;
console.log("jjj:"+res)
})
},
/**
* 全选或者反选
* @param checked
*/
allCheckbox: function () {
let that = this, checked = this.iSselect;
that.cityList.forEach(function (item, key) {
that.$set(that.cityList[key], 'checked', checked);
if (checked) {
that.$set(that.cityList[key], 'count', that.cityList[key].children.length);
} else {
that.$set(that.cityList[key], 'count', 0);
}
that.cityList[key].children.forEach(function (val, k) {
that.$set(that.cityList[key].children[k], 'checked', checked);
})
});
},
// 清空;
empty () {
let that = this;
that.cityList.forEach(function (item, key) {
that.$set(that.cityList[key], 'checked', false);
that.cityList[key].children.forEach(function (val, k) {
that.$set(that.cityList[key].children[k], 'checked', false);
});
that.$set(that.cityList[key], 'count', 0);
});
this.iSselect = false;
},
/**
* 点击省
* @param index
*/
checkedClick: function (index) {
let that = this;
if (that.cityList[index].checked) {
that.$set(that.cityList[index], 'count', that.cityList[index].children.length);
that.cityList[index].children.forEach(function (item, key) {
that.$set(that.cityList[index].children[key], 'checked', true);
});
} else {
that.$set(that.cityList[index], 'count', 0);
that.$set(that.cityList[index], 'checked', false);
that.cityList[index].children.forEach(function (item, key) {
that.$set(that.cityList[index].children[key], 'checked', false);
});
that.iSselect = false;
}
},
/**
* 点击市区
* @param index
* @param ind
*/
primary: function (index, ind) {
let checked = false, count = 0;
this.cityList[index].children.forEach(function (item, key) {
console.log("item:"+item.checked)
if (item.checked) {
checked = true;
count++;
}
});
this.$set(this.cityList[index], 'count', count);
this.$set(this.cityList[index], 'checked', checked);
},
// 确定;
confirm () {
let that = this;
// 被选中的省市;
let selectList = [];
console.log("city:"+that.cityList[0].children)
that.cityList.forEach(function (item, key) {
let data = {};
if (item.checked) {
data = {
name: item.name,
city_id: item.city_id,
children: []
};
}
console.log("data:"+data)
that.cityList[key].children.forEach(function (i, k) {
if (i.checked) {
data.children.push({
city_id: i.city_id
})
}
});
if (data.city_id !== undefined) {
selectList.push(data);
}
});
console.log(selectList);
if (selectList.length === 0) {
return this.$message({
message:'至少选择一个省份或者城市',
type: 'error'
});
} else {
this.$emit('selectCity', selectList, this.type);
that.addressView = false;
this.cityList = []
}
},
close () {
this.addressView = false;
this.cityList = []
}
},
mounted () {
}
}
</script>
<style scoped>
.modal .item {
position: relative;
margin-bottom: 20px;
}
.modal .item .city {
position: absolute;
z-index: 9;
top: 17px;
width: 100%;
padding-top: 18px;
}
.modal .item .city .checkBox {
width: 97%;
padding: 10px;
border: 1px solid #eee;
background-color: #fff;
max-height: 100px;
overflow-x: hidden;
overflow-y: auto;
}
.modal .item .city .checkBox .arrow {
position: absolute;
top: 3px;
width: 0;
height: 0;
border: 8px solid transparent;
border-bottom-color: #ddd;
}
.modal .item .city .checkBox .arrow:before {
position: absolute;
bottom: -8px;
right: -7px;
content: "";
width: 0;
height: 0;
border: 7px solid transparent;
border-bottom-color: #fff;
}
.modal .item .city .checkBox .itemn {
margin-bottom: 10px;
}
.radio {
padding: 5px 0;
font-size: 14px !important;
}
.red {
color: #ff0000;
}
.empty {
cursor: pointer;
margin-left:10px
}
</style>

View File

@ -0,0 +1,419 @@
<template>
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title" width="950px">
<el-form ref="formData" :model="formData" class="attrFrom" :rules="rules" label-width="130px" :inline="true">
<el-row :gutter="24" type="flex">
<el-col :xl="18" :lg="18" :md="18" :sm="24" :xs="24">
<el-form-item label="模板名称" prop="name">
<el-input type="text" placeholder="请输入模板名称" v-model="formData.name"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24" type="flex">
<el-col :xl="18" :lg="18" :md="18" :sm="24" :xs="24">
<el-form-item label="计费方式" props="state" >
<el-radio-group class="radio" v-model="formData.type" >
<el-radio :label="1">按件数</el-radio>
<el-radio :label="2">按重量</el-radio>
<el-radio :label="3">按体积</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24" type="flex">
<el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
<el-form-item class="label" label="配送区域及运费" props="state">
<el-table
ref="table"
:data="templateList"
empty-text="暂无数据"
border
>
<el-table-column prop="regionName" label="可配送区域" width="130" />
<el-table-column prop="first" label="首件" width="120">
<template slot="header" slot-scope="scope">
<span v-if="formData.type == 1">首件</span>
<span v-else-if="formData.type == 2">首件重量(KG)</span>
<span v-else>首件体积(m³)</span>
</template>
<template slot-scope="scope">
<span><el-input type="text" v-model="scope.row.first" /></span>
</template>
</el-table-column>
<el-table-column prop="price" label="运费" width="110">
<template slot-scope="scope">
<span><el-input type="text" v-model="scope.row.price"/></span>
</template>
</el-table-column>
<el-table-column prop="_continue" label="续件" width="120">
<template slot="header" slot-scope="scope">
<span v-if="formData.type == 1">续件</span>
<span v-else-if="formData.type == 2">续件重量(KG)</span>
<span v-else>续件体积(m³)</span>
</template>
<template slot-scope="scope">
<span><el-input type="text" v-model="scope.row._continue"/></span>
</template>
</el-table-column>
<el-table-column prop="continue_price" label="续费" width="110">
<template slot-scope="scope">
<span><el-input type="text" v-model="scope.row.continue_price"/></span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<a v-if="scope.row.regionName!=='默认全国'" @click="delCity(index,1)">删除</a>
</template>
</el-table-column>
</el-table>
<el-row type="flex" class="addTop">
<el-col>
<el-button type="primary" icon="md-add" @click="addCity(1)">单独添加配送区域</el-button>
</el-col>
</el-row>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24" type="flex">
<el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
<el-form-item label="指定包邮" prop="store_name">
<el-radio-group class="radio" v-model="formData.appoint_check">
<el-radio :label="1">开启</el-radio>
<el-radio :label="0">关闭</el-radio>
</el-radio-group>
<el-table
ref="table"
:data="appointList"
empty-text="暂无数据"
border
v-if="formData.appoint_check === 1"
>
<el-table-column prop="placeName" label="选择地区" />
<el-table-column prop="a_num" label="包邮件数" width="120" >
<template slot="header" slot-scope="scope">
<span v-if="formData.type == 1">包邮件数</span>
<span v-else-if="formData.type == 2">包邮重量(KG)</span>
<span v-else>包邮体积(m³)</span>
</template>
<template slot-scope="scope">
<span><el-input type="text" v-model="scope.row.a_num"/></span>
</template>
</el-table-column>
<el-table-column prop="a_price" label="包邮金额" width="120">
<template slot-scope="scope">
<span><el-input type="text" v-model="scope.row.a_price"/></span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<a v-if="scope.row.regionName!=='默认全国'" @click="delCity(index,2)">删除</a>
</template>
</el-table-column>
</el-table>
<el-row type="flex" v-if="formData.appoint_check === 1">
<el-col>
<el-button type="primary" icon="md-add" @click="addCity(2)">单独指定包邮</el-button>
</el-col>
</el-row>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24" type="flex">
<el-col :xl="18" :lg="18" :md="18" :sm="24" :xs="24">
<el-form-item label="排序" prop="store_name">
<el-input-number :min="0" placeholder="输入值越大越靠前" v-model="formData.sort" ></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24" type="flex">
<el-col>
<el-form-item prop="store_name" label=" ">
<el-button type="primary" @click="handleSubmit">{{id ? '立即修改':'立即提交'}}</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<!--<el-button type="text" @click="crud.cancelCU">取消</el-button>-->
<!--<el-button :loading="modal_loading" type="primary" @click="handleSubmit('formData')">确认</el-button>-->
</div>
<city ref="city" @selectCity="selectCity" :type="type"></city>
</el-dialog>
</template>
<script>
import crudYxShippingTemplates from '@/api/yxShippingTemplates'
import CRUD, {presenter, header, form, crud} from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import MaterialList from "@/components/material";
import city from './city';
var g = [
{
region: [
{
name: '默认全国',
city_id: 0
}
],
regionName: '默认全国',
first: 1,
price: 0,
_continue: 1,
continue_price: 0
}
]
const defaultForm = {id: null, type: null, sort: null, appointInfo: null, appoint: null, name: null}
export default {
name: 'tempForm',
components: {crudOperation, rrOperation, udOperation, MaterialList, city},
mixins: [header(), form(defaultForm), crud()],
data() {
return {
permission: {
add: ['admin', 'storeProductRule:add'],
edit: ['admin', 'storeProductRule:edit'],
del: ['admin', 'storeProductRule:del']
},
rules: {
ruleName: [
{required: true, message: '规格名称不能为空', trigger: 'blur'}
]
},
templateList: g,
appointList: [],
type: 1,
formData: {
type: 1,
sort: 0,
name: '',
appoint_check: 0
},
id: 0,
addressView: false,
indeterminate: true,
checkAll: false,
checkAllGroup: [],
activeCity: -1,
provinceAllGroup: [],
index: -1,
displayData: '',
currentProvince: ''
}
},
watch: {},
methods: {
// 获取数据前设置好接口地址
[CRUD.HOOK.beforeRefresh]() {
return true
}, // 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
console.log('uu:'+form.name)
this.appointList = form.appointInfo ? eval('(' + form.appointInfo + ')') : []
if(form.id){
this.templateList = eval('(' + form.regionInfo + ')')
}else{
this.templateList = g
}
this.formData.type = form.type || 1
this.formData.sort = form.sort || 0
this.formData.name = form.name || ''
this.formData.appoint_check = form.appoint || 0
this.id = form.id || 0
},
selectCity: function (data, type) {
let cityName = data.map(function (item) {
return item.name;
}).join(';');
switch (type) {
case 1:
this.templateList.push({
region: data,
regionName: cityName,
first: 1,
price: 0,
_continue: 1,
continue_price: 0
});
break;
case 2:
this.appointList.push({
place: data,
placeName: cityName,
a_num: 0,
a_price: 0
});
break;
}
},
// 单独添加配送区域
addCity (type) {
this.$refs.city.addressView = true;
this.type = type;
this.$refs.city.getCityList()
},
// 提交
handleSubmit: function () {
let that = this;
if (!that.formData.name.trim().length) {
return this.$message({
message:'请填写模板名称',
type: 'error'
});
}
for (let i = 0; i < that.templateList.length; i++) {
if (that.templateList[i].first <= 0) {
return this.$message({
message:'首件/重量/体积应大于0\'',
type: 'error'
});
}
if (that.templateList[i].price < 0) {
return this.$message({
message:'运费应大于等于0',
type: 'error'
});
}
if (that.templateList[i].continue <= 0) {
return this.$message({
message:'续件/重量/体积应大于0',
type: 'error'
});
}
if (that.templateList[i].continue_price < 0) {
return this.$message({
message:'续费应大于等于0',
type: 'error'
});
}
}
if (that.formData.appoint_check === 1) {
for (let i = 0; i < that.appointList.length; i++) {
if (that.appointList[i].a_num <= 0) {
return this.$message({
message:'包邮件数应大于0',
type: 'error'
});
}
if (that.appointList[i].a_price < 0) {
return this.$message({
message:'包邮金额应大于等于0',
type: 'error'
});
}
}
}
let data = {
appoint_info: that.appointList,
region_info: that.templateList,
sort: that.formData.sort,
type: that.formData.type,
name: that.formData.name,
appoint: that.formData.appoint_check
};
crudYxShippingTemplates.add(data,that.id).then(() => {
if(that.id){
this.crud.status.edit = CRUD.STATUS.NORMAL
this.crud.editSuccessNotify()
}else{
this.crud.status.add = CRUD.STATUS.NORMAL
this.crud.addSuccessNotify()
}
this.crud.resetForm()
this.crud.toQuery()
this.formData = {
type: 1,
sort: 0,
name: '',
appoint_check: 0
};
this.appointList = [];
this.addressView = false;
this.templateList = [
{
region: [
{
name: '默认全国',
city_id: 0
}
],
regionName: '默认全国',
first: 1,
price: 0,
continue: 1,
continue_price: 0
}
];
});
},
// 删除
delCity (index,type) {
if (type === 1) {
this.templateList.splice(index, 1);
} else {
this.appointList.splice(index, 1);
}
},
// 关闭
cancel () {
this.formData = {
type: 1,
sort: 0,
name: '',
appoint_check: 0
};
this.appointList = [];
this.addressView = false;
this.templateList = [
{
region: [
{
name: '默认全国',
city_id: 0
}
],
regionName: '默认全国',
first: 0,
price: 0,
continue: 0,
continue_price: 0
}
];
},
address () {
this.addressView = true
},
enter (index) {
this.activeCity = index;
},
leave () {
this.activeCity = null;
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,105 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<add />
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column v-if="columns.visible('id')" prop="id" label="模板ID" />
<el-table-column v-if="columns.visible('name')" prop="name" label="模板名称" />
<el-table-column v-if="columns.visible('type')" prop="type" label="计费方式">
<template slot-scope="scope">
<span v-if="scope.row.type == 1">按件数</span>
<span v-else-if="scope.row.type == 2">按重量</span>
<span v-else>按体积</span>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('appoint')" prop="appoint" label="指定包邮开关">
<template slot-scope="scope">
<span v-if="scope.row.appoint == 1">开启</span>
<span v-else>关闭</span>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('createTime')" prop="createTime" label="添加时间">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('sort')" prop="sort" label="排序" />
<el-table-column v-permission="['admin','yxShippingTemplates:edit','yxShippingTemplates:del']" label="操作" width="150px" align="center">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudYxShippingTemplates from '@/api/yxShippingTemplates'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import MaterialList from "@/components/material";
import add from './form'
// crud交由presenter持有
const defaultCrud = CRUD({ title: '运费模板', url: 'api/yxShippingTemplates', sort: 'id,desc', crudMethod: { ...crudYxShippingTemplates }})
const defaultForm = { id: null, name: null, type: null, regionInfo: null, appoint: null, appointInfo: null, createTime: null, updateTime: null, isDel: null, sort: null }
export default {
name: 'YxShippingTemplates',
components: { pagination, crudOperation, rrOperation, udOperation ,MaterialList ,add},
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
permission: {
add: ['admin', 'yxShippingTemplates:add'],
edit: ['admin', 'yxShippingTemplates:edit'],
del: ['admin', 'yxShippingTemplates:del']
},
rules: {
} }
},
watch: {
},
methods: {
// 获取数据前设置好接口地址
[CRUD.HOOK.beforeRefresh]() {
return true
}, // 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
},
}
}
</script>
<style scoped>
.table-img {
display: inline-block;
text-align: center;
background: #ccc;
color: #fff;
white-space: nowrap;
position: relative;
overflow: hidden;
vertical-align: middle;
width: 32px;
height: 32px;
line-height: 32px;
}
</style>

View File

@ -0,0 +1,228 @@
<template>
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title" width="950px">
<el-form ref="formData" :model="formData" class="attrFrom" :rules="rules" label-width="92px" :inline="true">
<el-row :gutter="24">
<el-col :span="24">
<el-col :span="9" class="mb15">
<el-form-item label="标题名称" prop="ruleName">
<el-input placeholder="请输入标题名称" v-model="formData.ruleName"/>
</el-form-item>
</el-col>
</el-col>
<el-col :span="23" class="noForm" v-for="(item, index) in formData.ruleValue" :key="index">
<el-form-item label=" ">
<div class="acea-row row-middle"><span class="mr5">{{item.value}}</span>
<i class="el-icon-circle-close" @click="handleRemove(index)"></i>
</div>
<div class="rulesBox">
<el-tag class="mb5" style="margin: 2px 4px 2px 0;" closable
v-for="(j, indexn) in item.detail" :key="indexn"
:name="j" @close="handleRemove2(item.detail,indexn)">{{j}}
</el-tag>
<el-input placeholder="请输入属性名称" v-model="item.detail.attrsVal"
style="width: 170px">
<el-button slot="append" type="primary" @click="createAttr(item.detail.attrsVal,index)">添加</el-button>
</el-input>
</div>
</el-form-item>
</el-col>
<el-col :span="24" v-if="isBtn" class="mt10">
<el-col :span="9" class="mr15">
<el-form-item label="规格">
<el-input placeholder="请输入规格" v-model="attrsName"/>
</el-form-item>
</el-col>
<el-col :span="9" class="mr20">
<el-form-item label="规格值">
<el-input v-model="attrsVal" placeholder="请输入规格值"/>
</el-form-item>
</el-col>
<el-col :span="2">
<el-button type="primary" @click="createAttrName">确定</el-button>
</el-col>
<el-col :span="2">
<el-button @click="offAttrName">取消</el-button>
</el-col>
</el-col>
</el-row>
<el-button type="primary" icon="md-add" @click="addBtn" v-if="!isBtn" class="ml95 mt10">添加新规格</el-button>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="modal_loading" type="primary" @click="handleSubmit('formData')">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import crudYxStoreProductRule from '@/api/storeProductRule'
import CRUD, {presenter, header, form, crud} from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import MaterialList from "@/components/material";
const defaultForm = {id: null, ruleName: null, ruleValue: null, createTime: null, updateTime: null, isDel: null}
export default {
name: 'ruleForm',
components: {crudOperation, rrOperation, udOperation, MaterialList},
mixins: [header(), form(defaultForm), crud()],
data() {
return {
permission: {
add: ['admin', 'storeProductRule:add'],
edit: ['admin', 'storeProductRule:edit'],
del: ['admin', 'storeProductRule:del']
},
rules: {
ruleName: [
{required: true, message: '规格名称不能为空', trigger: 'blur'}
]
},
modal_loading: false,
index: 1,
formData: {
ruleName: '',
ruleValue: []
},
attrsName: '',
attrsVal: '',
formDataNameData: [],
isBtn: false,
formDataName: [],
ids: 0
}
},
watch: {},
methods: {
// 获取数据前设置好接口地址
[CRUD.HOOK.beforeRefresh]() {
return true
}, // 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
this.formData.ruleName = form.ruleName || ''
this.formData.ruleValue = form.ruleValue || []
this.ids = form.id || 0
},
onCancel () {
this.clear();
},
// 添加按钮
addBtn () {
this.isBtn = true;
},
// 提交
handleSubmit (name) {
this.$refs[name].validate((valid) => {
if (valid) {
if (!this.formData.ruleValue) {
return this.$message.warning('请至少添加一条商品规格!');
}
if (this.formData.ruleValue.length === 0) {
return this.$message.warning('请至少添加一条商品规格!');
}
this.modal_loading = true;
setTimeout(() => {
crudYxStoreProductRule.add(this.formData, this.ids).then(res => {
setTimeout(() => {
if(this.ids){
this.crud.status.edit = CRUD.STATUS.NORMAL
this.crud.editSuccessNotify()
}else{
this.crud.status.add = CRUD.STATUS.NORMAL
this.crud.addSuccessNotify()
}
this.crud.resetForm()
this.crud.toQuery()
this.modal_loading = false;
}, 500);
setTimeout(() => {
this.clear();
}, 600);
}).catch(res => {
this.modal_loading = false;
this.$message({
message:res.msg,
type: 'error'
});
});
}, 1200);
} else {
return false
}
})
},
clear () {
this.$refs['formData'].resetFields();
this.formData.ruleValue = [];
this.isBtn = false;
this.attrsName = '';
this.attrsVal = '';
},
// 取消
offAttrName () {
this.isBtn = false;
},
// 删除
handleRemove (index) {
this.formData.ruleValue.splice(index, 1);
},
// 删除属性
handleRemove2 (item, index) {
item.splice(index, 1);
},
// 添加规则名称
createAttrName () {
if (this.attrsName && this.attrsVal) {
let data = {
value: this.attrsName,
detail: [
this.attrsVal
]
};
this.formData.ruleValue.push(data);
var hash = {};
this.formData.ruleValue = this.formData.ruleValue.reduce(function (item, next) {
/* eslint-disable */
hash[next.value] ? '' : hash[next.value] = true && item.push(next);
return item
}, [])
this.attrsName = '';
this.attrsVal = '';
this.isBtn = false;
} else {
return this.$message.warning('请添加规格名称!');
}
},
// 添加属性
createAttr (num, idx) {
if (num) {
this.formData.ruleValue[idx].detail.push(num);
var hash = {};
this.formData.ruleValue[idx].detail = this.formData.ruleValue[idx].detail.reduce(function (item, next) {
hash[next] ? '' : hash[next] = true && item.push(next);
return item
}, [])
} else {
return this.$message.warning('请添加属性!');
}
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,95 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<add />
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column v-if="columns.visible('id')" prop="id" label="id" />
<el-table-column v-if="columns.visible('ruleName')" prop="ruleName" label="规格名称" />
<el-table-column v-if="columns.visible('ruleValue')" prop="ruleValue" label="规格值" >
<template slot-scope="scope">
<div v-for="(item, index) in scope.row.ruleValue">
{{ item.value }} : {{ item.detail.join(',')}}
</div>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('createTime')" prop="createTime" label="创建时间">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column v-permission="['admin','storeProductRule:edit','storeProductRule:del']" label="操作" width="150px" align="center">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudYxStoreProductRule from '@/api/storeProductRule'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import MaterialList from "@/components/material"
import add from './form'
// crud交由presenter持有
const defaultCrud = CRUD({ title: 'sku规则', url: 'api/yxStoreProductRule', sort: 'id,desc', crudMethod: { ...crudYxStoreProductRule }})
const defaultForm = { id: null, ruleName: null, ruleValue: null, createTime: null, updateTime: null, isDel: null }
export default {
name: 'YxStoreProductRule',
components: { pagination, crudOperation, rrOperation, udOperation ,MaterialList,add},
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
permission: {
add: ['admin', 'storeProductRule:add'],
edit: ['admin', 'storeProductRule:edit'],
del: ['admin', 'storeProductRule:del']
}
}
},
watch: {
},
methods: {
// 获取数据前设置好接口地址
[CRUD.HOOK.beforeRefresh]() {
return true
}, // 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
},
}
}
</script>
<style scoped>
.table-img {
display: inline-block;
text-align: center;
background: #ccc;
color: #fff;
white-space: nowrap;
position: relative;
overflow: hidden;
vertical-align: middle;
width: 32px;
height: 32px;
line-height: 32px;
}
</style>

View File

@ -0,0 +1,130 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" title="查看分销下级" width="700px">
<el-card>
<div slot="header">
<span>{{ form.nickname }}的下级</span>
</div>
<el-tabs type="border-card" @tab-click="handleClick" v-model="activeName">
<el-tab-pane label="一级" name="first">
<el-table
:data="tableData"
border
style="width: 100%">
<el-table-column
prop="nickname"
label="姓名"
width="180">
</el-table-column>
<el-table-column
prop="avatar"
label="头像">
<template slot-scope="scope">
<a :href="scope.row.avatar" style="color: #42b983" target="_blank"><img :src="scope.row.avatar" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column
prop="time"
label="加入时间"
width="180">
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="二级" name="second">
<el-table
:data="tableData"
border
style="width: 100%">
<el-table-column
prop="nickname"
label="姓名"
width="180">
</el-table-column>
<el-table-column
prop="avatar"
label="头像">
<template slot-scope="scope">
<a :href="scope.row.avatar" style="color: #42b983" target="_blank"><img :src="scope.row.avatar" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column
prop="time"
label="加入时间"
width="180">
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</el-card>
</el-dialog>
</template>
<script>
import { add, edit, getSpread } from '@/api/yxUser'
import { parseTime } from '@/utils/index'
export default {
props: {
// isAdd: {
// type: Boolean,
// required: true
// }
},
data() {
return {
loading: false, dialog: false, expressInfo: [],
activeName: "first",
tableData: [],
form: {
uid: '',
nickname: ''
},
rules: {
unique: [
{ required: true, message: 'please enter', trigger: 'blur' }
]
}
}
},
mounted() {
// this.express()
},
methods: {
handleClick(tab, event) {
this.spread(this.form.uid)
},
parseTime,
cancel() {
this.dialog = false
},
spread(uid) {
var grade = 0;
if(this.activeName == 'second') grade = 1
let params ={
uid,
grade
}
getSpread(params).then(res=>{
console.log(res)
this.tableData = res
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
}
}
}
</script>
<style scoped>
.text {
font-size: 12px;
}
.item {
padding: 6px 0;
}
</style>

View File

@ -16,10 +16,6 @@
<el-form-item label="用户积分">
<el-input v-model="form.integral" style="width: 370px;" />
</el-form-item>
<el-form-item label="推广员">
<el-radio v-model="form.isPromoter" :label="1">开启</el-radio>
<el-radio v-model="form.isPromoter" :label="0">关闭</el-radio>
</el-form-item>
<el-form-item label="商户管理">
<el-radio v-model="form.adminid" :label="1">开启</el-radio>
<el-radio v-model="form.adminid" :label="0">关闭</el-radio>

View File

@ -28,6 +28,7 @@
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<pForm ref="formp" :is-add="isAdd" />
<detail ref="formd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="uid" label="用户id" />
@ -65,18 +66,25 @@
</el-table-column>
<el-table-column prop="spreadUid" label="推荐人" />
<el-table-column prop="payCount" label="购买次数" />
<el-table-column v-if="checkPermission(['admin','YXUSER_ALL','YXUSER_EDIT','YXUSER_DELETE'])" label="操作" width="185" align="center" fixed="right">
<el-table-column v-if="checkPermission(['admin','YXUSER_ALL','YXUSER_EDIT','YXUSER_DELETE'])" label="操作" width="215" align="center" fixed="right">
<template slot-scope="scope">
<el-button
v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']"
size="mini"
type="primary"
icon="el-icon-edit"
@click="edit(scope.row)"
/>
type="danger"
@click="editD(scope.row)"
>查看下级</el-button>
<el-dropdown size="mini" split-button type="primary" trigger="click">
操作
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<el-button
v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']"
size="mini"
type="primary"
@click="edit(scope.row)"
>修改用户</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button
v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']"
@ -87,20 +95,6 @@
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!--
<el-popover
v-permission="['admin','YXUSER_ALL','YXUSER_DELETE']"
:ref="scope.row.uid"
placement="top"
width="180">
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.uid].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.uid)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini"/>
</el-popover>
-->
</template>
</el-table-column>
</el-table>
@ -122,9 +116,10 @@ import initData from '@/mixins/crud'
import { del, onStatus } from '@/api/yxUser'
import eForm from './form'
import pForm from './formp'
import detail from './detail'
import { formatTime } from '@/utils/index'
export default {
components: { eForm, pForm },
components: { eForm, pForm, detail },
mixins: [initData],
data() {
return {
@ -250,6 +245,15 @@ export default {
money: 0
}
_this.dialog = true
},
editD(data) {
const _this = this.$refs.formd
_this.form = {
uid: data.uid,
nickname: data.nickname
}
_this.dialog = true
_this.spread(data.uid)
}
}
}