Initial commit: 小众厨房项目代码

Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
可乐加冰
2026-09-23 17:04:10 +08:00
当前提交 f7d3d7d1bd
共有 1761 个文件被更改,包括 453668 次插入 和 0 次删除

查看文件

@@ -0,0 +1,4 @@
<FilesMatch '.(py|exe|php|PHP|Php|PHp|pHp|pHP|pHP7|PHP7|phP|PhP|php5|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>

查看文件

@@ -0,0 +1,230 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'toastr'], function ($, undefined, Backend, Table, Form, Toastr) {
var Controller = {
index: function () {},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'shopro/dispatch/autosend/recyclebin' + location.search,
pk: 'id',
sortName: 'deletetime',
columns: [
[{
checkbox: true
},
{
field: 'id',
title: __('Id')
},
{
field: 'name',
title: __('Title'),
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/dispatch/autosend/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'shopro/dispatch/autosend/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.detailInit('add');
},
edit: function () {
Controller.detailInit('edit');
},
detailInit: function (type) {
var dispatchDetail = new Vue({
el: "#dispatchDetail",
data() {
return {
optType: type,
dispatchForm: {},
rules: {
name: [{
required: true,
message: '请输入自提点名称',
trigger: 'blur'
}],
type: [{
required: true,
message: '请选择发货类型',
trigger: 'blur'
}],
timecontent: [{
required: true,
message: '请输入发货内容',
trigger: 'blur'
}],
},
dispatchFormInit: {
name: '',
type: 'text',
timecontent: '',
},
dispatch_id: null,
}
},
mounted() {
if (this.optType == 'add') {
this.dispatchForm = JSON.parse(JSON.stringify(this.dispatchFormInit));
} else {
this.dispatch_id = Config.row.id;
this.dispatchForm = JSON.parse(JSON.stringify(this.dispatchFormInit));
this.dispatchForm.type=Config.row.autosend.type;
this.dispatchForm.name=Config.row.name;
if(this.dispatchForm.type=='params'){
let arr=[]
Config.row.autosend.content.forEach((i,index)=>{
arr.push({
title:Object.keys(i)[0],
content:Object.values(i)[0],
})
})
this.dispatchForm.timecontent=arr;
}else{
this.dispatchForm.timecontent=Config.row.autosend.content
}
}
},
methods: {
radioChange(val){
if(val=='text'){
this.dispatchForm.timecontent='';
}else if(val=='params'){
this.dispatchForm.timecontent=[];
}
},
addParams() {
this.dispatchForm.timecontent.push({
title: '',
content: ''
})
},
delParams(index) {
this.dispatchForm.timecontent.splice(index, 1)
},
dispatchSub(type, issub) {
let that = this;
if (type == 'yes') {
this.$refs[issub].validate((valid) => {
if (valid) {
let subData = JSON.parse(JSON.stringify(that.dispatchForm));
if(subData.type=='params'){
let arrfield=[];
let arrcontent=[];
let paramsflg=true;
subData.timecontent.forEach(i=>{
for(key in i){
if(!i[key]){
paramsflg=false
}
}
arrfield.push(i.title);
arrcontent.push(i.content);
})
if(!paramsflg){
Toastr.error('发货详情未填写完整');
return false;
}
subData.content=[];
arrfield.forEach((i,index)=>{
let obj={}
obj[i]=arrcontent[index]
subData.content.push(obj)
})
} else{
subData.content=subData.timecontent
}
delete subData.timecontent
if (this.optType != 'add') {
Fast.api.ajax({
url: 'shopro/dispatch/autosend/edit?ids=' + that.dispatch_id,
loading: true,
data: {
data: JSON.stringify(subData)
}
}, function (ret, res) {
Fast.api.close({
data: true
})
})
} else {
Fast.api.ajax({
url: 'shopro/dispatch/autosend/add',
loading: true,
type: "POST",
data: {
data: JSON.stringify(subData)
}
}, function (ret, res) {
Fast.api.close({
data: true
})
})
}
} else {
return false;
}
});
} else {
Fast.api.close({
data: false
})
}
},
},
})
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

查看文件

@@ -0,0 +1,239 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
var dispatchIndex = new Vue({
el: "#dispatchIndex",
data() {
return {
dispatchData: [],
isData: false,
activeName: "express",
limit: 10,
offset: 0,
currentPage: 1,
totalPage: 0,
}
},
mounted() {
this.getData();
},
methods: {
handleCopyTpl(id) {
this.$confirm('您确定要复制此模板吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'info'
}).then(() => {
let that = this;
Fast.api.ajax({
url: 'shopro/dispatch/' + that.activeName + '/copy',
loading: true,
type: 'GET',
data: {
id
}
}, function (ret, res) {
console.log(res);
})
}).catch(() => {
});
},
getData() {
let that = this;
that.isData = false;
Fast.api.ajax({
url: 'shopro/dispatch/' + that.activeName + '/index',
loading: true,
type: 'GET',
data: {
limit: that.limit,
offset: that.offset,
}
}, function (ret, res) {
that.dispatchData = res.data.rows;
if (that.dispatchData.length == 0) {
that.isData = true
}
that.totalPage = res.data.total
return false;
})
},
tabClick(tab, event) {
this.dispatchData=[];
this.isData = false;
this.activeName = tab.name;
this.limit = 10;
this.offset = 0;
this.currentPage = 1;
this.getData();
},
operation(opttype, id, idx, type) {
let that = this;
switch (opttype) {
case 'delete':
that.$confirm('此操作将删除模板, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
Fast.api.ajax({
url: 'shopro/dispatch/' + type + '/del/ids/' + id,
loading: true,
type: 'POST',
}, function (ret, res) {
that.getData();
})
}).catch(() => {
that.$message({
type: 'info',
message: '已取消删除'
});
});
break;
case 'create':
Fast.api.open("shopro/dispatch/" + type + "/add", "创建模板", {
callback(data) {
if (data.data) {
that.getData();
}
}
});
break;
case 'edit':
Fast.api.open("shopro/dispatch/" + type + "/edit?ids=" + id, "编辑模板", {
callback(data) {
if (data.data) {
that.getData();
}
}
});
break;
case 'recycle':
Fast.api.open('shopro/dispatch/' + type + '/recyclebin', '查看回收站')
break;
}
},
pageSizeChange(val) {
this.limit = val;
this.offset = 0;
this.getData();
},
pageCurrentChange(val) {
this.offset = (val - 1) * 10,
this.limit = 10
this.getData();
},
tableRowClassName({
rowIndex
}) {
if (rowIndex % 2 == 1) {
return 'bg-color';
}
return '';
},
tableCellClassName({
columnIndex
}) {
if (columnIndex == 0) {
return 'cell-left';
} else if (columnIndex == 4) {
return 'border-right';
}
return '';
},
tableCellClassName2({
columnIndex
}) {
if (columnIndex == 1 || columnIndex == 2) {
return 'cell-left';
} else if (columnIndex == 4) {
return 'cell-left border-right';
}
return '';
},
},
})
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'shopro/dispatch/dispatch/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/dispatch/dispatch/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'shopro/dispatch/dispatch/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

查看文件

@@ -0,0 +1,265 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'toastr'], function ($, undefined, Backend, Table, Form, Toastr) {
var Controller = {
index: function () {},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'shopro/dispatch/express/recyclebin' + location.search,
pk: 'id',
sortName: 'deletetime',
columns: [
[{
checkbox: true
},
{
field: 'id',
title: __('Id')
},
{
field: 'name',
title: __('Title'),
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/dispatch/express/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'shopro/dispatch/express/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.detailInit('add');
},
edit: function () {
Controller.detailInit('edit');
},
detailInit: function (type) {
// 大于0的数、最多两位小数
Vue.directive('enterNumber', {
inserted: function (el) {
let changeValue = (el, type) => {
const e = document.createEvent('HTMLEvents')
e.initEvent(type, true, true)
el.dispatchEvent(e)
}
el.addEventListener("keyup", function (e) {
let input = e.target;
let reg = new RegExp('^((?:(?:[1-9]{1}\\d*)|(?:[0]{1}))(?:\\.(?:\\d){0,2})?)(?:\\d*)?$');
let matchRes = input.value.match(reg);
if (matchRes === null) {
input.value = "";
} else {
if (matchRes[1] !== matchRes[0]) {
input.value = matchRes[1];
}
}
changeValue(input, 'input')
});
}
});
var dispatchDetail = new Vue({
el: "#dispatchDetail",
data() {
return {
optType: type,
dispatchForm: {},
rules: {
name: [{
required: true,
message: '请输入模板名称',
trigger: 'blur'
}],
type: [{
required: true,
message: '请选择计价方式',
trigger: 'change'
}],
},
dispatchFormInit: {
name: '',
type: 'number',
express: [{
first_num: 0,
first_price: 0.00,
additional_num: 0,
additional_price: 0.00,
area_text: '',
province_ids: '',
city_ids: '',
area_ids: '',
weigh: '',
}],
},
dispatch_id: null,
deleteArr: ['createtime', 'deletetime', 'name', 'type', 'type_text', 'updatetime'],
}
},
mounted() {
if (this.optType == 'add') {
this.dispatchForm = JSON.parse(JSON.stringify(this.dispatchFormInit));
} else {
this.dispatch_id = Config.row.id;
this.dispatchForm = JSON.parse(JSON.stringify(this.dispatchFormInit));
for (key in this.dispatchForm) {
if (key == 'type') {
this.dispatchForm[key] = Config.row.express[0].type
} else {
this.dispatchForm[key] = Config.row[key]
}
}
this.dispatchForm.express.forEach(i => {
this.deleteArr.forEach(j => {
delete i[j]
})
})
}
},
methods: {
dispatchSub(type, issub) {
let that = this;
if (type == 'yes') {
this.$refs[issub].validate((valid) => {
if (valid) {
if (that.dispatchForm.express.length == 0) {
Toastr.error('请选择配送规则');
return false;
}
let isArea = true;
that.dispatchForm.express.forEach((i, index) => {
if (i.province_ids == '' && i.city_ids == '' && i.area_ids == '') {
isArea = false
}
})
if (!isArea) {
Toastr.error('请选择地址');
return false;
}
let subData = JSON.parse(JSON.stringify(that.dispatchForm));
let leng = subData.express.length;
subData.express.forEach((i, index) => {
i.weigh = leng - index;
delete i.area_text
})
if (this.optType != 'add') {
Fast.api.ajax({
url: 'shopro/dispatch/express/edit?ids=' + that.dispatch_id,
loading: true,
data: {
data: JSON.stringify(subData)
}
}, function (ret, res) {
Fast.api.close({
data: true
})
})
} else {
Fast.api.ajax({
url: 'shopro/dispatch/express/add',
loading: true,
type: "POST",
data: {
data: JSON.stringify(subData)
}
}, function (ret, res) {
Fast.api.close({
data: true
})
})
}
} else {
return false;
}
});
} else {
Fast.api.close({
data: false
})
}
},
editArea(index) {
let that = this;
let parmas = {
name: that.dispatchForm.express[index].area_text,
province_ids: that.dispatchForm.express[index].province_ids,
city_ids: that.dispatchForm.express[index].city_ids,
area_ids: that.dispatchForm.express[index].area_ids,
}
Fast.api.open('shopro/area/select?parmas=' + encodeURI(JSON.stringify(parmas)), '区域选择', {
callback(data) {
that.dispatchForm.express[index].area_text = data.data.name.join(',');
that.dispatchForm.express[index].province_ids = data.data.province.join(',')
that.dispatchForm.express[index].city_ids = data.data.city.join(',')
that.dispatchForm.express[index].area_ids = data.data.area.join(',')
}
})
},
delArea(index) {
this.dispatchForm.express.splice(index, 1);
},
addExpress() {
this.dispatchForm.express.push({
first_num: 0,
first_price: 0.00,
additional_num: 0,
additional_price: 0.00,
area_text: '',
province_ids: '',
city_ids: '',
area_ids: '',
weigh: '',
});
},
},
})
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

查看文件

@@ -0,0 +1,280 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'shopro/dispatch/selfetch/recyclebin' + location.search,
pk: 'id',
sortName: 'deletetime',
columns: [
[{
checkbox: true
},
{
field: 'id',
title: __('Id')
},
{
field: 'name',
title: __('Title'),
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/dispatch/selfetch/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'shopro/dispatch/selfetch/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.detailInit('add');
},
edit: function () {
Controller.detailInit('edit');
},
detailInit: function (type) {
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 dispatchDetail = new Vue({
el: "#dispatchDetail",
data() {
return {
optType: type,
dispatchForm: {},
rules: {
name: [{
required: true,
message: '请输入自提点名称',
trigger: 'blur'
}],
expire_type: [{
required: true,
message: '请选择有效时间',
trigger: 'blur'
}],
expire_day: [{
required: true,
message: '请输入有效天数',
trigger: 'blur'
}],
expire_time: [{
required: true,
message: '请选择截至日期',
trigger: 'blur'
}],
store_ids: [{
required: true,
message: '请选择自提门店',
trigger: 'blur'
}],
},
dispatchFormInit: {
name: '',
store_ids: [],
expire_type: 'day',
expire_day: 0,
expire_time: '',
},
storeOptions: [],
dispatch_id: null,
limit: 6,
offset: 0,
currentPage: 1,
totalPage: 0,
searchPage: '',
self_user_type: 'all'
}
},
mounted() {
if (this.optType == 'add') {
this.dispatchForm = JSON.parse(JSON.stringify(this.dispatchFormInit));
} else {
this.dispatch_id = Config.row.id;
this.dispatchForm = JSON.parse(JSON.stringify(this.dispatchFormInit));
for (key in this.dispatchForm) {
this.dispatchForm[key] = Config.row.selfetch[key]
}
this.dispatchForm.name = Config.row.name;
// this.dispatchForm.store_ids = this.dispatchForm.store_ids.split(',');
if (this.dispatchForm.expire_time) {
this.dispatchForm.expire_time = moment(this.dispatchForm.expire_time * 1000).format('YYYY-MM-DD HH:mm:ss');
}
this.storeOptions=this.dispatchForm.store_ids_list
if (this.dispatchForm.store_ids.length>0) {
this.self_user_type = 'part'
}
}
this.getstoreOptions()
},
methods: {
getstoreOptions() {
let that = this;
Fast.api.ajax({
url: 'shopro/store/store/select',
loading: true,
type: 'GET',
data: {
limit: that.limit,
offset: that.offset,
filter: '{"selfetch":"1"}',
op: '{"selfetch":"="}',
searchWhere: that.searchPage,
}
}, function (ret, res) {
that.storeOptions = res.data.rows;
that.totalPage = res.data.total;
return false;
})
},
debounceFilter: debounce(function () {
this.getstoreOptions()
}, 3000),
dataFilter(val) {
this.searchPage = val;
this.limit = 6;
this.offset = 0;
this.currentPage = 1;
this.debounceFilter()
},
//分页
pageSizeChange(val) {
this.offset = 0;
this.limit = val;
this.currentPage = 1;
this.getstoreOptions();
},
pageCurrentChange(val) {
this.offset = (val - 1) * 6;
this.limit = 6;
this.currentPage = 1;
this.getstoreOptions();
},
dispatchSub(type, issub) {
let that = this;
if (type == 'yes') {
this.$refs[issub].validate((valid) => {
if (valid) {
let subData = JSON.parse(JSON.stringify(that.dispatchForm));
if (that.self_user_type == 'all') {
subData.store_ids = ''
} else {
subData.store_ids = subData.store_ids.join(',');
}
if (subData.expire_type == 'day') {
delete subData.expire_time
} else {
delete subData.expire_day
subData.expire_time = moment(subData.expire_time).valueOf() / 1000;
}
// return false;
if (this.optType != 'add') {
Fast.api.ajax({
url: 'shopro/dispatch/selfetch/edit?ids=' + that.dispatch_id,
loading: true,
data: {
data: JSON.stringify(subData)
}
}, function (ret, res) {
Fast.api.close({
data: true
})
})
} else {
Fast.api.ajax({
url: 'shopro/dispatch/selfetch/add',
loading: true,
type: "POST",
data: {
data: JSON.stringify(subData)
}
}, function (ret, res) {
Fast.api.close({
data: true
})
})
}
} else {
return false;
}
});
} else {
Fast.api.close({
data: false
})
}
},
createStore() {
let that = this;
Fast.api.open('shopro/store/store/add', '增加门店', {
callback(data) {
that.getstoreOptions();
}
})
}
},
})
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

查看文件

@@ -0,0 +1,247 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () { },
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'shopro/dispatch/store/recyclebin' + location.search,
pk: 'id',
sortName: 'deletetime',
columns: [
[{
checkbox: true
},
{
field: 'id',
title: __('Id')
},
{
field: 'name',
title: __('Title'),
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/dispatch/store/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'shopro/dispatch/store/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.detailInit('add');
},
edit: function () {
Controller.detailInit('edit');
},
detailInit: function (type) {
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 dispatchDetail = new Vue({
el: "#dispatchDetail",
data() {
return {
optType: type,
dispatchForm: {},
rules: {
name: [{
required: true,
message: '请输入模板名称',
trigger: 'blur'
}],
store_ids: [{
required: true,
message: '请选择配送门店',
trigger: 'blur'
}],
},
dispatchFormInit: {
name: '',
store_ids: []
},
storeOptions: [],
dispatch_id: null,
limit: 6,
offset: 0,
currentPage: 1,
totalPage: 0,
self_user_type: 'all'
}
},
mounted() {
if (this.optType == 'add') {
this.dispatchForm = JSON.parse(JSON.stringify(this.dispatchFormInit));
} else {
this.dispatch_id = Config.row.id;
this.dispatchForm = JSON.parse(JSON.stringify(this.dispatchFormInit));
this.dispatchForm.name = Config.row.name
this.dispatchForm.store_ids = Config.row.store.store_ids;
this.storeOptions = Config.row.store.store_ids_list
if (this.dispatchForm.store_ids.length>0) {
this.self_user_type = 'part'
}
}
this.getstoreOptions()
},
methods: {
getstoreOptions() {
let that = this;
Fast.api.ajax({
url: 'shopro/store/store/select',
loading: true,
type: 'GET',
data: {
limit: that.limit,
offset: that.offset,
filter: '{"store":"1"}',
op: '{"store":"="}',
searchWhere: that.searchPage,
}
}, function (ret, res) {
that.storeOptions = res.data.rows;
that.totalPage = res.data.total;
return false;
})
},
dispatchSub(type, issub) {
let that = this;
if (type == 'yes') {
this.$refs[issub].validate((valid) => {
if (valid) {
let subData = JSON.parse(JSON.stringify(that.dispatchForm));
if (that.self_user_type == 'all') {
subData.store_ids = ''
} else {
subData.store_ids = subData.store_ids.join(',')
}
if (this.optType != 'add') {
Fast.api.ajax({
url: 'shopro/dispatch/store/edit?ids=' + that.dispatch_id,
loading: true,
data: {
data: JSON.stringify(subData)
}
}, function (ret, res) {
Fast.api.close({
data: true
})
})
} else {
Fast.api.ajax({
url: 'shopro/dispatch/store/add',
loading: true,
type: "POST",
data: {
data: JSON.stringify(subData)
}
}, function (ret, res) {
Fast.api.close({
data: true
})
})
}
} else {
return false;
}
});
} else {
Fast.api.close({
data: false
})
}
},
createStore() {
let that=this;
Fast.api.open('shopro/store/store/add', '增加门店', {
callback(data) {
that.getstoreOptions();
}
})
},
debounceFilter: debounce(function () {
this.getstoreOptions()
}, 1000),
dataFilter(val) {
this.searchPage = val;
this.limit = 6;
this.offset = 0;
this.currentPage = 1;
this.debounceFilter()
},
//分页
pageSizeChange(val) {
this.offset = 0;
this.limit = val;
this.currentPage = 1;
this.getstoreOptions();
},
pageCurrentChange(val) {
this.offset = (val - 1) * 6;
this.limit = 6;
this.currentPage = 1;
this.getstoreOptions();
},
},
})
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});