装起全部商城菜单

This commit is contained in:
2022-04-21 18:07:40 +08:00
parent 1b6f8f0ed9
commit 05fdb1d9e7
436 changed files with 50845 additions and 63 deletions
@@ -0,0 +1,171 @@
<template>
<el-dialog
class="afterSealsAdd"
:close-on-click-modal="false"
:visible.sync="visible"
width="800px">
<div class="checkForm">
<span>订单详情</span>
<el-form ref="form" :model="checkForm" size="small" label-width="100px">
<el-form-item label="订单号:">
<el-input v-model="checkForm.orderCode" disabled />
</el-form-item>
<el-form-item label="售后类型:">
<el-input v-if="checkForm.serviceType === 0" :value="'仅退款'" disabled />
<el-input v-if="checkForm.serviceType === 1" :value="'退货退款'" disabled />
</el-form-item>
<el-form-item label="售后原因:">
<el-input v-model="checkForm.reasons" disabled />
</el-form-item>
<el-form-item label="售后说明:">
<el-input v-model="checkForm.explains" disabled />
</el-form-item>
<el-form-item label="原因图片:">
<div v-if="!checkForm.explainImg">
<b>用户未上传图片</b>
</div>
<div v-else>
<el-image
v-for="(item,index) in checkForm.explainImg.split(',')"
:key="index"
style="width: 100px; height: 100px"
:src="item"
:preview-src-list="[item]">
</el-image>
</div>
</el-form-item>
<el-form-item label="提交时间:">
<el-input v-model="checkForm.createTime" disabled />
</el-form-item>
<div v-for="item in checkForm.cartInfo"
:key="item.id">
<el-form-item label="售后商品:">
<el-input v-model="item.productInfo.storeName" disabled />
</el-form-item>
<el-form-item label="商品图片:">
<el-image
:src="item.productInfo.image"
style="width: 100px; height: 100px">
<div slot="placeholder" class="image-slot">
加载中<b class="dot">...</b>
</div>
</el-image>
</el-form-item>
<el-form-item label="规格:">
<el-input v-model="item.productInfo.attrInfo.sku" disabled />
</el-form-item>
<el-form-item label="商品单价">
<el-input v-model="item.truePrice" disabled />
</el-form-item>
<el-form-item label="商品数量">
<el-input v-model="item.cartNum" disabled />
</el-form-item>
<el-form-item label="邮费:">
<el-input v-model="item.productInfo.postage" disabled />
</el-form-item>
</div>
</el-form>
</div>
<div v-if="serviceType === 0 && isShow">
<span>该订单为仅退款订单审核通过之后将直接退款是否审核通过</span>
</div>
<div v-if="serviceType === 1 && isShow">
<span>该订单为退货退款请输入退货地址</span>
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="收货人" prop="consignee">
<el-input v-model="form.consignee" />
</el-form-item>
<el-form-item label="手机号" prop="phoneNumber">
<el-input v-model="form.phoneNumber" />
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model="form.address" />
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button class="refuse" type="danger" v-if="isShow" :loading="loading" @click="submit(1)">拒绝</el-button>
<el-button class="check" type="primary" v-if="isShow" :loading="loading" @click="submit(0)">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import {salesCheck} from '@/api/bxg/yxStoreAfterSales.js'
export default {
props: {
},
data () {
return {
visible: false,
isShow: false,
loading: false,
serviceType: '',
checkForm: {},
form: {
salesId: '', // 售后id
orderCode: '', // 订单编号
approvalStatus: '', // 审核状态0成功1失败
consignee: '', // 收货人
phoneNumber: '', // 手机号
address: '' // 地址
},
rules: {
consignee: [{ required: true, message: '请输入收货人', trigger: 'blur' }],
phoneNumber: [{ required: true, message: '请输入收货人手机号', trigger: 'blur' }],
address: [{ required: true, message: '请输入收货地址', trigger: 'blur' }]
},
}
},
methods: {
cancel() {
this.visible = false
this.$refs['form'].resetFields()
},
async submit(type) {
this.loading = true
if (this.serviceType === 0) {
this.form.consignee = ''
this.form.phoneNumber = ''
this.form.address = ''
}
this.form.approvalStatus = type // 0成功 1失败
var res = await salesCheck(this.form)
if (res) {
this.$message.success('审核成功')
this.visible = false
this.$emit('checkSuccess')
} else {
this.$message.error(res.message || '审核失败!')
}
this.loading = false
}
}
}
</script>
<style lang="scss" scoped>
.afterSealsAdd{
padding-bottom: 10vh;
span{
color: #F56C6C;
line-height: 40px;
font-size: 18px;
font-weight: bold;
margin: 25px 0;
}
}
.afterSealsAdd ::v-deep.el-input.is-disabled .el-input__inner{
color: #333333;
}
.afterSealsAdd ::v-deep .dialog-footer{
display: flex;
justify-content: space-around;
.el-button{
width: 120px;
height: 40px;
}
.refuse{}
.check{}
}
</style>
+267
View File
@@ -0,0 +1,267 @@
<template>
<div class="afterSealsContainer">
<!-- 搜索栏 -->
<div class="titleSearch">
<el-input v-model="query.orderCode" clearable placeholder="输入搜索订单号" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<el-date-picker
v-model="searchTime"
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
<br>
<el-select v-model="query.type"
clearable placeholder="售后类型"
class="filter-item"
style="width: 130px">
<el-option
v-for="item in serviceTypeOptions"
:key="item.key"
:label="item.name"
:value="item.key" />
</el-select>
<el-select v-model="query.salesState"
clearable placeholder="售后状态"
class="filter-item"
style="width: 130px">
<el-option
v-for="item in salesOptions"
:key="item.key"
:label="item.name"
:value="item.key" />
</el-select>
<el-select v-model="query.state"
clearable placeholder="订单状态"
class="filter-item"
style="width: 130px">
<el-option
v-for="item in statusOptions"
:key="item.key"
:label="item.name"
:value="item.key" />
</el-select>
<el-button size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<el-button
size="mini"
type="warning"
icon="el-icon-refresh-left"
@click="resetSearch">重置</el-button>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<!-- <crudOperation :permission="permission" /> -->
<!--表格渲染-->
<el-table
ref="table"
v-loading="loading"
:data="data"
size="small"
style="width: 100%;"
@selection-change="val => {selections = val}">
<!-- @selection-change="selectionChangeHandler" -->
<el-table-column type="selection" width="55" />
<el-table-column prop="orderCode" label="订单号" />
<el-table-column prop="refundAmount" label="退款金额" width="100px"/>
<el-table-column prop="serviceType" label="服务类型" >
<template slot-scope="scope">
<span v-if="scope.row.serviceType === 0">仅退款</span>
<span v-if="scope.row.serviceType === 1">退货退款</span>
</template>
</el-table-column>
<el-table-column prop="reasons" label="申请原因" />
<el-table-column prop="explains" label="说明" />
<el-table-column prop="createTime" label="申请时间" align="center">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="state" label="状态" width="100px" align="center">
<template slot-scope="scope">
<span v-if="scope.row.state === 0" :style="'color: #E6A23C'">等待审核</span>
<span v-if="scope.row.state === 1" :style="'color: #409EFF'">等待用户发货</span>
<span v-if="scope.row.state === 2" :style="'color: #F56C6C'">用户已发货</span>
<span v-if="scope.row.state === 3" :style="'color: #909399'">退款成功</span>
</template>
</el-table-column>
<el-table-column prop="salesState" label="售后状态" width="100px" align="center">
<template slot-scope="scope">
<span v-if="scope.row.salesState === 0" :style="'color: #42b983'">正常</span>
<span v-if="scope.row.salesState === 1" :style="'color: #409EFF'">用户已取消</span>
<span v-if="scope.row.salesState === 2" :style="'color: #F56C6C'">已拒绝用户</span>
</template>
</el-table-column>
<el-table-column
v-permission="['admin','yxStoreAfterSales:edit','yxStoreAfterSales:del']" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button type="text" @click="checkItem(scope.row, 0)">订单详情</el-button>
<el-button
size="mini"
type="success"
v-if="scope.row.state === 0 && scope.row.salesState === 0"
@click="checkItem(scope.row, 1)">审核</el-button>
<el-button
size="mini"
type="danger"
v-if="scope.row.state === 2"
@click="rebackVisible = true;
rebackQuery.salesId = scope.row.id;
rebackQuery.orderCode = scope.row.orderCode">
退款</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 20px; float: right"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange" />
<!-- 审核、订单详情 -->
<CheckDialog ref="addForm" :visible="addVisible" @checkSuccess="toQuery"/>
<!-- 退款 -->
<el-dialog
title="退款"
:visible.sync="rebackVisible"
width="400px">
<span>
是否给订单号:<b :style="'color: #409EFF'">{{ this.rebackQuery.orderCode }}</b> 确认退款?
</span>
<span slot="footer" class="dialog-footer">
<el-button @click="rebackVisible = false">取 消</el-button>
<el-button type="primary" @click="rebackItem">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import initData from '@/mixins/crud'
import {rebackMoney} from '@/api/bxg/yxStoreAfterSales'
import CheckDialog from './checkDialog.vue'
export default {
name: 'YxStoreAfterSales',
components: { CheckDialog },
mixins: [initData],
data() {
return {
addVisible: false,
rebackVisible: false,
searchTime: [],
permission: {
add: ['admin', 'yxStoreAfterSales:add'],
edit: ['admin', 'yxStoreAfterSales:edit'],
del: ['admin', 'yxStoreAfterSales:del']
},
salesOptions: [
{ key: 0, name: '正常'},
{ key: 1, name: '用户已取消' },
{ key: 2, name: '已拒绝用户'}
],
serviceTypeOptions: [
{ key: null, name: '全部' },
{ key: 0, name: '仅退款' },
{ key: 1, name: '退货退款' }
],
statusOptions: [
{ key: 0, name: '待审核'},
{ key: 1, name: '等待用户发货'},
{ key: 2, name: '用户已发货'},
{ key: 3, name: '已完成'},
],
// 退款参数
rebackQuery: {
orderCode: '', // 订单号
salesId: 0 // 数据的id
}
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
beforeInit() {
this.url = 'bxg/api/yxStoreAfterSales/sales/List'
this.params = {
page: this.page,
size: this.size,
serviceType: this.query.type || '', // 查询类型
salesState: this.query.salesState || 0, // 售后状态
state: this.query.state,
orderCode: this.query.orderCode || '',
time: this.searchTime
// startingTime: `${this.searchTime[0]}` || '',
// endTime: `${this.searchTime[1]}` || ''
}
if (this.query.state === 0) this.params.state = 0;
return true
},
resetSearch() {
this.query.orderCode = this.query.type = this.query.salesState = this.query.state = '';
this.searchTime = [];
this.toQuery()
},
// 审核
checkItem(row, type) {
this.$refs.addForm.checkForm = row
this.$refs.addForm.serviceType = row.serviceType
this.$refs.addForm.form.salesId = row.id
this.$refs.addForm.form.orderCode = row.orderCode
if (type === 1) {
this.$refs.addForm.isShow = true
} else {
this.$refs.addForm.isShow = false
}
this.$refs.addForm.visible = true
},
// 退款
async rebackItem() {
var res = await rebackMoney(this.rebackQuery)
if (res) {
this.$message.success('提交退款成功!')
this.rebackVisible = false
this.toQuery()
} else {
this.$message.error(res.message || '提交退款失败!')
}
}
}
}
</script>
<style lang="scss" scoped>
.afterSealsContainer{
padding: 12px 8px;
.titleSearch {
line-height: 40px;
margin: 20px 0;
}
.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>
+144
View File
@@ -0,0 +1,144 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission"/>
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0"
:title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="版本名称">
<el-input v-model="form.versionName" style="width: 370px;"/>
</el-form-item>
<el-form-item label="版本描述">
<el-input v-model="form.versionInfo" style="width: 370px;"/>
</el-form-item>
<el-form-item label="版本code">
<el-input v-model="form.versionCode" style="width: 370px;"/>
</el-form-item>
<el-form-item label="ios应用商店链接">
<el-input v-model="form.iosUrl" style="width: 370px;"/>
</el-form-item>
<el-form-item label="安卓下载链接">
<el-input v-model="form.androidUrl" style="width: 370px;"/>
</el-form-item>
<el-form-item label="是否强制升级">
<el-radio v-for="item in dict.force_update" :key="item.id" v-model="form.forceUpdate" :label="item.value">
{{ item.label }}
</el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<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('versionName')" prop="versionName" label="版本名称"/>
<el-table-column v-if="columns.visible('versionInfo')" prop="versionInfo" label="版本描述"/>
<el-table-column v-if="columns.visible('versionCode')" prop="versionCode" label="版本code"/>
<el-table-column v-if="columns.visible('iosUrl')" prop="iosUrl" label="ios store应用商店链接"/>
<el-table-column v-if="columns.visible('androidUrl')" prop="androidUrl" label="安卓下载链接"/>
<el-table-column v-if="columns.visible('forceUpdate')" prop="forceUpdate" label="是否强制升级">
<template slot-scope="scope">
{{ dict.label.force_update[scope.row.forceUpdate] }}
</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','yxAppVersion:edit','yxAppVersion: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 crudYxAppVersion from '@/api/bxg/yxAppVersion'
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";
// crud交由presenter持有
const defaultCrud = CRUD({
title: 'app版本控制',
url: 'api/yxAppVersion',
sort: 'id,desc',
crudMethod: {...crudYxAppVersion}
})
const defaultForm = {
id: null,
isDel: null,
createTime: null,
updateTime: null,
versionCode: null,
versionName: null,
versionInfo: null,
iosUrl: null,
androidUrl: null,
forceUpdate: null
}
export default {
name: 'YxAppVersion',
components: {pagination, crudOperation, rrOperation, udOperation, MaterialList},
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
dicts: ['force_update'],
data() {
return {
permission: {
add: ['admin', 'yxAppVersion:add'],
edit: ['admin', 'yxAppVersion:edit'],
del: ['admin', 'yxAppVersion: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>
+137
View File
@@ -0,0 +1,137 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-input v-model="query.cateName" clearable size="small" placeholder="输入分类名称搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<rrOperation :crud="crud" />
</div>
<crudOperation :permission="permission" />
</div>
<!--表单组件-->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="分类名称">
<el-input v-model="form.cateName" style="width: 370px;" />
</el-form-item>
<el-form-item label="分类图片">
<MaterialList v-model="picArr" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.isShow" style="width: 178px">
<el-radio :label="1">显示</el-radio>
<el-radio :label="0">隐藏</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 370px;" />
</el-form-item>
<el-form-item style="margin-bottom: 0;" label="上级分类" prop="pid">
<treeselect v-model="form.pid" :options="depts" style="width: 370px;" placeholder="选择上级分类" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" :data="crud.data" row-key="id" @select="crud.selectChange" @select-all="crud.selectAllChange" @selection-change="crud.selectionChangeHandler">
<el-table-column :selectable="checkboxT" type="selection" width="55" />
<el-table-column v-if="columns.visible('cateName')" label="名称" prop="cateName" />
<el-table-column v-if="columns.visible('isShow')" label="状态" align="center" prop="isShow">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.isShow === 1" :type="''">显示</el-tag>
<el-tag v-else :type=" 'info' ">隐藏</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('sort')" label="排序" prop="sort" sortable/>
<el-table-column v-permission="['admin','YXSTORECATEGORY_EDIT','YXSTORECATEGORY_DELETE']" label="操作" width="130px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
msg="确定删除吗,如果存在下级节点则一并删除此操作不能撤销"
/>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import crudDept from '@/api/bxg/yxStoreCategory'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
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 picUpload from '@/components/pic-upload'
import MaterialList from '@/components/material'
// crud交由presenter持有
const defaultCrud = CRUD({ title: '分类', url: 'api/yxStoreCategory', sort: 'sort,desc', crudMethod: { ...crudDept }})
const defaultForm = { id: null, cateName: null, pid: 0, isShow: 1 , sort: 1}
export default {
name: 'Dept',
components: { Treeselect, crudOperation, rrOperation, udOperation, picUpload, MaterialList },
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
picArr: [],
depts: [],
rules: {
cateName: [
{ required: true, message: '请输入名称', trigger: 'blur' }
]
},
permission: {
add: ['admin', 'YXSTORECATEGORY_CREATE'],
edit: ['admin', 'YXSTORECATEGORY_EDIT'],
del: ['admin', 'YXSTORECATEGORY_DELETE']
},
enabledTypeOptions: [
{ key: 'true', display_name: '正常' },
{ key: 'false', display_name: '禁用' }
]
}
},
watch: {
picArr: function(val) {
console.log();
this.form.pic = val.join(',')
}
},
methods: {
// 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
this.picArr = []
if (form.pic && form.id) {
this.picArr = form.pic.split(',')
}
// 获取所有部门
crudDept.getCates({ isShow: true }).then(res => {
this.depts = []
const dept = { id: 0, label: '顶级类目', children: [] }
dept.children = res.content
this.depts.push(dept)
})
},
// 提交前的验证
[CRUD.HOOK.afterValidateCU]() {
return true
},
checkboxT(row, rowIndex) {
return row.id !== 1
}
}
}
</script>
<style scoped>
</style>
+82
View File
@@ -0,0 +1,82 @@
<template>
<div class="app-container">
<div class="head-container">
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column type="selection" width="55" />
<el-table-column prop="id" label="id" />
<el-table-column prop="uid" label="用户ID" />
<el-table-column prop="userName" label="用户名" />
<el-table-column prop="productId" label="商品ID" />
<el-table-column prop="product.storeName" label="商品名称" />
<el-table-column ref="table" prop="product.image" label="商品图片">
<template slot-scope="scope">
<a :href="scope.row.product.image" style="color: #42b983" target="_blank"><img :src="scope.row.product.image" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="type" label="类型">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.type == 'collect'" :type="''">收藏</el-tag>
<el-tag v-else :type=" 'info' ">足迹</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="createTime" label="添加时间">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import initData from '@/mixins/crud'
export default {
name: 'YxStoreProductRelation',
mixins: [initData],
data(){
return {
query:{
type: 'type',
} }
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
beforeInit() {
this.url = 'bxg/api/yxStoreProductRelation'
const sort = 'create_time,desc'
this.params = { page: this.page, size: this.size, sort: sort }
const query = this.query
this.params[query.type] = 'collect'
return true
}
}
}
</script>
<style scoped>
</style>
+262
View File
@@ -0,0 +1,262 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-input
v-model="query.nickName"
clearable
placeholder="输入用户昵称"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-input
v-model="query.remark"
clearable
placeholder="输入备注"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<rrOperation :crud="crud" />
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title"
width="750px"
>
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
<el-form-item label="用户昵称">
<el-input v-model="form.nickName" style="width: 485px;" :disabled="true" />
</el-form-item>
<el-form-item label="openId">
<el-input v-model="form.openId" style="width: 485px;" :disabled="true" />
</el-form-item>
<el-form-item label="扫码获取">
<div class="qrcode_img">
<el-image :src="gzhsrc" class="qrcode">
<div slot="placeholder" class="image-slot">
加载中
<span class="dot">...</span>
</div>
</el-image>
<div class="attention">
<span class="demonstration">注:未关注公众号请先关注</span>
</div>
</div>
<div class="qrcode_img">
<el-image :src="src" class="qrcode">
<div slot="placeholder" class="image-slot">
加载中
<span class="dot">...</span>
</div>
</el-image>
</div>
</el-form-item>
<el-form-item label="备注" style="margin-top:40px">
<el-input v-model="form.remark" style="width: 485px;" />
</el-form-item>
<el-form-item label="是否启用">
<el-radio v-for="item in dict.is_enable" :key="item.id" v-model="form.isEnable" :label="item.value">{{ item.label }}</el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<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('nickName')" prop="nickName" label="用户昵称" />
<el-table-column v-if="columns.visible('openId')" prop="openId" label="用户标识" />
<el-table-column v-if="columns.visible('remark')" prop="remark" label="备注" />
<el-table-column v-if="columns.visible('isEnable')" prop="isEnable" label="是否启用">
<template slot-scope="scope">
{{ dict.label.is_enable[scope.row.isEnable] }}
</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','yzCustomer:edit','yzCustomer: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 crudYzCustomer from "@/api/bxg/yxStoreCustomer";
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 { RandomNumber } from "@/utils/index";
// crud交由presenter持有
const defaultCrud = CRUD({
title: "消息通知",
url: "api/yxStoreCustomer",
sort: "id,desc",
crudMethod: { ...crudYzCustomer }
});
const defaultForm = {
id: null,
nickName: null,
openId: null,
remark: null,
createTime: null,
updateTime: null
};
export default {
name: "yxStoreCustomer",
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
dicts: ['is_enable'],
data() {
return {
timer: null, //定时器
src: "",
gzhsrc: "",
permission: {
add: ["admin", "yzCustomer:add"],
edit: ["admin", "yzCustomer:edit"],
del: ["admin", "yzCustomer:del"]
},
rules: {}
};
},
created() {
this.init();
},
methods: {
// 获取数据前设置好接口地址
[CRUD.HOOK.beforeRefresh]() {
const query = this.query;
if (query.type && query.value) {
this.crud.params[query.type] = query.value;
}
return true;
},
[CRUD.HOOK.beforeToAdd]() {
this.randomStr = RandomNumber();
this.src =
process.env.VUE_APP_BASE_API + "/api/wxmp/qrcode?key=" + this.randomStr;
this.setIntervaltimer();
crudYzCustomer.getwechatCode()
//getOpenId("FK14YV17TURrFdyWG4")
.then(res => {
if (res != "") {
this.gzhsrc = res;
console.log(res);
}
})
.catch(err => {
console.log(err.response.data.message);
});
return true;
},
//新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
},
[CRUD.HOOK.beforeToCU]() {
this.randomStr = RandomNumber();
this.src =
process.env.VUE_APP_BASE_API + "/api/wxmp/qrcode?key=" + this.randomStr;
this.setIntervaltimer();
return true;
},
[CRUD.HOOK.afterAddCancel]() {
clearInterval(this.timer);
this.timer = null;
return true;
},
[CRUD.HOOK.afterEditCancel]() {
clearInterval(this.timer);
this.timer = null;
return true;
},
[CRUD.HOOK.afterAddCancel]() {
clearInterval(this.timer);
this.timer = null;
return true;
},
init() {},
setIntervaltimer() {
if (this.timer != null) {
clearInterval(this.timer);
this.timer = null;
}
this.timer = setInterval(() => {
crudYzCustomer.getOpenId(this.randomStr)
//getOpenId("FK14YV17TURrFdyWG4")
.then(res => {
if (res != "") {
this.form.nickName = res.nickName;
this.form.openId = res.openId;
clearInterval(this.timer);
this.timer = null;
}
})
.catch(err => {
console.log(err.response.data.message);
});
}, 2000);
return this.timer;
}
}
};
</script>
<style scoped>
.qrcode_img {
width: 250px;
height: 250px;
float: left;
}
.qrcode_img .qrcode {
width: 100%;
height: 100%;
}
.attention {
line-height: 0px;
color: red;
margin-left: 20px;
font-size: 19px;
}
</style>
+102
View File
@@ -0,0 +1,102 @@
<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="120px">
<el-form-item label="快递公司编号" prop="code">
<el-input v-model="form.code" style="width: 300px;" />
</el-form-item>
<el-form-item label="快递公司名称">
<el-input v-model="form.name" style="width: 300px;" />
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 300px;" />
</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>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxExpress'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
code: '',
name: '',
sort: 0
},
rules: {
code: [
{ required: true, message: 'please enter', trigger: 'blur' }
]
}
}
},
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: '',
code: '',
name: '',
sort: 0
}
}
}
}
</script>
<style scoped>
</style>
+121
View File
@@ -0,0 +1,121 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXEXPRESS_ALL','YXEXPRESS_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="code" label="快递公司编号" />
<el-table-column prop="name" label="快递公司名称" />
<el-table-column prop="sort" label="排序" />
<el-table-column v-if="checkPermission(['admin','YXEXPRESS_ALL','YXEXPRESS_EDIT','YXEXPRESS_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-permission="['admin','YXEXPRESS_ALL','YXEXPRESS_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" />
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXEXPRESS_ALL','YXEXPRESS_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxExpress'
import eForm from './form'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxExpress'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
code: data.code,
name: data.name,
sort: data.sort,
isShow: data.isShow
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+82
View File
@@ -0,0 +1,82 @@
<template>
<div class="app-container">
<div class="head-container">
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column type="selection" width="55" />
<el-table-column prop="id" label="id" />
<el-table-column prop="uid" label="用户ID" />
<el-table-column prop="userName" label="用户名" />
<el-table-column prop="productId" label="商品ID" />
<el-table-column prop="product.storeName" label="商品名称" />
<el-table-column ref="table" prop="product.image" label="商品图片">
<template slot-scope="scope">
<a :href="scope.row.product.image" style="color: #42b983" target="_blank"><img :src="scope.row.product.image" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="type" label="类型">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.type == 'collect'" :type="''">收藏</el-tag>
<el-tag v-else :type=" 'info' ">足迹</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="createTime" label="添加时间">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import initData from '@/mixins/crud'
export default {
name: 'YxStoreProductRelation',
mixins: [initData],
data(){
return {
query:{
type: 'type',
} }
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
beforeInit() {
this.url = 'bxg/api/yxStoreProductRelation'
const sort = 'create_time,desc'
this.params = { page: this.page, size: this.size, sort: sort }
const query = this.query
this.params[query.type] = 'foot'
return true
}
}
}
</script>
<style scoped>
</style>
+450
View File
@@ -0,0 +1,450 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="title" width="900px">
<el-form v-show="hidden == false" ref="form" :model="form" :inline="true" :rules="rules" label-width="80px">
<el-form-item label="规则名称">
<el-row :gutter="10">
<el-col :span="10"><el-button type="primary" @click="hiddenBool">添加新规则</el-button></el-col>
</el-row>
</el-form-item>
</el-form>
<el-form v-show="hidden == true" ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="规则名称">
<el-row :gutter="10">
<el-col
v-for="(item, index) in items"
:key="index"
:span="5"
style="position: relative;margin-right: 6px"
>
<el-input v-model="item.value" style="width: 150px;" placeholder="设置名称" />
<el-button v-show="item.attrHidden == true" type="text" style="position: absolute;top:-6px;right:17px;margin-top:1px;border: none;font-size: 14px;font-weight:bold;line-height: 1.8" icon="el-icon-close" @click="handleRemove(index)" />
<el-button v-show="item.attrHidden == false" type="text" style="position: absolute;top:-6px;right:17px;margin-top:1px;border: none;font-size: 14px;font-weight:bold;line-height: 1.8" icon="el-icon-check" @click="attrHiddenBool(item)" />
</el-col>
<el-col :span="5"><el-button type="primary" @click="handleAdd">添加新规则</el-button></el-col>
</el-row>
</el-form-item>
<el-form-item
v-for="(item, index) in items"
v-show="item.attrHidden == true"
:key="index"
:label="''+item.value+':'"
>
<el-row :gutter="13">
<el-col
v-for="(attr,k) in item.detail"
:key="attr"
:span="3"
:name="attr"
>
<el-tag closable @close="attrRemove(item,k)">{{ attr }}</el-tag>
</el-col>
<el-col :span="5">
<el-input v-model="item.detailValue" style="width: 150px;" placeholder="设置属性" />
</el-col>
<el-col :span="5">
<el-button type="primary" @click="attrAdd(item)">添加</el-button>
</el-col>
</el-row>
</el-form-item>
<el-form-item v-show="hidden == true">
<el-row :gutter="24">
<el-col :span="24"><el-button :loading="loading" type="primary" @click="addGoods(true)">生成</el-button></el-col>
</el-row>
</el-form-item>
<template v-if="items[0].value!='' && items[0].detail.length>0 && attrs.length">
<template v-for="(attr,index) in attrs">
<el-form-item>
<el-row :gutter="24">
<template v-for="(item,index) in attr.detail">
<el-col :span="3" style="margin-right: 2px">
{{ index }}:{{ item }}
</el-col>
</template>
<el-col :span="4">
<span :class="attr.check ? 'check':''">金额:</span>&nbsp;
<el-input v-model="attr.price" placeholder="金额" style="width: 60%" :number="true" />
</el-col>
<el-col :span="4">
<span :class="attr.check ? 'check':''">库存:</span>&nbsp;
<el-input v-model="attr.sales" placeholder="库存" style="width: 60%" :number="true" maxlength="7"/>
</el-col>
<el-col :span="5">
<span :class="attr.check ? 'check':''">成本价:</span>&nbsp;
<el-input v-model="attr.cost" placeholder="成本价" style="width: 60%" :number="true" />
</el-col>
<el-col :span="3" style="margin-right: 2px">
<div class="demo-upload">
<!--<img :src="attr.pic">-->
<pic-upload-two v-model="attr.pic" />
</div>
</el-col>
<el-col :span="2" style="margin-right: 3px">
<el-button type="primary" @click="removeGoods(index)">删除</el-button>
</el-col>
</el-row>
</el-form-item>
</template>
<el-form-item>
<el-row :gutter="24">
<el-col :span="2">
<el-button type="primary" :loading="loading" @click="submit">提交</el-button>
</el-col>
<el-col :span="2">
<el-button type="error" @click="clear">清空所有属性</el-button>
</el-col>
</el-row>
</el-form-item>
</template>
</el-form>
</el-dialog>
</template>
<script>
import { getCates } from '@/api/bxg/yxStoreCategory'
import { add, edit, isFormatAttr, setAttr, clearAttr, getAttr } from '@/api/bxg/yxStoreProduct'
import editor from '../../components/Editor'
import picUploadTwo from '@/components/pic-upload-two'
import mulpicUpload from '@/components/mul-pic-upload'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { Message } from 'element-ui'
export default {
components: { editor, picUploadTwo, mulpicUpload, Treeselect },
props: {
isAttr: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false, cates: [], title: '规则属性',
form: {
id: '',
merId: '',
image: '',
sliderImage: '',
storeName: '',
storeInfo: '',
keyword: '',
barCode: '',
cateId: 1,
price: '',
vipPrice: '',
otPrice: '',
postage: '',
unitName: '',
sort: '',
sales: '',
stock: '',
isShow: '',
isHot: '',
isBenefit: '',
isBest: '',
isNew: '',
description: '',
addTime: '',
isPostage: '',
isDel: '',
merUse: '',
giveIntegral: '',
cost: '',
isSeckill: '',
isBargain: '',
isGood: '',
ficti: '',
browse: '',
codePath: '',
soureLink: ''
},
rules: {
},
items: [{
value: '',
detailValue: '',
attrHidden: false,
detail: []
}],
attrs: [],
hidden: false,
attrHidden: false,
submiting: false
}
},
mounted() {
// console.log('items'+this.items)
// console.log('attrs'+this.attrs)
// if(this.items && this.attrs) this.hidden = true;
// window.changeIMG = (index,pic)=>{
// _vm.setAttrPic(index,pic);
// };
},
methods: {
getAttrs(id) {
getAttr(id).then(res => {
console.log('res' + res)
// this.items = JSON.parse(res.attr)
if (res) {
this.hidden = true
this.items = res.attr
this.attrs = res.value
} else {
this.hidden = false
this.items = [{
value: '',
detailValue: '',
attrHidden: false,
detail: []
}]
this.attrs = []
}
})
},
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAttr) {
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: '',
merId: '',
image: '',
sliderImage: '',
storeName: '',
storeInfo: '',
keyword: '',
barCode: '',
cateId: '',
price: '',
vipPrice: '',
otPrice: '',
postage: '',
unitName: '',
sort: '',
sales: '',
stock: '',
isShow: '',
isHot: '',
isBenefit: '',
isBest: '',
isNew: '',
description: '',
addTime: '',
isPostage: '',
isDel: '',
merUse: '',
giveIntegral: '',
cost: '',
isSeckill: '',
isBargain: '',
isGood: '',
ficti: '',
browse: '',
codePath: '',
soureLink: ''
}
},
setAttrPic(index, pic) {
this.$set(this.attrs[index], 'pic', pic)
},
attrHiddenBool(item) {
if (item.value == '') {
Message({ message: '请填写规则名称', type: 'error' })
} else {
item.attrHidden = true
}
},
hiddenBool() {
this.hidden = true
},
handleAdd() {
if (!this.checkAttr()) return
this.items.push({
value: '',
detailValue: '',
attrHidden: false,
detail: []
})
},
checkAttr() {
var bool = true
this.items.map(function(item) {
if (!bool) return
if (!item.value) {
Message({ message: '请填写规则名称', type: 'error' })
bool = false
} else if (!item.detail.length) {
Message({ message: '请设置规则属性', type: 'error' })
bool = false
}
})
return bool
},
attrAdd(item) {
if (!item.detailValue) return false
item.detail.push(item.detailValue)
item.detailValue = ''
},
handleRemove(index) {
if (this.items.length > 1) { this.items.splice(index, 1) } else { Message({ message: '请设置至少一个规则', type: 'error' }) }
},
attrRemove(item, k) {
console.log('item:')
if (item.detail.length == 1) {
Message({ message: '请设置至少一个属性', type: 'error' })
return false
}
item.detail.splice(k, 1)
},
removeGoods(index) {
this.attrs.splice(index, 1)
},
checkGoods() {
var bool = true
this.attrs.map(function(attr) {
if (!bool) return
if (!Object.keys(attr.detail).length) {
Message({ message: '请选择至少一个属性', type: 'error' })
bool = false
} else if (attr.price != parseFloat(attr.price) || attr.price < 0) {
Message({ message: '请输入正确的商品价格', type: 'error' })
bool = false
} else if (attr.sales != parseInt(attr.sales) || attr.sales < 0) {
Message({ message: '请输入正确的商品库存', type: 'error' })
bool = false
}
})
return bool
},
addGoods(type) {
if (this.attrs.length) {
if (!this.checkGoods()) return
}
var that = this
isFormatAttr(this.form.id, { items: this.items, attrs: this.attrs }).then(res => {
this.attrs = res
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
submit() {
var that = this
that.submiting = true
if (!this.checkAttr() || !this.checkGoods()) return
for (const attr in that.attrs) {
that.attrs[attr].check = false
}
// console.log({items:this.items,attrs:this.attrs})
this.loading = false
setAttr(this.form.id, { items: this.items, attrs: this.attrs }).then(res => {
this.attrs = res
Message({ message: '操作成功', type: 'success' })
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
this.dialog = false
},
clear() {
this.$confirm(`确定要清空属性数据'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
clearAttr(this.form.id).then(({ data }) => {
Message({ message: '操作成功', type: 'success' })
// this.dialog = false
this.getAttrs(this.form.id)
})
})
.catch(() => { })
}
}
}
</script>
<style scoped>
.demo-upload{
display: block;
/*//height: 50px;*/
text-align: center;
border: 1px solid transparent;
border-radius: 4px;
overflow: hidden;
background: #fff;
position: relative;
box-shadow: 0 1px 1px rgba(0,0,0,.2);
margin-right: 4px;
}
.demo-upload img{
width: 100%;
height: 100%;
display: block;
}
.demo-upload-cover{
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0,0,0,.6);
}
.demo-upload:hover .demo-upload-cover{
display: block;
}
.demo-upload-cover i{
color: #fff;
font-size: 20px;
cursor: pointer;
margin: 0 2px;
}
</style>
+827
View File
@@ -0,0 +1,827 @@
<template>
<div class="app-container">
<el-card :bordered="false">
<el-form ref="formValidate" :rules="ruleValidate" :model="formValidate" label-width="130px" >
<el-row :gutter="24">
<!-- 商品信息-->
<el-col v-bind="grid2">
<el-form-item label="商品名称:" prop="store_name">
<el-input v-model="formValidate.store_name" placeholder="请输入商品名称" />
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="商品分类:" prop="cate_id">
<el-select v-model="formValidate.cate_id" filterable :filter-method="dataFilter" clearable>
<el-option v-for="item in optionsMetaShow" :disabled="item.disabled === 0"
:value="item.value" :key="item.id" :label="item.label" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="商品关键字:" prop="">
<el-input v-model="formValidate.keyword" placeholder="请输入商品关键字" />
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="单位:" prop="unit_name">
<el-input v-model="formValidate.unit_name" placeholder="请输入单位" />
</el-form-item>
</el-col>
<el-col v-bind="grid2">
<el-form-item label="商品简介:" prop="">
<el-input v-model="formValidate.store_info" type="textarea" :rows="3" placeholder="请输入商品简介" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品封面图:" prop="image">
<single-pic v-model="formValidate.image" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品轮播图:" prop="slider_image">
<MaterialList v-model="formValidate.slider_image" type="image" :num="4" :width="150" :height="150" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品规格:" props="spec_type">
<el-radio-group v-model="formValidate.spec_type" @change="changeSpec">
<el-radio :label="0" class="radio">单规格</el-radio>
<el-radio :label="1">多规格{{formValidate.spec_typ}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="开启积分兑换:" props="is_integral">
<el-radio-group v-model="formValidate.is_integral" @change="changeSpec">
<el-radio :label="0" class="radio">不开启</el-radio>
<el-radio :label="1">开启</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- 多规格添加-->
<el-col :span="24" v-if="formValidate.spec_type === 1" class="noForm">
<el-col :span="24">
<el-form-item label="选择规格:" prop="">
<div class="acea-row row-middle">
<el-select v-model="formValidate.selectRule" style="width: 23%;">
<el-option v-for="(item, index) in ruleList" :value="item.ruleName" :key="index">{{ item.ruleName }}</el-option>
</el-select>
<el-button type="primary" class="mr20" @click="confirm">确认</el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item v-if="attrs.length!==0">
<div v-for="(item, index) in attrs" :key="index">
<div class="acea-row row-middle"><span class="mr5">{{item.value}}</span>
<i class="el-icon-circle-close" @click="handleRemoveRole(index)"></i>
</div>
<div class="rulesBox">
<el-tag type="dot" closable color="primary" v-for="(j, indexn) in item.detail" :key="indexn" :name="j" class="mr20" @close="handleRemove2(item.detail,indexn)">{{j}}</el-tag>
<el-input placeholder="请输入属性名称" v-model="item.detail.attrsVal"
style="width: 150px">
<el-button slot="append" type="primary" @click="createAttr(item.detail.attrsVal,index)">添加</el-button>
</el-input>
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="24" v-if="createBnt">
<el-form-item>
<el-button type="primary" icon="md-add" @click="addBtn" class="mr15">添加新规格</el-button>
<el-button type="success" @click="generate">立即生成</el-button>
</el-form-item>
</el-col>
<el-col :span="24" v-if="showIput">
<el-col :xl="6" :lg="9" :md="10" :sm="24" :xs="24" >
<el-form-item label="规格:">
<el-input placeholder="请输入规格" v-model="formDynamic.attrsName" />
</el-form-item>
</el-col>
<el-col :xl="6" :lg="9" :md="10" :sm="24" :xs="24">
<el-form-item label="规格值:">
<el-input v-model="formDynamic.attrsVal" placeholder="请输入规格值" />
</el-form-item>
</el-col>
<el-col :xl="6" :lg="5" :md="10" :sm="24" :xs="24" >
<el-button type="primary" @click="createAttrName">确定</el-button>
<el-button type="danger" @click="offAttrName" >取消</el-button>
</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 :span="24">
<el-form-item label="商品属性:" class="labeltop">
<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">
<template slot-scope="scope">
<div v-if="scope.column.property == 'pic'" align="center">
<single-pic v-model="scope.row[scope.column.property]" type="image" :num="1" :width="60" :height="60" />
</div>
<div v-else-if="scope.column.property.indexOf('value') != -1" align="center">
{{ scope.row[scope.column.property] }}
</div>
<div v-else-if="scope.column.property == 'action'" align="center" >
<a @click="delAttrTable(scope.$index)" align="center">删除</a>
</div>
<div v-else align="center">
<el-input v-model="scope.row[scope.column.property]" align="center" />
</div>
</template>
</el-table-column>
</el-table>
</el-form-item>
</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-form-item >
<el-table :data="oneFormValidate" size="small" style="width: 90%;">
<el-table-column prop="pic" label="图片" align="center">
<template slot-scope="scope">
<single-pic v-model="scope.row.pic" type="image" :num="1" :width="60" :height="60" />
</template>
</el-table-column>
<el-table-column prop="price" label="售价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.price"/>
</template>
</el-table-column>
<el-table-column prop="cost" label="成本价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.cost"/>
</template>
</el-table-column>
<el-table-column prop="ot_price" label="原价" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.ot_price"/>
</template>
</el-table-column>
<el-table-column prop="stock" label="库存" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.stock" maxlength="7"/>
</template>
</el-table-column>
<el-table-column prop="bar_code" label="商品编号" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.bar_code"/>
</template>
</el-table-column>
<el-table-column prop="weight" label="重量(KG" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.weight"/>
</template>
</el-table-column>
<el-table-column prop="volume" label="体积(m³)" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.volume"/>
</template>
</el-table-column>
<el-table-column prop="volume" label="所需兑换积分" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.integral"/>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="运费模板:" prop="temp_id">
<div class="acea-row">
<el-select v-model="formValidate.temp_id" class="mr20">
<el-option v-for="(item,index) in templateList" :value="item.id" :key="index" :label="item.name">
</el-option>
</el-select>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="商品详情:">
<ueditor-wrap v-model="formValidate.description" :config="myConfig" @beforeInit="addCustomDialog" style="width: 90%;"></ueditor-wrap>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col v-bind="grid">
<el-form-item label="虚拟销量:">
<el-input-number :min="0" v-model="formValidate.ficti" placeholder="请输入虚拟销量" />
</el-form-item>
</el-col>
<el-col v-bind="grid">
<el-form-item label="购买返回积分:">
<el-input-number v-model="formValidate.give_integral" :min="0" placeholder="请输入积分" />
</el-form-item>
</el-col>
<el-col v-bind="grid">
<el-form-item label="排序:">
<el-input-number :min="0" v-model="formValidate.sort" placeholder="请输入排序" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="佣金设置:">
<el-radio-group v-model="formValidate.is_sub">
<el-radio :label="1" class="radio">单独设置</el-radio>
<el-radio :label="0">默认设置</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24" v-if="formValidate.is_sub === 1">
<!--单规格返佣-->
<el-form-item label="商品属性:" v-if="formValidate.spec_type === 0">
<el-table :data="oneFormValidate" size="small" style="width: 90%;">
<el-table-column prop="imageArr" label="图片" align="center">
<template slot-scope="scope">
<el-image :src="scope.row.pic" class="el-avatar">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</template>
</el-table-column>
<el-table-column prop="price" label="售价" align="center" />
<el-table-column prop="cost" label="成本价" align="center" />
<el-table-column prop="ot_price" label="原价" align="center" />
<el-table-column prop="stock" label="库存" align="center" />
<el-table-column prop="bar_code" label="商品编号" align="center" />
<el-table-column prop="weight" label="重量(KG" align="center" />
<el-table-column prop="volume" label="体积(m³" align="center" />
<el-table-column prop="volume" label="一级返佣" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.brokerage"/>
</template>
</el-table-column>
<el-table-column prop="volume" label="二级返佣" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.brokerage_two"/>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item label="商品属性:" v-if="formValidate.spec_type === 1 && manyFormValidate.length">
<el-table :data="manyFormValidate" size="small" style="width: 90%;">
<el-table-column prop="imageArr" label="图片" align="center">
<template slot-scope="scope">
<el-image :src="scope.row.pic" :width="60" :height="60" >
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</template>
</el-table-column>
<el-table-column prop="sku" label="规格" align="center" />
<el-table-column prop="price" label="售价" align="center" />
<el-table-column prop="cost" label="成本价" align="center" />
<el-table-column prop="ot_price" label="原价" align="center" />
<el-table-column prop="stock" label="库存" align="center" />
<el-table-column prop="bar_code" label="商品编号" align="center" />
<el-table-column prop="weight" label="重量(KG" align="center" />
<el-table-column prop="volume" label="体积(m³)" align="center" />
<el-table-column prop="integral" label="所需兑换积分" align="center" />
<el-table-column prop="volume" label="一级返佣" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.brokerage"/>
</template>
</el-table-column>
<el-table-column prop="volume" label="二级返佣" align="center">
<template slot-scope="scope">
<el-input type="text" v-model="scope.row.brokerage_two"/>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
<el-col v-bind="grid">
<el-form-item label="商品状态:">
<el-radio-group v-model="formValidate.is_show" >
<el-radio :label="1" class="radio">上架</el-radio>
<el-radio :label="0">下架</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col v-bind="grid">
<el-form-item label="热卖单品:">
<el-radio-group v-model="formValidate.is_hot" >
<el-radio :label="1" class="radio">开启</el-radio>
<el-radio :label="0">关闭</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col v-bind="grid">
<el-form-item label="猜你喜欢:">
<el-radio-group v-model="formValidate.is_benefit" >
<el-radio :label="1" class="radio">开启</el-radio>
<el-radio :label="0">关闭</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col v-bind="grid">
<el-form-item label="精品推荐:">
<el-radio-group v-model="formValidate.is_best" >
<el-radio :label="1" class="radio">开启</el-radio>
<el-radio :label="0">关闭</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col v-bind="grid">
<el-form-item label="首发新品:">
<el-radio-group v-model="formValidate.is_new" >
<el-radio :label="1" class="radio">开启</el-radio>
<el-radio :label="0">关闭</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" class="submission" @click="handleSubmit('formValidate')">保存</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import { getCates } from '@/api/bxg/yxStoreCategory'
import { add, edit, getInfo, isFormatAttr } from '@/api/bxg/yxStoreProduct'
import editor from '../../components/Editor'
import picUpload from '@/components/pic-upload'
import mulpicUpload from '@/components/mul-pic-upload'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import MaterialList from '@/components/material'
import singlePic from '@/components/singlematerial'
import UeditorWrap from 'vue-ueditor-wrap';
export default {
components: { editor, picUpload, mulpicUpload, Treeselect, MaterialList, UeditorWrap, singlePic },
data() {
return {
spinShow: false,
grid2: {
xl: 10,
lg: 12,
md: 12,
sm: 24,
xs: 24
},
grid3: {
xl: 18,
lg: 18,
md: 20,
sm: 24,
xs: 24
},
// 批量设置表格data
oneFormBatch: [
{
pic: '',
price: 0,
cost: 0,
ot_price: 0,
stock: 0,
bar_code: '',
seckill_stock: 0,
seckill_price: 0,
pink_stock: 0,
pink_price: 0,
weight: 0,
volume: 0,
integral:0
}
],
// 规格数据
formDynamic: {
attrsName: '',
attrsVal: ''
},
formDynamicNameData: [],
isBtn: false,
myConfig: {
autoHeightEnabled: false, // 编辑器不自动被内容撑高
initialFrameHeight: 500, // 初始容器高度
initialFrameWidth: '100%', // 初始容器宽度
UEDITOR_HOME_URL: '/UEditor/',
serverUrl: ''
},
columns: [],
formValidate: {
imageArr:[],
sliderImageArr: [],
store_name: '',
cate_id: '',
keyword: '',
unit_name: '',
store_info: '',
image: '',
slider_image: [],
description: '',
ficti: 0,
give_integral: 0,
sort: 0,
is_show: 1,
is_hot: 0,
is_benefit: 0,
is_best: 0,
is_new: 0,
is_good: 0,
is_postage: 0,
is_sub: 0,
is_integral: 0,
id: 0,
spec_type: 0,
temp_id: '',
attrs: [],
items: [
{
pic: '',
price: 0,
cost: 0,
ot_price: 0,
stock: 0,
bar_code: '',
integral:0
}
],
header: [],
selectRule: ''
},
ruleList: [],
templateList: [],
createBnt: false,
showIput: false,
manyFormValidate: [],
// 单规格表格data
oneFormValidate: [
{
imageArr: [],
pic: '',
price: 2,
cost: 0,
ot_price: 0,
stock: 0,
seckill_stock: 0,
seckill_price: 0,
pink_stock: 0,
pink_price: 0,
bar_code: '',
weight: 0,
volume: 0,
brokerage: 0,
brokerage_two: 0,
integral: 0
}
],
images: [],
grid: {
xl: 8,
lg: 8,
md: 12,
sm: 24,
xs: 24
},
loading: false,
treeSelect: [],
optionsMetaShow: [],
tableIndex: 0,
ruleValidate: {
store_name: [
{ required: true, message: '请输入商品名称', trigger: 'blur' }
],
cate_id: [
{ required: true, message: '请选择商品分类', trigger: 'change' }
],
keyword: [
{ required: true, message: '请输入商品关键字', trigger: 'blur' }
],
unit_name: [
{ required: true, message: '请输入单位', trigger: 'blur' }
],
store_info: [
{ required: true, message: '请输入商品简介', trigger: 'blur' }
],
spec_type: [
{ required: true, message: '请选择商品规格', trigger: 'change' }
],
selectRule: [
{ required: true, message: '请选择商品规格属性', trigger: 'change' }
],
temp_id: [
{ required: true, message: '请选择运费模板', trigger: 'change', type: 'number' }
]
},
attrs: []
}
},
watch: {
'formValidate.image': function(val) {
console.log('aaaa:'+val)
if (val) {
this.oneFormValidate[0].pic = val
console.log('bbbbbb:'+this.oneFormValidate.pic)
}
},
'form.sliderImageArr': function(val) {
if (val) {
this.form.slider_image = val.join(',')
}
}
},
mounted () {
this.getInfo();
},
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 () {
let that = this;
that.createBnt = true;
if (that.formValidate.selectRule.trim().length <= 0) {
return this.$message({
message:'请选择属性',
type: 'error'
});
}
that.ruleList.forEach(function (item, index) {
if (item.ruleName === that.formValidate.selectRule) {
that.attrs = item.ruleValue;
}
});
},
// 删除表格中的属性
delAttrTable (index) {
this.manyFormValidate.splice(index, 1);
},
// 添加按钮
addBtn () {
this.clearAttr();
this.createBnt = false;
this.showIput = true;
},
// 立即生成
generate () {
isFormatAttr(this.formValidate.id, { attrs: this.attrs }).then(res => {
this.manyFormValidate = res.value;
let headerdel = {
title: '操作',
slot: 'action',
fixed: 'right',
width: 220
};
res.header.push(headerdel);
this.formValidate.header = res.header;
//this.formValidate.attrs = res.attr;
let header = res.header;
header.pop();
if (!this.$route.params.id && this.formValidate.spec_type === 1) {
this.manyFormValidate.map((item) => {
item.pic = this.formValidate.image
});
this.oneFormBatch[0].pic = this.formValidate.image;
}
}).catch(res => {
// this.$message({
// message:res.msg,
// type: 'error'
// });
})
},
// 取消
offAttrName () {
this.showIput = false;
this.createBnt = true;
},
clearAttr () {
this.formDynamic.attrsName = '';
this.formDynamic.attrsVal = '';
},
// 删除规格
handleRemoveRole (index) {
this.attrs.splice(index, 1);
this.manyFormValidate.splice(index, 1);
},
// 删除属性
handleRemove2 (item, index) {
item.splice(index, 1);
},
// 添加规则名称
createAttrName () {
if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
let data = {
value: this.formDynamic.attrsName,
detail: [
this.formDynamic.attrsVal
]
};
this.attrs.push(data);
var hash = {};
this.attrs = this.attrs.reduce(function (item, next) {
hash[next.value] ? '' : hash[next.value] = true && item.push(next);
return item
}, [])
this.clearAttr();
this.showIput = false;
this.createBnt = true;
} else {
this.$message.warning('请添加完整的规格!');
}
},
// 添加属性
createAttr (num, idx) {
if (num) {
this.attrs[idx].detail.push(num);
var hash = {};
this.attrs[idx].detail = this.attrs[idx].detail.reduce(function (item, next) {
hash[next] ? '' : hash[next] = true && item.push(next);
return item
}, [])
} else {
this.$message.warning('请添加属性!');
}
},
// 改变规格
changeSpec () {
},
// 详情
getInfo () {
let that = this;
let id = that.$route.params.id || 0;
getInfo(id).then(async res => {
let data = res.productInfo;
console.log('data:'+data)
if(data){
let cate_id = parseInt(data.cate_id) || 0;
this.attrs = data.items || [];
that.formValidate = data;
that.formValidate.cate_id = cate_id;
that.oneFormValidate = [data.attr];
that.formValidate.header = [];
that.generate();
that.manyFormValidate = data.attrs;
if(data.spec_type === 0){
that.manyFormValidate = [];
}else {
that.createBnt = true;
that.oneFormValidate = [
{
pic: '',
price: 0,
cost: 0,
ot_price: 0,
stock: 0,
seckill_stock: 0,
seckill_price: 0,
pink_stock: 0,
pink_price: 0,
bar_code: '',
weight:0,
volume:0,
brokerage:0,
brokerage_two:0,
integral:0
}
]
}
}
that.treeSelect = res.cateList;
that.ruleList = res.ruleList;
that.templateList = res.tempList;
that.optionsMetaShow = that.treeSelect
}).catch(res => {
console.log('err:'+res)
return this.$message({
message:res.msg,
type: 'error'
});
})
},
// 提交
handleSubmit (name) {
this.$refs[name].validate((valid) => {
if (valid) {
if(this.formValidate.spec_type ===0 ){
this.formValidate.attrs = this.oneFormValidate;
this.formValidate.header = [];
this.formValidate.items = [];
}else{
this.formValidate.items = this.attrs;
this.formValidate.attrs = this.manyFormValidate;
}
if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){
return this.$message.warning('请点击生成规格!');
}
add(this.formValidate).then(async res => {
this.$message({
message:'操作成功',
type: 'success'
});
setTimeout(() => {
this.$router.push({ path: '/shop/goods' });
}, 500);
}).catch(res => {
// this.$message({
// message:res.message,
// type: 'error'
// });
})
} else {
if(!this.formValidate.store_name || !this.formValidate.cate_id || !this.formValidate.keyword
|| !this.formValidate.unit_name || !this.formValidate.store_info
|| !this.formValidate.image || !this.formValidate.slider_image){
this.$message.warning("请填写完整商品信息!");
}
}
})
},
// 表单验证
validate (prop, status, error) {
if (status === false) {
this.$message.warning(error);
}
},
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);
},
cancel() {
this.resetForm()
}
}
}
</script>
<style scoped lang="stylus">
.submission
margin-left 10px;
.color-list .tip{
color: #c9c9c9;
}
.color-list .color-item{
height: 30px;
line-height: 30px;
padding: 0 10px;
color:#fff;
margin-right :10px;
}
.color-list .color-item.blue{
background-color: #1E9FFF;
}
.color-list .color-item.yellow{
background-color: rgb(254, 185, 0);
}
.color-list .color-item.green{
background-color: #009688;
}
.columnsBox
margin-right 10px
.priceBox
width 100%
.rulesBox
display flex
flex-wrap: wrap;
.curs
cursor pointer
</style>
+301
View File
@@ -0,0 +1,301 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<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-select>
<el-select v-model="cateId" clearable placeholder="商品分类" class="filter-item" filterable :filter-method="dataFilter" style="width: 130px">
<el-option v-for="item in optionsMetaShow" :disabled="item.disabled === 0"
:value="item.value"
:key="item.id"
:label="item.label"></el-option>
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="toAddURL"
>
新增
</el-button>
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
</div>
<!--表单组件-->
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="商品id" />
<el-table-column ref="table" prop="image" label="商品图片">
<template slot-scope="scope">
<a :href="scope.row.image" style="color: #42b983" target="_blank"><img :src="scope.row.image" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="storeName" label="商品名称" />
<el-table-column prop="storeCategory.cateName" label="分类名称" />
<el-table-column prop="price" label="商品价格" />
<el-table-column prop="sales" label="销量" />
<el-table-column prop="stock" label="库存" />
<el-table-column label="商品类型" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.isIntegral === 1" style="cursor: pointer" :type="'warning'">积分商品</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">普通商品</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div @click="onSale(scope.row.id,scope.row.isShow)">
<el-tag v-if="scope.row.isShow === 1" style="cursor: pointer" :type="''">已上架</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">已下架</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="265px" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="toUpdateURL(scope.row.id)"
>
编辑
</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>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del, onsale } from '@/api/bxg/yxStoreProduct'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import Treeselect from '@riophae/vue-treeselect'
export default {
components: { Treeselect },
mixins: [initData],
data() {
return {
dropDownValue: '',
optionsMetaShow: [],
delLoading: false,
visible: false,
queryTypeOptions: [
{ key: 'storeName', display_name: '商品名称' }
],
isAttr: false,
cateId: null,
}
},
created() {
this.$nextTick(() => {
this.init().then(() =>{
this.optionsMetaShow = this.cateList
})
})
},
methods: {
toAddURL(){
this.$router.push({ path: '/shop/goodsAdd' })
},
toUpdateURL(id){
this.$router.push({ path: '/shop/goodsEdit/'+id })
},
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,
beforeInit() {
this.url = 'bxg/api/yxStoreProduct'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, isShow: 1, isDel: 0,cateId: this.cateId }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
onSale(id, status) {
this.$confirm(`确定进行[${status ? '下架' : '上架'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
onsale(id, { status: status }).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1000,
onClose: () => {
this.init()
}
})
})
})
.catch(() => { })
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
this.$refs.form.getCates()
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.getCates()
_this.form = {
id: data.id,
merId: data.merId,
image: data.image,
sliderImage: data.sliderImage,
imageArr: data.image.split(','),
sliderImageArr: data.sliderImage.split(','),
storeName: data.storeName,
storeInfo: data.storeInfo,
keyword: data.keyword,
barCode: data.barCode,
storeCategory: data.storeCategory || {id:null},
price: data.price,
vipPrice: data.vipPrice,
otPrice: data.otPrice,
postage: data.postage,
unitName: data.unitName,
sort: data.sort,
sales: data.sales,
stock: data.stock,
isShow: data.isShow,
isHot: data.isHot,
isBenefit: data.isBenefit,
isBest: data.isBest,
isNew: data.isNew,
description: data.description,
addTime: data.addTime,
isPostage: data.isPostage,
isDel: data.isDel,
merUse: data.merUse,
giveIntegral: data.giveIntegral,
cost: data.cost,
isSeckill: data.isSeckill,
isBargain: data.isBargain,
isGood: data.isGood,
ficti: data.ficti,
browse: data.browse,
codePath: data.codePath,
soureLink: data.soureLink
}
_this.dialog = true
},
attr(data) {
console.log(3333)
this.isAttr = false
const _this = this.$refs.form2
_this.form = {
id: data.id,
merId: data.merId,
image: data.image,
sliderImage: data.sliderImage,
storeName: data.storeName,
storeInfo: data.storeInfo,
keyword: data.keyword,
barCode: data.barCode,
storeCategory: data.storeCategory,
price: data.price,
vipPrice: data.vipPrice,
otPrice: data.otPrice,
postage: data.postage,
unitName: data.unitName,
sort: data.sort,
sales: data.sales,
stock: data.stock,
isShow: data.isShow,
isHot: data.isHot,
isBenefit: data.isBenefit,
isBest: data.isBest,
isNew: data.isNew,
description: data.description,
addTime: data.addTime,
isPostage: data.isPostage,
isDel: data.isDel,
merUse: data.merUse,
giveIntegral: data.giveIntegral,
cost: data.cost,
isSeckill: data.isSeckill,
isBargain: data.isBargain,
isGood: data.isGood,
ficti: data.ficti,
browse: data.browse,
codePath: data.codePath,
soureLink: data.soureLink
}
_this.dialog = true
this.$refs.form2.getAttrs(data.id)
}
}
}
</script>
<style scoped>
</style>
+213
View File
@@ -0,0 +1,213 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<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-select>
<el-select v-model="cateId" clearable placeholder="商品分类" class="filter-item" style="width: 130px">
<el-option v-for="item in cateList" :disabled="item.disabled === 0"
:value="item.value"
:key="item.id"
:label="item.label"></el-option>
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="商品id" />
<el-table-column ref="table" prop="image" label="商品图片">
<template slot-scope="scope">
<a :href="scope.row.image" style="color: #42b983" target="_blank"><img :src="scope.row.image" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="storeName" label="商品名称" />
<el-table-column prop="storeCategory.cateName" label="分类名称" />
<el-table-column prop="price" label="商品价格" />
<el-table-column prop="sales" label="销量" />
<el-table-column prop="stock" label="库存" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div @click="onSale(scope.row.id,scope.row.isShow)">
<el-tag v-if="scope.row.isShow === 1" style="cursor: pointer" :type="''">已上架</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">已下架</el-tag>
</div>
</template>
</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">
<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']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del, onsale } from '@/api/bxg/yxStoreProduct'
import eForm from './form'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false,
visible: false,
cateId: null,
queryTypeOptions: [
{ key: 'storeName', display_name: '商品名称' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreProduct'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, isShow: 0, isDel: 0,cateId: this.cateId }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
onSale(id, status) {
this.$confirm(`确定进行[${status ? '下架' : '上架'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
onsale(id, { status: status }).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1000,
onClose: () => {
this.init()
}
})
})
})
.catch(() => { })
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
this.$refs.form.getCates()
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.getCates()
_this.form = {
id: data.id,
merId: data.merId,
image: data.image,
sliderImage: data.sliderImage,
imageArr: data.image.split(','),
sliderImageArr: data.sliderImage.split(','),
storeName: data.storeName,
storeInfo: data.storeInfo,
keyword: data.keyword,
barCode: data.barCode,
storeCategory: data.storeCategory || {id:null},
price: data.price,
vipPrice: data.vipPrice,
otPrice: data.otPrice,
postage: data.postage,
unitName: data.unitName,
sort: data.sort,
sales: data.sales,
stock: data.stock,
isShow: data.isShow,
isHot: data.isHot,
isBenefit: data.isBenefit,
isBest: data.isBest,
isNew: data.isNew,
description: data.description,
addTime: data.addTime,
isPostage: data.isPostage,
isDel: data.isDel,
merUse: data.merUse,
giveIntegral: data.giveIntegral,
cost: data.cost,
isSeckill: data.isSeckill,
isBargain: data.isBargain,
isGood: data.isGood,
ficti: data.ficti,
browse: data.browse,
codePath: data.codePath,
soureLink: data.soureLink
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+195
View File
@@ -0,0 +1,195 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<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-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</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" />
<el-table-column ref="table" prop="image" label="商品图片">
<template slot-scope="scope">
<a :href="scope.row.image" style="color: #42b983" target="_blank"><img :src="scope.row.image" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="storeName" label="商品名称" />
<el-table-column prop="storeCategory.cateName" label="分类名称" />
<el-table-column prop="price" label="商品价格" />
<el-table-column prop="sales" label="销量" />
<el-table-column prop="stock" label="库存" />
<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-popover
:ref="scope.row.id"
v-permission="['admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE']"
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>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { recovery, onsale } from '@/api/bxg/yxStoreProduct'
import eForm from './form'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false,
visible: false,
queryTypeOptions: [
{ key: 'storeName', display_name: '商品名称' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreProduct'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, isDel: 1 }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(id) {
this.delLoading = true
recovery(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '恢复成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
onSale(id, status) {
this.$confirm(`确定进行[${status ? '下架' : '上架'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
onsale(id, { status: status }).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1000,
onClose: () => {
this.init()
}
})
})
})
.catch(() => { })
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
this.$refs.form.getCates()
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.getCates()
_this.form = {
id: data.id,
merId: data.merId,
image: data.image,
sliderImage: data.sliderImage,
imageArr: data.image.split(','),
sliderImageArr: data.sliderImage.split(','),
storeName: data.storeName,
storeInfo: data.storeInfo,
keyword: data.keyword,
barCode: data.barCode,
storeCategory: data.storeCategory || {id:null},
price: data.price,
vipPrice: data.vipPrice,
otPrice: data.otPrice,
postage: data.postage,
unitName: data.unitName,
sort: data.sort,
sales: data.sales,
stock: data.stock,
isShow: data.isShow,
isHot: data.isHot,
isBenefit: data.isBenefit,
isBest: data.isBest,
isNew: data.isNew,
description: data.description,
addTime: data.addTime,
isPostage: data.isPostage,
isDel: data.isDel,
merUse: data.merUse,
giveIntegral: data.giveIntegral,
cost: data.cost,
isSeckill: data.isSeckill,
isBargain: data.isBargain,
isGood: data.isGood,
ficti: data.ficti,
browse: data.browse,
codePath: data.codePath,
soureLink: data.soureLink
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+37
View File
@@ -0,0 +1,37 @@
<template>
<el-tabs v-model="activeName" style="padding-left: 8px;" @tab-click="tabClick">
<el-tab-pane label="出售中产品" name="first">
<onSale ref="onSale" />
</el-tab-pane>
<el-tab-pane label="待上架产品" name="second">
<unonSale ref="unonSale" />
</el-tab-pane>
</el-tabs>
</template>
<script>
import onSale from '@/views/bxg/shop/goods/index'
import unonSale from '@/views/bxg/shop/goods/index2'
import '@/assets/styles/description.scss'
export default {
name: 'Tab',
components: { onSale, unonSale },
data() {
return {
activeName: 'first'
}
},
methods: {
tabClick(name) {
if (this.activeName === 'first') {
this.$refs.onSale.init()
} else if (this.activeName === 'second') {
this.$refs.unonSale.init()
}
}
}
}
</script>
<style scoped>
</style>
File diff suppressed because it is too large Load Diff
+332
View File
@@ -0,0 +1,332 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '订单详情'" width="700px">
<el-card>
<div slot="header">
<span>进度信息</span>
</div>
<el-steps
v-if="form.refundStatus===0"
:active="orderStatus.size"
align-center
process-status="process"
finish-status="success"
>
<el-step title="用户下单" :description="orderStatus.cacheKeyCreateOrder"></el-step>
<el-step title="待核销" :description="orderStatus.paySuccess"></el-step>
<el-step title="待评价" :description="orderStatus.orderVerific"></el-step>
<el-step title="已完成" :description="orderStatus.checkOrderOver"></el-step>
</el-steps>
<el-steps v-else :active="form.refundStatus+1" align-center process-status="process" finish-status="success">
<el-step title="用户下单" :description="orderStatus.cacheKeyCreateOrder"></el-step>
<el-step title="用户申请退款" :description="orderStatus.applyRefund"></el-step>
<el-step title="退款申请通过" :description="orderStatus.refundOrderSuccess"></el-step>
</el-steps>
</el-card>
<el-card>
<div slot="header">
<span>收货信息</span>
</div>
<div class="text item">用户昵称:{{ form.nickname }}</div>
<div class="text item">收货人: {{ form.realName }}</div>
<div class="text item">联系电话: {{ form.userPhone }}</div>
<div class="text item">收货地址: {{ form.userAddress }}</div>
</el-card>
<el-card>
<div slot="header">
<span>订单信息</span>
</div>
<el-row :gutter="24">
<el-col :span="12">
<div class="text item">订单编号: {{ form.orderId }}</div>
<div class="text item">商品总数: {{ form.totalNum }}</div>
<div class="text item">支付邮费: {{ form.totalPostage }}</div>
<div class="text item">实际支付: {{ form.payPrice }}</div>
<div class="text item">支付方式: {{ form.payTypeName }}</div>
</el-col>
<el-col :span="12">
<div class="text item">订单状态: <span v-html="form.statusName"></span></div>
<div class="text item">商品总价: {{ form.totalPrice }}</div>
<div class="text item">优惠券金额: {{ form.couponPrice }}</div>
<div class="text item">创建时间: {{ parseTime(form.createTime) }}</div>
<div class="text item">支付时间: {{ parseTime(form.payTime) }}</div>
</el-col>
</el-row>
</el-card>
<el-card v-if="form.storeId == 0">
<div slot="header">
<span>物流信息</span>
</div>
<div class="text item">快递公司:{{ form.deliveryName }}</div>
<div class="text item">快递单号:{{ form.deliveryId }}</div>
<div><el-button :loading="loading" type="primary" @click="express">查看物流</el-button></div>
<div style="margin-top: 20px">
<el-timeline v-if="form.deliveryId && expressInfo.length > 0">
<el-timeline-item
v-for="(obj, index) in expressInfo"
:key="index"
:timestamp="obj.acceptTime"
>
{{obj.acceptStation}}
</el-timeline-item>
</el-timeline>
<el-timeline :reverse="false" v-else>
<el-timeline-item>
暂无物流信息
</el-timeline-item>
</el-timeline>
</div>
</el-card>
<el-card>
<div slot="header">
<span>备注信息</span>
</div>
<div class="text item">{{ form.remark }}</div>
</el-card>
</el-dialog>
</template>
<script>
import { add, edit, express,
getNowOrderStatus } from '@/api/bxg/yxStoreOrder'
import {formatTimeTwo, parseTime} from '@/utils/index'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
orderStatus:null,
loading: false, dialog: false, expressInfo: [],
form: {
id: '',
orderId: '',
uid: '',
realName: '',
userPhone: '',
userAddress: '',
cartId: '',
freightPrice: '',
totalNum: '',
totalPrice: '',
totalPostage: '',
payPrice: '',
payPostage: '',
deductionPrice: '',
couponId: '',
couponPrice: '',
paid: '',
payTime: '',
payType: '',
addTime: '',
status: '',
refundStatus: '',
refundReasonWapImg: '',
refundReasonWapExplain: '',
refundReasonTime: '',
refundReasonWap: '',
refundReason: '',
refundPrice: '',
deliveryName: '',
deliverySn: '',
deliveryType: '',
deliveryId: '',
gainIntegral: '',
useIntegral: '',
backIntegral: '',
mark: '',
isDel: '',
unique: '',
remark: '',
merId: '',
isMerCheck: '',
combinationId: '',
pinkId: '',
cost: '',
seckillId: '',
bargainId: '',
verifyCode: '',
storeId: '',
shippingType: '',
isChannel: '',
isRemind: '',
isSystemDel: ''
},
rules: {
unique: [
{ required: true, message: 'please enter', trigger: 'blur' }
]
}
}
},
watch: {
'form': function(val) {
this.getNowOrderStatus();
}
},
methods: {
parseTime,
cancel() {
this.dialog = false
},
express() {
let params ={
"orderCode": this.form.id,
"shipperCode": this.form.deliverySn,
"logisticCode": this.form.deliveryId
}
express(params).then(res=>{
console.log(res)
this.expressInfo = res.Traces
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
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)
})
}, formatTime(time) {
if (time == null || time === '') {
return '';
}
let date = new Date(time);
return formatTimeTwo(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStepStatus(value) {
//todo 1-未付款 2-未发货 3-退款中 4-待收货 5-待评价 6-已完成 7-已退款
if (value === 2) {
//待发货
return 2;
} else if (value === 4) {
//已发货
return 3;
} else if (value === 6) {
//已完成
return 4;
}else {
//待付款、已关闭、无限订单
return 1;
}
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
orderId: '',
uid: '',
realName: '',
userPhone: '',
userAddress: '',
cartId: '',
freightPrice: '',
totalNum: '',
totalPrice: '',
totalPostage: '',
payPrice: '',
payPostage: '',
deductionPrice: '',
couponId: '',
couponPrice: '',
paid: '',
payTime: '',
payType: '',
addTime: '',
status: '',
refundStatus: '',
refundReasonWapImg: '',
refundReasonWapExplain: '',
refundReasonTime: '',
refundReasonWap: '',
refundReason: '',
refundPrice: '',
deliveryName: '',
deliveryType: '',
deliveryId: '',
gainIntegral: '',
useIntegral: '',
backIntegral: '',
mark: '',
isDel: '',
unique: '',
remark: '',
merId: '',
isMerCheck: '',
combinationId: '',
pinkId: '',
cost: '',
seckillId: '',
bargainId: '',
verifyCode: '',
storeId: '',
shippingType: '',
isChannel: '',
isRemind: '',
isSystemDel: ''
}
},
getNowOrderStatus() {
let id = this.form.id || 0;
getNowOrderStatus(id)
.then(res => {
this.orderStatus = res;
})
.catch(err => {
console.log(err.response.data.message);
});
},
}
}
</script>
<style scoped>
.text {
font-size: 12px;
}
.item {
padding: 6px 0;
}
</style>
+196
View File
@@ -0,0 +1,196 @@
<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="订单号">
<el-input v-model="form.orderId" :disabled="true" style="width: 370px;" />
</el-form-item>
<el-form-item label="原始邮费">
<el-input v-model="form.totalPostage" :disabled="true" style="width: 370px;" />
</el-form-item>
<el-form-item label="实际支付">
<el-input v-model="form.payPrice" style="width: 370px;" />
</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>
</el-dialog>
</template>
<script>
import { add, editOrder } from '@/api/bxg/yxStoreOrder'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
orderId: '',
uid: '',
realName: '',
userPhone: '',
userAddress: '',
cartId: '',
freightPrice: '',
totalNum: '',
totalPrice: '',
totalPostage: '',
payPrice: '',
payPostage: '',
deductionPrice: '',
couponId: '',
couponPrice: '',
paid: '',
payTime: '',
payType: '',
addTime: '',
status: '',
refundStatus: '',
refundReasonWapImg: '',
refundReasonWapExplain: '',
refundReasonTime: '',
refundReasonWap: '',
refundReason: '',
refundPrice: '',
deliveryName: '',
deliveryType: '',
deliveryId: '',
gainIntegral: '',
useIntegral: '',
backIntegral: '',
mark: '',
isDel: '',
unique: '',
remark: '',
merId: '',
isMerCheck: '',
combinationId: '',
pinkId: '',
cost: '',
seckillId: '',
bargainId: '',
verifyCode: '',
storeId: '',
shippingType: '',
isChannel: '',
isRemind: '',
isSystemDel: ''
},
rules: {
unique: [
{ required: true, message: 'please enter', trigger: 'blur' }
]
}
}
},
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() {
editOrder(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: '',
orderId: '',
uid: '',
realName: '',
userPhone: '',
userAddress: '',
cartId: '',
freightPrice: '',
totalNum: '',
totalPrice: '',
totalPostage: '',
payPrice: '',
payPostage: '',
deductionPrice: '',
couponId: '',
couponPrice: '',
paid: '',
payTime: '',
payType: '',
addTime: '',
status: '',
refundStatus: '',
refundReasonWapImg: '',
refundReasonWapExplain: '',
refundReasonTime: '',
refundReasonWap: '',
refundReason: '',
refundPrice: '',
deliveryName: '',
deliveryType: '',
deliveryId: '',
gainIntegral: '',
useIntegral: '',
backIntegral: '',
mark: '',
isDel: '',
unique: '',
remark: '',
merId: '',
isMerCheck: '',
combinationId: '',
pinkId: '',
cost: '',
seckillId: '',
bargainId: '',
verifyCode: '',
storeId: '',
shippingType: '',
isChannel: '',
isRemind: '',
isSystemDel: ''
}
}
}
}
</script>
<style scoped>
</style>
+184
View File
@@ -0,0 +1,184 @@
<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="快递公司">
<!--<el-input v-model="form.deliveryName" style="width: 370px;"/>-->
<el-select v-model="form.deliveryName" filterable placeholder="请选择" style="width: 370px;">
<el-option
v-for="item in express"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
<el-form-item label="快递单号">
<el-input v-model="form.deliveryId" style="width: 370px;" />
</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>
</el-dialog>
</template>
<script>
import { add, edit, get,updateDelivery } from '@/api/bxg/yxStoreOrder'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false, express: [],
form: {
id: '',
deliveryName: '',
deliveryType: 'express',
deliveryId: ''
},
rules: {
unique: [
{ required: true, message: 'please enter', trigger: 'blur' }
]
}
}
},
created() {
this.get()
},
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() {
if(this.form._status == 4){
updateDelivery(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)
})
}else{
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: '',
orderId: '',
uid: '',
realName: '',
userPhone: '',
userAddress: '',
cartId: '',
freightPrice: '',
totalNum: '',
totalPrice: '',
totalPostage: '',
payPrice: '',
payPostage: '',
deductionPrice: '',
couponId: '',
couponPrice: '',
paid: '',
payTime: '',
payType: '',
addTime: '',
status: '',
refundStatus: '',
refundReasonWapImg: '',
refundReasonWapExplain: '',
refundReasonTime: '',
refundReasonWap: '',
refundReason: '',
refundPrice: '',
deliveryName: '',
deliveryType: '',
deliveryId: '',
gainIntegral: '',
useIntegral: '',
backIntegral: '',
mark: '',
isDel: '',
unique: '',
remark: '',
merId: '',
isMerCheck: '',
combinationId: '',
pinkId: '',
cost: '',
seckillId: '',
bargainId: '',
verifyCode: '',
storeId: '',
shippingType: '',
isChannel: '',
isRemind: '',
isSystemDel: ''
}
},
get() {
get().then(res => {
this.express = res.content
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
}
}
}
</script>
<style scoped>
</style>
+158
View File
@@ -0,0 +1,158 @@
<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="核销码">
<el-input v-model="form.verifyCode" style="width: 370px;" placeholder="请输入核销码" />
<p style="color: red">注意:请务必核对核销码的与客户正确性</p>
<p style="color: red">注意:手机端也可以核销去会员管理里把编辑相应会员开启商户管理即可</p>
</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>
</el-dialog>
</template>
<script>
import { add, editT, get } from '@/api/bxg/yxStoreOrder'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false, express: [],
form: {
id: '',
deliveryName: '',
deliveryType: 'express',
deliveryId: ''
},
rules: {
unique: [
{ required: true, message: 'please enter', trigger: 'blur' }
]
}
}
},
created() {
this.get()
},
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() {
editT(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: '',
orderId: '',
uid: '',
realName: '',
userPhone: '',
userAddress: '',
cartId: '',
freightPrice: '',
totalNum: '',
totalPrice: '',
totalPostage: '',
payPrice: '',
payPostage: '',
deductionPrice: '',
couponId: '',
couponPrice: '',
paid: '',
payTime: '',
payType: '',
addTime: '',
status: '',
refundStatus: '',
refundReasonWapImg: '',
refundReasonWapExplain: '',
refundReasonTime: '',
refundReasonWap: '',
refundReason: '',
refundPrice: '',
deliveryName: '',
deliveryType: '',
deliveryId: '',
gainIntegral: '',
useIntegral: '',
backIntegral: '',
mark: '',
isDel: '',
unique: '',
remark: '',
merId: '',
isMerCheck: '',
combinationId: '',
pinkId: '',
cost: '',
seckillId: '',
bargainId: '',
verifyCode: '',
storeId: '',
shippingType: '',
isChannel: '',
isRemind: '',
isSystemDel: ''
}
},
get() {
get().then(res => {
this.express = res.content
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
}
}
}
</script>
<style scoped>
</style>
+867
View File
@@ -0,0 +1,867 @@
<template>
<div class="app-container" style="position: relative; height: calc(100vh - 117px);">
<div class="container">
<el-tabs v-model="status" type="card" @tab-click="handleOrder">
<el-tab-pane name="-9">
<span slot="label"><i class="el-icon-s-order"></i> 全部订单</span>
</el-tab-pane>
<el-tab-pane name="0">
<span slot="label"><i class="el-icon-bank-card"></i> 未支付</span>
</el-tab-pane>
<el-tab-pane name="1">
<span slot="label"><i class="el-icon-refrigerator"></i> 未发货</span>
</el-tab-pane>
<el-tab-pane name="2">
<span slot="label"><i class="el-icon-truck"></i> 待收货</span>
</el-tab-pane>
<el-tab-pane name="3">
<span slot="label"><i class="el-icon-document"></i> 待评价</span>
</el-tab-pane>
<el-tab-pane name="4">
<span slot="label"><i class="el-icon-circle-check"></i> 交易完成</span>
</el-tab-pane>
<el-tab-pane name="-1">
<span slot="label"><i class="el-icon-back"></i> 退款中</span>
</el-tab-pane>
<el-tab-pane name="-2">
<span slot="label"><i class="el-icon-finished"></i> 已退款</span>
</el-tab-pane>
</el-tabs>
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<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-select>
<el-select v-model="orderType" clearable placeholder="订单类型" class="filter-item" style="width: 130px">
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-date-picker
v-model="createTime"
:default-time="['00:00:00','23:59:59']"
type="daterange"
range-separator=":"
size="small"
class="date-item"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<eDetail ref="form1" :is-add="isAdd" />
<eRefund ref="form2" :is-add="isAdd" />
<editOrder ref="form3" :is-add="isAdd" />
<eRemark ref="form4" :is-add="isAdd" />
<ePrint ref="form5" :is-add="isAdd" :print-list="checkList" :to-query="toQuery"/>
<!--订单数据统计-->
<div class="order-caculate">
<a class="caculate-title">订单数 : <span class="caculate-num">{{caculateInfo.orderNum}}</span></a>
<a class="caculate-title">商品数 : <span class="caculate-num">{{caculateInfo.storeNum}}</span></a>
<a class="caculate-title">订单金额 : <span class="caculate-num">{{caculateInfo.orderPrice}}</span></a>
<a class="caculate-title">客户数 : <span class="caculate-num">{{caculateInfo.userNum}}</span></a>
</div>
<!--表格渲染-->
<el-table ref="multipleTable" v-loading="loading" :data="data" size="small" style="width: 100%;" @selection-change="handleSelectionChange">
<el-table-column :selectable="checkboxT" type="selection" width="50" />
<el-table-column prop="orderId" width="140" label="订单号">
<template slot-scope="scope">
<span>{{ scope.row.orderId }}</span>
<p>{{ scope.row.pinkName }}</p>
</template>
</el-table-column>
<el-table-column prop="realName" label="用户昵称" >
<template slot-scope="scope">
<span>{{ scope.row.userDTO.nickname }}</span>
</template>
</el-table-column>
<el-table-column prop="cartInfoList" width="300" label="商品信息">
<template slot-scope="scope">
<!-- <div v-for="(item,index) in scope.row.cartInfoList"
:key="index"
v-if="item.cartInfoMap.productInfo.attrInfo">
<span>
<img style="width: 30px;height: 30px;margin:0;cursor: pointer;"
:src="item.cartInfoMap.productInfo.attrInfo.image"
>
</span>
<span>{{ item.cartInfoMap.productInfo.storeName }}&nbsp;{{ item.cartInfoMap.productInfo.attrInfo.suk }}</span>
<span> | {{ item.cartInfoMap.truePrice }}×{{ item.cartInfoMap.cartNum }}</span>
</div>
<div v-else>
<span>
<img
style="width: 30px;height: 30px;margin:0;cursor: pointer;"
:src="item.cartInfoMap.productInfo.image">
</span>
<span>{{ item.cartInfoMap.productInfo.storeName }}</span>
<span> | {{ item.cartInfoMap.truePrice }}×{{ item.cartInfoMap.cartNum }}</span>
</div> -->
<div v-for="(item,index) in scope.row.cartInfoList"
:key="index">
<span v-if="item.cartInfoMap.productInfo.attrInfo">
<img style="width: 30px;height: 30px;margin:0;cursor: pointer;"
:src="item.cartInfoMap.productInfo.attrInfo.image"
>
</span>
<span v-else>
<img
style="width: 30px;height: 30px;margin:0;cursor: pointer;"
:src="item.cartInfoMap.productInfo.image">
</span>
<span>
{{ item.cartInfoMap.productInfo.storeName }}
<span v-if="item.cartInfoMap.productInfo.attrInfo">&nbsp;{{ item.cartInfoMap.productInfo.attrInfo.sku }}</span>
</span>
<span> | {{ item.cartInfoMap.truePrice }}×{{ item.cartInfoMap.cartNum }}</span>
</div>
</template>
</el-table-column>
<el-table-column prop="payPrice" label="实际支付" />
<el-table-column prop="payIntegral" label="消费积分" />
<el-table-column prop="payTypeName" label="支付状态" />
<el-table-column prop="statusName" label="订单状态">
<template slot-scope="scope">
<span v-html="scope.row.statusName"></span>
</template>
</el-table-column>
<el-table-column prop="addTime" width="160" label="创建时间">
<template slot-scope="scope">
<span>{{ formatTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT','YXSTOREORDER_DELETE'])" label="操作" width="200" align="center" fixed="right">
<template slot-scope="scope">
<el-button
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="primary"
@click="toDetailURL(scope.row.id)"
>
订单详情</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','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="success"
@click="remark(scope.row)"
>
订单备注</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button
v-if="scope.row._status == 2"
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="primary"
@click="edit(scope.row)"
>
去发货</el-button>
<el-button
v-if="scope.row._status == 4"
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="primary"
@click="edit(scope.row)"
>
修改快递</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button
v-if="scope.row._status == 3"
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="primary"
@click="refund(scope.row)"
>
立刻退款</el-button>
</el-dropdown-item>
<el-dropdown-item v-if="scope.row._status == 1">
<el-button
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="primary"
@click="editOrder(scope.row)"
>
修改订单</el-button>
</el-dropdown-item>
<el-dropdown-item v-if="scope.row._status == 1">
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_DELETE']"
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-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</div>
<!--添加订单打印及订单导出功能 2020.04.13 changxh-->
<el-footer class="footer-contains">
<div class="footer-search">
<el-checkbox v-model="printChecked" @change="batchSelection" style="margin-right: 20px;"></el-checkbox>
<el-select v-model="batchHandle" @change="handlePrintOption" clearable placeholder="批量操作" class="filter-item" style="width: 130px; margin-right: 8px;">
<el-option
v-for="item in handleOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select v-model="batchExport" @change="handleExportOption" clearable placeholder="批量导出" class="filter-item" style="width: 130px">
<el-option
v-for="item in exportOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange" />
</el-footer>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStoreOrder'
import eForm from './form'
import eDetail from './detail1'
import eRefund from './refund'
import editOrder from './edit'
import eRemark from './remark'
import ePrint from './print'
import { formatTime } from '@/utils/index'
import { gett } from '@/api/bxg/visits'
export default {
components: { eForm, eDetail, eRefund, editOrder, eRemark, ePrint },
mixins: [initData],
data() {
return {
delLoading: false,
status: '-9',
orderType: '0',
createTime: '',
checkList: [],
printChecked: false,
batchHandle: '',
batchExport: '',
listContent: [],
queryTypeOptions: [
{ key: 'orderId', display_name: '订单号' },
{ key: 'realName', display_name: '用户姓名' },
{ key: 'userPhone', display_name: '用户电话' }
],
statusOptions: [
{ value: '0', label: '未支付' },
{ value: '1', label: '未发货' },
{ value: '2', label: '待收货' },
{ value: '3', label: '待评价' },
{ value: '4', label: '交易完成' },
// { value: '5', label: '待核销' },
{ value: '-1', label: '退款中' },
{ value: '-2', label: '已退款' },
{ value: '-4', label: '已删除' }
],
typeOptions: [
{ value: '0', label: '所有订单' },
{ value: '1', label: '普通订单' },
{ value: '2', label: '拼团订单' },
{ value: '3', label: '秒杀订单' },
{ value: '4', label: '砍价订单' },
{ value: '5', label: '核销订单' },
{ value: '6', label: '积分订单' }
],
handleOptions: [
{value: '', label: '批量操作'},
{value: '0', label: '批量打印'},
],
exportOptions: [
{value: '', label: '批量导出'},
{value: '0', label: '导出全部'},
{value: '1', label: '导出选中'},
],
caculateInfo: {
orderNum : 0,
storeNum : 0,
orderPrice : 0,
userNum : 0,
},
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
toDetailURL(id){
this.$router.push({ path: '/order/detail/'+id })
},
formatTime,
checkPermission,
handleOrder(tab, event) {
this.status = tab.name
this.toQuery()
},
beforeInit() {
this.url = 'bxg/api/yxStoreOrder'
const sort = 'id,desc'
this.params = {
page: this.page,
size: this.size,
sort: sort,
orderStatus: this.status,
orderType: this.orderType,
createTime: this.createTime,
listContent: this.listContent
}
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
orderId: data.orderId,
uid: data.uid,
realName: data.realName,
userPhone: data.userPhone,
userAddress: data.userAddress,
cartId: data.cartId,
freightPrice: data.freightPrice,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
totalPostage: data.totalPostage,
payPrice: data.payPrice,
payPostage: data.payPostage,
deductionPrice: data.deductionPrice,
couponId: data.couponId,
couponPrice: data.couponPrice,
paid: data.paid,
payTime: data.payTime,
payType: data.payType,
addTime: data.addTime,
status: data.status,
refundStatus: data.refundStatus,
refundReasonWapImg: data.refundReasonWapImg,
refundReasonWapExplain: data.refundReasonWapExplain,
refundReasonTime: data.refundReasonTime,
refundReasonWap: data.refundReasonWap,
refundReason: data.refundReason,
refundPrice: data.refundPrice,
deliveryName: data.deliveryName,
deliverySn: data.deliverySn,
deliveryType: data.deliveryType,
deliveryId: data.deliveryId,
gainIntegral: data.gainIntegral,
useIntegral: data.useIntegral,
backIntegral: data.backIntegral,
mark: data.mark,
isDel: data.isDel,
unique: data.unique,
remark: data.remark,
merId: data.merId,
isMerCheck: data.isMerCheck,
combinationId: data.combinationId,
pinkId: data.pinkId,
cost: data.cost,
seckillId: data.seckillId,
bargainId: data.bargainId,
verifyCode: data.verifyCode,
storeId: data.storeId,
shippingType: data.shippingType,
isChannel: data.isChannel,
isRemind: data.isRemind,
isSystemDel: data.isSystemDel,
_status:data._status
}
_this.dialog = true
},
editOrder(data) {
this.isAdd = false
const _this = this.$refs.form3
_this.form = {
id: data.id,
orderId: data.orderId,
uid: data.uid,
realName: data.realName,
userPhone: data.userPhone,
userAddress: data.userAddress,
cartId: data.cartId,
freightPrice: data.freightPrice,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
totalPostage: data.totalPostage,
payPrice: data.payPrice,
payPostage: data.payPostage,
deductionPrice: data.deductionPrice,
couponId: data.couponId,
couponPrice: data.couponPrice,
paid: data.paid,
payTime: data.payTime,
payType: data.payType,
addTime: data.addTime,
status: data.status,
refundStatus: data.refundStatus,
refundReasonWapImg: data.refundReasonWapImg,
refundReasonWapExplain: data.refundReasonWapExplain,
refundReasonTime: data.refundReasonTime,
refundReasonWap: data.refundReasonWap,
refundReason: data.refundReason,
refundPrice: data.refundPrice,
deliveryName: data.deliveryName,
deliveryType: data.deliveryType,
deliveryId: data.deliveryId,
gainIntegral: data.gainIntegral,
useIntegral: data.useIntegral,
backIntegral: data.backIntegral,
mark: data.mark,
isDel: data.isDel,
unique: data.unique,
remark: data.remark,
merId: data.merId,
isMerCheck: data.isMerCheck,
combinationId: data.combinationId,
pinkId: data.pinkId,
cost: data.cost,
seckillId: data.seckillId,
bargainId: data.bargainId,
verifyCode: data.verifyCode,
storeId: data.storeId,
shippingType: data.shippingType,
isChannel: data.isChannel,
isRemind: data.isRemind,
isSystemDel: data.isSystemDel
}
_this.dialog = true
},
remark(data) {
this.isAdd = false
const _this = this.$refs.form4
_this.form = {
id: data.id,
orderId: data.orderId,
uid: data.uid,
realName: data.realName,
userPhone: data.userPhone,
userAddress: data.userAddress,
cartId: data.cartId,
freightPrice: data.freightPrice,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
totalPostage: data.totalPostage,
payPrice: data.payPrice,
payPostage: data.payPostage,
deductionPrice: data.deductionPrice,
couponId: data.couponId,
couponPrice: data.couponPrice,
paid: data.paid,
payTime: data.payTime,
payType: data.payType,
addTime: data.addTime,
status: data.status,
refundStatus: data.refundStatus,
refundReasonWapImg: data.refundReasonWapImg,
refundReasonWapExplain: data.refundReasonWapExplain,
refundReasonTime: data.refundReasonTime,
refundReasonWap: data.refundReasonWap,
refundReason: data.refundReason,
refundPrice: data.refundPrice,
deliveryName: data.deliveryName,
deliveryType: data.deliveryType,
deliveryId: data.deliveryId,
gainIntegral: data.gainIntegral,
useIntegral: data.useIntegral,
backIntegral: data.backIntegral,
mark: data.mark,
isDel: data.isDel,
unique: data.unique,
remark: data.remark,
merId: data.merId,
isMerCheck: data.isMerCheck,
combinationId: data.combinationId,
pinkId: data.pinkId,
cost: data.cost,
seckillId: data.seckillId,
bargainId: data.bargainId,
verifyCode: data.verifyCode,
storeId: data.storeId,
shippingType: data.shippingType,
isChannel: data.isChannel,
isRemind: data.isRemind,
isSystemDel: data.isSystemDel
}
_this.dialog = true
},
refund(data) {
this.isAdd = false
const _this = this.$refs.form2
_this.form = {
id: data.id,
orderId: data.orderId,
uid: data.uid,
realName: data.realName,
userPhone: data.userPhone,
userAddress: data.userAddress,
cartId: data.cartId,
freightPrice: data.freightPrice,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
totalPostage: data.totalPostage,
payPrice: data.payPrice,
payPostage: data.payPostage,
deductionPrice: data.deductionPrice,
couponId: data.couponId,
couponPrice: data.couponPrice,
paid: data.paid,
payTime: data.payTime,
payType: data.payType,
addTime: data.addTime,
status: data.status,
refundStatus: data.refundStatus,
refundReasonWapImg: data.refundReasonWapImg,
refundReasonWapExplain: data.refundReasonWapExplain,
refundReasonTime: data.refundReasonTime,
refundReasonWap: data.refundReasonWap,
refundReason: data.refundReason,
refundPrice: data.refundPrice,
deliveryName: data.deliveryName,
deliveryType: data.deliveryType,
deliveryId: data.deliveryId,
gainIntegral: data.gainIntegral,
useIntegral: data.useIntegral,
backIntegral: data.backIntegral,
mark: data.mark,
isDel: data.isDel,
unique: data.unique,
remark: data.remark,
merId: data.merId,
isMerCheck: data.isMerCheck,
combinationId: data.combinationId,
pinkId: data.pinkId,
cost: data.cost,
seckillId: data.seckillId,
bargainId: data.bargainId,
verifyCode: data.verifyCode,
storeId: data.storeId,
shippingType: data.shippingType,
isChannel: data.isChannel,
isRemind: data.isRemind,
isSystemDel: data.isSystemDel
}
_this.dialog = true
},
detail(data) {
this.isAdd = false
const _this = this.$refs.form1
_this.form = {
id: data.id,
orderId: data.orderId,
payTypeName: data.payTypeName,
statusName: data.statusName,
uid: data.uid,
realName: data.realName,
userPhone: data.userPhone,
userAddress: data.userAddress,
cartId: data.cartId,
freightPrice: data.freightPrice,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
totalPostage: data.totalPostage,
payPrice: data.payPrice,
payPostage: data.payPostage,
deductionPrice: data.deductionPrice,
couponId: data.couponId,
couponPrice: data.couponPrice,
paid: data.paid,
payTime: data.payTime,
payType: data.payType,
createTime: data.createTime,
status: data.status,
refundStatus: data.refundStatus,
refundReasonWapImg: data.refundReasonWapImg,
refundReasonWapExplain: data.refundReasonWapExplain,
refundReasonTime: data.refundReasonTime,
refundReasonWap: data.refundReasonWap,
refundReason: data.refundReason,
refundPrice: data.refundPrice,
deliveryName: data.deliveryName,
deliverySn: data.deliverySn,
deliveryType: data.deliveryType,
deliveryId: data.deliveryId,
gainIntegral: data.gainIntegral,
useIntegral: data.useIntegral,
backIntegral: data.backIntegral,
mark: data.mark,
isDel: data.isDel,
unique: data.unique,
remark: data.remark,
merId: data.merId,
isMerCheck: data.isMerCheck,
combinationId: data.combinationId,
pinkId: data.pinkId,
cost: data.cost,
seckillId: data.seckillId,
bargainId: data.bargainId,
verifyCode: data.verifyCode,
storeId: data.storeId,
shippingType: data.shippingType,
isChannel: data.isChannel,
isRemind: data.isRemind,
isSystemDel: data.isSystemDel,
nickname: data.userDTO.nickname
}
_this.dialog = true
},
getCaculateInfo(){
gett().then(res => {
this.caculateInfo = {
orderPrice : res.priceCount,
orderNum : res.orderCount,
storeNum : res.goodsCount,
userNum : res.userCount,
};
})
},
clearCaculateInfo(){
this.caculateInfo = {
orderPrice : 0,
storeNum : 0,
orderNum : 0,
userNum : 0,
};
},
handleSelectionChange(val) {
this.checkList = val;
let orderPrice = 0, storeNum = 0, orderNum = 0, userNum = 0;
if(val.length !=0 ){
this.printChecked = true;
let user = [];
val.forEach((item,index)=>{
orderNum += 1;
orderPrice += item.totalPrice;
storeNum += item.totalNum;
user.push(item.userDTO.nickname);
})
user = Array.from(new Set(user));
this.caculateInfo = {
orderPrice : orderPrice.toFixed(2),
storeNum : storeNum,
orderNum : orderNum,
userNum : user.length,
};
}else {
this.printChecked = false;
this.clearCaculateInfo();
// this.getCaculateInfo();
}
},
batchSelection(val){
let rows = this.data;
if (val) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row);
});
} else {
this.$refs.multipleTable.clearSelection();
}
},
// 导出选中
handlePrintOption(val){
switch (val) {
case '0':
this.getPrintList();
this.batchHandle = '';
break;
default:
break;
}
},
handleExportOption(val){
let list = this.checkList;
this.page = 0;
this.size = 10000;
switch (val) {
case "0":
this.listContent = "";
this.beforeInit();
this.downloadMethod();
break;
case "1":
if(list.length == 0){
this.$message({
message: '请选择订单',
type: 'warning'
});
}else {
this.listContent = [];
list.forEach((item) => {
this.listContent.push(item.orderId);
})
this.listContent = JSON.stringify(this.listContent);
this.beforeInit();
this.downloadMethod();
}
break;
default:
break;
}
this.batchExport = "";
},
getPrintList(){
let list = this.checkList;
if(list.length == 0){
this.$message({
message: '请选择订单',
type: 'warning'
});
}else {
const _this = this.$refs.form5;
_this.dialog = true
}
},
checkboxT(row, rowIndex) {
return row.id !== 1
},
}
}
</script>
<style scoped lang="scss">
.container {
height: calc(100% - 80px);
position: absolute;
overflow: auto;
width: calc(100% - 20px);
.order-caculate {
font-size: 14px;
color: #909399;
border-top: 1px solid #f0f0f0;
padding: 20px 10px;
.caculate-title {
display: inline-block;
margin-right: 50px;
}
.caculate-num {
font-size: 20px;
color: #ff4949;
}
}
.el-table th {
background-color: #fafafa;
}
}
.footer-contains {
position: absolute;
display: -ms-flexbox;
display: flex;
background-color: #f6f6f6;
bottom: 0;
align-items: center;
justify-content: space-between;
width: 100%;
z-index: 999;
padding: 0 20px 0 13px;
}
/*打印单样式编辑*/
.order-list {
/* height: 297mm;*/
margin: 0 auto;
width: 210mm;
.order-title {
height: 16mm;
line-height: 16mm;
font-size: 8mm;
font-weight: bolder;
text-align: center;
}
.order-info {
span {
display: inline-block;
padding: 0 0 10px 0;
font-size: 3mm;
}
span.info {
width: 60mm;
}
}
.el-table--small th, .el-table--small td {
padding: 4px 0;
}
}
</style>
+565
View File
@@ -0,0 +1,565 @@
<template>
<div class="app-container">
<el-tabs v-model="status" type="card" @tab-click="handleOrder">
<el-tab-pane name="-9">
<span slot="label"><i class="el-icon-s-order"></i> 全部订单</span>
</el-tab-pane>
<el-tab-pane name="0">
<span slot="label"><i class="el-icon-bank-card"></i> 未支付</span>
</el-tab-pane>
<el-tab-pane name="1">
<span slot="label"><i class="el-icon-refrigerator"></i> 待核销</span>
</el-tab-pane>
<el-tab-pane name="3">
<span slot="label"><i class="el-icon-document"></i> 待评价</span>
</el-tab-pane>
<el-tab-pane name="4">
<span slot="label"><i class="el-icon-circle-check"></i> 交易完成</span>
</el-tab-pane>
<el-tab-pane name="-1">
<span slot="label"><i class="el-icon-back"></i> 退款中</span>
</el-tab-pane>
<el-tab-pane name="-2">
<span slot="label"><i class="el-icon-finished"></i> 已退款</span>
</el-tab-pane>
</el-tabs>
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<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-select>
<el-select v-model="storeId" clearable placeholder="选择门店" class="filter-item" style="width: 130px">
<el-option v-for="item in storeList" :key="item.key" :label="item.name" :value="item.id" />
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
<!-- 新增 -->
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<eDetail ref="form1" :is-add="isAdd" />
<eRefund ref="form2" :is-add="isAdd" />
<editOrder ref="form3" :is-add="isAdd" />
<eRemark ref="form4" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="storeName" label="所属门店" />
<el-table-column prop="orderId" width="150" label="订单号">
<template slot-scope="scope">
<span>{{ scope.row.orderId }}</span>
<p>{{ scope.row.pinkName }}</p>
</template>
</el-table-column>
<el-table-column prop="realName" label="用户姓名" />
<el-table-column prop="cartInfoList" width="300" label="商品信息">
<template slot-scope="scope">
<div v-for="(item,index) in scope.row.cartInfoList" v-if="item.cartInfoMap.productInfo.attrInfo">
<span>
<img
style="width: 30px;height: 30px;margin:0;cursor: pointer;"
:src="item.cartInfoMap.productInfo.attrInfo.image"
>
</span>
<span>{{ item.cartInfoMap.productInfo.storeName }}&nbsp;{{ item.cartInfoMap.productInfo.attrInfo.sku }}</span>
<span> | {{ item.cartInfoMap.truePrice }}×{{ item.cartInfoMap.cartNum }}</span>
</div>
<div v-else>
<span><img
style="width: 30px;height: 30px;margin:0;cursor: pointer;"
:src="item.cartInfoMap.productInfo.image"
></span>
<span>{{ item.cartInfoMap.productInfo.storeName }}</span>
<span> | {{ item.cartInfoMap.truePrice }}×{{ item.cartInfoMap.cartNum }}</span>
</div>
</template>
</el-table-column>
<el-table-column prop="payPrice" label="实际支付" />
<el-table-column prop="payTypeName" label="支付状态" />
<el-table-column prop="statusName" label="订单状态">
<template slot-scope="scope">
<span v-html="scope.row.statusName"></span>
</template>
</el-table-column>
<el-table-column prop="addTime" width="160" label="创建时间">
<template slot-scope="scope">
<span>{{ formatTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT','YXSTOREORDER_DELETE'])" label="操作" width="200" align="center" fixed="right">
<template slot-scope="scope">
<el-button
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="primary"
@click="detail(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','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="success"
@click="remark(scope.row)"
>
订单备注</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button
v-if="scope.row._status == 2"
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="primary"
@click="edit(scope.row)"
>
订单核销</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button
v-if="scope.row._status == 3"
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="primary"
@click="refund(scope.row)"
>
立刻退款</el-button>
</el-dropdown-item>
<el-dropdown-item v-if="scope.row._status == 1">
<el-button
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT']"
size="mini"
type="primary"
@click="editOrder(scope.row)"
>
修改订单</el-button>
</el-dropdown-item>
<el-dropdown-item v-if="scope.row._status == 1">
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSTOREORDER_ALL','YXSTOREORDER_DELETE']"
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-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStoreOrder'
import { getAll } from '@/api/bxg/yxSystemStore'
import eForm from './formC'
import eDetail from './detail1'
import eRefund from './refund'
import editOrder from './edit'
import eRemark from './remark'
import { formatTime } from '@/utils/index'
export default {
components: { eForm, eDetail, eRefund, editOrder, eRemark },
mixins: [initData],
data() {
return {
delLoading: false, status: '-9', orderType: '0', storeList: [] , storeId: null,
queryTypeOptions: [
{ key: 'orderId', display_name: '订单号' },
{ key: 'realName', display_name: '用户姓名' },
{ key: 'userPhone', display_name: '用户电话' }
],
statusOptions: [
{ value: '0', label: '未支付' },
{ value: '1', label: '未发货' },
{ value: '2', label: '待收货' },
{ value: '3', label: '待评价' },
{ value: '4', label: '交易完成' },
// { value: '5', label: '待核销' },
{ value: '-1', label: '退款中' },
{ value: '-2', label: '已退款' },
{ value: '-4', label: '已删除' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
this.getStoreAll()
},
methods: {
getStoreAll() {
getAll().then(res => {
this.storeList = res
})
},
formatTime,
checkPermission,
handleOrder(tab, event) {
this.status = tab.name
this.toQuery()
},
beforeInit() {
this.url = 'bxg/api/yxStoreOrder'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, orderStatus: this.status, orderType: 5, storeId: this.storeId }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
orderId: data.orderId,
uid: data.uid,
realName: data.realName,
userPhone: data.userPhone,
userAddress: data.userAddress,
cartId: data.cartId,
freightPrice: data.freightPrice,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
totalPostage: data.totalPostage,
payPrice: data.payPrice,
payPostage: data.payPostage,
deductionPrice: data.deductionPrice,
couponId: data.couponId,
couponPrice: data.couponPrice,
paid: data.paid,
payTime: data.payTime,
payType: data.payType,
addTime: data.addTime,
status: data.status,
refundStatus: data.refundStatus,
refundReasonWapImg: data.refundReasonWapImg,
refundReasonWapExplain: data.refundReasonWapExplain,
refundReasonTime: data.refundReasonTime,
refundReasonWap: data.refundReasonWap,
refundReason: data.refundReason,
refundPrice: data.refundPrice,
deliveryName: data.deliveryName,
deliveryType: data.deliveryType,
deliveryId: data.deliveryId,
gainIntegral: data.gainIntegral,
useIntegral: data.useIntegral,
backIntegral: data.backIntegral,
mark: data.mark,
isDel: data.isDel,
unique: data.unique,
remark: data.remark,
merId: data.merId,
isMerCheck: data.isMerCheck,
combinationId: data.combinationId,
pinkId: data.pinkId,
cost: data.cost,
seckillId: data.seckillId,
bargainId: data.bargainId,
verifyCode: data.verifyCode,
storeId: data.storeId,
shippingType: data.shippingType,
isChannel: data.isChannel,
isRemind: data.isRemind,
isSystemDel: data.isSystemDel
}
_this.dialog = true
},
editOrder(data) {
this.isAdd = false
const _this = this.$refs.form3
_this.form = {
id: data.id,
orderId: data.orderId,
uid: data.uid,
realName: data.realName,
userPhone: data.userPhone,
userAddress: data.userAddress,
cartId: data.cartId,
freightPrice: data.freightPrice,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
totalPostage: data.totalPostage,
payPrice: data.payPrice,
payPostage: data.payPostage,
deductionPrice: data.deductionPrice,
couponId: data.couponId,
couponPrice: data.couponPrice,
paid: data.paid,
payTime: data.payTime,
payType: data.payType,
addTime: data.addTime,
status: data.status,
refundStatus: data.refundStatus,
refundReasonWapImg: data.refundReasonWapImg,
refundReasonWapExplain: data.refundReasonWapExplain,
refundReasonTime: data.refundReasonTime,
refundReasonWap: data.refundReasonWap,
refundReason: data.refundReason,
refundPrice: data.refundPrice,
deliveryName: data.deliveryName,
deliveryType: data.deliveryType,
deliveryId: data.deliveryId,
gainIntegral: data.gainIntegral,
useIntegral: data.useIntegral,
backIntegral: data.backIntegral,
mark: data.mark,
isDel: data.isDel,
unique: data.unique,
remark: data.remark,
merId: data.merId,
isMerCheck: data.isMerCheck,
combinationId: data.combinationId,
pinkId: data.pinkId,
cost: data.cost,
seckillId: data.seckillId,
bargainId: data.bargainId,
verifyCode: data.verifyCode,
storeId: data.storeId,
shippingType: data.shippingType,
isChannel: data.isChannel,
isRemind: data.isRemind,
isSystemDel: data.isSystemDel
}
_this.dialog = true
},
remark(data) {
this.isAdd = false
const _this = this.$refs.form4
_this.form = {
id: data.id,
orderId: data.orderId,
uid: data.uid,
realName: data.realName,
userPhone: data.userPhone,
userAddress: data.userAddress,
cartId: data.cartId,
freightPrice: data.freightPrice,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
totalPostage: data.totalPostage,
payPrice: data.payPrice,
payPostage: data.payPostage,
deductionPrice: data.deductionPrice,
couponId: data.couponId,
couponPrice: data.couponPrice,
paid: data.paid,
payTime: data.payTime,
payType: data.payType,
addTime: data.addTime,
status: data.status,
refundStatus: data.refundStatus,
refundReasonWapImg: data.refundReasonWapImg,
refundReasonWapExplain: data.refundReasonWapExplain,
refundReasonTime: data.refundReasonTime,
refundReasonWap: data.refundReasonWap,
refundReason: data.refundReason,
refundPrice: data.refundPrice,
deliveryName: data.deliveryName,
deliveryType: data.deliveryType,
deliveryId: data.deliveryId,
gainIntegral: data.gainIntegral,
useIntegral: data.useIntegral,
backIntegral: data.backIntegral,
mark: data.mark,
isDel: data.isDel,
unique: data.unique,
remark: data.remark,
merId: data.merId,
isMerCheck: data.isMerCheck,
combinationId: data.combinationId,
pinkId: data.pinkId,
cost: data.cost,
seckillId: data.seckillId,
bargainId: data.bargainId,
verifyCode: data.verifyCode,
storeId: data.storeId,
shippingType: data.shippingType,
isChannel: data.isChannel,
isRemind: data.isRemind,
isSystemDel: data.isSystemDel
}
_this.dialog = true
},
refund(data) {
this.isAdd = false
const _this = this.$refs.form2
_this.form = {
id: data.id,
orderId: data.orderId,
uid: data.uid,
realName: data.realName,
userPhone: data.userPhone,
userAddress: data.userAddress,
cartId: data.cartId,
freightPrice: data.freightPrice,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
totalPostage: data.totalPostage,
payPrice: data.payPrice,
payPostage: data.payPostage,
deductionPrice: data.deductionPrice,
couponId: data.couponId,
couponPrice: data.couponPrice,
paid: data.paid,
payTime: data.payTime,
payType: data.payType,
addTime: data.addTime,
status: data.status,
refundStatus: data.refundStatus,
refundReasonWapImg: data.refundReasonWapImg,
refundReasonWapExplain: data.refundReasonWapExplain,
refundReasonTime: data.refundReasonTime,
refundReasonWap: data.refundReasonWap,
refundReason: data.refundReason,
refundPrice: data.refundPrice,
deliveryName: data.deliveryName,
deliveryType: data.deliveryType,
deliveryId: data.deliveryId,
gainIntegral: data.gainIntegral,
useIntegral: data.useIntegral,
backIntegral: data.backIntegral,
mark: data.mark,
isDel: data.isDel,
unique: data.unique,
remark: data.remark,
merId: data.merId,
isMerCheck: data.isMerCheck,
combinationId: data.combinationId,
pinkId: data.pinkId,
cost: data.cost,
seckillId: data.seckillId,
bargainId: data.bargainId,
verifyCode: data.verifyCode,
storeId: data.storeId,
shippingType: data.shippingType,
isChannel: data.isChannel,
isRemind: data.isRemind,
isSystemDel: data.isSystemDel
}
_this.dialog = true
},
detail(data) {
this.isAdd = false
const _this = this.$refs.form1
_this.form = {
id: data.id,
orderId: data.orderId,
payTypeName: data.payTypeName,
statusName: data.statusName,
uid: data.uid,
realName: data.realName,
userPhone: data.userPhone,
userAddress: data.userAddress,
cartId: data.cartId,
freightPrice: data.freightPrice,
totalNum: data.totalNum,
totalPrice: data.totalPrice,
totalPostage: data.totalPostage,
payPrice: data.payPrice,
payPostage: data.payPostage,
deductionPrice: data.deductionPrice,
couponId: data.couponId,
couponPrice: data.couponPrice,
paid: data.paid,
payTime: data.payTime,
payType: data.payType,
createTime: data.createTime,
status: data.status,
refundStatus: data.refundStatus,
refundReasonWapImg: data.refundReasonWapImg,
refundReasonWapExplain: data.refundReasonWapExplain,
refundReasonTime: data.refundReasonTime,
refundReasonWap: data.refundReasonWap,
refundReason: data.refundReason,
refundPrice: data.refundPrice,
deliveryName: data.deliveryName,
deliveryType: data.deliveryType,
deliveryId: data.deliveryId,
gainIntegral: data.gainIntegral,
useIntegral: data.useIntegral,
backIntegral: data.backIntegral,
mark: data.mark,
isDel: data.isDel,
unique: data.unique,
remark: data.remark,
merId: data.merId,
isMerCheck: data.isMerCheck,
combinationId: data.combinationId,
pinkId: data.pinkId,
cost: data.cost,
seckillId: data.seckillId,
bargainId: data.bargainId,
verifyCode: data.verifyCode,
storeId: data.storeId,
shippingType: data.shippingType,
isChannel: data.isChannel,
isRemind: data.isRemind,
isSystemDel: data.isSystemDel,
nickname: data.userDTO.nickname
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+189
View File
@@ -0,0 +1,189 @@
<template>
<el-dialog id="printDialog" :append-to-body="false" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" title="订单打印" width="220mm">
<el-button
type="warning"
class="filter-item"
size="mini"
icon="el-icon-printer"
onclick="doPrint()"
>打印</el-button>
<div id="printList">
<div class="order-list" v-for="(list, index) in printList">
<el-header class="order-title">订货单</el-header>
<div class="order-info">
<span class="info">{{list.orderId}}</span>
<span class="info">下单日期 : {{formatTimeTwo(list.addTime)}}</span>
<span>客户名称 : {{list.realName}}</span>
</div>
<div class="order-info">
<span class="info">联系人 : {{list.userDTO.account}}</span>
<span class="info">联系电话 : {{list.userPhone}}</span>
<span>收货地址 : {{list.userAddress}}</span>
</div>
<el-table border show-summary :data="list.cartInfoList" :summary-method="getSummaries" size="small" style="width: 100%;">
<el-table-column type="index" label="行号" :index="indexMethod" width="60mm"/>
<el-table-column prop="cartInfoMap.productInfo.productId" width="80mm" label="商品编号" />
<el-table-column prop="cartInfoMap.productInfo.storeName" width="172mm" label="商品名称" />
<el-table-column prop="cartInfoMap.productInfo.unitName" width="80mm" label="商品规格" />
<el-table-column prop="cartInfoMap.productInfo.unitName" width="80mm" label="单位" />
<el-table-column prop="cartInfoMap.productInfo.price" width="80mm" label="单价" />
<el-table-column prop="cartInfoMap.cartNum" width="80mm" label="数量" />
<el-table-column prop="cartInfoMap" width="80mm" label="小计(元)" >
<template slot-scope="scope">
<span>{{ scope.row.cartInfoMap.productInfo.price*scope.row.cartInfoMap.cartNum }}</span>
</template>
</el-table-column>
<el-table-column prop="cartInfoMap.mark" width="80mm" label="备注" />
</el-table>
</div>
</div>
</el-dialog>
</template>
<script>
import { formatTime, parseTime, formatTimeTwo } from '@/utils/index'
export default {
props: {
printList: {
type: Array,
required: true
},
toQuery: {
type: Function,
required: true
}
},
data() {
return {
loading: false, dialog: false
}
},
mounted() {
window.doPrint = this.doPrint;
},
methods: {
formatTime,
parseTime,
formatTimeTwo,
cancel() {
this.dialog = false
},
indexMethod(index){
return index+1;
},
doPrint(){
let printbox = document.querySelector("#printList").innerHTML;
document.querySelector("body").innerHTML = printbox;
window.print();
this.cancel();
// this.toQuery();
window.location.reload();
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}else if(index === 7){
const values = data.map(item => Number(item.cartInfoMap.productInfo.price*item.cartInfoMap.cartNum));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += ' 元';
}
});
return sums;
}
}
}
</script>
<style scoped lang="scss">
.container {
height: calc(100% - 80px);
position: absolute;
overflow: auto;
width: calc(100% - 20px);
.order-caculate {
font-size: 14px;
color: #909399;
border-top: 1px solid #f0f0f0;
padding: 20px 10px;
.caculate-title {
display: inline-block;
margin-right: 50px;
}
.caculate-num {
font-size: 20px;
color: #ff4949;
}
}
.el-table th {
background-color: #fafafa;
}
}
.footer-contains {
position: absolute;
display: -ms-flexbox;
display: flex;
background-color: #f6f6f6;
bottom: 0;
flex-align: center;
align-items: center;
justify-content: space-between;
width: 100%;
z-index: 999;
padding: 0 20px 0 13px;
}
/*打印单样式编辑*/
.order-list {
/* height: 297mm;*/
margin: 0 auto;
width: 210mm;
.order-title {
height: 16mm;
line-height: 16mm;
font-size: 8mm;
font-weight: bolder;
text-align: center;
}
.order-info {
span {
display: inline-block;
padding: 0 0 10px 0;
font-size: 3mm;
}
span.info {
width: 60mm;
}
}
.el-table--small th, .el-table--small td {
padding: 4px 0;
}
}
</style>
+193
View File
@@ -0,0 +1,193 @@
<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="订单号">
<el-input v-model="form.orderId" :disabled="true" style="width: 370px;" />
</el-form-item>
<el-form-item label="退款金额">
<el-input v-model="form.payPrice" style="width: 370px;" />
</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>
</el-dialog>
</template>
<script>
import { add, refund } from '@/api/bxg/yxStoreOrder'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
orderId: '',
uid: '',
realName: '',
userPhone: '',
userAddress: '',
cartId: '',
freightPrice: '',
totalNum: '',
totalPrice: '',
totalPostage: '',
payPrice: '',
payPostage: '',
deductionPrice: '',
couponId: '',
couponPrice: '',
paid: '',
payTime: '',
payType: '',
addTime: '',
status: '',
refundStatus: '',
refundReasonWapImg: '',
refundReasonWapExplain: '',
refundReasonTime: '',
refundReasonWap: '',
refundReason: '',
refundPrice: '',
deliveryName: '',
deliveryType: '',
deliveryId: '',
gainIntegral: '',
useIntegral: '',
backIntegral: '',
mark: '',
isDel: '',
unique: '',
remark: '',
merId: '',
isMerCheck: '',
combinationId: '',
pinkId: '',
cost: '',
seckillId: '',
bargainId: '',
verifyCode: '',
storeId: '',
shippingType: '',
isChannel: '',
isRemind: '',
isSystemDel: ''
},
rules: {
unique: [
{ required: true, message: 'please enter', trigger: 'blur' }
]
}
}
},
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() {
refund(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: '',
orderId: '',
uid: '',
realName: '',
userPhone: '',
userAddress: '',
cartId: '',
freightPrice: '',
totalNum: '',
totalPrice: '',
totalPostage: '',
payPrice: '',
payPostage: '',
deductionPrice: '',
couponId: '',
couponPrice: '',
paid: '',
payTime: '',
payType: '',
addTime: '',
status: '',
refundStatus: '',
refundReasonWapImg: '',
refundReasonWapExplain: '',
refundReasonTime: '',
refundReasonWap: '',
refundReason: '',
refundPrice: '',
deliveryName: '',
deliveryType: '',
deliveryId: '',
gainIntegral: '',
useIntegral: '',
backIntegral: '',
mark: '',
isDel: '',
unique: '',
remark: '',
merId: '',
isMerCheck: '',
combinationId: '',
pinkId: '',
cost: '',
seckillId: '',
bargainId: '',
verifyCode: '',
storeId: '',
shippingType: '',
isChannel: '',
isRemind: '',
isSystemDel: ''
}
}
}
}
</script>
<style scoped>
</style>
+193
View File
@@ -0,0 +1,193 @@
<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="订单号">
<el-input v-model="form.orderId" :disabled="true" style="width: 370px;" />
</el-form-item>
<el-form-item label="订单备注">
<el-input v-model="form.remark" style="width: 370px;" rows="5" type="textarea" />
</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>
</el-dialog>
</template>
<script>
import { add, remark } from '@/api/bxg/yxStoreOrder'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
orderId: '',
uid: '',
realName: '',
userPhone: '',
userAddress: '',
cartId: '',
freightPrice: '',
totalNum: '',
totalPrice: '',
totalPostage: '',
payPrice: '',
payPostage: '',
deductionPrice: '',
couponId: '',
couponPrice: '',
paid: '',
payTime: '',
payType: '',
addTime: '',
status: '',
refundStatus: '',
refundReasonWapImg: '',
refundReasonWapExplain: '',
refundReasonTime: '',
refundReasonWap: '',
refundReason: '',
refundPrice: '',
deliveryName: '',
deliveryType: '',
deliveryId: '',
gainIntegral: '',
useIntegral: '',
backIntegral: '',
mark: '',
isDel: '',
unique: '',
remark: '',
merId: '',
isMerCheck: '',
combinationId: '',
pinkId: '',
cost: '',
seckillId: '',
bargainId: '',
verifyCode: '',
storeId: '',
shippingType: '',
isChannel: '',
isRemind: '',
isSystemDel: ''
},
rules: {
unique: [
{ required: true, message: 'please enter', trigger: 'blur' }
]
}
}
},
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() {
remark(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: '',
orderId: '',
uid: '',
realName: '',
userPhone: '',
userAddress: '',
cartId: '',
freightPrice: '',
totalNum: '',
totalPrice: '',
totalPostage: '',
payPrice: '',
payPostage: '',
deductionPrice: '',
couponId: '',
couponPrice: '',
paid: '',
payTime: '',
payType: '',
addTime: '',
status: '',
refundStatus: '',
refundReasonWapImg: '',
refundReasonWapExplain: '',
refundReasonTime: '',
refundReasonWap: '',
refundReason: '',
refundPrice: '',
deliveryName: '',
deliveryType: '',
deliveryId: '',
gainIntegral: '',
useIntegral: '',
backIntegral: '',
mark: '',
isDel: '',
unique: '',
remark: '',
merId: '',
isMerCheck: '',
combinationId: '',
pinkId: '',
cost: '',
seckillId: '',
bargainId: '',
verifyCode: '',
storeId: '',
shippingType: '',
isChannel: '',
isRemind: '',
isSystemDel: ''
}
}
}
}
</script>
<style scoped>
</style>
+101
View File
@@ -0,0 +1,101 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<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-select>
<rrOperation :crud="crud" />
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<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" width="75px" />
<el-table-column v-if="columns.visible('nickname')" prop="nickname" label="昵称" width="100px" />
<el-table-column v-if="columns.visible('orderId')" prop="orderId" label="订单号" />
<el-table-column v-if="columns.visible('price')" prop="price" label="充值金额" width="100px" />
<el-table-column v-if="columns.visible('rechargeType')" prop="rechargeType" label="充值类型" width="100px" />
<el-table-column v-if="columns.visible('paid')" prop="paid" label="是否支付" width="100px">
<template slot-scope="scope">
<span v-if="scope.row.paid == 1">是</span>
<span v-else>否</span>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('payTime')" prop="payTime" label="支付时间" >
<template slot-scope="scope">
<span>{{ formatTimeTwo(scope.row.payTime) }}</span>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('createTime')" prop="createTime" label="充值时间" >
<template slot-scope="scope">
<span>{{ formatTimeTwo(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudYxUserRecharge from '@/api/bxg/yxUserRecharge'
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 { formatTimeTwo } from '@/utils/index'
// crud交由presenter持有
const defaultCrud = CRUD({ title: '充值管理', url: 'api/yxUserRecharge', sort: 'id,desc', crudMethod: { ...crudYxUserRecharge }, optShow: { add: false, edit: false, del: true, download: true}})
const defaultForm = { id: null, uid: null, orderId: null, price: null, rechargeType: null, paid: null, payTime: null, addTime: null, refundPrice: null, nickname: null }
export default {
name: 'YxUserRecharge',
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
permission: {
add: ['admin', 'yxUserRecharge:add'],
edit: ['admin', 'yxUserRecharge:edit'],
del: ['admin', 'yxUserRecharge:del']
},
rules: {
},
queryTypeOptions: [
{ key: 'nickname', display_name: '昵称' }
]
}
},
methods: {
formatTimeTwo,
// 获取数据前设置好接口地址
[CRUD.HOOK.beforeRefresh]() {
const query = this.query
if (query.type && query.value) {
this.crud.params[query.type] = query.value
}
return true
}
}
}
</script>
<style scoped>
</style>
+115
View File
@@ -0,0 +1,115 @@
<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="回复内容">
<el-input v-model="form.merchantReplyContent" style="width: 370px;" rows="5" type="textarea"/>
</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>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxStoreProductReply'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
uid: '',
oid: '',
unique: '',
productId: '',
replyType: '',
productScore: '',
serviceScore: '',
comment: '',
pics: '',
addTime: '',
merchantReplyContent: '',
merchantReplyTime: '',
isDel: '',
isReply: ''
},
rules: {
}
}
},
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: '',
uid: '',
oid: '',
unique: '',
productId: '',
replyType: '',
productScore: '',
serviceScore: '',
comment: '',
pics: '',
addTime: '',
merchantReplyContent: '',
merchantReplyTime: '',
isDel: '',
isReply: ''
}
}
}
}
</script>
<style scoped>
</style>
+164
View File
@@ -0,0 +1,164 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</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" />
<el-table-column prop="user.nickname" label="用户" />
<el-table-column prop="storeProduct.storeName" label="商品信息" />
<el-table-column prop="productScore" label="商品分数" />
<el-table-column prop="serviceScore" label="服务分数" />
<el-table-column prop="comment" label="评论内容" />
<el-table-column prop="" label="评论图片">
<template slot-scope="scope">
<div v-if="scope.row.pics">
<a v-for="pic in handlePic(scope.row.pics)" :href="pic" style="color: #42b983" target="_blank">
<img :src="pic" alt="点击打开" class="el-avatar">
</a>
</div>
<div v-else>无图</div>
</template>
</el-table-column>
<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']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxStoreProductReply'
import eForm from './form'
import { formatTime } from '@/utils/index'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
handlePic(pics) {
return pics.split(',')
},
formatTime,
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxStoreProductReply'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
uid: data.uid,
oid: data.oid,
unique: data.unique,
productId: data.productId,
replyType: data.replyType,
productScore: data.productScore,
serviceScore: data.serviceScore,
comment: data.comment,
pics: data.pics,
addTime: data.addTime,
merchantReplyContent: data.merchantReplyContent,
merchantReplyTime: data.merchantReplyTime,
isDel: data.isDel,
isReply: data.isReply
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+129
View File
@@ -0,0 +1,129 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</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" />
<el-table-column prop="map.title" label="标题" />
<el-table-column prop="map.info" label="简介" />
<el-table-column prop="map.url" label="链接url" />
<el-table-column ref="table" label="图片">
<template slot-scope="scope">
<a :href="scope.row.map.pic" style="color: #42b983" target="_blank"><img :src="scope.row.map.pic" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center">
<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-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemGroupData'
import eForm from './actform'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_home_activity' }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
groupName: data.groupName,
title: data.map.title,
info: data.map.info,
url: data.map.url,
pic: data.map.pic,
imageArr: data.map.pic.split(',')
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+121
View File
@@ -0,0 +1,121 @@
<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="100px">
<el-form-item label="标题">
<el-input v-model="form.title" style="width: 370px;" />
</el-form-item>
<el-form-item label="简介">
<el-input v-model="form.info" style="width: 370px;" />
</el-form-item>
<el-form-item label="跳转url">
<el-input v-model="form.url" style="width: 370px;" />
</el-form-item>
<el-form-item label="图片(260*260/416*214)">
<pic-upload v-model="form.pic" style="width: 500px;" />
<MaterialList v-model="form.imageArr" style="width: 500px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<!--<el-input v-model="form.groupName" />-->
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxSystemGroupData'
import picUpload from '@/components/pic-upload'
import MaterialList from '@/components/material'
export default {
components: { picUpload, MaterialList },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_home_activity',
title: '',
info: '',
url: '',
pic: '',
imageArr: [],
sort: '',
status: ''
},
rules: {
}
}
},
watch: {
'form.imageArr': function(val) {
if (val) {
this.form.pic = 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: '',
groupName: 'yshop_home_activity',
value: '',
addTime: '',
sort: '',
status: ''
}
}
}
}
</script>
<style scoped>
</style>
+137
View File
@@ -0,0 +1,137 @@
<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="140px">
<el-form-item label="标题">
<el-input v-model="form.name" style="width: 300px;" />
</el-form-item>
<el-form-item label="H5跳转url">
<el-input v-model="form.url" style="width: 300px;" />
</el-form-item>
<el-form-item label="uniapp路由">
<el-input v-model="form.uniapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="图片(750*375)">
<MaterialList v-model="form.imageArr" style="width: 300px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="轮播背景色">
<el-color-picker v-model="form.color"></el-color-picker>
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 300px;" />
</el-form-item>
<el-form-item label="是否显示">
<el-radio v-model="form.status" :label="1"></el-radio>
<el-radio v-model="form.status" :label="0" style="width: 200px;"></el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<!--<el-input v-model="form.groupName" />-->
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxSystemGroupData'
import picUpload from '@/components/pic-upload'
import MaterialList from '@/components/material'
export default {
components: { picUpload, MaterialList },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_home_banner',
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,
status: 1,
color: ''
},
rules: {
}
}
},
watch: {
'form.imageArr': function(val) {
if (val) {
this.form.pic = 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: '',
groupName: 'yshop_home_banner',
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,
status: 1,
color: null
}
}
}
}
</script>
<style scoped>
</style>
+132
View File
@@ -0,0 +1,132 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</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" />
<el-table-column prop="map.title" label="标签" />
<el-table-column prop="sort" label="排序" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">显示</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">不显示</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center">
<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-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemGroupData'
import eForm from './hotform'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_hot_search' }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
groupName: data.groupName,
title: data.map.title,
info: data.map.info,
url: data.map.url,
pic: data.map.pic,
sort: data.sort,
status: data.status
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+105
View File
@@ -0,0 +1,105 @@
<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="100px">
<el-form-item label="标签">
<el-input v-model="form.title" style="width: 370px;" />
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 300px;" />
</el-form-item>
<el-form-item label="是否显示">
<el-radio v-model="form.status" :label="1"></el-radio>
<el-radio v-model="form.status" :label="0" style="width: 200px;"></el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<!--<el-input v-model="form.groupName" />-->
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxSystemGroupData'
import picUpload from '@/components/pic-upload'
export default {
components: { picUpload },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_hot_search',
title: '',
sort: 0,
status: 1
},
rules: {
}
}
},
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: '',
groupName: 'yshop_hot_search',
title: '',
sort: 0,
status: 1
}
}
}
}
</script>
<style scoped>
</style>
+143
View File
@@ -0,0 +1,143 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</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" />
<el-table-column prop="map.name" label="标题" />
<el-table-column prop="map.url" label="链接url" />
<el-table-column prop="map.uniapp_url" label="uniapp路由" />
<el-table-column ref="table" label="图片">
<template slot-scope="scope">
<a :href="scope.row.map.pic" style="color: #42b983" target="_blank"><img :src="scope.row.map.pic" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="map.color" label="轮播背景色" />
<el-table-column prop="sort" label="排序" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">显示</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">不显示</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center">
<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-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemGroupData'
import eForm from './form'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_home_banner' }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
groupName: data.groupName,
name: data.map.name,
url: data.map.url,
wxapp_url: data.map.wxapp_url,
uniapp_url: data.map.uniapp_url,
pic: data.map.pic,
imageArr: data.map.pic ? data.map.pic.split(',') : [],
sort: data.sort,
status: data.status,
color: data.map.color
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+141
View File
@@ -0,0 +1,141 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</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" />
<el-table-column prop="map.name" label="分类名称" />
<el-table-column prop="map.url" label="链接url" />
<el-table-column prop="map.uniapp_url" label="uniapp路由" />
<el-table-column ref="table" label="分类图标">
<template slot-scope="scope">
<a :href="scope.row.map.pic" style="color: #42b983" target="_blank"><img :src="scope.row.map.pic" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="sort" label="排序" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">显示</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">不显示</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center">
<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-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemGroupData'
import eForm from './menuform'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_home_menus' }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
groupName: data.groupName,
name: data.map.name,
url: data.map.url,
wxapp_url: data.map.wxapp_url,
uniapp_url: data.map.uniapp_url,
pic: data.map.pic,
imageArr: data.map.pic ? data.map.pic.split(',') : [],
sort: data.sort,
status: data.status
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+132
View File
@@ -0,0 +1,132 @@
<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="140px">
<el-form-item label="分类名称">
<el-input v-model="form.name" style="width: 300px;" />
</el-form-item>
<el-form-item label="跳转url">
<el-input v-model="form.url" style="width: 300px;" />
</el-form-item>
<el-form-item label="uniapp路由">
<el-input v-model="form.uniapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="分类图标(90*90)">
<MaterialList v-model="form.imageArr" style="width: 300px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 300px;" />
</el-form-item>
<el-form-item label="是否显示">
<el-radio v-model="form.status" :label="1"></el-radio>
<el-radio v-model="form.status" :label="0" style="width: 200px;"></el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<!--<el-input v-model="form.groupName" />-->
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxSystemGroupData'
import picUpload from '@/components/pic-upload'
import MaterialList from '@/components/material'
export default {
components: { picUpload, MaterialList },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_home_menus',
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,
status: 1
},
rules: {
}
}
},
watch: {
'form.imageArr': function(val) {
if (val) {
this.form.pic = 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: '',
groupName: 'yshop_home_menus',
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,
status: 1
}
}
}
}
</script>
<style scoped>
</style>
+131
View File
@@ -0,0 +1,131 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</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" />
<el-table-column prop="map.price" label="额度" />
<el-table-column prop="map.give_price" label="赠送" />
<el-table-column prop="sort" label="排序" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">显示</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">不显示</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center">
<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-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemGroupData'
import eForm from './rechargeform'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_recharge_price_ways' }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
groupName: data.groupName,
give_price: data.map.give_price,
price: data.map.price,
sort: data.sort,
status: data.status
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+110
View File
@@ -0,0 +1,110 @@
<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="100px">
<el-form-item label="额度">
<el-input v-model="form.price" style="width: 300px;" />
</el-form-item>
<el-form-item label="赠送">
<el-input v-model="form.give_price" style="width: 300px;" />
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 300px;" />
</el-form-item>
<el-form-item label="是否显示">
<el-radio v-model="form.status" :label="1"></el-radio>
<el-radio v-model="form.status" :label="0" style="width: 200px;"></el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<!--<el-input v-model="form.groupName" />-->
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxSystemGroupData'
import picUpload from '@/components/pic-upload'
export default {
components: { picUpload },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_recharge_price_ways',
price: 1,
give_price: 0,
sort: 0,
status: 1
},
rules: {
}
}
},
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: '',
groupName: 'yshop_recharge_price_ways',
price: 1,
give_price: 0,
sort: 0,
status: 1
}
}
}
}
</script>
<style scoped>
</style>
+136
View File
@@ -0,0 +1,136 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</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" />
<el-table-column prop="map.info" label="滚动文字" />
<el-table-column prop="map.url" label="链接url" />
<el-table-column prop="map.uniapp_url" label="uniapp路由" />
<el-table-column prop="sort" label="排序" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">显示</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">不显示</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center">
<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-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemGroupData'
import eForm from './rollform'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_home_roll_news' }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
groupName: data.groupName,
title: data.map.title,
info: data.map.info,
url: data.map.url,
wxapp_url: data.map.wxapp_url,
uniapp_url: data.map.uniapp_url,
pic: data.map.pic,
sort: data.sort,
status: data.status
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+117
View File
@@ -0,0 +1,117 @@
<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="140px">
<el-form-item label="滚动文字">
<el-input v-model="form.info" style="width: 300px;" />
</el-form-item>
<el-form-item label="跳转url">
<el-input v-model="form.url" style="width: 300px;" />
</el-form-item>
<el-form-item label="uniapp路由">
<el-input v-model="form.uniapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 300px;" />
</el-form-item>
<el-form-item label="是否显示">
<el-radio v-model="form.status" :label="1"></el-radio>
<el-radio v-model="form.status" :label="0" style="width: 200px;"></el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<!--<el-input v-model="form.groupName" />-->
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxSystemGroupData'
import picUpload from '@/components/pic-upload'
export default {
components: { picUpload },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_home_roll_news',
info: '',
wxapp_url: '',
uniapp_url: '',
url: '',
sort: 0,
status: 1
},
rules: {
}
}
},
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: '',
groupName: 'yshop_home_roll_news',
info: '',
wxapp_url: '',
uniapp_url: '',
url: '',
sort: 0,
status: 1
}
}
}
}
</script>
<style scoped>
</style>
+127
View File
@@ -0,0 +1,127 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</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" />
<el-table-column prop="map.time" 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">
<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-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemGroupData'
import eForm from './seckillform'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_seckill_time'}
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
groupName: data.groupName,
time: data.map.time,
continued: data.map.continued,
status:data.map.status
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+111
View File
@@ -0,0 +1,111 @@
<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="150px">
<el-form-item label="开启时间(整数小时)">
<el-input v-model="form.time" style="width: 270px;"/>
</el-form-item>
<el-form-item label="持续时间(整数小时)">
<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>
<div slot="footer" class="dialog-footer">
<!--<el-input v-model="form.groupName" />-->
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import {add, edit} from '@/api/bxg/yxSystemGroupData'
import picUpload from '@/components/pic-upload'
export default {
components: {picUpload},
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_seckill_time',
time: 5,
status:2, //默认关闭
continued: 2
},
rules: {}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
if (parseInt(this.form.continued) + parseInt(this.form.time) > 24) {
return this.$message.error("开启+持续时间不能超过24小时")
}
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: '',
groupName: 'yshop_seckill_time',
time: 5,
continued: 2,
status:2 //默认关闭
}
}
}
}
</script>
<style scoped>
</style>
+131
View File
@@ -0,0 +1,131 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</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" />
<el-table-column prop="map.day" label="第几天" />
<el-table-column prop="map.sign_num" label="获取积分" />
<el-table-column prop="sort" label="排序" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">显示</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">不显示</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center">
<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-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemGroupData'
import eForm from './signform'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_sign_day_num' }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
groupName: data.groupName,
day: data.map.day,
sign_num: data.map.sign_num,
sort: data.sort,
status: data.status
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+110
View File
@@ -0,0 +1,110 @@
<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="100px">
<el-form-item label="第几天">
<el-input v-model="form.day" style="width: 300px;" />
</el-form-item>
<el-form-item label="获取积分">
<el-input v-model="form.sign_num" style="width: 300px;" />
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 300px;" />
</el-form-item>
<el-form-item label="是否显示">
<el-radio v-model="form.status" :label="1"></el-radio>
<el-radio v-model="form.status" :label="0" style="width: 200px;"></el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<!--<el-input v-model="form.groupName" />-->
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxSystemGroupData'
import picUpload from '@/components/pic-upload'
export default {
components: { picUpload },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_sign_day_num',
day: 1,
sign_num: 0,
sort: 0,
status: 1
},
rules: {
}
}
},
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: '',
groupName: 'yshop_sign_day_num',
day: 1,
sign_num: 0,
sort: 0,
status: 1
}
}
}
}
</script>
<style scoped>
</style>
+143
View File
@@ -0,0 +1,143 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</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" />
<el-table-column prop="map.name" label="菜单名" />
<el-table-column prop="map.url" label="链接url" />
<el-table-column prop="map.uniapp_url" label="uniapp路由" />
<el-table-column ref="table" label="图标">
<template slot-scope="scope">
<a :href="scope.row.map.pic" style="color: #42b983" target="_blank">
<img :src="scope.row.map.pic" alt="点击打开" class="el-avatar">
</a>
</template>
</el-table-column>
<el-table-column prop="sort" label="排序" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">显示</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">不显示</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center">
<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-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemGroupData'
import eForm from './usermenuform'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_my_menus' }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
groupName: data.groupName,
name: data.map.name,
url: data.map.url,
wxapp_url: data.map.wxapp_url,
uniapp_url: data.map.uniapp_url,
pic: data.map.pic,
imageArr: data.map.pic ? data.map.pic.split(',') : [],
sort: data.sort,
status: data.status
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+132
View File
@@ -0,0 +1,132 @@
<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="140px">
<el-form-item label="菜单名">
<el-input v-model="form.name" style="width: 300px;" />
</el-form-item>
<el-form-item label="跳转url">
<el-input v-model="form.url" style="width: 300px;" />
</el-form-item>
<el-form-item label="uniapp路由">
<el-input v-model="form.uniapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="图标(52*52)">
<MaterialList v-model="form.imageArr" style="width: 300px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 300px;" />
</el-form-item>
<el-form-item label="是否显示">
<el-radio v-model="form.status" :label="1"></el-radio>
<el-radio v-model="form.status" :label="0" style="width: 200px;"></el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<!--<el-input v-model="form.groupName" />-->
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxSystemGroupData'
import picUpload from '@/components/pic-upload'
import MaterialList from '@/components/material'
export default {
components: { picUpload, MaterialList },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_my_menus',
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,
status: 1
},
rules: {
}
}
},
watch: {
'form.imageArr': function(val) {
if (val) {
this.form.pic = 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: '',
groupName: 'yshop_my_menus',
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,
status: 1
}
}
}
}
</script>
<style scoped>
</style>
@@ -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/bxg/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>
@@ -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/bxg/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>
@@ -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/bxg/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>
+194
View File
@@ -0,0 +1,194 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="门店名称" prop="name">
<el-input v-model="form.name" style="width: 370px;" />
</el-form-item>
<el-form-item label="门店简介" prop="introduction">
<el-input v-model="form.introduction" style="width: 370px;" />
</el-form-item>
<el-form-item label="门店手机" prop="phone">
<el-input v-model="form.phone" style="width: 370px;" />
</el-form-item>
<el-form-item label="门店地址" prop="address">
<el-input v-model="form.address" style="width: 370px;" />
<el-button size="medium" type="primary" @click="getL(form.address)">获取经纬度</el-button>
</el-form-item>
<el-form-item label="门店logo" prop="image">
<MaterialList v-model="form.imageArr" style="width: 370px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="纬度" prop="latitude">
<el-input v-model="form.latitude" style="width: 370px;" :disabled="true" />
</el-form-item>
<el-form-item label="经度" prop="longitude">
<el-input v-model="form.longitude" style="width: 370px;" :disabled="true" />
</el-form-item>
<el-form-item label="核销时效" prop="validTime">
<el-date-picker
@change="getTimeT"
style="width: 370px;"
v-model="form.validTimeArr"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="营业时间" prop="dayTime">
<el-time-picker
@change="getTime"
style="width: 370px;"
is-range
v-model="form.dayTimeArr"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围">
</el-time-picker>
</el-form-item>
<el-form-item label="是否显示" prop="isShow">
<el-radio-group v-model="form.isShow" style="width: 178px">
<el-radio :label="1">显示</el-radio>
<el-radio :label="0">隐藏</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<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" width="50" />
<el-table-column v-if="columns.visible('name')" prop="name" label="门店名称" />
<el-table-column v-if="columns.visible('phone')" prop="phone" label="门店电话" />
<el-table-column v-if="columns.visible('address')" prop="address" label="地址" />
<el-table-column v-if="columns.visible('image')" prop="image" label="门店logo" >
<template slot-scope="scope">
<a :href="scope.row.image" style="color: #42b983" target="_blank"><img :src="scope.row.image" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('validTime')" prop="validTime" label="核销有效日期" />
<el-table-column v-if="columns.visible('dayTime')" prop="dayTime" label="营业时间" />
<el-table-column v-if="columns.visible('isShow')" prop="isShow" label="是否显示" >
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.isShow === 1" :type="''">显示</el-tag>
<el-tag v-else :type=" 'info' ">隐藏</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-permission="['admin','yxSystemStore:edit','yxSystemStore: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 crudYxSystemStore from '@/api/bxg/yxSystemStore'
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 { parseTime } from '@/utils/index'
// crud交由presenter持有
const defaultCrud = CRUD({ title: '门店', url: 'api/yxSystemStore', sort: 'id,desc', crudMethod: { ...crudYxSystemStore }})
const defaultForm = { id: null, name: null, introduction: null, phone: null, address: null, detailedAddress: null, image: null, latitude:
null, longitude: null, validTime: null, dayTime: null, addTime: null, isShow: 1, imageArr: [], validTimeArr: [], dayTimeArr: [new Date(),new Date()] }
export default {
name: 'YxSystemStore',
components: { pagination, crudOperation, rrOperation, udOperation, MaterialList },
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
permission: {
add: ['admin', 'yxSystemStore:add'],
edit: ['admin', 'yxSystemStore:edit'],
del: ['admin', 'yxSystemStore:del']
},
rules: {
name: [
{ required: true, message: '门店名称不能为空', trigger: 'blur' }
],
introduction: [
{ required: true, message: '简介不能为空', trigger: 'blur' }
],
phone: [
{ required: true, message: '手机号码不能为空', trigger: 'blur' }
],
address: [
{ required: true, message: '省市区不能为空', trigger: 'blur' }
],
latitude: [
{ required: true, message: '纬度不能为空', trigger: 'blur' }
],
longitude: [
{ required: true, message: '经度不能为空', trigger: 'blur' }
],
isShow: [
{ required: true, message: '是否显示不能为空', trigger: 'blur' }
]
}
}
},
methods: {
// 获取数据前设置好接口地址
[CRUD.HOOK.beforeRefresh]() {
return true
},
// 添加后
[CRUD.HOOK.beforeSubmit]() {
//console.log('hah:'+this.form.imageArr)
this.form.image = this.form.imageArr.join(',')
},
// 编辑前
[CRUD.HOOK.beforeToEdit](crud, form) {
form.imageArr = [form.image]
form.dayTimeArr = [form.dayTimeStart,form.dayTimeEnd]
form.validTimeArr = [form.validTimeStart,form.validTimeEnd]
},
getTime(t) {
this.form.dayTimeStart = t[0]
this.form.dayTimeEnd = t[1]
this.form.dayTime = parseTime(t[0],'{h}:{i}:{s}') + ' - ' + parseTime(t[1],'{h}:{i}:{s}')
},
getTimeT(t) {
this.form.validTimeStart = t[0]
this.form.validTimeEnd = t[1]
this.form.validTime = parseTime(t[0],'{y}-{m}-{d}') + ' - ' + parseTime(t[1],'{y}-{m}-{d}')
},
getL(addr) {
crudYxSystemStore.getL({addr}).then(res => {
this.form.latitude = res.result.location.lat
this.form.longitude = res.result.location.lng
//console.log(this.form)
})
}
}
}
</script>
<style scoped>
</style>
+70
View File
@@ -0,0 +1,70 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px">
<el-form-item label="开启门店自提">
<el-radio v-model="form.store_self_mention" :label="1">开启</el-radio>
<el-radio v-model="form.store_self_mention" :label="2">关闭</el-radio>
</el-form-item>
<el-form-item label="腾讯地图KEY">
<el-input v-model="form.tengxun_map_key" style="width: 370px;" />
</el-form-item>
<el-form-item label="">
<el-button type="primary" @click="doSubmit">提交</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del, add, get } from '@/api/bxg/yxSystemConfig'
import { Message } from 'element-ui'
export default {
mixins: [initData],
data() {
return {
delLoading: false,
form: {
store_self_mention: 1,
tengxun_map_key: ''
},
rules: {
}
}
},
created() {
get().then(rese => {
const that = this
rese.content.map(function(key, value) {
const keyName = key.menuName
const newValue = key.value
if(keyName in that.form){
that.form[keyName] = newValue
}
})
this.form.store_self_mention = parseInt(this.form.store_self_mention)
})
},
methods: {
checkPermission,
doSubmit() {
add(this.form).then(res => {
Message({ message: '设置成功', type: 'success' })
}).catch(err => {
// this.loading = false
console.log(err.response.data.message)
})
}
}
}
</script>
<style scoped>
</style>
@@ -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/bxg/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', 'yxStoreProductRule:add'],
edit: ['admin', 'yxStoreProductRule:edit'],
del: ['admin', 'yxStoreProductRule: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>
@@ -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','yxStoreProductRule:edit','yxStoreProductRule: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/bxg/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', 'yxStoreProductRule:add'],
edit: ['admin', 'yxStoreProductRule:edit'],
del: ['admin', 'yxStoreProductRule: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>
+181
View File
@@ -0,0 +1,181 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<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-select>
<rrOperation :crud="crud" />
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="商城用户" prop="uid">
<cuser v-model="form.user"></cuser>
</el-form-item>
<el-form-item label="所属门店" prop="storeId">
<el-select v-model="form.storeId" style="width: 178px" placeholder="请先选择门店">
<el-option
v-for="(item, index) in mystores"
:key="item.name + index"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="店员名称" prop="staffName">
<el-input v-model="form.staffName" style="width: 370px;" />
</el-form-item>
<el-form-item label="手机号码" prop="phone">
<el-input v-model="form.phone" style="width: 370px;" />
</el-form-item>
<el-form-item label="核销开关" prop="verifyStatus">
<el-radio-group v-model="form.verifyStatus" style="width: 178px">
<el-radio :label="1">开启</el-radio>
<el-radio :label="0">关闭</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<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" width="55" />
<el-table-column v-if="columns.visible('nickname')" prop="nickname" label="微信昵称" />
<el-table-column v-if="columns.visible('avatar')" 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 v-if="columns.visible('staffName')" prop="staffName" label="店员名称" />
<el-table-column v-if="columns.visible('storeName')" prop="storeName" label="所属门店" />
<el-table-column v-if="columns.visible('verifyStatus')" prop="verifyStatus" label="核销开关" >
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.verifyStatus === 1" :type="''">开启</el-tag>
<el-tag v-else :type=" 'info' ">关闭</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('createTime')" prop="createTime" label="添加时间" >
<template slot-scope="scope">
<span>{{ formatTimeTwo(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column v-permission="['admin','yxSystemStoreStaff:edit','yxSystemStoreStaff: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 crudYxSystemStoreStaff from '@/api/bxg/yxSystemStoreStaff'
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 cuser from '@/views/components/user'
import crudYxSystemStore from '@/api/bxg/yxSystemStore'
import { formatTimeTwo } from '@/utils/index'
// crud交由presenter持有
const defaultCrud = CRUD({ title: '门店店员', url: 'api/yxSystemStoreStaff', sort: 'id,desc', crudMethod: { ...crudYxSystemStoreStaff }})
const defaultForm = { user: {uid: null,nickname: null,avatar: null}, id: null, uid: null, avatar: null, storeId: null, staffName: null, phone: null, verifyStatus: 1, status: null, addTime: null, nickname: null, storeName: null }
export default {
name: 'YxSystemStoreStaff',
components: { pagination, crudOperation, rrOperation, udOperation, cuser },
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
mystores: [],
permission: {
add: ['admin', 'yxSystemStoreStaff:add'],
edit: ['admin', 'yxSystemStoreStaff:edit'],
del: ['admin', 'yxSystemStoreStaff:del']
},
rules: {
// uid: [
// { required: true, message: '微信用户id不能为空', trigger: 'blur' }
// ],
// avatar: [
// { required: true, message: '店员头像不能为空', trigger: 'blur' }
// ],
// storeId: [
// { required: true, message: '门店id不能为空', trigger: 'blur' }
// ],
// staffName: [
// { required: true, message: '店员名称不能为空', trigger: 'blur' }
// ],
// phone: [
// { required: true, message: '手机号码不能为空', trigger: 'blur' }
// ],
// verifyStatus: [
// { required: true, message: '核销开关不能为空', trigger: 'blur' }
// ],
// nickname: [
// { required: true, message: '微信昵称不能为空', trigger: 'blur' }
// ]
},
queryTypeOptions: [
{ key: 'staffName', display_name: '店员名称' },
{ key: 'nickname', display_name: '微信昵称' }
]
}
},
methods: {
formatTimeTwo,
// 获取数据前设置好接口地址
[CRUD.HOOK.beforeRefresh]() {
const query = this.query
console.log('query:'+query.value)
if (query.type && query.value) {
this.crud.params[query.type] = query.value
}else{
delete this.crud.params.staffName
delete this.crud.params.nickname
}
return true
},
//新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
crudYxSystemStore.getAll().then(res => {
this.mystores= res
})
},
// 编辑前
[CRUD.HOOK.beforeToEdit](crud, form) {
this.form.user.uid = form.uid
this.form.user.nickname = form.nickname
this.form.user.avatar = form.avatar
},
[CRUD.HOOK.beforeSubmit]() {
this.form.uid = this.form.user.uid
this.form.nickname = this.form.user.nickname
this.form.avatar = this.form.user.avatar
}
}
}
</script>
<style scoped>
</style>
+204
View File
@@ -0,0 +1,204 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<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-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</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="uid" label="用户id" />
<el-table-column prop="nickname" label="用户昵称" />
<el-table-column ref="table" 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="phone" label="手机号码" />
<el-table-column prop="nowMoney" label="用户余额" />
<el-table-column prop="brokeragePrice" label="佣金金额" />
<el-table-column :show-overflow-tooltip="true" prop="addTime" label="创建日期">
<template slot-scope="scope">
<span>{{ formatTime(scope.row.addTime) }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div @click="onStatus(scope.row.uid,scope.row.status)">
<el-tag v-if="scope.row.status == 1" style="cursor: pointer" :type="''">正常</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">禁用</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="spreadCount" label="直推人数" />
<el-table-column prop="payCount" label="购买次数" />
<!---->
<!--<el-table-column v-if="checkPermission(['admin','YXUSER_ALL','YXUSER_EDIT','YXUSER_DELETE'])" label="操作" width="150px" align="center">-->
<!--<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)"/>-->
<!--<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>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del, onStatus } from '@/api/bxg/yxUser'
import eForm from './form'
import { formatTime } from '@/utils/index'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false,
queryTypeOptions: [
{ key: 'nickname', display_name: '用户昵称' },
{ key: 'phone', display_name: '手机号码' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
formatTime,
checkPermission,
onStatus(id, status) {
this.$confirm(`确定进行[${status ? '禁用' : '开启'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
onStatus(id, { status: status }).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1000,
onClose: () => {
this.init()
}
})
})
})
.catch(() => { })
},
beforeInit() {
this.url = 'bxg/api/yxUser'
const sort = 'uid,desc'
this.params = { page: this.page, size: this.size, sort: sort, isPromoter: 1 }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(uid) {
this.delLoading = true
del(uid).then(res => {
this.delLoading = false
this.$refs[uid].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[uid].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
uid: data.uid,
account: data.account,
pwd: data.pwd,
realName: data.realName,
birthday: data.birthday,
cardId: data.cardId,
mark: data.mark,
partnerId: data.partnerId,
groupId: data.groupId,
nickname: data.nickname,
avatar: data.avatar,
phone: data.phone,
addTime: data.addTime,
addIp: data.addIp,
lastTime: data.lastTime,
lastIp: data.lastIp,
nowMoney: data.nowMoney,
brokeragePrice: data.brokeragePrice,
integral: data.integral,
signNum: data.signNum,
status: data.status,
level: data.level,
spreadUid: data.spreadUid,
spreadTime: data.spreadTime,
userType: data.userType,
isPromoter: data.isPromoter,
payCount: data.payCount,
spreadCount: data.spreadCount,
cleanTime: data.cleanTime,
addres: data.addres,
adminid: data.adminid,
loginType: data.loginType
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+270
View File
@@ -0,0 +1,270 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="nickname" clearable placeholder="输入用户昵称" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<el-select v-model="category" clearable placeholder="明细种类" class="filter-item" style="width: 130px">
<el-option
v-for="item in categoryOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select v-model="type" clearable placeholder="明细类型" class="filter-item" style="width: 130px">
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select v-model="inOuttype" clearable placeholder="进出账" class="filter-item" style="width: 130px">
<el-option
v-for="item in inOutOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select v-model="shibai" clearable placeholder="账单标题" class="filter-item" style="width: 130px">
<el-option
v-for="item in shibais"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-date-picker
class="filter-item"
v-model="startTime"
type="date"
placeholder="开始日期"
value-format="yyyy-MM-dd"
style="width: 180px">
</el-date-picker>
<el-date-picker
class="filter-item"
v-model="endTime"
type="date"
placeholder="结束日期"
value-format="yyyy-MM-dd"
style="width: 180px">
</el-date-picker>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<pForm ref="formp" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="nickname" label="用户昵称" />
<el-table-column prop="title" label="账单标题" />
<el-table-column prop="category" label="明细种类">
<template slot-scope="scope">
<span v-if="scope.row.category == 'now_money'">余额</span>
<span v-else-if="scope.row.category == 'integral'">积分</span>
<span v-else>未知</span>
</template>
</el-table-column>
<el-table-column prop="number" label="明细数字">
<template slot-scope="scope">
<span v-if="scope.row.pm == 1">+</span>
<span v-else>-</span>
<span>{{ scope.row.number }}</span>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" />
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import {del, onStatus} from '@/api/bxg/yxUser'
import eForm from './form'
import pForm from './formp'
import {formatTime} from '@/utils/index'
export default {
components: { eForm, pForm },
mixins: [initData],
data() {
return {
delLoading: false, nickname: '', category: '', type: '',inOuttype:'',startTime: '',endTime: '',shibai: '',
queryTypeOptions: [
{ key: 'nickname', display_name: '用户昵称' },
{ key: 'phone', display_name: '手机号码' }
],
categoryOptions: [
{ value: 'now_money', label: '余额' },
{ value: 'integral', label: '积分' }
],
typeOptions: [
{ value: 'brokerage', label: '佣金' },
{ value: 'sign', label: '签到' }
],
inOutOptions: [
{ value: 0, label: '支出' },
{ value: 1, label: '获得' }
],
shibais: [
{ value: "获得推广佣金", label: '获得推广佣金' },
{ value: "系统增加余额", label: '增加余额' },
{ value: "系统减少余额", label: '减少余额' },
{ value: "佣金提现", label: '佣金提现' },
{ value: "佣金提现", label: '佣金提现' },
{ value: "购买商品", label: '购买商品' },
{ value: "商品退款", label: '商品退款' },
],
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
formatTime,
checkPermission,
onStatus(id, status) {
this.$confirm(`确定进行[${status ? '禁用' : '开启'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
onStatus(id, { status: status }).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1000,
onClose: () => {
this.init()
}
})
})
})
.catch(() => { })
},
beforeInit() {
this.url = '/bxg/api/yxUserBill'
const sort = 'id,desc'
this.params = {
page: this.page,
size: this.size,
nickname: this.nickname,
category: this.category,
type: this.type,
pm : this.inOuttype,
startTime: this.startTime,
endTime: this.endTime,
title: this.shibai
}
const query = this.query
const type = query.type
const value = query.value
const pm = query.inOuttype
if (type && value) { this.params[type] = value }
return true
},
subDelete(uid) {
this.delLoading = true
del(uid).then(res => {
this.delLoading = false
this.$refs[uid].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[uid].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
uid: data.uid,
account: data.account,
pwd: data.pwd,
realName: data.realName,
birthday: data.birthday,
cardId: data.cardId,
mark: data.mark,
partnerId: data.partnerId,
groupId: data.groupId,
nickname: data.nickname,
avatar: data.avatar,
phone: data.phone,
addTime: data.addTime,
addIp: data.addIp,
lastTime: data.lastTime,
lastIp: data.lastIp,
nowMoney: data.nowMoney,
brokeragePrice: data.brokeragePrice,
integral: data.integral,
signNum: data.signNum,
status: data.status,
level: data.level,
spreadUid: data.spreadUid,
spreadTime: data.spreadTime,
userType: data.userType,
isPromoter: data.isPromoter,
payCount: data.payCount,
spreadCount: data.spreadCount,
cleanTime: data.cleanTime,
addres: data.addres,
adminid: data.adminid,
loginType: data.loginType
}
_this.dialog = true
},
editP(data) {
this.isAdd = false
const _this = this.$refs.formp
_this.form = {
uid: data.uid,
nickname: data.nickname,
ptype: 1,
money: 0
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+207
View File
@@ -0,0 +1,207 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="nickname" clearable placeholder="输入用户昵称" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<pForm ref="formp" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="nickname" label="用户昵称" />
<el-table-column prop="title" label="账单标题" />
<el-table-column prop="category" label="明细种类">
<template slot-scope="scope">
<span v-if="scope.row.category == 'now_money'">余额</span>
<span v-else-if="scope.row.category == 'integral'">积分</span>
<span v-else>未知</span>
</template>
</el-table-column>
<el-table-column prop="number" label="明细数字">
<template slot-scope="scope">
<span v-if="scope.row.pm == 1">+</span>
<span v-else>-</span>
<span>{{ scope.row.number }}</span>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="addTime" label="创建日期">
<template slot-scope="scope">
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del, onStatus } from '@/api/bxg/yxUser'
import eForm from './form'
import pForm from './formp'
import { formatTime } from '@/utils/index'
export default {
components: { eForm, pForm },
mixins: [initData],
data() {
return {
delLoading: false, nickname: '', category: '', type: '',
queryTypeOptions: [
{ key: 'nickname', display_name: '用户昵称' },
{ key: 'phone', display_name: '手机号码' }
],
categoryOptions: [
{ value: 'now_money', label: '余额' },
{ value: 'integral', label: '积分' }
],
typeOptions: [
{ value: 'brokerage', label: '佣金' },
{ value: 'sign', label: '签到' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
formatTime,
checkPermission,
onStatus(id, status) {
this.$confirm(`确定进行[${status ? '禁用' : '开启'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
onStatus(id, { status: status }).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1000,
onClose: () => {
this.init()
}
})
})
})
.catch(() => { })
},
beforeInit() {
this.url = '/bxg/api/yxUserBill'
const sort = 'id,desc'
this.params = {
page: this.page,
size: this.size,
nickname: this.nickname,
category: 'now_money',
type: 'brokerage'
}
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(uid) {
this.delLoading = true
del(uid).then(res => {
this.delLoading = false
this.$refs[uid].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[uid].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
uid: data.uid,
account: data.account,
pwd: data.pwd,
realName: data.realName,
birthday: data.birthday,
cardId: data.cardId,
mark: data.mark,
partnerId: data.partnerId,
groupId: data.groupId,
nickname: data.nickname,
avatar: data.avatar,
phone: data.phone,
addTime: data.addTime,
addIp: data.addIp,
lastTime: data.lastTime,
lastIp: data.lastIp,
nowMoney: data.nowMoney,
brokeragePrice: data.brokeragePrice,
integral: data.integral,
signNum: data.signNum,
status: data.status,
level: data.level,
spreadUid: data.spreadUid,
spreadTime: data.spreadTime,
userType: data.userType,
isPromoter: data.isPromoter,
payCount: data.payCount,
spreadCount: data.spreadCount,
cleanTime: data.cleanTime,
addres: data.addres,
adminid: data.adminid,
loginType: data.loginType
}
_this.dialog = true
},
editP(data) {
this.isAdd = false
const _this = this.$refs.formp
_this.form = {
uid: data.uid,
nickname: data.nickname,
ptype: 1,
money: 0
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+130
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/bxg/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>
+165
View File
@@ -0,0 +1,165 @@
<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="用户昵称">
<el-input v-model="form.nickname" :disabled="true" style="width: 370px;" />
</el-form-item>
<el-form-item label="真实姓名">
<el-input v-model="form.realName" style="width: 370px;" />
</el-form-item>
<el-form-item label="用户备注">
<el-input v-model="form.mark" style="width: 370px;" />
</el-form-item>
<el-form-item label="手机号码">
<el-input v-model="form.phone" style="width: 370px;" />
</el-form-item>
<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.adminid" :label="1">开启</el-radio>
<el-radio v-model="form.adminid" :label="0">关闭</el-radio>
</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>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxUser'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
uid: '',
account: '',
pwd: '',
realName: '',
birthday: '',
cardId: '',
mark: '',
partnerId: '',
groupId: '',
nickname: '',
avatar: '',
phone: '',
addTime: '',
addIp: '',
lastTime: '',
lastIp: '',
nowMoney: '',
brokeragePrice: '',
integral: '',
signNum: '',
status: '',
level: '',
spreadUid: '',
spreadTime: '',
userType: '',
isPromoter: 0,
payCount: '',
spreadCount: '',
cleanTime: '',
addres: '',
adminid: 0,
loginType: ''
},
rules: {
}
}
},
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 = {
uid: '',
account: '',
pwd: '',
realName: '',
birthday: '',
cardId: '',
mark: '',
partnerId: '',
groupId: '',
nickname: '',
avatar: '',
phone: '',
addTime: '',
addIp: '',
lastTime: '',
lastIp: '',
nowMoney: '',
brokeragePrice: '',
integral: '',
signNum: '',
status: '',
level: '',
spreadUid: '',
spreadTime: '',
userType: '',
isPromoter: '',
payCount: '',
spreadCount: '',
cleanTime: '',
addres: '',
adminid: '',
loginType: ''
}
}
}
}
</script>
<style scoped>
</style>
+128
View File
@@ -0,0 +1,128 @@
<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="用户昵称">
<el-input v-model="form.nickname" :disabled="true" style="width: 370px;" />
</el-form-item>
<el-form-item label="修改余额">
<el-radio v-model="form.ptype" :label="1">增加</el-radio>
<el-radio v-model="form.ptype" :label="2">减少</el-radio>
</el-form-item>
<el-form-item label="用户余额">
<el-input v-model="form.money" style="width: 370px;" />
</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>
</el-dialog>
</template>
<script>
import { add, edit, editp } from '@/api/bxg/yxUser'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
uid: '',
nickname: '',
money: '',
ptype: '1'
},
rules: {
}
}
},
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() {
editp(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 = {
uid: '',
account: '',
pwd: '',
realName: '',
birthday: '',
cardId: '',
mark: '',
partnerId: '',
groupId: '',
nickname: '',
avatar: '',
phone: '',
addTime: '',
addIp: '',
lastTime: '',
lastIp: '',
nowMoney: '',
brokeragePrice: '',
integral: '',
signNum: '',
status: '',
level: '',
spreadUid: '',
spreadTime: '',
userType: '',
isPromoter: '',
payCount: '',
spreadCount: '',
cleanTime: '',
addres: '',
adminid: '',
loginType: ''
}
}
}
}
</script>
<style scoped>
</style>
+264
View File
@@ -0,0 +1,264 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<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-select>
<el-select v-model="userType" clearable placeholder="用户来源" class="filter-item" style="width: 130px">
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<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" />
<el-table-column prop="nickname" label="用户昵称" />
<el-table-column ref="table" 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="phone" label="手机号码" />
<el-table-column prop="nowMoney" label="用户余额" />
<el-table-column prop="brokeragePrice" label="佣金金额" />
<el-table-column prop="integral" label="用户积分" />
<el-table-column prop="createTime" label="创建日期" width="140">
<template slot-scope="scope">
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div @click="onStatus(scope.row.uid,scope.row.status)">
<el-tag v-if="scope.row.status == 1" style="cursor: pointer" :type="''">正常</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">禁用</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="用户来源" align="center">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.userType == 'wechat'">公众号</el-tag>
<el-tag v-else-if="scope.row.userType == 'routine'">小程序</el-tag>
<el-tag v-else>H5</el-tag>
</div>
</template>
</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="215" align="center" fixed="right">
<template slot-scope="scope">
<el-button
v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']"
size="mini"
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']"
size="mini"
type="primary"
@click="editP(scope.row)"
>修改余额</el-button>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del, onStatus } from '@/api/bxg/yxUser'
import eForm from './form'
import pForm from './formp'
import detail from './detail'
import { formatTime } from '@/utils/index'
export default {
components: { eForm, pForm, detail },
mixins: [initData],
data() {
return {
delLoading: false,
userType: '',
queryTypeOptions: [
{ key: 'nickname', display_name: '用户昵称' },
{ key: 'phone', display_name: '手机号码' }
],
statusOptions: [
{ value: 'routine', label: '小程序' },
{ value: 'wechat', label: '公众号' },
{ value: 'H5', label: 'H5' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
formatTime,
checkPermission,
onStatus(id, status) {
this.$confirm(`确定进行[${status ? '禁用' : '开启'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
onStatus(id, { status: status }).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1000,
onClose: () => {
this.init()
}
})
})
})
.catch(() => { })
},
beforeInit() {
this.url = 'bxg/api/yxUser'
const sort = 'uid,desc'
this.params = { page: this.page, size: this.size, sort: sort, userType: this.userType }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(uid) {
this.delLoading = true
del(uid).then(res => {
this.delLoading = false
this.$refs[uid].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[uid].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
uid: data.uid,
account: data.account,
pwd: data.pwd,
realName: data.realName,
birthday: data.birthday,
cardId: data.cardId,
mark: data.mark,
partnerId: data.partnerId,
groupId: data.groupId,
nickname: data.nickname,
avatar: data.avatar,
phone: data.phone,
addTime: data.addTime,
addIp: data.addIp,
lastTime: data.lastTime,
lastIp: data.lastIp,
nowMoney: data.nowMoney,
brokeragePrice: data.brokeragePrice,
integral: data.integral,
signNum: data.signNum,
status: data.status,
level: data.level,
spreadUid: data.spreadUid,
spreadTime: data.spreadTime,
userType: data.userType,
isPromoter: data.isPromoter,
payCount: data.payCount,
spreadCount: data.spreadCount,
cleanTime: data.cleanTime,
addres: data.addres,
adminid: data.adminid,
loginType: data.loginType
}
_this.dialog = true
},
editP(data) {
this.isAdd = false
const _this = this.$refs.formp
_this.form = {
uid: data.uid,
nickname: data.nickname,
ptype: 1,
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)
}
}
}
</script>
<style scoped>
</style>
+207
View File
@@ -0,0 +1,207 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="nickname" clearable placeholder="输入用户昵称" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-refresh"
@click="toQuery"
>刷新</el-button>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<pForm ref="formp" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="nickname" label="用户昵称" />
<el-table-column prop="title" label="账单标题" />
<el-table-column prop="category" label="明细种类">
<template slot-scope="scope">
<span v-if="scope.row.category == 'now_money'">余额</span>
<span v-else-if="scope.row.category == 'integral'">积分</span>
<span v-else>未知</span>
</template>
</el-table-column>
<el-table-column prop="number" label="明细数字">
<template slot-scope="scope">
<span v-if="scope.row.pm == 1">+</span>
<span v-else>-</span>
<span>{{ scope.row.number }}</span>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="addTime" label="创建日期">
<template slot-scope="scope">
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del, onStatus } from '@/api/bxg/yxUser'
import eForm from './form'
import pForm from './formp'
import { formatTime } from '@/utils/index'
export default {
components: { eForm, pForm },
mixins: [initData],
data() {
return {
delLoading: false, nickname: '', category: '', type: '',
queryTypeOptions: [
{ key: 'nickname', display_name: '用户昵称' },
{ key: 'phone', display_name: '手机号码' }
],
categoryOptions: [
{ value: 'now_money', label: '余额' },
{ value: 'integral', label: '积分' }
],
typeOptions: [
{ value: 'brokerage', label: '佣金' },
{ value: 'sign', label: '签到' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
formatTime,
checkPermission,
onStatus(id, status) {
this.$confirm(`确定进行[${status ? '禁用' : '开启'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
onStatus(id, { status: status }).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1000,
onClose: () => {
this.init()
}
})
})
})
.catch(() => { })
},
beforeInit() {
this.url = '/bxg/api/yxUserBill'
const sort = 'id,desc'
this.params = {
page: this.page,
size: this.size,
nickname: this.nickname,
category: 'integral',
type: ''
}
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
subDelete(uid) {
this.delLoading = true
del(uid).then(res => {
this.delLoading = false
this.$refs[uid].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[uid].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
uid: data.uid,
account: data.account,
pwd: data.pwd,
realName: data.realName,
birthday: data.birthday,
cardId: data.cardId,
mark: data.mark,
partnerId: data.partnerId,
groupId: data.groupId,
nickname: data.nickname,
avatar: data.avatar,
phone: data.phone,
addTime: data.addTime,
addIp: data.addIp,
lastTime: data.lastTime,
lastIp: data.lastIp,
nowMoney: data.nowMoney,
brokeragePrice: data.brokeragePrice,
integral: data.integral,
signNum: data.signNum,
status: data.status,
level: data.level,
spreadUid: data.spreadUid,
spreadTime: data.spreadTime,
userType: data.userType,
isPromoter: data.isPromoter,
payCount: data.payCount,
spreadCount: data.spreadCount,
cleanTime: data.cleanTime,
addres: data.addres,
adminid: data.adminid,
loginType: data.loginType
}
_this.dialog = true
},
editP(data) {
this.isAdd = false
const _this = this.$refs.formp
_this.form = {
uid: data.uid,
nickname: data.nickname,
ptype: 1,
money: 0
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+163
View File
@@ -0,0 +1,163 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="600px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px">
<el-form-item label="等级名称">
<el-input v-model="form.name" style="width: 370px;" />
</el-form-item>
<el-form-item label="是否永久">
<el-radio v-model="form.isForever" :label="1"></el-radio>
<el-radio v-model="form.isForever" :label="0" style="width: 200px;"></el-radio>
</el-form-item>
<el-form-item label="有效时间(天)">
<el-input-number v-model="form.validDate" style="width: 370px;" />
</el-form-item>
<el-form-item label="会员等级">
<el-input-number v-model="form.grade" style="width: 370px;" />
</el-form-item>
<el-form-item label="享受折扣">
<el-input-number v-model="form.discount" style="width: 370px;" />
</el-form-item>
<el-form-item label="会员背景">
<MaterialList v-model="form.imageArr" style="width: 300px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="会员图标">
<MaterialList v-model="form.iconArr" style="width: 300px" type="image" :num="1" :width="150" :height="150" />
</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="说明">
<el-input v-model="form.explain" rows="3" type="textarea" />
</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>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxSystemUserLevel'
import picUpload from '@/components/pic-upload'
import MaterialList from '@/components/material'
export default {
components: { picUpload, MaterialList },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
merId: '',
name: '',
money: '',
validDate: '',
isForever: 1,
isPay: '',
isShow: 1,
grade: '',
discount: '',
image: '',
icon: '',
imageArr: [],
iconArr: [],
explain: '',
addTime: '',
isDel: ''
},
rules: {
// grade: [
// { type: 'number', message: '只能输入数字', trigger: 'blur' }
// ]
}
}
},
watch: {
'form.imageArr': function(val) {
if (val) {
this.form.image = val.join(',')
}
},
'form.iconArr': function(val) {
if (val) {
this.form.icon = 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: '',
merId: '',
name: '',
money: '',
validDate: '',
isForever: 1,
isPay: '',
isShow: 1,
grade: '',
discount: '',
image: '',
icon: '',
imageArr: [],
iconArr: [],
explain: '',
addTime: '',
isDel: ''
}
}
}
}
</script>
<style scoped>
</style>
+152
View File
@@ -0,0 +1,152 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</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" />
<el-table-column prop="icon" label="等级图标">
<template slot-scope="scope">
<a :href="scope.row.icon" style="color: #42b983" target="_blank"><img :src="scope.row.icon" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="name" label="等级名称" />
<el-table-column prop="grade" label="会员等级" />
<el-table-column prop="discount" label="享受折扣" />
<el-table-column prop="validDate" label="有效时间" />
<el-table-column prop="isForever" label="是否永久">
<template slot-scope="scope">
<el-tag v-if="scope.row.isForever === 1" style="cursor: pointer" :type="''"></el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' "></el-tag>
</template>
</el-table-column>
<el-table-column prop="isShow" label="是否显示">
<template slot-scope="scope">
<el-tag v-if="scope.row.isShow === 1" style="cursor: pointer" :type="''"></el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' "></el-tag>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_EDIT','YXSYSTEMUSERLEVEL_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-permission="['admin','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" />
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_DELETE']"
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-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemUserLevel'
import eForm from './form'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemUserLevel'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
merId: data.merId,
name: data.name,
money: data.money,
validDate: data.validDate,
isForever: data.isForever,
isPay: data.isPay,
isShow: data.isShow,
grade: data.grade,
discount: data.discount,
image: data.image,
icon: data.icon,
imageArr: data.image ? data.image.split(',') : [],
iconArr: data.icon ? data.icon.split(',') : [],
explain: data.explain,
addTime: data.addTime,
isDel: data.isDel
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>
+126
View File
@@ -0,0 +1,126 @@
<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="任务名称">
<el-input v-model="form.levalName" :disabled="true" style="width: 370px;" />
</el-form-item>
<el-form-item label="任务类型">
<el-input v-model="form.taskType" :disabled="true" style="width: 370px;" />
</el-form-item>
<el-form-item label="任务名称">
<el-input v-model="form.name" style="width: 370px;" />
</el-form-item>
<el-form-item label="限定数">
<el-input-number v-model="form.number" style="width: 370px;" />
</el-form-item>
<el-form-item label="排序">
<el-input-number v-model="form.sort" style="width: 370px;" />
</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="任务说明">
<el-input v-model="form.illustrate" rows="3" type="textarea" />
</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>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/bxg/yxSystemUserTask'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
name: '',
realName: '',
taskType: '',
number: '',
levelId: '',
sort: '',
isShow: '',
isMust: '',
illustrate: '',
addTime: ''
},
rules: {
}
}
},
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: '',
name: '',
realName: '',
taskType: '',
number: '',
levelId: '',
sort: '',
isShow: '',
isMust: '',
illustrate: '',
addTime: ''
}
}
}
}
</script>
<style scoped>
</style>
+112
View File
@@ -0,0 +1,112 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="levalName" label="等级名称" />
<el-table-column prop="name" label="任务名称" />
<el-table-column prop="sort" label="排序" />
<el-table-column prop="isShow" label="是否显示">
<template slot-scope="scope">
<el-tag v-if="scope.row.isShow === 1" style="cursor: pointer" :type="''"></el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' "></el-tag>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_EDIT','YXSYSTEMUSERTASK_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-permission="['admin','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" />
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/bxg/yxSystemUserTask'
import eForm from './form'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'bxg/api/yxSystemUserTask'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
levalName: data.levalName,
id: data.id,
name: data.name,
realName: data.realName,
taskType: data.taskType,
number: data.number,
levelId: data.levelId,
sort: data.sort,
isShow: data.isShow,
isMust: data.isMust,
illustrate: data.illustrate,
addTime: data.addTime
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>