Browse Source

新增会员列表组件,店员管理,修复#I1C5AP,#I1C6MK,#I1C055

master
hupeng 5 years ago
parent
commit
cbe0a6f592
  1. 14
      src/api/yxSystemStore.js
  2. 27
      src/api/yxSystemStoreStaff.js
  3. 3
      src/components/material/index.vue
  4. 9
      src/views/shop/order/index.vue
  5. 3
      src/views/shop/order/indext.vue
  6. 179
      src/views/shop/storestaff/index.vue
  7. 156
      src/views/shop/storestaff/user.vue

14
src/api/yxSystemStore.js

@ -8,12 +8,12 @@ export function add(data) {
}) })
} }
// export function get() { export function get() {
// return request({ return request({
// url: 'api/yxSystemStore', url: 'api/yxSystemStore',
// method: 'get' method: 'get'
// }) })
// } }
export function getL(data) { export function getL(data) {
return request({ return request({
@ -39,4 +39,4 @@ export function edit(data) {
}) })
} }
export default { getL, add, edit, del } export default { getL, add, edit, del, get }

27
src/api/yxSystemStoreStaff.js

@ -0,0 +1,27 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/yxSystemStoreStaff',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/yxSystemStoreStaff/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/yxSystemStoreStaff',
method: 'put',
data
})
}
export default { add, edit, del }

3
src/components/material/index.vue

@ -338,7 +338,8 @@ export default {
page: page.currentPage - 1, page: page.currentPage - 1,
size: page.pageSize, size: page.pageSize,
descs: this.page.descs, descs: this.page.descs,
ascs: this.page.ascs ascs: this.page.ascs,
sort: 'createTime,desc'
}, { }, {
groupId: this.groupId groupId: this.groupId
})).then(response => { })).then(response => {

9
src/views/shop/order/index.vue

@ -71,7 +71,11 @@
<p>{{ scope.row.pinkName }}</p> <p>{{ scope.row.pinkName }}</p>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="realName" label="用户姓名" /> <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="商品信息"> <el-table-column prop="cartInfoList" width="300" label="商品信息">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-for="(item,index) in scope.row.cartInfoList" v-if="item.cartInfoMap.productInfo.attrInfo"> <div v-for="(item,index) in scope.row.cartInfoList" v-if="item.cartInfoMap.productInfo.attrInfo">
@ -564,7 +568,8 @@ export default {
shippingType: data.shippingType, shippingType: data.shippingType,
isChannel: data.isChannel, isChannel: data.isChannel,
isRemind: data.isRemind, isRemind: data.isRemind,
isSystemDel: data.isSystemDel isSystemDel: data.isSystemDel,
nickname: data.userDTO.nickname
} }
_this.dialog = true _this.dialog = true
} }

3
src/views/shop/order/indext.vue

@ -543,7 +543,8 @@ export default {
shippingType: data.shippingType, shippingType: data.shippingType,
isChannel: data.isChannel, isChannel: data.isChannel,
isRemind: data.isRemind, isRemind: data.isRemind,
isSystemDel: data.isSystemDel isSystemDel: data.isSystemDel,
nickname: data.userDTO.nickname
} }
_this.dialog = true _this.dialog = true
} }

179
src/views/shop/storestaff/index.vue

@ -0,0 +1,179 @@
<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('addTime')" prop="addTime" label="添加时间" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.addTime) }}</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/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 './user'
import crudYxSystemStore from '@/api/yxSystemStore'
// crudpresenter
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: {
//
[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.get().then(res => {
this.mystores= res.content
})
},
//
[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>

156
src/views/shop/storestaff/user.vue

@ -0,0 +1,156 @@
<template>
<div>
<div v-if="value.uid">
<!--<img :src="value.avatar" alt="" class="el-upload-list__item-thumbnail">-->
<!--<span class="el-upload-list__item-delete" @click="deleteMaterial(index)">-->
<!--<i class="el-icon-delete" />-->
<!--</span>-->
<ul class="el-upload-list el-upload-list--picture-card">
<li tabindex="0" class="el-upload-list__item is-ready">
<div>
<img :src="value.avatar" alt="" class="el-upload-list__item-thumbnail">
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-delete" @click="deleteUser">
<i class="el-icon-delete" />
</span>
</span>
</div>
</li>
</ul>
</div>
<div v-else tabindex="0" class="el-upload el-upload--picture-card" @click="toSelete">
<i class="el-icon-plus" />
</div>
<el-dialog :visible.sync="dialog" append-to-body width="60%" title="商城会员">
<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>
<!--表格渲染-->
<el-table :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 v-if="checkPermission(['admin','YXUSER_ALL','YXUSER_EDIT','YXUSER_DELETE'])" label="操作" width="185" align="center" fixed="right">
<template slot-scope="scope">
<el-button
v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']"
size="mini"
type="primary"
icon="el-icon-edit"
@click="doSelect(scope.row)"
>选择</el-button>
</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>
</el-dialog>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
export default {
components: {},
mixins: [initData],
props: {
value: {
type: Object
}
},
data() {
return {
myValue: this.value,
delLoading: false, dialog: false,
userType: '',
queryTypeOptions: [
{ key: 'nickname', display_name: '用户昵称' },
{ key: 'phone', display_name: '手机号码' }
]
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'api/yxUser'
const sort = 'uid,desc'
this.params = { page: this.page, size: this.size, sort: sort }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
deleteUser() {
const that = this
this.$confirm('是否确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
//that.myValue = {uid: null,nickname: null,avatar: null}
that.$set(that.value,"uid", null)
that.$set(that.value,"nickname", null)
that.$set(that.value,"avatar", null)
})
},
toSelete() {
this.dialog = true
},
doSelect(data) {
this.$set(this.value,"uid", data.uid)
this.$set(this.value,"nickname", data.nickname)
this.$set(this.value,"avatar", data.avatar)
this.dialog = false
}
}
}
</script>
<style scoped>
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
</style>
Loading…
Cancel
Save