|
|
@@ -645,6 +645,82 @@
|
|
|
</el-col>
|
|
|
<!-- 多规格设置-->
|
|
|
<el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24" v-if="manyFormValidate!=null&&manyFormValidate.length">
|
|
|
+ <!-- 批量设置功能 -->
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" size="small" @click="showBatchSet = true">批量设置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- 批量设置弹窗 -->
|
|
|
+ <el-dialog title="批量设置属性" :visible.sync="showBatchSet" width="800px" append-to-body>
|
|
|
+ <el-form :model="batchSetForm" label-width="100px">
|
|
|
+ <el-form-item label="选择规格">
|
|
|
+ <el-checkbox-group v-model="batchSetForm.selectedItems">
|
|
|
+ <el-checkbox
|
|
|
+ v-for="(item, index) in manyFormValidate"
|
|
|
+ :key="index"
|
|
|
+ :label="index"
|
|
|
+ :disabled="batchSetForm.selectAll"
|
|
|
+ >
|
|
|
+ {{ getSpecName(item) }}
|
|
|
+ </el-checkbox>
|
|
|
+ <el-checkbox v-model="batchSetForm.selectAll" @change="selectAllItems">全选</el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="售价">
|
|
|
+ <el-input v-model.number="batchSetForm.price" placeholder="请输入售价"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="代理价">
|
|
|
+ <el-input v-model.number="batchSetForm.agentPrice" placeholder="请输入代理价"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="成本价">
|
|
|
+ <el-input v-model.number="batchSetForm.cost" placeholder="请输入成本价"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="原价">
|
|
|
+ <el-input v-model.number="batchSetForm.otPrice" placeholder="请输入原价"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="库存">
|
|
|
+ <el-input v-model.number="batchSetForm.stock" placeholder="请输入库存"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="商品编号">
|
|
|
+ <el-input v-model="batchSetForm.barCode" placeholder="请输入商品编号"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="重量">
|
|
|
+ <el-input v-model.number="batchSetForm.weight" placeholder="请输入重量"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="体积">
|
|
|
+ <el-input v-model.number="batchSetForm.volume" placeholder="请输入体积"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="所需积分">
|
|
|
+ <el-input v-model.number="batchSetForm.integral" placeholder="请输入所需积分"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="一级返佣">
|
|
|
+ <el-input v-model.number="batchSetForm.brokerage" placeholder="请输入一级返佣"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="二级返佣">
|
|
|
+ <el-input v-model.number="batchSetForm.brokerageTwo" placeholder="请输入二级返佣"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="三级返佣">
|
|
|
+ <el-input v-model.number="batchSetForm.brokerageThree" placeholder="请输入三级返佣"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="showBatchSet = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="applyBatchSet">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
<!-- 多规格表格-->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="商品属性:" class="labeltop">
|
|
|
@@ -987,6 +1063,24 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+
|
|
|
+ showBatchSet: false,
|
|
|
+ batchSetForm: {
|
|
|
+ selectedItems: [],
|
|
|
+ selectAll: false,
|
|
|
+ price: '',
|
|
|
+ agentPrice: '',
|
|
|
+ cost: '',
|
|
|
+ otPrice: '',
|
|
|
+ stock: '',
|
|
|
+ barCode: '',
|
|
|
+ weight: '',
|
|
|
+ volume: '',
|
|
|
+ integral: '',
|
|
|
+ brokerage: '',
|
|
|
+ brokerageTwo: '',
|
|
|
+ brokerageThree: ''
|
|
|
+ },
|
|
|
isMedicalMall: this.$store.state.user.medicalMallConfig.medicalMall,
|
|
|
// isStores: this.$store.state.user.medicalMallConfig.stores,
|
|
|
isStores: true,
|
|
|
@@ -1248,6 +1342,102 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+ // 获取规格名称显示
|
|
|
+ getSpecName(item) {
|
|
|
+ let names = [];
|
|
|
+ for (let key in item) {
|
|
|
+ if (key.indexOf('value') !== -1 && item[key]) {
|
|
|
+ names.push(item[key]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return names.join(' - ');
|
|
|
+ },
|
|
|
+
|
|
|
+ // 全选/取消全选
|
|
|
+ selectAllItems(checked) {
|
|
|
+ if (checked) {
|
|
|
+ this.batchSetForm.selectedItems = this.manyFormValidate.map((item, index) => index);
|
|
|
+ } else {
|
|
|
+ this.batchSetForm.selectedItems = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 应用批量设置
|
|
|
+ applyBatchSet() {
|
|
|
+ if (this.batchSetForm.selectedItems.length === 0) {
|
|
|
+ this.$message.warning('请选择要设置的规格');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 批量设置选中项的所有字段值
|
|
|
+ this.batchSetForm.selectedItems.forEach(index => {
|
|
|
+ if (index < this.manyFormValidate.length) {
|
|
|
+ // 更新价格相关字段
|
|
|
+ if (this.batchSetForm.price !== '') {
|
|
|
+ this.manyFormValidate[index].price = parseFloat(this.batchSetForm.price) || 0;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.agentPrice !== '') {
|
|
|
+ this.manyFormValidate[index].agentPrice = parseFloat(this.batchSetForm.agentPrice) || 0;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.cost !== '') {
|
|
|
+ this.manyFormValidate[index].cost = parseFloat(this.batchSetForm.cost) || 0;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.otPrice !== '') {
|
|
|
+ this.manyFormValidate[index].otPrice = parseFloat(this.batchSetForm.otPrice) || 0;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.stock !== '') {
|
|
|
+ this.manyFormValidate[index].stock = parseInt(this.batchSetForm.stock) || 0;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.barCode !== '') {
|
|
|
+ this.manyFormValidate[index].barCode = this.batchSetForm.barCode;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.weight !== '') {
|
|
|
+ this.manyFormValidate[index].weight = parseFloat(this.batchSetForm.weight) || 0;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.volume !== '') {
|
|
|
+ this.manyFormValidate[index].volume = parseFloat(this.batchSetForm.volume) || 0;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.integral !== '') {
|
|
|
+ this.manyFormValidate[index].integral = parseInt(this.batchSetForm.integral) || 0;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.brokerage !== '') {
|
|
|
+ this.manyFormValidate[index].brokerage = parseFloat(this.batchSetForm.brokerage) || 0;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.brokerageTwo !== '') {
|
|
|
+ this.manyFormValidate[index].brokerageTwo = parseFloat(this.batchSetForm.brokerageTwo) || 0;
|
|
|
+ }
|
|
|
+ if (this.batchSetForm.brokerageThree !== '') {
|
|
|
+ this.manyFormValidate[index].brokerageThree = parseFloat(this.batchSetForm.brokerageThree) || 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.$message.success('批量设置成功');
|
|
|
+ this.showBatchSet = false;
|
|
|
+ this.resetBatchSetForm();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 重置批量设置表单
|
|
|
+ resetBatchSetForm() {
|
|
|
+ this.batchSetForm = {
|
|
|
+ selectedItems: [],
|
|
|
+ selectAll: false,
|
|
|
+ price: '',
|
|
|
+ agentPrice: '',
|
|
|
+ cost: '',
|
|
|
+ otPrice: '',
|
|
|
+ stock: '',
|
|
|
+ barCode: '',
|
|
|
+ weight: '',
|
|
|
+ volume: '',
|
|
|
+ integral: '',
|
|
|
+ brokerage: '',
|
|
|
+ brokerageTwo: '',
|
|
|
+ brokerageThree: ''
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
getAppMallOptions() {
|
|
|
getAppMallOptions({pageNum:1,pageSize:100}).then(response => {
|
|
|
this.appMallOptions = response.rows;
|