init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
336
Application/Retail/View/Xcx/hot.html
可执行文件
336
Application/Retail/View/Xcx/hot.html
可执行文件
@@ -0,0 +1,336 @@
|
||||
<!--[1.6.48]-->
|
||||
<style>
|
||||
.content-table {
|
||||
width: 100%;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
color: #409EFF;
|
||||
font-weight: bold;
|
||||
font-size: 15px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.demo-table-expand label {
|
||||
width: 90px;
|
||||
color: #99a9bf;
|
||||
}
|
||||
.demo-table-expand .el-form-item {
|
||||
margin-right: 0;
|
||||
margin-bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.input-width{
|
||||
width: 220px;
|
||||
}
|
||||
</style>
|
||||
<div id="host" v-cloak style="width: 100%">
|
||||
<el-form :model="switch_form" :inline="true" size="small">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getGoodsList">新增</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启推荐商品">
|
||||
<el-switch
|
||||
v-model="switch_form.recommend_status"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
:active-text="switch_form.recommend_status == 0 ? '关闭' : '开启' "
|
||||
@change="setRecommendStatus">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="width:100%;" v-loading="loading" element-loading-text="数据加载中,请等待" element-loading-spinner="el-icon-loading">
|
||||
<el-table :data="recommend_goods" :highlight-current-row="true" border size="mini" max-height="calc(100vh - 280px)">
|
||||
<el-table-column align="center" type="index" label="序号" width="60"></el-table-column>
|
||||
<el-table-column align="center" prop="goods_name" label="商品名称" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column align="center" prop="goods_number" label="商品货号"></el-table-column>
|
||||
<el-table-column align="center" prop="goods_code" label="商品条码"></el-table-column>
|
||||
<el-table-column align="center" prop="online_price" label="商城价"></el-table-column>
|
||||
<el-table-column align="center" prop="addtime" label="添加时间"></el-table-column>
|
||||
<el-table-column align="center" prop="goods_type" label="商品状态"></el-table-column>
|
||||
<el-table-column align="center" prop="sort" label="排序" width="60"></el-table-column>
|
||||
<el-table-column align="center" label="操作" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="deleteRecommendGoods(scope.row.id)">移除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@current-change="pageChange"
|
||||
@size-change="limitChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:current-page.sync="page"
|
||||
:pager-count="5"
|
||||
:page-sizes="[10,20,30,40,50,60,70,80,90]"
|
||||
:page-size="limit"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
<el-dialog :modal-append-to-body="false" :visible.sync="show_goods">
|
||||
<div class="content-table">商城商品档案</div>
|
||||
<el-form :model="seek_data" :inline="true" size="small">
|
||||
<el-form-item>
|
||||
<el-input v-model="seek_data.goods_name" placeholder="商品名称" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model="seek_data.keyword" placeholder="货号/条码" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getGoodsList">搜索</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="reset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="padding-bottom: 5px;">
|
||||
<el-button type="primary" size="small" @click="batchAdd">批量添加</el-button>
|
||||
</div>
|
||||
<div v-loading="loading2" element-loading-text="数据加载中,请等待" element-loading-spinner="el-icon-loading">
|
||||
<el-table :data="goods_list" :highlight-current-row="true" border size="small" max-height="450" @selection-change="choseGoods">
|
||||
<el-table-column align="center" type="selection" width="60"></el-table-column>
|
||||
<el-table-column align="center" type="index" label="序号" width="60"></el-table-column>
|
||||
<el-table-column align="center" prop="goods_name" label="商品名称" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column align="center" prop="good_number" label="商品货号"></el-table-column>
|
||||
<el-table-column align="center" prop="goods_code" label="商品条码"></el-table-column>
|
||||
<el-table-column align="center" prop="online_price" label="商城价"></el-table-column>
|
||||
<el-table-column align="center" label="排序">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.sort" size="small" onkeyup="value=value.replace(/[^\d]/g,'')"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@current-change="gPageChange"
|
||||
@size-change="gLimitChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:current-page.sync="g_page"
|
||||
:pager-count="5"
|
||||
:page-sizes="[10,20,30,40,50,60,70,80,90]"
|
||||
:page-size="g_limit"
|
||||
:total="g_total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '#host',
|
||||
data: function () {
|
||||
return {
|
||||
switch_form:{
|
||||
recommend_status:0, // 推荐商品状态
|
||||
},
|
||||
recommend_goods:[], // 推荐商品
|
||||
page:1, // 分页
|
||||
limit:10, // 每页显示条数
|
||||
total:0, // 总数 int类型
|
||||
show_goods:false, // 商品列表显示
|
||||
seek_data: {
|
||||
goods_name: '', // 商品名称
|
||||
keyword: '', // 货号、条码
|
||||
},
|
||||
goods_list:[], // 商品列表
|
||||
g_page:1, // 分页
|
||||
g_limit:10, // 每页显示条数
|
||||
g_total:0, // 总数 int类型
|
||||
loading:false, // 加载
|
||||
loading2:false,
|
||||
chose_goods:[], // 选择的商品
|
||||
};
|
||||
},
|
||||
|
||||
methods:{
|
||||
// 获取门店推荐商品状态
|
||||
getRecommendStatus(){
|
||||
var that = this;
|
||||
$.ajax({
|
||||
url:"{:U('getRecommendStatus')}",
|
||||
type:"post",
|
||||
success:function (res) {
|
||||
if(res.status == 1){
|
||||
that.switch_form.recommend_status = res.recommend_status;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 设置门店推荐商品状态
|
||||
setRecommendStatus(){
|
||||
var that = this;
|
||||
$.ajax({
|
||||
url:"{:U('setRecommendStatus')}",
|
||||
type:"post",
|
||||
data:{recommend_status:that.switch_form.recommend_status},
|
||||
success:function (res) {
|
||||
if(res.status == 1){
|
||||
that.$message({
|
||||
message:res.msg,
|
||||
type:'success',
|
||||
})
|
||||
}else{
|
||||
that.$message({
|
||||
message:res.msg,
|
||||
type:'error',
|
||||
})
|
||||
that.getRecommendStatus()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 获取推荐商品
|
||||
getRecommendGoods(){
|
||||
var that = this;
|
||||
that.loading = true;
|
||||
$.ajax({
|
||||
url:"{:U('getRecommendGoods')}",
|
||||
type:"post",
|
||||
data:{page:that.page,limit:that.limit},
|
||||
success:function (res) {
|
||||
that.loading = false;
|
||||
if(res.status == 1){
|
||||
that.recommend_goods = res.recommend_goods;
|
||||
that.total = res.total;
|
||||
}else{
|
||||
that.recommend_goods = [];
|
||||
that.total = 0;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 分页
|
||||
pageChange(val){
|
||||
this.page = val;
|
||||
this.getRecommendGoods();
|
||||
},
|
||||
|
||||
// 显示数量
|
||||
limitChange(val){
|
||||
this.limit = val;
|
||||
this.page = 1;
|
||||
this.getRecommendGoods();
|
||||
},
|
||||
|
||||
// 移除推荐商品
|
||||
deleteRecommendGoods(id){
|
||||
var that = this;
|
||||
this.$confirm('确定移除该商品吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$.ajax({
|
||||
url:"{:U('deleteRecommendGoods')}",
|
||||
type:"post",
|
||||
data:{id:id},
|
||||
success:function (res) {
|
||||
if(res.status == 1){
|
||||
that.$message({
|
||||
message:res.msg,
|
||||
type:"success",
|
||||
})
|
||||
that.getRecommendGoods();
|
||||
}else{
|
||||
that.$message({
|
||||
message:res.msg,
|
||||
type:"error",
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 获取门店商城出售商品
|
||||
getGoodsList(){
|
||||
var that = this;
|
||||
that.loading2 = true;
|
||||
$.ajax({
|
||||
url:"{:U('getGoodsList')}",
|
||||
type:"post",
|
||||
data:{seek_data:that.seek_data,page:that.g_page,limit:that.g_limit},
|
||||
success:function (res) {
|
||||
that.loading2 = false;
|
||||
if(res.status == 1){
|
||||
that.show_goods = true;
|
||||
that.goods_list = res.goods_list;
|
||||
that.g_total = res.total;
|
||||
}else{
|
||||
that.$message({
|
||||
message:res.msg,
|
||||
type:'error',
|
||||
})
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 重置搜索
|
||||
reset(){
|
||||
var seek_data = {
|
||||
goods_name: '',
|
||||
keyword: '',
|
||||
}
|
||||
this.seek_data = seek_data;
|
||||
this.getGoodsList();
|
||||
},
|
||||
|
||||
// 分页2
|
||||
gPageChange(val){
|
||||
this.g_page = val;
|
||||
this.getGoodsList();
|
||||
},
|
||||
|
||||
// 显示数量2
|
||||
gLimitChange(val){
|
||||
this.g_limit = val;
|
||||
this.g_page = 1;
|
||||
this.getGoodsList();
|
||||
},
|
||||
|
||||
// 选择商品
|
||||
choseGoods(val){
|
||||
this.chose_goods = val;
|
||||
},
|
||||
|
||||
// 批量添加
|
||||
batchAdd(){
|
||||
var that = this;
|
||||
if(that.chose_goods.length <= 0){
|
||||
that.$message({
|
||||
message:'提示:请勾选需要添加的商品',
|
||||
type:'warning'
|
||||
})
|
||||
return false;
|
||||
}
|
||||
that.loading2 = true;
|
||||
$.ajax({
|
||||
url:"{:U('batchAdd')}",
|
||||
type:"post",
|
||||
data:{chose_goods:that.chose_goods},
|
||||
success: function (res) {
|
||||
that.loading2 = false;
|
||||
if (res.status == 1) {
|
||||
that.$message({
|
||||
message:res.msg,
|
||||
type:'success'
|
||||
})
|
||||
that.show_goods = false;
|
||||
that.getRecommendGoods();
|
||||
}else{
|
||||
that.$message({
|
||||
message:res.msg,
|
||||
type:'error'
|
||||
})
|
||||
that.getGoodsList();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
created: function () {
|
||||
this.getRecommendStatus();
|
||||
this.getRecommendGoods();
|
||||
},
|
||||
})
|
||||
</script>
|
||||
在新工单中引用
屏蔽一个用户