文件

242 行
9.2 KiB
HTML
可执行文件

<!doctype html>
<html>
<!--[1.7.90]-->
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>简拼设置</title>
<link rel="stylesheet" href="__PUBLIC__/vue/element-ui.css">
<style>
[v-cloak] {
display: none;
}
.seek {
margin-right: 10px;
margin-top: 10px;
white-space: nowrap;
}
.dialog {
width: 70%;
}
</style>
</head>
<body>
<div id="app" v-cloak style="width: 100%;padding-left: 10px;">
<!-- 搜索数据 -->
<div style="display: flex;padding-bottom: 15px;flex-wrap: wrap;">
<div class="seek">
<el-input v-model="searchText" placeholder="商品名称/货号/条码" clearable size="small"
style="width: 220px;"></el-input>
</div>
<div class="seek">
<select-goods-category :user-type="2"
:store-id="store_id"
:category-id1.sync="goodsClassId1"
:category-id2.sync="goodsClassId2"
:category-id3.sync="goodsClassId3"></select-goods-category>
</div>
<div class="seek" style="display: flex;text-align: center;">
<el-button type="primary" @click="getGoods" size="small">查询</el-button>
<if condition="$authArr['updateGoods'] eq true">
<el-button type="primary" @click="updateGoods" size="small">批量修改</el-button>
</if>
<if condition="$authArr['generate'] eq true">
<el-button type="primary" @click="generate" size="small">一键生成</el-button>
</if>
<el-popover
placement="bottom"
title="详解"
width="100"
trigger="hover"
content="系统自动给所有商品生成简拼">
<span slot="reference" size="mini"><i class="el-icon-question"></i></span>
</el-popover>
</div>
</div>
<!-- 列表展示 -->
<template>
<el-table :data="goodsList" border size="small"
@selection-change="ChooseSelectionChange"
>
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
<el-table-column prop="goods_name" label="商品名称" width="150" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="goods_number" label="商品货号" width="160"
:show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="goods_code" label="商品条码" width="160"></el-table-column>
<el-table-column prop="simple_spelling" label="简拼">
<template slot-scope="scope">
<el-input size="mini" v-model="scope.row.simple_spelling" style="width:200px"></el-input>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChange"
@current-change="pageChange"
layout="total, sizes, prev, pager, next, jumper"
:pager-count="5"
:page-sizes="[10,20,30,40,50,60,70,80,90]"
:page-size="10"
:total="total">
</el-pagination>
</template>
</div>
</body>
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
<script src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
<script src="__PUBLIC__/vue/element-ui.js"></script>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Retail/common/js/select-goods-category.js"></script>
<script>
var app = new Vue({
el: '#app',
data: function () {
return {
store_id: localStorage.store_id,
searchText: '',
goodsList: [],
goodsClassId1: "",
goodsClassId2: "",
goodsClassId3: "",
page: 1, // 分页
limit: 10, // 每页显示条数
total: 0, // 总数 [int]
goodsSelection: [],
};
},
methods: {
//批量修改
updateGoods: function (res) {
var that = this;
var goodsSelection = that.goodsSelection;
$.ajax({
url: "{:U('batchPinYin')}",
type: "post",
data: {
goodsSelection: goodsSelection
},
success: function (res) {
if (res.status == 1) {
that.$message({
type: "success",
message: res.message,
duration: 1500,
onClose: function (res) {
that.getGoods();
}
})
} else {
that.$message.error(res.message);
}
}
})
},
//一键生成
generate: function () {
var that = this;
this.$confirm('此操作将所有未生成简拼的商品生成简拼, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.onekeyGenerate(1);
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
});
});
},
//一键生成简拼
onekeyGenerate: function (page) {
var that = this;
that.$loading({
lock: true,
text: '数据获取中,请等待...',
spinner: 'el-icon-loading',
background: 'rgba(255, 255, 255, 0.7)'
});
$.ajax({
url: "{:U('generatePinYin')}",
type: "post",
data: {
page: page,
},
success: function (res) {
if (res.status == 1) {
if (res.data.state == 1) {
that.onekeyGenerate(++page);
} else {
that.$loading().close();
that.$message({
type: "success",
message: res.message,
duration: 1500,
onClose: function (res) {
that.getGoods();
}
})
}
} else {
that.$message.error(res.message);
}
}
})
},
//选择
ChooseSelectionChange: function (data) {
var that = this;
that.goodsSelection = data;
},
// 商品列表
getGoods() {
var that = this;
that.$loading({
lock: true,
text: '数据获取中,请等待...',
spinner: 'el-icon-loading',
background: 'rgba(255, 255, 255, 0.7)'
});
$.ajax({
url: "{:U('getSimpleGoods')}",
type: "post",
data: {
searchText: that.searchText,
page: that.page,
limit: that.limit,
person1: this.goodsClassId1,
person2: this.goodsClassId2,
person3: this.goodsClassId3
},
success: function (res) {
that.$loading().close();
that.goodsList = [];
that.goodsList = res.data.list;
that.total = res.data.count;
}
})
},
// 分页
pageChange(val) {
this.page = val;
this.getGoods();
},
// 显示数量
sizeChange(val) {
this.limit = val;
this.page = 1;
this.getGoods();
},
},
created: function () {
this.getGoods();
},
})
</script>
</html>