Commit e7910581 by LJM

修改价格并记录

parent 41a366c8
Showing with 133 additions and 10 deletions
......@@ -39,5 +39,14 @@ export default {
var cval = this.getCookie(name);
if (cval != null)
document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}
},
/**
*
* @param arr
*/
isPurchasesValid : function (arr) {
return arr.every((item, index, array) =>
index === 0 ? true : item.purchases > array[index - 1].purchases
);
},
}
......@@ -234,11 +234,16 @@
</el-table-column>
<el-table-column prop="cp_time" label="上架有效期" width="150" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="update_time" label="更新时间" width="150" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column fixed="right" label="操作" width="110" align="center">
<template slot-scope="scope">
<el-button @click="handleClick(scope.row)" type="primary" size="mini" class="yunyin-btn">查看日志</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100, 200]" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"></el-pagination>
</div>
<!--修改库存弹窗-->
<el-dialog title="修改库存" :visible.sync="dialogVisible" width="900px">
<el-dialog title="修改库存" :close-on-click-modal="false" :visible.sync="dialogVisible" width="900px">
<div class="kc-mask">
<el-table :data="kucundata" border max-height="600">
<el-table-column prop="goods_name" label="型号" min-width="25%">
......@@ -261,7 +266,7 @@
</span>
</el-dialog>
<!--修改交期弹窗-->
<el-dialog title="修改交期" :visible.sync="dialogVisible2" width="900px">
<el-dialog title="修改交期" :close-on-click-modal="false" :visible.sync="dialogVisible2" width="900px">
<div class="kc-mask">
<el-table :data="huoqidata" border max-height="600">
<el-table-column prop="goods_name" label="型号" min-width="20%"></el-table-column>
......@@ -290,7 +295,7 @@
</span>
</el-dialog>
<!--修改上架有效期弹窗-->
<el-dialog title="修改上架有效期" :visible.sync="dialogVisible3" width="900px">
<el-dialog title="修改上架有效期" :close-on-click-modal="false" :visible.sync="dialogVisible3" width="900px">
<div class="kc-mask">
<el-table :data="cpdata" border max-height="600">
<el-table-column prop="goods_name" label="型号" min-width="20%" :show-overflow-tooltip="true"></el-table-column>
......@@ -315,17 +320,20 @@
</span>
</el-dialog>
<!--修改价格-->
<el-dialog title="修改价格" :visible.sync="dialogVisible4" width="900px">
<el-dialog title="修改价格" :close-on-click-modal="false" :visible.sync="dialogVisible4" width="900px">
<div class="kc-mask">
<el-table :data="priceData" border max-height="600" style="margin-bottom: 10px">
<el-table-column label="商品信息" width="100%">
<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-column>
</el-table>
<el-table :data="skuOriginalStepPriceData" border max-height="600">
<el-table-column label="阶梯价格" width="100%">
<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">
<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>
......@@ -340,6 +348,14 @@
<el-input v-model="skuOriginalStepPriceData[scope.$index].price_us" placeholder="$"></el-input>
</template>
</el-table-column>
<el-table-column label="操作" width="80" align="center">
<template slot-scope="scope">
<template v-if="scope.$index > 0">
<el-button type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</template>
</el-table-column>
</el-table-column>
</el-table>
<i class="el-icon-plus add" @click="addRow" style="color: #409EFF;cursor: pointer;margin-top: 20px;">增加阶梯价</i>
</div>
......@@ -348,6 +364,43 @@
<el-button type="primary" @click="updateSkuOriginalStepPrice">确 定</el-button>
</span>
</el-dialog>
<!--弹窗日志-->
<el-dialog title="现货库存管理日志" :close-on-click-modal="false" :visible.sync="dialogVisibleLog" width="1000px">
<el-table :data="logs" border max-height="600">
<el-table-column prop="create_time" label="时间" min-width="150" align="center"></el-table-column>
<el-table-column prop="message" label="操作说明" min-width="150" align="center">
<template slot-scope="scope">
<span>修改了价格,点击查看 <a style="color: #409EFF" href="javascript:;" @click="handleDetailClick(scope.row.message.pre_data,scope.row.message.current_data)">修改详情</a></span>
</template>
</el-table-column>
<el-table-column prop="operator" label="操作人" min-width="150" align="center"></el-table-column>
</el-table>
</el-dialog>
<!--弹窗日志详情-->
<el-dialog title="修改详情" :close-on-click-modal="false" :visible.sync="dialogVisibleLogDetail" width="1000px">
<div class="row verCenter bothSide">
<div style="width:470px">
<el-table :data="message.pre_data" border max-height="600">
<el-table-column label="修改前" width="100%">
<el-table-column label="阶梯" type="index" align="center" width="50"></el-table-column>
<el-table-column prop="purchases" label="起订量" align="center"></el-table-column>
<el-table-column prop="price_cn" label="含税成本价(RMB)" align="center"></el-table-column>
<el-table-column prop="price_us" label="美金成本价(USD)" align="center"></el-table-column>
</el-table-column>
</el-table>
</div>
<div style="width:470px">
<el-table :data="message.current_data" border max-height="600">
<el-table-column label="修改后" width="100%">
<el-table-column label="阶梯" type="index" align="center" width="50"></el-table-column>
<el-table-column prop="purchases" label="起订量" align="center"></el-table-column>
<el-table-column prop="price_cn" label="含税成本价(RMB)" align="center"></el-table-column>
<el-table-column prop="price_us" label="美金成本价(USD)" align="center"></el-table-column>
</el-table-column>
</el-table>
</div>
</div>
</el-dialog>
</div>
<Menu/>
</div>
......@@ -355,10 +408,11 @@
<script>
import Vue from 'vue';
import Menu from "@/components/menu.vue";
import {Autocomplete, Button, DatePicker, Dialog, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Message, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip} from 'element-ui'
import {Autocomplete, Button, DatePicker, Dialog, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip} from 'element-ui'
import Util from "../../tool";
Vue.prototype.$message = Message
Vue.use(Button).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Tag)
Vue.use(Button).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Tag).use(Link)
Vue.use(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Popover)
export default {
name: "list",
......@@ -371,6 +425,9 @@ export default {
dialogVisible2: false,//交期弹窗
dialogVisible3: false,//上架有效期
dialogVisible4: false,//修改价格
dialogVisibleLog: false,//日志
dialogVisibleLogDetail: false,//日志详情
logs: [],
downHref: "",
cp_time_val: '',
formParam: {
......@@ -386,6 +443,7 @@ export default {
kucundata: [],//修改库存数据
cpdata: [],//上架有效期数据
priceData: [],//修改价格数据
message: {},
skuOriginalStepPriceData: [],
goods_id: '',
stock: 0,
......@@ -410,6 +468,54 @@ export default {
},
methods: {
/**
* 查看日志
* @param row
*/
handleClick(row) {
this.getLogs(507, '1168906660256142490');
},
/**
* 查看日志详情
* @param row
*/
handleDetailClick(pre_data, current_data) {
var data = Object.assign({}, {
pre_data: pre_data,
current_data: current_data
});
this.dialogVisibleLogDetail = true;
this.message = data;
},
/**
* 获取日志
* @param obj_type
* @param obj_id
*/
getLogs(obj_type, obj_id) {
this.$http('GET', "/api/log/getLogs", {
obj_type: obj_type,
obj_id: obj_id
}).then(res => {
if (res.code === 0) {
this.dialogVisibleLog = true;
this.logs = res.data.list;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
});
},
/**
* 修改价格删除
* @param index
* @param row
*/
handleDelete(index, row) {
this.skuOriginalStepPriceData.splice(index, 1);
},
/**
* 监听起订量
*/
handleInput(index) {
......@@ -722,6 +828,13 @@ export default {
* 修改阶梯价格
*/
updateSkuOriginalStepPrice() {
var isPurchasesValid = Util.isPurchasesValid(this.skuOriginalStepPriceData);
if (!isPurchasesValid) {
this.$message({
message: '修改价格时格式填写错误,起订量不能低于最小起订量,不能高于库存;并且需要填写对应价格;',
type: 'warning'
});
} else {
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({
......@@ -739,12 +852,13 @@ export default {
});
}
})
}
},
/**
* 获取sku阶梯价格
*/
getSkuOriginalStepPrice(goods_id) {
this.$http('GET', "/api/sku/getSkuOriginalStepPrice", {goods_id: '1168188546694196678'}).then(res => {
this.$http('GET', "/api/sku/getSkuOriginalStepPrice", {goods_id: goods_id}).then(res => {
if (res.code == 0) {
this.skuOriginalStepPriceData = res.data.data;
this.goods_id = goods_id;
......@@ -829,7 +943,7 @@ export default {
} else {
this.$message({
message: res.msg,
type: 'warning'
type: 'error'
});
}
})
......
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