276 行
12 KiB
HTML
可执行文件
276 行
12 KiB
HTML
可执行文件
<!DOCTYPE html>
|
|
<html>
|
|
<!--jsy添加-->
|
|
<!--[1.7.90]-->
|
|
<head>
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css"/>
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vue/element-ui.2.8.2.css">
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vue/element-ui.css">
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css"/>
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/common-upload.css">
|
|
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/element-ui.2.8.2.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/element-ui.js"></script>
|
|
<title>批量使用</title>
|
|
<style>
|
|
.el-header .el-input {
|
|
width: 190px;
|
|
}
|
|
|
|
[v-cloak] {
|
|
display: none;
|
|
}
|
|
|
|
.el-checkbox-group {
|
|
text-align: left;
|
|
}
|
|
|
|
.el-checkbox + .el-checkbox {
|
|
margin-left: 10px;
|
|
}
|
|
|
|
.el-checkbox {
|
|
margin-right: 0;
|
|
margin-left: 10px;
|
|
}
|
|
|
|
.el-checkbox:last-of-type {
|
|
margin-right: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="app" v-cloak>
|
|
<el-container>
|
|
<!--头部-->
|
|
<el-header style="margin-top: 20px">
|
|
<el-input clearable v-model="formInline.name" size="small" placeholder="请输入商品名称/货号/条码"></el-input>
|
|
<el-select clearable v-model="formInline.template_id" size="small" placeholder="从已使用模板中筛选">
|
|
<el-option
|
|
v-for="item in TemplateName"
|
|
@change="pager=1;getBatchUsageGoods()"
|
|
:key="item.id"
|
|
:value="item.id"
|
|
:label="item.title">
|
|
</el-option>
|
|
</el-select>
|
|
<el-select v-model="formInline.goods_type" @change="pager=1;getBatchUsageGoods()" size="small"
|
|
placeholder="场景类型">
|
|
<el-option label="商城普通商品" value="1"></el-option>
|
|
<el-option label="商城拼团商品" value="2"></el-option>
|
|
<el-option label="商城秒杀商品" value="3"></el-option>
|
|
<el-option label="商城预售商品" value="4"></el-option>
|
|
</el-select>
|
|
<el-select v-if="type == 1||type == 4" clearable v-model="formInline.type"
|
|
@change="pager=1;getBatchUsageGoods()" size="small" placeholder="商品类型">
|
|
<el-option label="称重" value="2"></el-option>
|
|
<el-option label="非称重" value="1"></el-option>
|
|
</el-select>
|
|
<el-button type="primary" size="small" plain @click="pager=1;getBatchUsageGoods()">搜索</el-button>
|
|
</el-header>
|
|
<el-footer style="margin-top: -10px;margin-bottom: -20px;">
|
|
<el-button type="primary" size="small" style="width: 80px;" @click="confirm()">确认使用</el-button>
|
|
</el-footer>
|
|
<!--表格-->
|
|
<el-main>
|
|
<template>
|
|
<el-table
|
|
:data="tableData"
|
|
ref="multipleTable"
|
|
border
|
|
style="width: 100%"
|
|
:cell-style="rowClass"
|
|
:header-cell-style="headClass">
|
|
<el-table-column type="selection" width="55"></el-table-column>
|
|
<el-table-column type="index" width="50" label="序号"></el-table-column>
|
|
<el-table-column prop="act_name" label="活动标题"
|
|
v-if="formInline.goods_type==2||formInline.goods_type==3"></el-table-column>
|
|
<el-table-column prop="goods_name" label="商品名称"></el-table-column>
|
|
<el-table-column prop="goods_number" label="商品货号"></el-table-column>
|
|
<el-table-column prop="goods_code" label="商品条码"></el-table-column>
|
|
<el-table-column prop="pricing_method" label="商品类型">
|
|
<template slot-scope="scope">
|
|
<p v-if="scope.row.pricing_method==1">非称重</p>
|
|
<p v-if="scope.row.pricing_method==2">称重</p>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="act_price" label="活动价"
|
|
v-if="formInline.goods_type==2||formInline.goods_type==3 || formInline.goods_type==4"></el-table-column>
|
|
<el-table-column prop="retail_price" label="商城价" v-else></el-table-column>
|
|
<el-table-column prop="delivery_type" label="配送方式">
|
|
<template slot-scope="scope">
|
|
<el-checkbox-group v-model="scope.row.delivery_type" @change="checkType">
|
|
<el-checkbox v-for="(item,i) in delivery_list"
|
|
:label="i+1"
|
|
:key="i+1">{{item.title}}
|
|
</el-checkbox>
|
|
</el-checkbox-group>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="title" label="使用模板">
|
|
<template slot-scope="scope">
|
|
<p v-if="scope.row.title==null" style="color: #dcdfe6">未使用</p>
|
|
<p v-if="scope.row.title">{{scope.row.title}}</p>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</template>
|
|
</el-main>
|
|
<!--分页-->
|
|
<el-footer>
|
|
<div class="block" style="text-align: center">
|
|
<el-pagination
|
|
background
|
|
:current-page="pager"
|
|
:pager-count="5"
|
|
@current-change="changePageNum"
|
|
layout="prev, pager, next"
|
|
:total="totalQuantity">
|
|
</el-pagination>
|
|
</div>
|
|
</el-footer>
|
|
</el-container>
|
|
</div>
|
|
</body>
|
|
<style>
|
|
|
|
</style>
|
|
<script type="text/javascript" src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
|
<script type="text/javascript">
|
|
var app = new Vue({
|
|
el: '#app',
|
|
data: function () {
|
|
return {
|
|
pager: 1,//当前页
|
|
totalQuantity: 1,//总条数
|
|
pageSize: '10',//每页多少条
|
|
formInline: {
|
|
name: '',//商品名称和货号,搜索框内容
|
|
template_id: '',//模板,模板ID
|
|
goods_type: '1',//类型,1普通商品 2拼团 3秒杀
|
|
type: '',//类型,商品类型
|
|
},
|
|
tableData: [],//配送模板页面数据
|
|
TemplateName: [],//模板名称,使用模板下拉框用到
|
|
templateId: '',//模板ID
|
|
multipleTable: '',
|
|
type: '',
|
|
delivery_list: [
|
|
{type: '1', title: "自提"},
|
|
{type: '2', title: "同城配送"},
|
|
{type: '3', title: "快递配送"}
|
|
],//配送方式列表
|
|
}
|
|
},
|
|
mounted: function () {
|
|
this.templateId = {$id};
|
|
this.type = {$type};
|
|
this.getBatchUsageGoods();
|
|
this.getTemplate();
|
|
},
|
|
methods: {
|
|
checkType: function (e) {
|
|
console.log(e);
|
|
},
|
|
// 获取数据
|
|
getBatchUsageGoods: function () {
|
|
if (this.type == 3) {
|
|
this.formInline.type = 2;
|
|
} else if (this.type == 2) {
|
|
this.formInline.type = 1;
|
|
}
|
|
var that = this;
|
|
$.ajax({
|
|
url: "{:U('SystemDelivery/batchUsageGoodsInfo')}",
|
|
type: 'post',
|
|
dataType: 'json',
|
|
data: {
|
|
page: that.pager,
|
|
limit: that.pageSize,
|
|
keyword: that.formInline.name,
|
|
pricing_method: that.formInline.type,
|
|
template_id: that.formInline.template_id,
|
|
goods_type: that.formInline.goods_type,
|
|
},
|
|
success: res => {
|
|
that.tableData = [];
|
|
that.tableData = res.data.shopBaseData;
|
|
that.totalQuantity = res.data.totalQuantity;
|
|
}
|
|
});
|
|
},
|
|
// 获取使用模板
|
|
getTemplate: function () {
|
|
var that = this;
|
|
$.ajax({
|
|
url: "{:U('SystemDelivery/getStoreFreightTem')}",
|
|
type: 'post',
|
|
dataType: 'json',
|
|
data: '',
|
|
success: res => {
|
|
that.TemplateName = res.data;
|
|
}
|
|
});
|
|
},
|
|
// 表头样式设置
|
|
headClass() {
|
|
return 'text-align: center;background:#eef1f6;'
|
|
},
|
|
// 表格样式设置
|
|
rowClass() {
|
|
return 'text-align: center;'
|
|
},
|
|
//分页
|
|
changePageNum(pager) {
|
|
this.pager = pager;
|
|
this.getBatchUsageGoods();
|
|
},
|
|
//确认使用
|
|
confirm() {
|
|
var sel = this.$refs.multipleTable.selection;//已选中的商品
|
|
if (sel.length) {
|
|
//获取的多选框转换数组
|
|
var arr = [];
|
|
for (let i = 0; i < sel.length; i++) {
|
|
if (!sel[i].delivery_type || !sel[i].delivery_type.length) {
|
|
this.$message({message: '必须选择一种配送方式', type: 'warning'});
|
|
return;
|
|
}
|
|
let obj = {
|
|
id: sel[i].id,
|
|
delivery_type: sel[i].delivery_type.join(','),
|
|
};
|
|
arr.push(obj)
|
|
}
|
|
this.$confirm('选择的商品如果包含已经设置配送模板的商品,商品模板将发生改变!', '温馨提示', {
|
|
confirmButtonText: '确定使用',
|
|
cancelButtonText: '取消',
|
|
// type: 'warning'
|
|
}).then(() => {
|
|
$.ajax({
|
|
url: "{:U('SystemDelivery/batchUsage')}",
|
|
type: 'post',
|
|
dataType: 'json',
|
|
data: {
|
|
goodsList: JSON.stringify(arr),
|
|
templateId: this.templateId,
|
|
goods_type: this.formInline.goods_type,
|
|
}, success: res => {
|
|
if (res.code == 0) {
|
|
this.$message({message: '操作成功', type: 'success'})
|
|
this.pager = 1;
|
|
this.getBatchUsageGoods();
|
|
}else{
|
|
this.$message({message: '保存失败', type: 'error'})
|
|
}
|
|
}
|
|
});
|
|
}).catch(() => {
|
|
|
|
});
|
|
}
|
|
},
|
|
}
|
|
})
|
|
</script>
|
|
</html> |