Commit ef815c02 authored by 黄奎's avatar 黄奎

页面修改

parent f43559bc
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
color: #F56C6C; color: #F56C6C;
margin-right: 2px; margin-right: 2px;
} }
.app-attr .priceComTable { .app-attr .priceComTable {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
...@@ -57,7 +58,6 @@ ...@@ -57,7 +58,6 @@
transition: background-color .25s ease; transition: background-color .25s ease;
} }
</style> </style>
<template> <template>
<div class="app-attr"> <div class="app-attr">
...@@ -67,10 +67,11 @@ ...@@ -67,10 +67,11 @@
style="position:absolute">全选 style="position:absolute">全选
</el-checkbox> </el-checkbox>
<el-form-item label="批量设置" size="small" style="margin-bottom:0;padding:18px 0;display:inline-block;"> <el-form-item label="批量设置" size="small" style="margin-bottom:0;padding:18px 0;display:inline-block;">
<el-input @keyup.enter.native="batchAttr(selectData)" size="small" :type="selectData == 'no' ? 'text' : 'number'" <el-input @keyup.enter.native="batchAttr(selectData)" size="small"
v-model="batch"> :type="selectData == 'no' ? 'text' : 'number'" v-model="batch">
<el-select v-model="selectData" slot="prepend"> <el-select v-model="selectData" slot="prepend">
<el-option v-for="(item, index) in cList" :value="index" :key="item" v-if="index!='pic_url'" :label="item"> <el-option v-for="(item, index) in cList" :value="index" :key="item" v-if="index!='pic_url'"
:label="item">
{{item}} {{item}}
</el-option> </el-option>
</el-select> </el-select>
...@@ -83,55 +84,16 @@ ...@@ -83,55 +84,16 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<!-- <el-table ref="multipleTable" :data="cData" border stripe style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column v-for="(item, index) in attrGroups" :key="item.id" :prop="'attr_list['+index+'].attr_name'"
:label="item.attr_group_name">
</el-table-column>
<el-table-column v-if="cList" v-for="(item, key, index) in cList" :key="item.id" :property="key"
:label="item + (append ? '(' + append + ')' : '')">
<template slot="header" v-if="requiredArray.indexOf(key) !== -1">
<div class="header-require">{{item}}</div>
</template>
<template slot-scope="scope">
<template v-if="!isLevel">
<div flex="box:first" v-if="scope.column.property == 'pic_url'" style="padding: 10px;">
<div flex="cross:center" style="margin-right: 10px;position: relative;">
<app-attachment :multiple="false" :params="scope.row" :max="1"
v-model="scope.row[scope.column.property]">
<app-gallery :url="scope.row[scope.column.property]" width="50px" height="50px"></app-gallery>
</app-attachment>
<el-button v-if="scope.row[scope.column.property]"
style="position: absolute; right: -8px; top: -8px; padding: 4px 4px;" size="mini" type="danger"
icon="el-icon-close" circle @click="scope.row[scope.column.property] = ''"></el-button>
</div>
</div>
<el-input v-else-if="scope.column.property == 'no'" v-model="scope.row[scope.column.property]"></el-input>
<el-input v-else-if="scope.column.property == 'stock'"
oninput="this.value = this.value.replace(/[^0-9]/g, '');" v-model="scope.row[scope.column.property]">
</el-input>
<el-input v-else-if="scope.column.property.indexOf('price') > -1 || scope.column.property.indexOf('level')"
type="number" v-model="scope.row[scope.column.property]"></el-input>
<el-input v-else oninput="this.value = this.value.replace(/[^0-9]/g, '');"
v-model="scope.row[scope.column.property]">
<template v-if="append" slot="append">{{append}}</template>
</el-input>
</template>
<template v-else>
<el-input :data-id="scope.row[scope.column.label]" type="number"
v-model="scope.row[paramKey][scope.column.property]">
</el-input>
</template>
</template>
</el-table-column>
</el-table> -->
<table class="priceComTable"> <table class="priceComTable">
<thead>
<tr> <tr>
<td style="width:55px;"> <td style="width:55px;">
<el-checkbox></el-checkbox> <el-checkbox></el-checkbox>
</td> </td>
<td>型号-HD03</td> <template v-for="headerItem in attrGroups">
<td>{{headerItem.Name}}</td>
</template>
<td> <td>
<div class="header-require">拼团价</div> <div class="header-require">拼团价</div>
</td> </td>
...@@ -139,143 +101,54 @@ ...@@ -139,143 +101,54 @@
<div class="header-require">拼团库存</div> <div class="header-require">拼团库存</div>
</td> </td>
</tr> </tr>
</thead>
<tbody>
<tr v-for="item in pinTuanPriceList">
<td>
<el-checkbox></el-checkbox>
</td>
<template v-for="(attrItem, attrIndex) in attrGroups">
<td v-if="attrIndex == index2" v-for="(item2, index2) in item.AttrList" :key="index2+'6'">
{{ item.AttrList[index2].SVName }}
</td>
</template>
<td>
<el-input v-model="item.PintuanPrice" />
</td>
<td>
<el-input v-model="item.PintuanStock" />
</td>
</tr>
</tbody>
</table> </table>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
props: { props: ["pinTuanPriceList", "attrGroups"],
value: Array, // 商品规格信息
attrGroups: Array, // 商品规格组
extra: Object, // 额外的数据信息
list: Object | Array, // 从排列数据信息
isLevel: Boolean, // 是否是会员
members: Array, // 会员等级列表
share: Array, // 分销等级列表
append: String, // 输入框后缀
requiredExtra: {
type: Array,
default () {
return []
}
},
paramKey: {
type: String,
default () {
return 'member_price';
}
}
},
data() { data() {
return { return {
requiredArray: [`price`, `stock`].concat(this.requiredExtra),
attrBatch: false,
data: {
price: '价格',
stock: '库存',
weight: '重量(克)',
no: '货号',
//pic_url: '规格图片',
},
selectData: '',
batch: 0,
selectList: [],
}; };
}, },
created() { created() {
}, },
watch: { watch: {
'selectList': function () {
const self = this;
let sign = 0;
this.value.forEach(function (item, index) {
self.selectList.map((item1) => {
if (JSON.stringify(item1.attr_list) === JSON.stringify(item.attr_list)) {
sign++;
}
});
});
self.attrBatch = self.value.length === sign;
}
}, },
methods: { methods: {
//全选 getItemName()
selectClick() { {
this.$refs.multipleTable.toggleAllSelection();
},
handleSelectionChange(data) {
this.selectList = data;
},
batchAttr(param) {
if (!param) {
this.$message.warning('请选择批量设置');
return;
}
if (!this.selectList || this.selectList.length === 0) {
this.$message.warning('请勾选商品规格');
return;
}
let self = this;
let batch = self.batch;
this.value.forEach((item, index) => {
let sign = false;
self.selectList.map((item1) => {
if (JSON.stringify(item1.attr_list) === JSON.stringify(item.attr_list)) {
sign = true;
}
});
if (sign) {
// 批量设置会员价
// 判断字符串是否出现过,并返回位置
if (param.indexOf('level') !== -1) {
item[this.paramKey][param] = batch;
} else {
item[param] = batch;
}
}
});
} }
}, },
mounted() { mounted() {
}, },
computed: { computed: {
cList() {
// TODO 分销数据暂时
if (this.share) {
let share = JSON.parse(JSON.stringify(this.share));
let obj = {};
for (let i = 0; i < share.length; i++) {
obj[share[i].value] = share[i].label;
}
return obj;
}
// TODO 会员数据暂时
if (this.isLevel) {
let members = JSON.parse(JSON.stringify(this.members));
let obj = {};
for (let i = 0; i < members.length; i++) {
obj['level' + members[i].level] = members[i].name
}
return obj;
} else {
if (this.extra) {
return Object.assign(this.data, JSON.parse(JSON.stringify(this.extra)));
} else if (this.list) {
return JSON.parse(JSON.stringify(this.list))
} else {
return this.data;
}
}
},
cData() {
if (this.attrGroups && this.attrGroups.length > 0 && this.attrGroups[0].attr_list.length === 0) {
return [];
} else {
return this.value;
}
}
}, },
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment