feat: 初始化雄戈商城服务端代码与Webhook自动部署配置
这个提交包含在:
@@ -0,0 +1,205 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
var commentView = new Vue({
|
||||
el: "#commentView",
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
offset: 0,
|
||||
limit: 10,
|
||||
totalPage: 20,
|
||||
currentPage: 1,
|
||||
|
||||
selectedData: [],
|
||||
|
||||
searchForm: {
|
||||
goods_title: "",
|
||||
comment_status: "all"
|
||||
},
|
||||
searchFormInit: {
|
||||
goods_title: "",
|
||||
comment_status: "all"
|
||||
},
|
||||
searchOp: {
|
||||
goods_title: "like",
|
||||
comment_status: "=",
|
||||
},
|
||||
|
||||
allAjax: false,
|
||||
tableAjax: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
let that = this;
|
||||
that.allAjax = true;
|
||||
let filter = {}
|
||||
let op = {}
|
||||
for (key in that.searchForm) {
|
||||
if (that.searchForm[key] != '') {
|
||||
filter[key] = that.searchForm[key];
|
||||
}
|
||||
}
|
||||
for (key in filter) {
|
||||
op[key] = that.searchOp[key]
|
||||
}
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/goods/comment/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
limit: that.limit,
|
||||
offset: that.offset,
|
||||
filter: JSON.stringify(filter),
|
||||
op: JSON.stringify(op)
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.data = res.data.rows;
|
||||
that.totalPage = res.data.total;
|
||||
that.allAjax = false;
|
||||
return false;
|
||||
}, function (ret, res) {
|
||||
that.allAjax = false;
|
||||
})
|
||||
},
|
||||
|
||||
handleSizeChange(val) {
|
||||
this.limit = val;
|
||||
this.getData()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.currentPage = val;
|
||||
this.offset = (val - 1) * this.limit;
|
||||
this.getData()
|
||||
},
|
||||
handleSelectionChange(row) {
|
||||
this.selectedData = row;
|
||||
},
|
||||
recyclebin() {
|
||||
let that = this;
|
||||
Fast.api.open('shopro/goods/comment/recyclebin', '查看回收站')
|
||||
},
|
||||
editRow(row) {
|
||||
let that = this;
|
||||
Fast.api.open("shopro/goods/comment/edit?ids=" + row.id, '编辑')
|
||||
},
|
||||
deleteRow(id) {
|
||||
let that = this;
|
||||
Fast.api.ajax({
|
||||
url: `shopro/goods/comment/del/ids/${id}`,
|
||||
loading: true,
|
||||
}, function (ret, res) {
|
||||
that.getData();
|
||||
return false;
|
||||
})
|
||||
},
|
||||
batchDelete() {
|
||||
let ids = []
|
||||
this.selectedData.forEach(s => {
|
||||
ids.push(s.id)
|
||||
})
|
||||
this.deleteRow(ids.join(","))
|
||||
},
|
||||
screenEmpty() {
|
||||
this.searchForm = JSON.parse(JSON.stringify(this.searchFormInit))
|
||||
this.screenFilter()
|
||||
},
|
||||
screenFilter() {
|
||||
this.offset = 0;
|
||||
this.getData()
|
||||
},
|
||||
setStatus(type) {
|
||||
let that = this;
|
||||
let ids = []
|
||||
that.selectedData.forEach(s => {
|
||||
ids.push(s.id)
|
||||
})
|
||||
Fast.api.ajax({
|
||||
url: `shopro/goods/comment/setStatus/ids/${ids.join(",")}/status/${type}`,
|
||||
loading: true,
|
||||
}, function (ret, res) {
|
||||
that.getData();
|
||||
return false;
|
||||
})
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
'dragsort_url': ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: 'shopro/goods/comment/recyclebin' + location.search,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{ checkbox: true },
|
||||
{ field: 'id', title: __('Id') },
|
||||
{
|
||||
field: 'deletetime',
|
||||
title: __('Deletetime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
width: '130px',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'Restore',
|
||||
text: __('Restore'),
|
||||
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
||||
icon: 'fa fa-rotate-left',
|
||||
url: 'shopro/goods/comment/restore',
|
||||
refresh: true
|
||||
},
|
||||
{
|
||||
name: 'Destroy',
|
||||
text: __('Destroy'),
|
||||
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||||
icon: 'fa fa-times',
|
||||
url: 'shopro/goods/comment/destroy',
|
||||
refresh: true
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
文件差异内容过多而无法显示
加载差异
文件差异内容过多而无法显示
加载差异
@@ -0,0 +1,369 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
let vue = new Vue({
|
||||
el: '#vue',
|
||||
data: {
|
||||
groupList: [],
|
||||
loadingText: '拼命加载中...',
|
||||
formLoading: false,
|
||||
// 添加编辑
|
||||
title: '',
|
||||
addDialog: false,
|
||||
// 表格当前页数据
|
||||
tableData: [],
|
||||
// 多选数组
|
||||
multipleSelection: [],
|
||||
// 搜索条件
|
||||
key: '',
|
||||
// 默认每页数据量
|
||||
pageSize: 20,
|
||||
// 当前页码
|
||||
currentPage: 1,
|
||||
// 默认数据总数
|
||||
totalCount: 0,
|
||||
// 列表加载遮罩
|
||||
listLoading: false,
|
||||
// 搜索字段
|
||||
search: {
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
keyword: '',
|
||||
type: '',
|
||||
status: '',
|
||||
sort: 'id',
|
||||
},
|
||||
// 字段信息
|
||||
formData: {},
|
||||
searchOpt: [{
|
||||
id: 1,
|
||||
value: '标题'
|
||||
}],
|
||||
statusOpt: [{
|
||||
id: 1,
|
||||
value: '显示'
|
||||
}, {
|
||||
id: 2,
|
||||
value: '隐藏'
|
||||
}],
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
title: [{
|
||||
required: true,
|
||||
message: '请您输入学校标题',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
},
|
||||
sendStartTime: '',
|
||||
sendEndTime: '',
|
||||
// 时间格式化
|
||||
dateFormat: function (row, column) {
|
||||
var date = row[column.property];
|
||||
if (date === undefined || date === 0) {
|
||||
return '';
|
||||
}
|
||||
return moment(date * 1000).format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
},
|
||||
methods: {
|
||||
// 刷新页面
|
||||
refreshPage() {
|
||||
this.search = {
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
keyword: '',
|
||||
type: '',
|
||||
status: '',
|
||||
sort: 'id',
|
||||
};
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
},
|
||||
handleClearSelect(field) {
|
||||
// 重新加载
|
||||
this.$set(this.search, field, '');
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
},
|
||||
handleClearSearchInp() {
|
||||
if (this.search.type) {
|
||||
// 重新加载
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
}
|
||||
},
|
||||
// 提交
|
||||
submit() {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let formData = this.formData;
|
||||
|
||||
if (!this.formData.params.length) {
|
||||
this.$message.warning('请您添加参数');
|
||||
return;
|
||||
}
|
||||
|
||||
for (let item of this.formData.params) {
|
||||
if (!item.title || !item.content) {
|
||||
this.$message.warning('请您填写完整的参数内容');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
let loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在提交中...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.3)'
|
||||
});
|
||||
$.ajax({
|
||||
url: 'shopro/goods/params/add',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
success: res => {
|
||||
loading.close();
|
||||
if (res.code === 200) {
|
||||
this.$message.success(res.msg);
|
||||
this.addDialog = false;
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
} else {
|
||||
this.$message.warning(res.msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
// 状态改变
|
||||
statusChange(row) {
|
||||
// 提交
|
||||
let loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在更改中...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.3)'
|
||||
});
|
||||
$.ajax({
|
||||
url: 'shopro/goods/params/status',
|
||||
data: {
|
||||
id: row.id,
|
||||
status: row.status
|
||||
},
|
||||
type: 'GET',
|
||||
success: res => {
|
||||
loading.close();
|
||||
if (res.code === 200) {
|
||||
this.$message.success(res.msg);
|
||||
let index = this.tableData.findIndex(v => v.id == row.id);
|
||||
} else {
|
||||
this.$message.warning(res.msg);
|
||||
}
|
||||
},
|
||||
error: function (er) {
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
addParams() {
|
||||
this.formData.params.push({
|
||||
title: '',
|
||||
content: ''
|
||||
})
|
||||
},
|
||||
delParams(index) {
|
||||
this.formData.params.splice(index, 1)
|
||||
},
|
||||
handleCopy(id) {
|
||||
this.$confirm('您确定要复制此模板吗?', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'info'
|
||||
}).then(() => {
|
||||
let loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在复制中...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.3)'
|
||||
});
|
||||
$.getJSON('shopro/goods/params/copy', {
|
||||
id,
|
||||
}, data => {
|
||||
loading.close();
|
||||
if (data.code === 200) {
|
||||
this.$message.success(data.msg);
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
} else {
|
||||
this.$message.warning(data.msg);
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
},
|
||||
// 添加/编辑
|
||||
openAddDialog(type, item) {
|
||||
this.addDialog = true;
|
||||
if (type === 'add') {
|
||||
this.title = '添加';
|
||||
this.formData = {
|
||||
id: 0,
|
||||
title: '',
|
||||
params: [],
|
||||
status: '1',
|
||||
};
|
||||
} else {
|
||||
this.title = '编辑';
|
||||
this.formData = {
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
params: JSON.parse(item.params),
|
||||
status: item.status.toString(),
|
||||
};
|
||||
}
|
||||
},
|
||||
// 从服务器读取数据
|
||||
loadData(key, currentPage, pageSize, sort) {
|
||||
this.listLoading = true;
|
||||
$.getJSON('shopro/goods/params/index', {
|
||||
keyword: key,
|
||||
type: this.search.type,
|
||||
start_time: this.sendStartTime,
|
||||
end_time: this.sendEndTime,
|
||||
status: this.search.status,
|
||||
page: currentPage,
|
||||
rows: pageSize,
|
||||
sort: sort,
|
||||
}, data => {
|
||||
this.totalCount = data.total;
|
||||
this.tableData = data.list;
|
||||
this.groupList = data.groupList;
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
// 排序
|
||||
sortChange(e) {
|
||||
|
||||
},
|
||||
// 搜索
|
||||
searchData() {
|
||||
this.sendStartTime = this.search.startTime !== '' ? +this.search.startTime / 1000 : '';
|
||||
this.sendEndTime = this.search.endTime !== '' ? +this.search.endTime / 1000 : '';
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
this.listLoading = false;
|
||||
},
|
||||
// 每页显示数据量变更
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
},
|
||||
// 页码变更
|
||||
handleCurrentChange(val) {
|
||||
this.currentPage = val;
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
},
|
||||
// 多选响应
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
// 批量删除
|
||||
del() {
|
||||
if (this.multipleSelection.length === 0) {
|
||||
this.$message.warning('请选择至少一个参数模板进行删除!');
|
||||
return;
|
||||
}
|
||||
var array = [];
|
||||
this.multipleSelection.forEach((row) => {
|
||||
array.push(row.id);
|
||||
});
|
||||
|
||||
this.$confirm('您确定要删除所选的参数模板吗?', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
let loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在删除中..',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.3)'
|
||||
});
|
||||
$.ajax({
|
||||
url: 'shopro/goods/params/dell',
|
||||
data: "id=" + array,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
success: res => {
|
||||
loading.close();
|
||||
if (res.code === 200) {
|
||||
this.$message.success(res.msg);
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
} else {
|
||||
this.$message.warning(res.msg);
|
||||
}
|
||||
},
|
||||
error: function (er) {
|
||||
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
},
|
||||
// 单条删除
|
||||
dell(id) {
|
||||
this.$confirm('您确定要删除此参数模板吗?', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
let loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在删除中..',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.3)'
|
||||
});
|
||||
$.ajax({
|
||||
url: 'shopro/goods/params/dell',
|
||||
data: {
|
||||
id
|
||||
},
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
success: res => {
|
||||
loading.close();
|
||||
if (res.code === 200) {
|
||||
this.$message.success(res.msg);
|
||||
this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort);
|
||||
} else {
|
||||
this.$message.warning(res.msg);
|
||||
}
|
||||
},
|
||||
error: function (er) {
|
||||
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,119 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'shopro/goods/service/index' + location.search,
|
||||
add_url: 'shopro/goods/service/add',
|
||||
edit_url: 'shopro/goods/service/edit',
|
||||
del_url: 'shopro/goods/service/del',
|
||||
multi_url: 'shopro/goods/service/multi',
|
||||
table: 'shopro_goods_service',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
Fast.config.openArea = ['100%', '100%'];
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name')},
|
||||
{field: 'image', title: __('Image'), events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'description', title: __('Description')},
|
||||
{field: 'status', title: __('状态'), formatter: function (value, row, index) {
|
||||
return value === 'normal' ? '<span style="color: green;">显示</span>' : '<span style="color: red;">隐藏</span>';
|
||||
}
|
||||
},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
'dragsort_url': ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: 'shopro/goods_service/recyclebin' + location.search,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), align: 'left'},
|
||||
{
|
||||
field: 'deletetime',
|
||||
title: __('Deletetime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
width: '130px',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'Restore',
|
||||
text: __('Restore'),
|
||||
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
||||
icon: 'fa fa-rotate-left',
|
||||
url: 'shopro/goods_service/restore',
|
||||
refresh: true
|
||||
},
|
||||
{
|
||||
name: 'Destroy',
|
||||
text: __('Destroy'),
|
||||
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||||
icon: 'fa fa-times',
|
||||
url: 'shopro/goods_service/destroy',
|
||||
refresh: true
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'shopro/goods/sku/index' + location.search,
|
||||
add_url: 'shopro/goods/sku/add',
|
||||
edit_url: 'shopro/goods/sku/edit',
|
||||
del_url: 'shopro/goods/sku/del',
|
||||
multi_url: 'shopro/goods/sku/multi',
|
||||
table: 'shopro_goods_sku',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name')},
|
||||
{field: 'pid', title: __('Pid')},
|
||||
{field: 'goods_id', title: __('Goods_id')},
|
||||
{field: 'weigh', title: __('Weigh')},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,120 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'shopro/goods/sku_price/index' + location.search,
|
||||
add_url: 'shopro/goods/sku_price/add',
|
||||
edit_url: 'shopro/goods/sku_price/edit',
|
||||
del_url: 'shopro/goods/sku_price/del',
|
||||
multi_url: 'shopro/goods/sku_price/multi',
|
||||
table: 'shopro_goods_sku_price',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'goods_sku_ids', title: __('Goods_sku_ids')},
|
||||
{field: 'goods_id', title: __('Goods_id')},
|
||||
{field: 'weigh', title: __('Weigh')},
|
||||
{field: 'image', title: __('Image'), events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'stock', title: __('Stock')},
|
||||
{field: 'sales', title: __('Sales')},
|
||||
{field: 'sn', title: __('Sn')},
|
||||
{field: 'weight', title: __('Weight')},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
'dragsort_url': ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: 'shopro/goods/sku_price/recyclebin' + location.search,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{
|
||||
field: 'deletetime',
|
||||
title: __('Deletetime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
width: '130px',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'Restore',
|
||||
text: __('Restore'),
|
||||
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
||||
icon: 'fa fa-rotate-left',
|
||||
url: 'shopro/goods/sku_price/restore',
|
||||
refresh: true
|
||||
},
|
||||
{
|
||||
name: 'Destroy',
|
||||
text: __('Destroy'),
|
||||
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||||
icon: 'fa fa-times',
|
||||
url: 'shopro/goods/sku_price/destroy',
|
||||
refresh: true
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,248 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'toastr'], function ($, undefined, Backend, Table, Form, Toastr) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
function debounce(handle, delay) {
|
||||
let time = null;
|
||||
return function () {
|
||||
let self = this,
|
||||
arg = arguments;
|
||||
clearTimeout(time);
|
||||
time = setTimeout(function () {
|
||||
handle.apply(self, arg);
|
||||
}, delay)
|
||||
}
|
||||
}
|
||||
var stockIndex = new Vue({
|
||||
el: "#stockIndex",
|
||||
data() {
|
||||
return {
|
||||
allAjax: true,
|
||||
tableAjax: false,
|
||||
stockList: [],
|
||||
warning_total: 0,
|
||||
over_total: 0,
|
||||
stockDialogVisible: false,
|
||||
stockId: null,
|
||||
stockForm: {
|
||||
stockNum: '',
|
||||
},
|
||||
stockRules: {
|
||||
stockNum: [
|
||||
{ required: true, message: '请输入补货数量', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
offset: 0,
|
||||
limit: 10,
|
||||
totalPage: 0,
|
||||
currentPage: 1,
|
||||
stock_warning_list: [{
|
||||
value: "all",
|
||||
label: "全部"
|
||||
}, {
|
||||
value: "warning",
|
||||
label: "预警中"
|
||||
}, {
|
||||
value: "over",
|
||||
label: "已售罄"
|
||||
}],
|
||||
searchForm: {
|
||||
goods_title: "",
|
||||
stock_type: "all"
|
||||
},
|
||||
searchFormInit: {
|
||||
goods_title: "",
|
||||
stock_type: "all"
|
||||
},
|
||||
searchOp: {
|
||||
goods_title: "like",
|
||||
stock_type: "=",
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getListData();
|
||||
},
|
||||
methods: {
|
||||
getListData() {
|
||||
let that = this;
|
||||
if (!that.allAjax) {
|
||||
that.tableAjax = true;
|
||||
}
|
||||
let filter = {}
|
||||
let op = {}
|
||||
for (key in that.searchForm) {
|
||||
if (that.searchForm[key] != '') {
|
||||
filter[key] = that.searchForm[key];
|
||||
}
|
||||
}
|
||||
for (key in filter) {
|
||||
op[key] = that.searchOp[key]
|
||||
}
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/goods/stock_warning/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
limit: that.limit,
|
||||
offset: that.offset,
|
||||
filter: JSON.stringify(filter),
|
||||
op: JSON.stringify(op)
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.stockList = res.data.rows
|
||||
that.totalPage = res.data.total;
|
||||
that.warning_total = res.data.warning_total
|
||||
that.over_total = res.data.over_total
|
||||
that.allAjax = false;
|
||||
that.tableAjax = false;
|
||||
return false;
|
||||
}, function (ret, res) {
|
||||
that.allAjax = false;
|
||||
that.tableAjax = false;
|
||||
})
|
||||
},
|
||||
screenEmpty() {
|
||||
this.searchForm = JSON.parse(JSON.stringify(this.searchFormInit))
|
||||
this.offset = 0
|
||||
this.limit = 10
|
||||
this.currentPage = 1
|
||||
this.getListData()
|
||||
},
|
||||
operation(type, id) {
|
||||
switch (type) {
|
||||
case 'recycle':
|
||||
Fast.api.open('shopro/goods/stock_warning/recyclebin', '查看回收站')
|
||||
break;
|
||||
case 'addStock':
|
||||
this.stockDialogVisible = true
|
||||
this.stockId = id
|
||||
break;
|
||||
case 'openGoods':
|
||||
Fast.api.open('shopro/goods/goods/edit/ids/' + id + "?id=" + id + "&type=edit", '商品', {
|
||||
callback() {
|
||||
that.getListData();
|
||||
}
|
||||
})
|
||||
break;
|
||||
|
||||
}
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.offset = 0
|
||||
this.limit = val;
|
||||
this.currentPage = 1;
|
||||
this.getListData()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.currentPage = val;
|
||||
this.offset = (val - 1) * this.limit;
|
||||
this.getListData()
|
||||
},
|
||||
closeStock(type) {
|
||||
let that = this;
|
||||
if (type == 1) {
|
||||
this.$refs.stock.validate((valid) => {
|
||||
if (valid) {
|
||||
Fast.api.ajax({
|
||||
url: `shopro/goods/stock_warning/addStock/ids/${that.stockId}`,
|
||||
loading: true,
|
||||
type: 'POST',
|
||||
data: {
|
||||
stock: that.stockForm.stockNum
|
||||
},
|
||||
}, function (ret, res) {
|
||||
that.getListData()
|
||||
that.stockDialogVisible = false
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
that.stockDialogVisible = false
|
||||
}
|
||||
that.stockForm.stockNum = ''
|
||||
that.stockId = null
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
'dragsort_url': ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: 'shopro/goods/stock_warning/recyclebin' + location.search,
|
||||
pk: 'id',
|
||||
sortName: 'deletetime',
|
||||
columns: [
|
||||
[{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: __('Id')
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: __('Title'),
|
||||
align: 'left',
|
||||
formatter: function(value, row){
|
||||
if(row.goods){
|
||||
return `<div class="displsy-flex">
|
||||
<img class="goods-image" src="${Fast.api.cdnurl(row.goods.image)}">
|
||||
<div class="ellipsis-item goods-title">
|
||||
${row.goods.title}
|
||||
</div>
|
||||
</div>`
|
||||
}else{
|
||||
return `${row.goods_id}`
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'goods_sku_text',
|
||||
title: '商品规格',
|
||||
},
|
||||
{
|
||||
field: 'deletetime',
|
||||
title: __('Deletetime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
width: '130px',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [{
|
||||
name: 'Destroy',
|
||||
text: __('Destroy'),
|
||||
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||||
icon: 'fa fa-times',
|
||||
url: 'shopro/goods/stock_warning/destroy',
|
||||
refresh: true
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户