优化商品的多属性
This commit is contained in:
94
jshERP-web/src/views/material/modules/BatchSetPriceModal.vue
Normal file
94
jshERP-web/src/views/material/modules/BatchSetPriceModal.vue
Normal file
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<a-modal
|
||||
:title="title"
|
||||
:width="500"
|
||||
:visible="visible"
|
||||
:confirm-loading="confirmLoading"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭"
|
||||
wrapClassName="ant-modal-cust-warp"
|
||||
style="top:35%;height: 30%;overflow-y: hidden">
|
||||
<template slot="footer">
|
||||
<a-button key="back" v-if="isReadOnly" @click="handleCancel">
|
||||
关闭
|
||||
</a-button>
|
||||
</template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="请输入价格">
|
||||
<a-input placeholder="请输入价格" v-decorator.trim="[ 'price', validatorRules.price]" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'BatchSetPriceModal',
|
||||
data () {
|
||||
return {
|
||||
title:"批量设置",
|
||||
visible: false,
|
||||
isReadOnly: false,
|
||||
batchType: '',
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
validatorRules:{
|
||||
price:{
|
||||
rules: [
|
||||
{ required: true, message: '请输入价格!' }
|
||||
]}
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
methods: {
|
||||
add (type) {
|
||||
this.batchType = type
|
||||
if(type === 'purchase') {
|
||||
this.title = '采购价-批量设置'
|
||||
} else if(type === 'commodity') {
|
||||
this.title = '零售价-批量设置'
|
||||
} else if(type === 'wholesale') {
|
||||
this.title = '销售价-批量设置'
|
||||
} else if(type === 'low') {
|
||||
this.title = '最低售价-批量设置'
|
||||
}
|
||||
this.edit({});
|
||||
},
|
||||
edit (record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
let price = this.form.getFieldValue('price')
|
||||
this.$emit('ok', price, this.batchType);
|
||||
this.visible = false
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -149,7 +149,16 @@
|
||||
:maxHeight="300"
|
||||
:rowNumber="true"
|
||||
:rowSelection="true"
|
||||
:actionButton="true"/>
|
||||
:actionButton="true">
|
||||
<template #buttonAfter>
|
||||
<a-button @click="batchSet('purchase')">采购价-批量</a-button>
|
||||
<a-button style="margin-left: 8px" @click="batchSet('commodity')">零售价-批量</a-button>
|
||||
<a-button style="margin-left: 8px" @click="batchSet('wholesale')">销售价-批量</a-button>
|
||||
<a-button style="margin-left: 8px" @click="batchSet('low')">最低售价-批量</a-button>
|
||||
</template>
|
||||
</j-editable-table>
|
||||
<!-- 表单区域 -->
|
||||
<batch-set-price-modal ref="modalForm" @ok="batchSetPricemodalFormOk"></batch-set-price-modal>
|
||||
</div>
|
||||
<a-row class="form-row" :gutter="24">
|
||||
<a-col :lg="24" :md="24" :sm="24">
|
||||
@@ -217,6 +226,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import BatchSetPriceModal from './BatchSetPriceModal'
|
||||
import JEditableTable from '@/components/jeecg/JEditableTable'
|
||||
import { FormTypes, VALIDATE_NO_PASSED, getRefPromise, validateFormAndTables } from '@/utils/JEditableTableUtil'
|
||||
import {queryMaterialCategoryTreeList,checkMaterial,checkMaterialBarCode,getAllMaterialAttribute,getMaxBarCode} from '@/api/api'
|
||||
@@ -227,6 +237,7 @@
|
||||
export default {
|
||||
name: "MaterialModal",
|
||||
components: {
|
||||
BatchSetPriceModal,
|
||||
JImageUpload,
|
||||
JDate,
|
||||
JEditableTable
|
||||
@@ -678,6 +689,37 @@
|
||||
}
|
||||
return num
|
||||
},
|
||||
batchSet(type) {
|
||||
this.$refs.modalForm.add(type);
|
||||
this.$refs.modalForm.disableSubmit = false;
|
||||
},
|
||||
batchSetPricemodalFormOk(price, batchType) {
|
||||
console.log(price)
|
||||
console.log(batchType)
|
||||
let arr = this.meTable.dataSource
|
||||
debugger
|
||||
if(arr.length === 0) {
|
||||
this.$message.warning('请先录入条码、单位等信息!');
|
||||
} else {
|
||||
let meTableData = []
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
let meInfo = {barCode: arr[i].barCode, commodityUnit: arr[i].commodityUnit, sku: arr[i].sku,
|
||||
purchaseDecimal: arr[i].purchaseDecimal, commodityDecimal: arr[i].commodityDecimal,
|
||||
wholesaleDecimal: arr[i].wholesaleDecimal, lowDecimal: arr[i].lowDecimal}
|
||||
if(batchType === 'purchase') {
|
||||
meInfo.purchaseDecimal = price-0
|
||||
} else if(batchType === 'commodity') {
|
||||
meInfo.commodityDecimal = price-0
|
||||
} else if(batchType === 'wholesale') {
|
||||
meInfo.wholesaleDecimal = price-0
|
||||
} else if(batchType === 'low') {
|
||||
meInfo.lowDecimal = price-0
|
||||
}
|
||||
meTableData.push(meInfo)
|
||||
}
|
||||
this.meTable.dataSource = meTableData
|
||||
}
|
||||
},
|
||||
initMaterialAttribute() {
|
||||
getAllMaterialAttribute({}).then((res)=>{
|
||||
if(res && res.code===200) {
|
||||
|
||||
Reference in New Issue
Block a user