Commit 5e02edce by cwq0219

多选商品-跳转

1 parent c06c9057
<!-- 选择商品弹窗 -->
<template>
<glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose">
<GLTable v-loading="loading" ref="mutiProRef" :tableData="productList" :hasPage="false" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList">
<glsx-dialog
class="muti-pro"
title="选择商品"
:isVisible.sync="isMutiSelectVisible"
:btnOkLabel="productList.length ? '确定' : '创建商品'"
width="70%"
@confirmDialog="handleMutiSelectConfirm"
@closeDialog="handleMutiSelectClose"
v-loading="loading"
>
<div class="noproDiv" v-show="!productList.length && fnCallBack">
<img src="@/assets/noPro.png" />
<p class="noproP">系统暂无已创建的商品</p>
</div>
<div v-show="productList.length">
<slot name="search"></slot>
<GLTable
v-loading="loading"
ref="mutiProRef"
:tableData="productList"
:hasPage="false"
:noDataImg="url"
:tableParams="tableParams"
@refreshTable="getList"
>
<span slot="goodsImage" slot-scope="scope">
<img class="m-t-10 img-60" :src="scope.scope.goodsImage" />
</span>
</GLTable>
</div>
</glsx-dialog>
</template>
<script>
// import { getGoodsList } from '@/api/modules/common'
import url from "@/assets/empty.png"
import url from '@/assets/empty.png'
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'selectMutiProDialog',
......@@ -19,7 +43,9 @@ export default {
return {
// 表格组件
// getListApi: this.$apis.common.getGoodsListApi,
userInfo: {},
productList: [],
fnCallBack: false,
url: url,
loading: true,
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
......@@ -58,6 +84,10 @@ export default {
type: Boolean,
default: false
},
searchForm: {
type: Object,
default: () => {}
},
selectedProList: {
type: Array,
default: () => []
......@@ -68,23 +98,26 @@ export default {
glsxDialog
},
created() {
mounted() {
this.userInfo = this.$globalState.session
this.getList(true)
},
methods: {
getList(isMounted = false) {
getList(isReset = false) {
var params = {
...this.searchForm,
goodsStatus: 1,
goodsSource: 1,
pageNum: isMounted ? 1 : this.$refs.mutiProRef.page.pageNum,
pageSize: isMounted ? 10 : this.$refs.mutiProRef.page.pageSize
pageNum: isReset ? 1 : this.$refs.mutiProRef.page.pageNum,
pageSize: isReset ? 10 : this.$refs.mutiProRef.page.pageSize
}
var that = this
this.loading = true
this.$apis.common.getGoodsListApi(params).then(res => {
this.productList = res
this.loading = false
this.fnCallBack = true
// this.$refs.mutiProRef.tableTotal = res.total
this.productList.forEach(function(item) {
item.saleAmount = item.goodsStatistics.saleAmount
......@@ -123,8 +156,19 @@ export default {
}
},
handleMutiSelectConfirm() {
if (!this.productList.length) {
var params = {
addOrEdit: 1,
groupOrStore: this.userInfo.accountLevel == 4 ? 2 : 1,
$title: '新建商品'
}
this.$router.push({
path: '/productGroup/editProduct',
query: params
})
return true
}
var selectedData = this.$refs.mutiProRef.mutiSelectArr[this.tableParams.mutiSelectName]
// console.log(selectedData)
this.$emit('handleMutiSelectConfirm', selectedData)
},
handleMutiSelectClose() {
......@@ -137,4 +181,14 @@ export default {
.muti-pro .m-t-10 {
margin-top: 10px;
}
.muti-pro .noproP {
width: 100%;
height: 20px;
font-family: PingFangSC-Medium;
font-size: 16px;
color: #666666;
line-height: 20px;
font-weight: 500;
text-align: center;
}
</style>
<!-- 选择商品弹窗 -->
<template>
<glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose" :noClose="false" :noCancel="true" :showClose="true">
<glsx-dialog
class="muti-pro"
title="选择商品"
:isVisible.sync="isMutiSelectVisible"
:btnOkLabel="productList.length ? '确定' : '创建商品'"
width="70%"
@confirmDialog="handleMutiSelectConfirm"
@closeDialog="handleMutiSelectClose"
:noClose="false"
:noCancel="true"
:showClose="true"
>
<div style="max-height:60vh">
<div class="noproDiv" v-if="!productList.length && fnCallBack">
<img src="@/assets/noPro.png" />
......@@ -9,14 +20,26 @@
<div v-if="productList.length">
<el-form :inline="true" :model="searchProForm">
<el-form-item label="商品名称:">
<el-input :size="size" v-model="searchProForm.name" placeholder="请输入商品名称" maxlength="20" clearable></el-input>
<el-input
:size="size"
v-model="searchProForm.name"
placeholder="请输入商品名称"
maxlength="20"
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>
<GLTable ref="mutiProRef" :tableData="productList" :hasPage="false" :tableParams="tableParams" @refreshTable="getList">
<GLTable
ref="mutiProRef"
:tableData="productList"
:hasPage="false"
:tableParams="tableParams"
@refreshTable="getList"
>
<span slot="goodsImage" slot-scope="scope">
<img class="m-t-10 img-60" :src="scope.scope.goodsImage" />
</span>
......@@ -36,6 +59,7 @@ export default {
// 表格组件
// getListApi: this.$apis.common.getGoodsListApi,
productList: [],
userInfo: {},
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchProForm: {
name: ''
......@@ -87,6 +111,7 @@ export default {
},
mounted() {
this.userInfo = this.$globalState.session
this.getList(true)
},
......@@ -147,12 +172,24 @@ export default {
}
},
handleMutiSelectConfirm() {
if(!this.productList.length) {
var params = {
addOrEdit: 1,
groupOrStore: this.userInfo.accountLevel == 4 ? 2 : 1,
$title: '新建商品'
}
this.$router.push({
path: '/productGroup/editProduct',
query: params
})
return true
}
var selectedData = this.$refs.mutiProRef.mutiSelectArr[this.tableParams.mutiSelectName]
// console.log(selectedData)
if (!selectedData) {
this.$message({
message: '未选择商品',
type: 'error'
type: 'error',
customClass: 'message-Z-zinde'
})
return
}
......
......@@ -24,7 +24,7 @@
<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">
<select-muti-pro-dialog ref="classMutiProRef" 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">
......@@ -150,8 +150,16 @@ export default {
})
})
},
handleConfigSearch() {
this.$refs.classMutiProRef.getList()
},
handleConfigReset() {
this.searchProForm = {
name: ''
}
this.handleConfigSearch()
},
handleMutiProClose(targetItem) {
// console.log(targetItem)
this.selectedProList = this.$common.utils.deepClone(this.editForm.goodsRefList)
this.handleMutiSelectClose()
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!