This commit is contained in:
zkthink
2020-06-23 09:13:54 +08:00
parent 3571659e42
commit 15c7b64f52
31 changed files with 1199 additions and 510 deletions
+59 -92
View File
@@ -9,10 +9,7 @@
>
<div class="product-page">
<div class="toolbar">
<el-form
:inline="true"
:model="formParams"
>
<el-form :inline="true" :model="formParams">
<el-form-item>
<el-input
v-model="formParams.keyword"
@@ -21,47 +18,30 @@
/>
</el-form-item>
<el-form-item label="上架状态">
<el-select
v-model="formParams.status"
size="mini"
>
<el-option
label="全部"
value=""
/>
<el-option
label="上架"
:value="1"
/>
<el-option
label="下架"
:value="0"
/>
<el-select v-model="formParams.status" size="mini">
<el-option label="全部" value="" />
<el-option label="上架" :value="1" />
<el-option label="下架" :value="0" />
</el-select>
</el-form-item>
<el-form-item label="官方分类">
<el-select
<el-cascader
v-model="formParams.categoryId"
class="category-select"
size="mini"
>
<el-option
label="全部"
value=""
/>
<el-option
v-for="(category, index) in categoryList"
:key="index"
:label="category.categoryName"
:value="category.id"
/>
</el-select>
:options="categoryList"
clearable
:props="{
checkStrictly: true,
expandTrigger: 'hover',
label: 'categoryName',
value: 'id',
children: 'childs'
}"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="mini"
@click="fetch"
>
<el-button type="primary" size="mini" @click="fetch">
查询
</el-button>
</el-form-item>
@@ -99,35 +79,20 @@
height="80"
width="80"
:src="scope.row.productImg"
>
/>
</template>
</el-table-column>
<el-table-column
prop="productName"
label="产品名称"
/>
<el-table-column prop="productName" label="产品名称" />
<el-table-column
prop="id"
width="200"
class="text-overflow"
label="产品ID"
/>
<el-table-column
prop="price"
label="售价"
/>
<el-table-column
prop="applyPrice"
label="原价"
/>
<el-table-column
prop="stock"
label="库存"
/>
<el-table-column
prop="sellCount"
label="销量"
/>
<el-table-column prop="price" label="售价" />
<el-table-column prop="applyPrice" label="原价" />
<el-table-column prop="stock" label="库存" />
<el-table-column prop="sellCount" label="销量" />
</el-table>
</div>
<pagination
@@ -167,19 +132,15 @@ export default {
default: false
}
},
data () {
data() {
return {
formParams: {
"categoryId": '',
"hasStock": '',
"keyword": "",
"pageSize": 10,
"pageIndex": 1,
"status": ''
},
dialog: {
type: 'add',
isVisible: false
categoryId: '',
hasStock: '',
keyword: '',
pageSize: 10,
pageIndex: 1,
status: ''
},
tableData: [],
categoryList: [],
@@ -195,15 +156,15 @@ export default {
},
computed: {
isVisible: {
get () {
get() {
return this.dialogVisible
},
set () {
set() {
this.close()
this.reset()
}
},
title () {
title() {
return '选择商品'
}
},
@@ -240,7 +201,11 @@ export default {
})
}
},
async getProductList () {
async getProductList() {
const { categoryId } = this.formParams
if (typeof categoryId === 'object') {
this.formParams.categoryId = categoryId.splice(-1, 1)[0]
}
const res = await Goods.findAdminProductList(this.formParams)
const resData = res.data
const { code } = resData
@@ -249,21 +214,21 @@ export default {
this.formatData()
}
},
async findCategoryList () {
const res = await Goods.findCategoryList(3)
async queryAllCategory() {
const res = await Goods.queryAllCategory()
const resData = res.data
this.categoryList = resData.data
},
fetch (config) {
fetch(config) {
const { limit, page } = config
this.formParams.pageIndex = page || 1
this.formParams.pageSize = limit || 10
this.getProductList()
},
editClose () {
editClose() {
this.dialog.isVisible = false
},
onSubmit () {
onSubmit() {
if (this.radioState) {
this.$emit('success', [this.selectOneGoods])
} else {
@@ -271,12 +236,12 @@ export default {
}
this.close()
},
close () {
close() {
this.$emit('close')
},
open() {
this.getProductList()
this.findCategoryList()
this.queryAllCategory()
},
formatData() {
if (this.radioState) {
@@ -292,22 +257,24 @@ export default {
const excludeIds = this.exclude.map(i => i.id)
this.tableData.adminProductVOList.map(item => {
if (excludeIds.indexOf(item.id) > 0) {
this.$refs.multipleTable && this.$refs.multipleTable.toggleRowSelection(item, true)
this.$refs.multipleTable &&
this.$refs.multipleTable.toggleRowSelection(item, true)
} else {
this.$refs.multipleTable && this.$refs.multipleTable.toggleRowSelection(item, false)
this.$refs.multipleTable &&
this.$refs.multipleTable.toggleRowSelection(item, false)
}
})
}
},
reset () {
reset() {
this.radioId = null
this.formParams = {
"categoryId": '',
"hasStock": '',
"keyword": "",
"pageSize": 10,
"pageIndex": 1,
"status": ''
categoryId: '',
hasStock: '',
keyword: '',
pageSize: 10,
pageIndex: 1,
status: ''
}
}
}
@@ -315,7 +282,7 @@ export default {
</script>
<style lang="less">
.add-dialog-component {
.form-inline{
.form-inline {
display: inline-block;
margin: auto;
}
@@ -328,7 +295,7 @@ export default {
}
</style>
<style lang="less" scoped>
.goods-dialog{
.goods-dialog {
/deep/ .el-dialog {
display: flex;
flex-direction: column;
+42 -22
View File
@@ -9,26 +9,28 @@
>
<div class="add-dialog-component">
<el-form ref="form" class="form-inline" label-width="80px">
<el-form-item label="一级分类">
<el-select v-model="value" placeholder="请选择" @change="change(value, 1)">
<el-option
v-for="item in categorys"
:key="item.id"
:label="item.categoryName"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="二级分类">
<el-select v-model="value1" placeholder="请选择" @change="change(value1, 2)">
<el-option
v-for="item in secondaryList"
:key="item.id"
:label="item.categoryName"
:value="item.id"
/>
</el-select>
</el-form-item>
<template v-if="deep===1">
<el-form-item label="一级分类">
<el-select v-model="value" placeholder="请选择" @change="change(value, 1)">
<el-option
v-for="item in categorys"
:key="item.id"
:label="item.categoryName"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="二级分类">
<el-select v-model="value1" placeholder="请选择" @change="change(value1, 2)">
<el-option
v-for="item in secondaryList"
:key="item.id"
:label="item.categoryName"
:value="item.id"
/>
</el-select>
</el-form-item>
</template>
<el-form-item label="三级分类">
<el-select v-model="value2" placeholder="请选择" @change="change(value2, 3)">
<el-option
@@ -49,6 +51,7 @@
</template>
<script>
import Classification from '@/api/Classification.js'
import Goods from '@/api/Goods.js'
export default {
props: {
exclude: {
@@ -57,6 +60,12 @@ export default {
return []
}
},
deep: {
type: Number,
default() {
return 1
}
},
dialogVisible: {
type: Boolean,
default: false
@@ -137,7 +146,9 @@ export default {
}
})
}
this.queryChildCategory(id, deep)
if (deep !== 3) {
this.queryChildCategory(id, deep)
}
},
async queryChildCategory (id, deep) {
const res = await Classification.queryChildCategory({
@@ -159,6 +170,11 @@ export default {
})
}
},
async findCategoryList() {
const res = await Goods.findCategoryList(this.deep)
const categoryList = res.data.data || []
this.level3List = categoryList
},
onSubmit () {
this.$emit('success', this.currentObj)
this.close()
@@ -168,7 +184,11 @@ export default {
this.reset()
},
open() {
this.getProductCategory()
if (this.deep === 1) {
this.getProductCategory()
} else {
this.findCategoryList()
}
},
reset () {
this.value = ''
+245
View File
@@ -0,0 +1,245 @@
<template>
<el-dialog
:close-on-click-modal="false"
:title="title"
top="25px"
:visible.sync="isVisible"
class="goods-dialog"
@opened="open"
>
<div class="product-page">
<div class="toolbar">
<el-form
:inline="true"
:model="formParams"
>
<el-form-item>
<el-input
v-model="formParams.storeName"
size="mini"
placeholder="店铺名称"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="mini"
@click="fetch"
>
查询
</el-button>
</el-form-item>
</el-form>
</div>
<div class="product-content">
<el-table
ref="multipleTable"
:data="tableData.records"
style="width: 100%"
>
<el-table-column width="55" align="center">
<template slot-scope="scope">
<el-radio
v-model="radioId"
:label="scope.row.id"
size="medium"
class="textRadio"
@change.native="getCurrentRow(scope.row)"
>&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column
prop="storeName"
label="店铺名称"
/>
<el-table-column
prop="mobile"
label="手机号"
/>
</el-table>
</div>
<pagination
v-show="tableData.total > 0"
:limit.sync="formParams.size"
:page.sync="formParams.current"
:total="Number(tableData.total)"
@pagination="fetch"
/>
</div>
<div slot="footer" class="add-btn-wrap">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="onSubmit"> </el-button>
</div>
</el-dialog>
</template>
<script>
import Applet from '@/api/Applet'
import Pagination from '@/components/Pagination'
export default {
components: {
Pagination
},
props: {
exclude: {
type: Array,
default() {
return []
}
},
dialogVisible: {
type: Boolean,
default: false
}
},
data () {
return {
tableData: {},
formParams: {
"current": 1,
"map": {},
"model": {
"id": 0,
"isAutoSendRefundAddress": 0,
"logo": "",
"mobile": "",
"refundAddress": "",
"refundContact": "",
"refundTel": "",
"remark": "",
"shipAddress": "",
"storeName": ""
},
"order": "descending",
"size": 10,
"sort": "id"
},
radioId: null
}
},
computed: {
isVisible: {
get () {
return this.dialogVisible
},
set () {
this.close()
this.reset()
}
},
title () {
return '选择商品'
}
},
methods: {
getCurrentRow(row) {
this.radioId = row.id
this.selectOneShop = {
id: row.id,
storeName: row.storeName
}
},
async getStorePage () {
const res = await Applet.getStorePage(this.formParams)
const resData = res.data
const { code } = resData
if (code === 0) {
this.tableData = resData.data
}
},
fetch (config) {
const { limit, page } = config
this.formParams.current = page || 1
this.formParams.size = limit || 10
this.getStorePage()
},
editClose () {
this.dialog.isVisible = false
},
onSubmit () {
this.$emit('success', [this.selectOneShop])
this.close()
},
close () {
this.$emit('close')
},
open() {
this.getStorePage()
},
reset () {
this.radioId = null
this.formParams = {
"current": 1,
"map": {},
"model": {
"id": 0,
"isAutoSendRefundAddress": 0,
"logo": "",
"mobile": "",
"refundAddress": "",
"refundContact": "",
"refundTel": "",
"remark": "",
"shipAddress": "",
"storeName": ""
},
"order": "descending",
"size": 10,
"sort": "id"
}
}
}
}
</script>
<style lang="less">
.add-dialog-component {
.form-inline{
display: inline-block;
margin: auto;
}
.tree-box {
.el-tree-node__content {
margin-bottom: 15px;
height: auto;
}
}
}
</style>
<style lang="less" scoped>
.goods-dialog{
/deep/ .el-dialog {
display: flex;
flex-direction: column;
max-height: 90vh;
min-width: 1000px;
overflow: hidden;
.el-dialog__body {
flex: 1;
overflow: auto;
}
}
.dialog-from {
width: 80%;
margin: auto;
}
.btn-wrap {
margin: 45px auto 0;
text-align: right;
}
.form-item-row {
padding-top: 40px;
/deep/ .el-input {
width: 100px;
margin: 0 5px;
}
}
}
.product-page {
padding: 15px 20px;
.toolbar {
margin-bottom: 25px;
.product-name {
width: 180px;
}
}
}
</style>