Commit 41a366c8 by LJM

bug

parent 22acec72
Showing with 119 additions and 10 deletions
......@@ -121,6 +121,7 @@
<el-dropdown-item command="1">修改库存</el-dropdown-item>
<el-dropdown-item command="2">修改交期</el-dropdown-item>
<el-dropdown-item command="3">上架有效期</el-dropdown-item>
<el-dropdown-item command="4">修改价格</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
......@@ -252,7 +253,6 @@
</el-input>
</template>
</el-table-column>
</el-table>
</div>
<span slot="footer" class="dialog-footer">
......@@ -314,6 +314,40 @@
<el-button type="primary" @click="submitCp">确 定</el-button>
</span>
</el-dialog>
<!--修改价格-->
<el-dialog title="修改价格" :visible.sync="dialogVisible4" width="900px">
<div class="kc-mask">
<el-table :data="priceData" border max-height="600" style="margin-bottom: 10px">
<el-table-column prop="goods_name" label="型号" min-width="20%" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="brand_name" label="品牌" min-width="20%" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="stock" label="库存" min-width="20%" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="moq" label="起订量" min-width="20%" :show-overflow-tooltip="true"></el-table-column>
</el-table>
<el-table :data="skuOriginalStepPriceData" border max-height="600">
<el-table-column type="index" label="阶梯" width="50" align="center"></el-table-column>
<el-table-column prop="purchases" label="起订量" min-width="20%" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="skuOriginalStepPriceData[scope.$index].purchases" @input="handleInput(scope.$index)" placeholder="起订量" onkeyup="if(event.keyCode !=37 &amp;&amp; event.keyCode != 39){if (!/^[\d]+$/ig.test(this.value)){this.value='';}}"></el-input>
</template>
</el-table-column>
<el-table-column prop="price_cn" label="含税成本价(RMB)" min-width="20%" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="skuOriginalStepPriceData[scope.$index].price_cn" placeholder="¥"></el-input>
</template>
</el-table-column>
<el-table-column prop="price_us" label="美金成本价(USD)" min-width="20%" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="skuOriginalStepPriceData[scope.$index].price_us" placeholder="$"></el-input>
</template>
</el-table-column>
</el-table>
<i class="el-icon-plus add" @click="addRow" style="color: #409EFF;cursor: pointer;margin-top: 20px;">增加阶梯价</i>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible4 = false">取 消</el-button>
<el-button type="primary" @click="updateSkuOriginalStepPrice">确 定</el-button>
</span>
</el-dialog>
</div>
<Menu/>
</div>
......@@ -336,6 +370,7 @@ export default {
dialogVisible: false,//库存弹窗
dialogVisible2: false,//交期弹窗
dialogVisible3: false,//上架有效期
dialogVisible4: false,//修改价格
downHref: "",
cp_time_val: '',
formParam: {
......@@ -350,6 +385,10 @@ export default {
huoqidata: [],//修改交期数据
kucundata: [],//修改库存数据
cpdata: [],//上架有效期数据
priceData: [],//修改价格数据
skuOriginalStepPriceData: [],
goods_id: '',
stock: 0,
tableData: [],
brandList: [],
disabled: false,
......@@ -371,6 +410,16 @@ export default {
},
methods: {
/**
* 监听起订量
*/
handleInput(index) {
var val = Number(this.skuOriginalStepPriceData[index].purchases) || 0;
var max = Number(this.stock) || 0;
if (val > max) {
this.$set(this.skuOriginalStepPriceData[index], 'purchases', max);
}
},
/**
* 获取数据
*/
getData() {
......@@ -538,23 +587,21 @@ export default {
handleSelectionChange(val) {
this.multipleSelection = val;
},
disabledDate(date) {
var maxDate = new Date(); // 设置最大日期
var minDate = new Date(); // 设置最小日期
var cp_time_day = localStorage.getItem('cp_time_day');
if( cp_time_day == -1 ){
if (cp_time_day == -1) {
// “无限制”,则修改上架有效期默认为:2035-01-01
var maxDate = new Date('2035-01-01');
}else{
} else {
var maxDate = new Date(new Date().getTime() + cp_time_day * 24 * 60 * 60 * 1000);
}
return date > maxDate || date < minDate; // 返回 true 禁用日期,返回 false 启用日期
},
/**
*
* @param date 时间类型
......@@ -565,10 +612,10 @@ export default {
if (type) {
var cp_time_day = localStorage.getItem('cp_time_day');
if( cp_time_day == -1 ){
if (cp_time_day == -1) {
// “无限制”,则修改上架有效期默认为:2035-01-01
var date = new Date('2035-01-01');
}else{
} else {
var date = new Date(new Date().getTime() + cp_time_day * 24 * 60 * 60 * 1000);
}
......@@ -628,7 +675,7 @@ export default {
//修改货期弹窗
this.dialogVisible2 = true;
this.huoqidata = this.selectData;
} else {
} else if (command == 3) {
//修改上架有效期
this.dialogVisible3 = true;
let currentTime = new Date().getTime();//当前日期毫秒
......@@ -645,7 +692,69 @@ export default {
}
}
this.cpdata = this.selectData;
} else if (command == 4) {
//修改价格
this.dialogVisible4 = true;
this.priceData = this.selectData;
this.getSkuOriginalStepPrice(this.selectData[0].goods_id);
this.stock = this.selectData[0].stock;
}
},
/**
* 增加阶梯价
*/
addRow() {
if (this.skuOriginalStepPriceData.length >= 9) {
this.$message({
message: '已超过阶梯限制',
type: 'warning'
});
return false;
}
this.skuOriginalStepPriceData.push({
cost_price: '',
price_cn: '',
price_us: '',
purchases: ''
})
},
/**
* 修改阶梯价格
*/
updateSkuOriginalStepPrice() {
this.$http('GET', "/api/sku/updateSkuOriginalStepPrice", {goods_id: this.goods_id, original_price: JSON.stringify(this.skuOriginalStepPriceData)}).then(res => {
if (res.code == 0) {
this.$message({
message: '操作成功',
type: 'success'
});
setTimeout(() => {
this.dialogVisible4 = false;
this.getData();
}, 2000)
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 获取sku阶梯价格
*/
getSkuOriginalStepPrice(goods_id) {
this.$http('GET', "/api/sku/getSkuOriginalStepPrice", {goods_id: '1168188546694196678'}).then(res => {
if (res.code == 0) {
this.skuOriginalStepPriceData = res.data.data;
this.goods_id = goods_id;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 修改上架有效期
......
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 sign in to comment