352 行
14 KiB
HTML
可执行文件
352 行
14 KiB
HTML
可执行文件
<!--[1.8.50]-->
|
|
<style>
|
|
th {
|
|
background-color: #f5f7fa !important;
|
|
}
|
|
|
|
th > .cell {
|
|
white-space: nowrap !important;
|
|
text-align: center;
|
|
}
|
|
|
|
th, td {
|
|
text-align: center;
|
|
line-height: 30px;
|
|
padding: 0;
|
|
}
|
|
|
|
th > .cell, td > .cell {
|
|
text-align: center;
|
|
}
|
|
|
|
.el-pagination {
|
|
padding: 8px;
|
|
}
|
|
|
|
.el-table__row > td:last-child > .cell {
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.center-content {
|
|
margin: 10px;
|
|
}
|
|
|
|
|
|
.small-dialog-content {
|
|
margin-left: calc(7% + 40px);
|
|
}
|
|
|
|
.el-input {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.state {
|
|
display: inline-block;
|
|
vertical-align: top;
|
|
margin: 10px;
|
|
}
|
|
</style>
|
|
<div id="advanceSaleApp" v-cloak>
|
|
<if condition="$authArr['advance_sale_status'] eq true">
|
|
<div>
|
|
<div class="state">
|
|
是否开启预售:
|
|
<el-switch
|
|
v-model="advance_sale_status"
|
|
@change="changeState(1)"
|
|
inactive-value="0"
|
|
active-value="1"
|
|
>
|
|
</el-switch>
|
|
</div>
|
|
<div class="state">
|
|
是否在首页展示:
|
|
<el-switch
|
|
v-model="advance_sale_index_status"
|
|
@change="changeState(2)"
|
|
inactive-value="0"
|
|
active-value="1"
|
|
>
|
|
</el-switch>
|
|
</div>
|
|
</div>
|
|
</if>
|
|
<div>
|
|
<div class="center-content">
|
|
<el-input placeholder="商品名称/货号/条码"
|
|
style="width: 200px;"
|
|
type="text"
|
|
size="small"
|
|
clearable
|
|
@keydown.enter.exact.native.prevent="search"
|
|
v-model="order_number"></el-input>
|
|
<el-select v-model="price" placeholder="价格区间" size="small" clearable>
|
|
<el-option label="50以下" value="1"></el-option>
|
|
<el-option label="50-200" value="2"></el-option>
|
|
<el-option label="200-500" value="3"></el-option>
|
|
<el-option label="500-1000" value="4"></el-option>
|
|
<el-option label="1000以上" value="5"></el-option>
|
|
</el-select>
|
|
<el-select v-model="advance_type" placeholder="预售方式" size="small" clearable>
|
|
<el-option label="全款" value="1"></el-option>
|
|
<el-option label="定金" value="2"></el-option>
|
|
</el-select>
|
|
<el-select v-model="advance_state" placeholder="预售状态" size="small" clearable>
|
|
<el-option label="开" value="1"></el-option>
|
|
<el-option label="关" value="0"></el-option>
|
|
</el-select>
|
|
</div>
|
|
<div class="center-content">
|
|
<date-picker-range :date-time.sync="add_time"></date-picker-range>
|
|
|
|
</div>
|
|
<div class="center-content">
|
|
<el-button type="primary" plain @click="search" size="small">查询</el-button>
|
|
<if condition="$authArr['addAdvance'] eq true">
|
|
<el-button type="primary" plain @click="addAdvance(0)" size="small">添加预售商品</el-button>
|
|
</if>
|
|
<if condition="$authArr['imgSet'] eq true">
|
|
<el-button type="primary" plain @click="imgSet" size="small">设置封面</el-button>
|
|
</if>
|
|
</div>
|
|
</div>
|
|
<div style="border: 1px solid #e6e6e6;max-width: calc(100vw - 208px);">
|
|
<el-table border :data="DataList" style="width: calc(100vw - 208px);border: none;"
|
|
size="mini"
|
|
max-height="500"
|
|
v-loading="loading"
|
|
element-loading-text="数据获取中"
|
|
element-loading-spinner="el-icon-loading">
|
|
<el-table-column prop="index" label="序号" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="goods_name" label="商品名称" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="goods_number" label="货号" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="goods_code" label="条码" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="advance_num" label="预售库存" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="surplus_num" label="剩余数量" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="advance_start_time" label="开启时间" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="advance_end_time" label="结束时间" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="type_name" label="预售方式" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="状态" show-overflow-tooltip>
|
|
<template slot-scope="scope">
|
|
<el-switch
|
|
@change="advance_modify(scope.$index)"
|
|
v-model="scope.row.advance_state"
|
|
inactive-value="0"
|
|
active-value="1">
|
|
</el-switch>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column fixed="right" label="操作" width="150px" style="border-right: none;">
|
|
<template slot-scope="scope">
|
|
<if condition="$authArr['addAdvance'] eq true">
|
|
<el-button @click="addAdvance(scope.row.id)" type="text" size="small">编辑</el-button>
|
|
</if>
|
|
<if condition="$authArr['Delete'] eq true">
|
|
<el-button @click="Delete(scope.row.id,scope.row.goods_id)" type="text" size="small">删除
|
|
</el-button>
|
|
</if>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-pagination
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
:current-page="currentPage"
|
|
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
|
|
:page-size="100"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:total="currentLen">
|
|
</el-pagination>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var advanceSaleApp = new Vue({
|
|
el: "#advanceSaleApp",
|
|
data: function () {
|
|
return {
|
|
DataList: [],
|
|
currentPage: 1,
|
|
currentLimit: 10,
|
|
currentLen: 0,
|
|
loading: true,
|
|
advance_sale_status: "{$advance_sale_status}",
|
|
advance_sale_index_status: "{$advance_sale_index_status}",
|
|
order_number: "",
|
|
price: "",
|
|
advance_state: "",
|
|
advance_type: "",
|
|
add_time: "",
|
|
showSelectImage: false,
|
|
actFileName: "",
|
|
}
|
|
},
|
|
methods: {
|
|
advance_modify(index) {
|
|
$.ajax({
|
|
url: "{:U('advance_state_modify')}",
|
|
type: "post",
|
|
data: {
|
|
id: this.DataList[index].id,
|
|
advance_state: this.DataList[index].advance_state,
|
|
goods_id: this.DataList[index].goods_id,
|
|
},
|
|
success: (res) => {
|
|
if (res.status == 1) {
|
|
this.$message.success(res.msg)
|
|
} else {
|
|
this.DataList[index].advance_state = this.DataList[index].advance_state == 1 ? '0' : '1';
|
|
this.$message.error(res.msg)
|
|
}
|
|
}
|
|
})
|
|
},
|
|
handleSizeChange: function (val) {
|
|
this.currentLimit = val;//切换每页数量
|
|
this.currentPage = 1;
|
|
this.getData();
|
|
},
|
|
handleCurrentChange: function (val) {
|
|
this.currentPage = val;
|
|
this.getData();//切换页数
|
|
},
|
|
imgSet: function () {
|
|
layer.open({
|
|
type: 2,
|
|
content: "{:U('banner')}",
|
|
title: "预售轮播图",
|
|
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
|
|
shade: 0,
|
|
offset: 'rb',
|
|
btnAlign: 'c'
|
|
})
|
|
},
|
|
selectImage: function (actName) {
|
|
//将选择图片
|
|
this.actFileName = actName;
|
|
this.showSelectImage = true;
|
|
},
|
|
changeState (type) {
|
|
if (type == 1) {
|
|
var state = this.advance_sale_status;
|
|
} else {
|
|
var state = this.advance_sale_index_status;
|
|
}
|
|
$.ajax({
|
|
url: "{:U('changeSate')}",
|
|
type: "post",
|
|
data: {
|
|
type: type,
|
|
state: state
|
|
},
|
|
success: (res)=> {
|
|
if (res.status == 1) {
|
|
this.$message.success(res.msg)
|
|
} else {
|
|
this.$message.error(res.msg)
|
|
}
|
|
}
|
|
})
|
|
},
|
|
search: function () {
|
|
this.currentPage = 1;
|
|
this.getData();
|
|
},
|
|
getData: function () {
|
|
var that = this;
|
|
var order_number = that.order_number;
|
|
var price = that.price;
|
|
var advance_type = that.advance_type;
|
|
var advance_state = that.advance_state;
|
|
var add_time = that.add_time;
|
|
$.ajax({
|
|
url: "{:U('advanceList')}",
|
|
type: "post",
|
|
data: {
|
|
order_number: order_number,
|
|
price: price,
|
|
advance_type: advance_type,
|
|
advance_state: advance_state,
|
|
add_time: add_time,
|
|
page: that.currentPage,
|
|
limit: that.currentLimit
|
|
},
|
|
success: function (res) {
|
|
that.DataList = [];
|
|
that.DataList = res.data;
|
|
that.loading = false;
|
|
that.$nextTick(function () {
|
|
that.currentLen = parseInt(res.count);
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//添加
|
|
addAdvance: function (id) {
|
|
var that = this;
|
|
layer.open({
|
|
type: 2,
|
|
content: "{:U('addAdvance')}?id=" + id,
|
|
title: "预售商品",
|
|
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
|
|
offset: 'rb',
|
|
shade: 0,
|
|
btnAlign: 'c',
|
|
end: function () {
|
|
that.getData();
|
|
}
|
|
})
|
|
},
|
|
//删除
|
|
Delete: function (id, goods_id) {
|
|
var that = this;
|
|
this.$confirm('此操作删除该活动,库存恢复,是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
const loadsing = that.$loading({
|
|
lock: true,
|
|
text: '保存中,请等待',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(255, 255, 255, 0.7)'
|
|
});
|
|
$.ajax({
|
|
url: "{:U('deleteAct')}",
|
|
type: "post",
|
|
data: {id: id, goods_id: goods_id},
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
that.$message({
|
|
type: 'success',
|
|
message: res.msg,
|
|
duration: 1000,
|
|
onClose: function () {
|
|
loadsing.close();
|
|
that.getData();
|
|
}
|
|
});
|
|
} else {
|
|
that.$message({
|
|
type: 'error',
|
|
message: res.msg,
|
|
duration: 1000,
|
|
onClose: function () {
|
|
loadsing.close();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消删除'
|
|
});
|
|
});
|
|
},
|
|
},
|
|
created: function () {
|
|
this.getData();
|
|
}
|
|
})
|
|
</script> |