Commit fc21c280 by cwq0219

分类管理

1 parent 7b7809f8
...@@ -12,4 +12,14 @@ const getListApi = params => { ...@@ -12,4 +12,14 @@ const getListApi = params => {
}) })
} }
export default { getListApi } const getClassifyInfoApi = params => {
params.method = `${defaultPath}classify.getById`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
export default { getListApi, getClassifyInfoApi }
...@@ -2,7 +2,7 @@ import { http } from '@/main' ...@@ -2,7 +2,7 @@ import { http } from '@/main'
const defaultPath = 'scrm.api.carlife.' const defaultPath = 'scrm.api.carlife.'
const getGoodsListApi = params => { const getMerchantGoodsListApi = params => {
params.method = 'scrm.api.shopmall.goods.page.curMerchant' params.method = 'scrm.api.shopmall.goods.page.curMerchant'
return http({ return http({
url: 'rop-scrm-shopmall/router', url: 'rop-scrm-shopmall/router',
...@@ -12,6 +12,17 @@ const getGoodsListApi = params => { ...@@ -12,6 +12,17 @@ const getGoodsListApi = params => {
}) })
} }
const getGoodsListApi = params => {
// scrm.api.shopmall.goods.getGoodsList
params.method = 'scrm.api.shopmall.goods.getGoodsList'
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
const uploadImgApi = params => { const uploadImgApi = params => {
params.method = `${defaultPath}common.uploadImg` params.method = `${defaultPath}common.uploadImg`
return http({ return http({
...@@ -43,4 +54,4 @@ const getMerchantList = params => { ...@@ -43,4 +54,4 @@ const getMerchantList = params => {
// }) // })
// } // }
export default { getGoodsListApi, uploadImgApi, getMerchantList } export default { getMerchantGoodsListApi, getGoodsListApi, uploadImgApi, getMerchantList }
<!-- 选择商品弹窗 --> <!-- 选择商品弹窗 -->
<template> <template>
<glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose"> <glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose">
<GLTable ref="mutiProRef" :tableData="productList" :tableParams="tableParams" @refreshTable="getList"> <GLTable ref="mutiProRef" :tableData="productList" :hasPage="false" :tableParams="tableParams" @refreshTable="getList">
<span slot="goodsImage" slot-scope="scope"> <span slot="goodsImage" slot-scope="scope">
<img class="m-t-10 img-60" :src="scope.scope.goodsImage" /> <img class="m-t-10 img-60" :src="scope.scope.goodsImage" />
</span> </span>
...@@ -80,8 +80,8 @@ export default { ...@@ -80,8 +80,8 @@ export default {
var that = this var that = this
this.$apis.common.getGoodsListApi(params).then(res => { this.$apis.common.getGoodsListApi(params).then(res => {
// console.log(res) // console.log(res)
this.productList = res.list this.productList = res
this.$refs.mutiProRef.tableTotal = res.total // this.$refs.mutiProRef.tableTotal = res.total
this.productList.forEach(function(item) { this.productList.forEach(function(item) {
item.saleAmount = item.goodsStatistics.saleAmount item.saleAmount = item.goodsStatistics.saleAmount
if (item.specificationDetailList.length > 1) { if (item.specificationDetailList.length > 1) {
......
...@@ -60,7 +60,7 @@ export default { ...@@ -60,7 +60,7 @@ export default {
pageSize: 100000 pageSize: 100000
} }
var that = this var that = this
this.$apis.common.getGoodsListApi(params).then(res => { this.$apis.common.getMerchantGoodsListApi(params).then(res => {
// console.log(res) // console.log(res)
this.productList = res.list this.productList = res.list
this.productList.forEach(function(item) { this.productList.forEach(function(item) {
......
...@@ -36,7 +36,7 @@ const staticRoutes = Object.freeze([ ...@@ -36,7 +36,7 @@ const staticRoutes = Object.freeze([
}, },
{ {
name: 'classifyList', name: 'classifyList',
path: '/zoneList/index', path: '/classifyList/index',
component: resolve => require([`@/views/classifyList/index.vue`], resolve), component: resolve => require([`@/views/classifyList/index.vue`], resolve),
meta: {} meta: {}
}, },
......
<!-- 编辑分类 --> <!-- 编辑分类 -->
<template> <template>
<div></div> <div class="edit-classify marketing">
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="selectProBtn" slot-scope="scope" class="select-pro">
<el-button type="primary" @click="handleMutiProClose(scope)">{{ editForm.goodsRefList.length ? '更换' : '请选择' }}</el-button>
</div>
<div slot="proTable" class="select-pro">
<GLTable v-show="editForm.goodsRefList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.goodsRefList">
<template slot="goodsImage" slot-scope="scope">
<img class="img-60" :src="scope.scope.goodsImage"/>
</template>
<span slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleProDelete(scope)">删除</el-button>
<el-button type="text" @click="handleProDelete(scope)">置顶</el-button>
</span>
</GLTable>
</div>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="default" @click="handleCancel">取消</el-button>
</div>
<select-muti-pro-dialog v-if="isMutiSelectVisible" :isMutiSelectVisible="isMutiSelectVisible" :searchForm="searchProForm" :selectedProList="selectedProList" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose">
<!-- <template slot="search">
<div class="flex">
<el-form :inline="true" :model="searchProForm">
<el-form-item label="商品名称:">
<el-input :size="size" v-model="searchProForm.name" placeholder="请输入商品名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="handleConfigSearch">查询</el-button>
<el-button :size="size" @click="handleConfigReset">重置</el-button>
</el-form-item>
</el-form>
</div>
</template> -->
</select-muti-pro-dialog>
</div>
</template> </template>
<script> <script>
...@@ -8,18 +47,154 @@ export default { ...@@ -8,18 +47,154 @@ export default {
name: 'editClassify', name: 'editClassify',
data() { data() {
return { return {
size: 'small',
title: '创建分类',
titleObj: {
1: '创建分类',
2: '编辑分类'
},
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
// 商品-多选
isMutiSelectVisible: false,
searchProForm: {},
selectedProList: [],
// getGoodsListApi: this.$apis.common.getGoodsListApi,
editForm: {
classifyName: '',
goodsRefList: [],
goodsIdList: []
},
editRule: {
classifyName: [{ required: true, message: '请输入分类名称', trigger: 'change' }]
},
editFormData: [
{
label: '分类名称',
name: 'classifyName',
width: '320px',
type: 'input',
maxlength: 20
},
{
label: '商品',
name: 'goodsIdList',
addHtml: 'selectProBtn'
},
{
// label: '门店',
name: '',
addHtml: 'proTable'
}
],
// 门店表格
tableParams: {
tableOption: true,
tableColumns: [
{
label: '缩略图',
prop: 'goodsImage',
addHtml: 'goodsImage'
},
{
label: '商品名称',
prop: 'productName'
},
{
label: '零售价',
prop: 'retailPrice'
}
]
},
} }
}, },
components: {}, mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
computed: {}, this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
mounted() {}, this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
},
methods: {} methods: {
getInfo() {
this.$apis.classifyList.getClassifyInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm.classifyName = res.classifyName
res.goodsRefList.forEach(item => {
this.editForm.goodsRefList.push({
id: item.goods.id,
productName: item.goods.goodsName,
retailPrice: (item.goods.retailPrice / 100).toFixed(2),
goodsImage: item.goods.goodsImage
})
})
})
},
handleMutiProClose(targetItem) {
// console.log(targetItem)
this.selectedProList = this.$common.utils.deepClone(this.editForm.goodsRefList)
this.handleMutiSelectClose()
},
handleMutiSelectConfirm(selectedData) {
this.editForm.goodsRefList = selectedData
this.handleMutiSelectClose()
},
handleMutiSelectClose() {
this.isMutiSelectVisible = !this.isMutiSelectVisible
},
handleProDelete(obj) {
this.$messageBox.confirm('是否删除该商品?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error',
callback: action => {
if (action == 'confirm') {
var idx = this.editForm.goodsRefList.findIndex(item => item.id == obj.scope.id)
this.editForm.goodsRefList.splice(idx, 1)
}
}
})
},
handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = {
classifyName: this.editForm.classifyName,
goodsIdList: this.editForm.goodsRefList.length ? this.editForm.goodsRefList.map(item => item.id) : []
}
if (this.routeInfo.addOrEdit == 2) {
params.id = this.routeInfo.id
}
// this.$apis.zoneList.insertZoneApi(params).then(res => {
// this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.handleCancel()
// }
// })
}
})
},
handleCancel() {
this.$router.push({
path: '/classifyList/index'
})
}
}
} }
</script> </script>
<style scoped> <style scoped>
.marketing.edit-classify .select-pro {
/* width: calc(98% - 140px); */
width: 98%;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!