|
@@ -2,7 +2,7 @@
|
|
|
<div>
|
|
|
<el-button type="primary" size="small" @click="drawer=true">新 建</el-button>
|
|
|
<el-drawer title="创建商品组" :visible.sync="drawer" size="80%" direction="rtl" append-to-body @close="onCancel" :show-close="false">
|
|
|
- <div class="drawer__panel">
|
|
|
+ <div class="drawer__panel" style="margin-bottom: 0!important;">
|
|
|
<el-row :gutter="20">
|
|
|
<el-form :model="form" :rules="rules" ref="form" size="small" label-position="right" label-width="100px">
|
|
|
<el-col :span="6">
|
|
@@ -34,16 +34,85 @@
|
|
|
<el-col :span="24">
|
|
|
<p class="normal-title normal-margin">
|
|
|
添加产品
|
|
|
- <el-button v-if="col === 0" type="text" size="mini" @click="col = 12">选择商品</el-button>
|
|
|
+ <el-button v-if="col === 0" type="text" size="mini" @click="productData(col=12)">选择商品</el-button>
|
|
|
<el-button v-else type="text" size="mini" @click="col = 0">关闭选择</el-button>
|
|
|
</p>
|
|
|
|
|
|
</el-col>
|
|
|
<el-col :span="24 - col">
|
|
|
- <Table type="add" :data="tableData" ref="submitProduct" @onSuccess="onSuccess" @deleteProduct="deleteProduct"></Table>
|
|
|
+ <tableNewLayout :layout="tablecols" :data="tableData" :opwidth="200" height="calc(100vh - 300px)" :width="true" :custom="true" >
|
|
|
+ <template v-slot:customcol="scope">
|
|
|
+ <div v-if="scope.column.columnname === 'itemclass'">
|
|
|
+ <span v-for="(item,index) in scope.column.data.itemclass" :key="index">
|
|
|
+ {{item?item.itemclassname+',':'--'}}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="scope.column.columnname === 'isonsale'">
|
|
|
+ <span >
|
|
|
+ {{scope.column.data == 1?'上架':'下架'}}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="scope.column.columnname === 'marketprice'">
|
|
|
+ {{scope.column.data[[scope.column.columnname]]?tool.formatAmount(scope.column.data[[scope.column.columnname]],2):scope.column.data[[scope.column.columnname]] == 0?'0.00':'--'}}
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ {{scope.column.data[[scope.column.columnname]] || scope.column.columnname === 'operation'?scope.column.data[[scope.column.columnname]]:'--'}}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-slot:opreation="scope">
|
|
|
+ <el-popconfirm
|
|
|
+ title="确定删除吗?"
|
|
|
+ @confirm="deleteProduct(scope.data)">
|
|
|
+ <el-button slot="reference" type="text" size="mini">删 除</el-button>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ </tableNewLayout>
|
|
|
</el-col>
|
|
|
<el-col :span="col">
|
|
|
- <selectTable :all="true" @addProduct="addProduct"></selectTable>
|
|
|
+<!-- <selectTable :all="true" @addProduct="addProduct"></selectTable>-->
|
|
|
+ <tableNewLayout :layout="tablecolsAdd" :data="productList" :opwidth="200" height="calc(100vh - 300px)" :width="true" :custom="true" fixedName="operation">
|
|
|
+ <template v-slot:customcol="scope">
|
|
|
+ <div v-if="scope.column.columnname === 'itemclass'">
|
|
|
+ <span v-for="(item,index) in scope.column.data.itemclass" :key="index">
|
|
|
+ {{item?item.itemclassname+',':'--'}}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="scope.column.columnname === 'brand'">
|
|
|
+ <p v-for="(item,index) in scope.column.data.brand" :key="index">
|
|
|
+ <span style="float: left" v-if="index === scope.column.data.brand.length -1">{{item?item.brandname+'':'--'}}</span>
|
|
|
+ <span style="float: left" v-else>{{item?item.brandname+',':'--'}}</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="scope.column.columnname === 'unitid'">
|
|
|
+ <el-tag size="mini" type="info" effect="plain">{{scope.column.data.unitname}}/{{scope.column.data.axunitname}}</el-tag>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="scope.column.columnname === 'marketprice'">
|
|
|
+ {{scope.column.data[[scope.column.columnname]]?tool.formatAmount(scope.column.data[[scope.column.columnname]],2):scope.column.data[[scope.column.columnname]] == 0?'0.00':'--'}}
|
|
|
+ </div>
|
|
|
+ <div v-else-if="scope.column.columnname === 'attinfos'">
|
|
|
+ <div v-if="scope.column.data.attinfos[0]">
|
|
|
+ <previewImage style="height:38px;width:38px" :image="scope.column.data.attinfos[0]" :list="scope.column.data.attinfos" :deletebtn="false"></previewImage>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ {{scope.column.data[[scope.column.columnname]] || scope.column.columnname === 'operation'?scope.column.data[[scope.column.columnname]]:'--'}}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-slot:opreation="scope">
|
|
|
+ <el-button type="text" size="small" @click="addProduct(scope.data)">添 加</el-button>
|
|
|
+ </template>
|
|
|
+ </tableNewLayout>
|
|
|
+ <div style="margin-top:16px;float:right">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-size="params.content.pageSize"
|
|
|
+ layout="total,sizes, prev, pager, next, jumper"
|
|
|
+ :total="total">
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
</el-col>
|
|
|
</el-form>
|
|
|
</el-row>
|
|
@@ -70,6 +139,8 @@ export default {
|
|
|
drawer:false,
|
|
|
col:0,
|
|
|
tableData:[],
|
|
|
+ tablecols:[],
|
|
|
+ tablecolsAdd:[],
|
|
|
index:0,
|
|
|
form: {
|
|
|
sa_brandid: '',
|
|
@@ -94,11 +165,30 @@ export default {
|
|
|
sequence: [
|
|
|
{ required: false, message: '请输入序号', trigger: 'blur' },
|
|
|
],
|
|
|
- }
|
|
|
+ },
|
|
|
+ params:{
|
|
|
+ "id": 20220923112503,
|
|
|
+ "content": {
|
|
|
+ "nocache":true,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "sa_itemgroupid":0,
|
|
|
+ "where": {
|
|
|
+ "condition": '',
|
|
|
+ "type": this.all ? '1' : '' //未上架商品也拉取
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ tableSelectData:[],
|
|
|
+ productList: [],
|
|
|
+ total:0,
|
|
|
+ currentPage:0
|
|
|
}
|
|
|
},
|
|
|
inject:['brandList'],
|
|
|
created () {
|
|
|
+ this.tablecols = this.tool.tabelCol(this.$route.name).productListTable.tablecols
|
|
|
+ this.tablecolsAdd = this.tool.tabelCol(this.$route.name).productAddTable.tablecols
|
|
|
},
|
|
|
computed:{
|
|
|
...mapGetters({
|
|
@@ -108,6 +198,7 @@ export default {
|
|
|
methods: {
|
|
|
onCancel(){
|
|
|
this.drawer = false
|
|
|
+ this.col = 0
|
|
|
this.form={
|
|
|
sa_brandid: '',
|
|
|
groupname: '',
|
|
@@ -115,10 +206,28 @@ export default {
|
|
|
itemid:'0',
|
|
|
itemname:'',
|
|
|
tag: []
|
|
|
- },
|
|
|
+ }
|
|
|
this.tableData = []
|
|
|
},
|
|
|
+ async productData(){
|
|
|
+ this.params.content.where.type = true
|
|
|
+ const res = await this.$api.requested(this.params)
|
|
|
+ this.productList = res.data
|
|
|
+ this.total = res.total
|
|
|
+ this.currentPage = res.pageNumber
|
|
|
+ },
|
|
|
+ handleSizeChange(val) {
|
|
|
+ // console.log(`每页 ${val} 条`);
|
|
|
+ this.params.content.pageSize = val
|
|
|
+ this.productData()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ // console.log(`当前页: ${val}`);
|
|
|
+ this.params.content.pageNumber = val
|
|
|
+ this.productData()
|
|
|
+ },
|
|
|
addProduct (row) {
|
|
|
+ this.productList.splice(this.productList.findIndex(item => item.itemid == row.itemid),1)
|
|
|
this.index ++
|
|
|
row.sequence = this.index
|
|
|
this.tableData.push(row)
|
|
@@ -147,17 +256,37 @@ export default {
|
|
|
"id": "20220922164303",
|
|
|
"content": this.form
|
|
|
})
|
|
|
- this.tool.showMessage(res,()=>{
|
|
|
+ this.tool.showMessage(res,async()=>{
|
|
|
this.$store.commit('setLoading',false)
|
|
|
this.groupdata = res.data
|
|
|
this.index = 0
|
|
|
- this.$refs['submitProduct'].submitProduct(res.data.sa_itemgroupid)
|
|
|
+ this.col = 0
|
|
|
+ // this.$refs['submitProduct'].submitProduct(res.data.sa_itemgroupid)
|
|
|
+ this.submitProduct(res.data.sa_itemgroupid)
|
|
|
this.$store.dispatch('changeDetailDrawer',true)
|
|
|
this.$router.push({path:'/productGroupDetail',query:{id:res.data.sa_itemgroupid,rowindex:res.data.rowindex}})
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ },
|
|
|
+ async submitProduct (id) {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20220923110303",
|
|
|
+ "content": {
|
|
|
+ "sa_itemgroupid":id,
|
|
|
+ "itemclassinfos":this.tableData.map(e=>{
|
|
|
+ return {
|
|
|
+ "sa_itemgroupmxid":0,
|
|
|
+ "itemno":e.itemno,
|
|
|
+ "itemid":e.itemid,
|
|
|
+ "sequence":e.sequence
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ res.code === 1?this.onSuccess():this.tool.showMessage(res)
|
|
|
+
|
|
|
},
|
|
|
productChange (data) {
|
|
|
this.form.itemno = data.itemno
|
|
@@ -180,8 +309,12 @@ export default {
|
|
|
this.$emit('onSuccess')
|
|
|
this.drawer = false
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ onInput ($event,data) {
|
|
|
+ this.$forceUpdate()
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
}
|
|
|
|
|
|
</script>
|