feat: 初始化雄戈商城服务端代码与Webhook自动部署配置
这个提交包含在:
@@ -0,0 +1,233 @@
|
||||
const { Callbacks } = require("jquery");
|
||||
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
var applyIndex = new Vue({
|
||||
el: "#applyIndex",
|
||||
data() {
|
||||
return {
|
||||
isAjax: true,
|
||||
isAjaxtable: false,
|
||||
activeTabsName: 'all',
|
||||
tabsList: [{
|
||||
name: 'all',
|
||||
label: '全部'
|
||||
},{
|
||||
name: '0',
|
||||
label: '待审核'
|
||||
},{
|
||||
name: '1',
|
||||
label: '已同意'
|
||||
},{
|
||||
name: '-1',
|
||||
label: '已拒绝'
|
||||
}],
|
||||
searchForm: {
|
||||
status: "all",
|
||||
name: "",
|
||||
realname: "",
|
||||
phone: "",
|
||||
},
|
||||
searchFormInit: {
|
||||
status: "all",
|
||||
name: "",
|
||||
realname: "",
|
||||
phone: "",
|
||||
},
|
||||
searchOp: {
|
||||
status: "=",
|
||||
name: "like",
|
||||
realname: "like",
|
||||
phone: "like",
|
||||
},
|
||||
listData: [],
|
||||
offset: 0,
|
||||
limit: 10,
|
||||
totalPage: 0,
|
||||
currentPage: 1,
|
||||
rejectReason:""
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getListData();
|
||||
},
|
||||
methods: {
|
||||
getListData() {
|
||||
let that = this;
|
||||
if (!that.isAjax) {
|
||||
that.isAjaxtable = true;
|
||||
}
|
||||
let filter = {}
|
||||
let op = {}
|
||||
for (key in that.searchForm) {
|
||||
if (that.searchForm[key] != '' && that.searchForm[key] != 'all') {
|
||||
filter[key] = that.searchForm[key];
|
||||
}
|
||||
}
|
||||
for (key in filter) {
|
||||
op[key] = that.searchOp[key]
|
||||
}
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/store/apply/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
offset: that.offset,
|
||||
limit: that.limit,
|
||||
filter: JSON.stringify(filter),
|
||||
op: JSON.stringify(op)
|
||||
},
|
||||
}, function (ret, res) {
|
||||
that.listData = res.data.rows;
|
||||
that.totalPage = res.data.total;
|
||||
that.isAjax = false;
|
||||
that.isAjaxtable = false;
|
||||
return false;
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
that.isAjaxtable = false;
|
||||
return false;
|
||||
})
|
||||
},
|
||||
screenEmpty() {
|
||||
this.searchForm = JSON.parse(JSON.stringify(this.searchFormInit))
|
||||
},
|
||||
operation(type, id, index) {
|
||||
let that = this;
|
||||
switch (type) {
|
||||
case 'cancel':
|
||||
that.$refs['refNamePopover'+index].doClose();
|
||||
that.rejectReason='';
|
||||
break;
|
||||
case 'reject':
|
||||
Fast.api.ajax({
|
||||
url: `shopro/store/apply/applyOper/id/${id}`,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
data: {
|
||||
status:'-1',
|
||||
status_msg:that.rejectReason
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.$refs['refNamePopover'+index].doClose();
|
||||
that.rejectReason='';
|
||||
that.getListData();
|
||||
}, function (ret, res) {
|
||||
that.$refs['refNamePopover'+index].doClose();
|
||||
that.rejectReason='';
|
||||
})
|
||||
break;
|
||||
case 'agree':
|
||||
Fast.api.ajax({
|
||||
url: `shopro/store/apply/applyOper/id/${id}`,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
data: {
|
||||
status:'1',
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.getListData();
|
||||
Fast.api.open(`shopro/store/store/edit?ids=${res.data.store.id}`, "门店详情");
|
||||
return false;
|
||||
})
|
||||
break;
|
||||
case 'view':
|
||||
Fast.api.open(`shopro/store/apply/detail?ids=${id}`, "查看详情",{
|
||||
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()
|
||||
},
|
||||
tabshandleClick(value) {
|
||||
this.offset = 0;
|
||||
this.limit = 10;
|
||||
this.totalPage = 0;
|
||||
this.currentPage = 1;
|
||||
this.getListData();
|
||||
},
|
||||
tableCellClassName({
|
||||
columnIndex
|
||||
}) {
|
||||
if (columnIndex == 0 || columnIndex == 6 || columnIndex == 8) {
|
||||
return 'cell-left';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
detail: function () {
|
||||
var applyDetail = new Vue({
|
||||
el: "#applyDetail",
|
||||
data() {
|
||||
return {
|
||||
detailForm:{},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.detailForm=Config.row;
|
||||
},
|
||||
methods: {
|
||||
operation(type, id, index) {
|
||||
let that = this;
|
||||
switch (type) {
|
||||
case 'reject':
|
||||
if(!that.detailForm.status_msg){
|
||||
that.$message({
|
||||
message: '请填写拒绝理由',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
Fast.api.ajax({
|
||||
url: `shopro/store/apply/applyOper/id/${that.detailForm.id}`,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
data: {
|
||||
status:'-1',
|
||||
status_msg:that.detailForm.status_msg
|
||||
}
|
||||
}, function (ret, res) {
|
||||
Fast.api.close()
|
||||
})
|
||||
break;
|
||||
case 'agree':
|
||||
Fast.api.ajax({
|
||||
url: `shopro/store/apply/applyOper/id/${that.detailForm.id}`,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
data: {
|
||||
status:'1',
|
||||
}
|
||||
}, function (ret, res) {
|
||||
window.location.reload();
|
||||
parent.Fast.api.open(`shopro/store/store/edit?ids=${res.data.store.id}`, "门店详情",{
|
||||
callback(){
|
||||
Fast.api.close()
|
||||
}
|
||||
});
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,480 @@
|
||||
requirejs.config({
|
||||
paths: {
|
||||
g2: "/assets/addons/shopro/libs/antv"
|
||||
}
|
||||
})
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'g2'], function ($, undefined, Backend, Table, Form, G2) {
|
||||
|
||||
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 dashboardIndex = new Vue({
|
||||
el: "#dashboardIndex",
|
||||
data() {
|
||||
return {
|
||||
orderList: [],
|
||||
chartsData: [],
|
||||
dataList: [{
|
||||
id: 'payed',
|
||||
title: '支付订单',
|
||||
num: 0,
|
||||
checked: true,
|
||||
type:'payOrder',
|
||||
color: 'rgba(157, 96, 255, 1)',
|
||||
back: 'rgba(157, 96, 255, 0.1)',
|
||||
unit: '单'
|
||||
}, {
|
||||
id: 'paymoney',
|
||||
title: '支付金额',
|
||||
num: 0,
|
||||
checked: true,
|
||||
type:'payAmount',
|
||||
color: 'rgba(0,198,198,1)',
|
||||
back: 'rgba(0,198,198,0.1)',
|
||||
unit: '元'
|
||||
}, {
|
||||
id: 'nosend',
|
||||
title: '待备货订单',
|
||||
num: 0,
|
||||
checked: false,
|
||||
type:'noSent',
|
||||
color: 'rgba(246,95,34,1)',
|
||||
back: 'rgba(246,95,34,0.1)',
|
||||
unit: '笔'
|
||||
}, {
|
||||
id: 'noget',
|
||||
title: '待配送/待核销',
|
||||
num: 0,
|
||||
checked: false,
|
||||
type:'offSent',
|
||||
color: 'rgba(101,180,1,1)',
|
||||
back: 'rgba(101,180,1,0.1)',
|
||||
unit: '笔'
|
||||
},
|
||||
{
|
||||
id: 'orderpersonnum',
|
||||
title: '下单人数',
|
||||
num: 0,
|
||||
checked: false,
|
||||
type:'down',
|
||||
color: 'rgba(231,19,184,1)',
|
||||
back: 'rgba(231,19,184,0.1)',
|
||||
unit: '人'
|
||||
}, {
|
||||
id: 'allordernum',
|
||||
title: '总订单量(含未付款)',
|
||||
num: 0,
|
||||
checked: false,
|
||||
type:'order',
|
||||
color: 'rgba(50,108,222,1)',
|
||||
back: 'rgba(50,108,222,0.1)',
|
||||
unit: '笔'
|
||||
}, {
|
||||
id: 'aftersale',
|
||||
title: '维权订单',
|
||||
num: 0,
|
||||
checked: false,
|
||||
type: 'aftersale',
|
||||
color: 'rgba(231,172,37,1)',
|
||||
back: 'rgba(231,172,37,0.1)',
|
||||
unit: '笔'
|
||||
}, {
|
||||
id: 'refund',
|
||||
title: '退款订单',
|
||||
num: 0,
|
||||
checked: false,
|
||||
type: 'refund',
|
||||
color: 'rgba(237,41,104,1)',
|
||||
back: 'rgba(237,41,104,0.1)',
|
||||
unit: '笔'
|
||||
}
|
||||
],
|
||||
selectInputs: [],
|
||||
dropdownList: [{
|
||||
date: 'yesterday',
|
||||
name: '昨日'
|
||||
}, {
|
||||
date: 'today',
|
||||
name: '今日'
|
||||
}, {
|
||||
date: 'week',
|
||||
name: '近一周'
|
||||
}, {
|
||||
date: 'month',
|
||||
name: '近一月'
|
||||
}, {
|
||||
date: 'year',
|
||||
name: '近一年'
|
||||
}],
|
||||
dropdownName: '今日',
|
||||
dropdownDate: 'today',
|
||||
searchTime: [new Date(), new Date()],
|
||||
//支付单数/总单数
|
||||
tranPeople: 0,
|
||||
tranPeoplescale: 0,
|
||||
//支付比例
|
||||
allOrderPayNum: 0,
|
||||
transcale: 0,
|
||||
allAjax: false,
|
||||
storeSelected: '0',
|
||||
searchWhree:'',
|
||||
storeSelectList: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
//请求数据
|
||||
this.getstoreOptions();
|
||||
this.changeTime();
|
||||
},
|
||||
methods: {
|
||||
getstoreOptions() {
|
||||
let that = this;
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/store/store/all',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
search: that.searchWhree,
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.storeSelectList = res.data;
|
||||
that.storeSelectList.unshift({
|
||||
id:'0',
|
||||
name:'全部门店'
|
||||
})
|
||||
return false;
|
||||
})
|
||||
},
|
||||
sdebounceFilter: debounce(function () {
|
||||
this.getstoreOptions()
|
||||
}, 1000),
|
||||
dataFilter(val) {
|
||||
this.searchWhree = val;
|
||||
this.sdebounceFilter()
|
||||
},
|
||||
//折线
|
||||
charts() {
|
||||
$("#antvContainer").empty()
|
||||
const chart = new G2.Chart({
|
||||
container: 'antvContainer',
|
||||
autoFit: true,
|
||||
height: 332,
|
||||
animate: true,
|
||||
});
|
||||
chart.data(this.chartsData);
|
||||
var dataBoxNum = 0
|
||||
this.selectInputs.forEach(e => {
|
||||
if (e.checked) {
|
||||
dataBoxNum++
|
||||
}
|
||||
})
|
||||
if (dataBoxNum == 1) {
|
||||
let title
|
||||
this.selectInputs.forEach(i => {
|
||||
if (i.checked) {
|
||||
title = i.title
|
||||
}
|
||||
})
|
||||
chart.scale({
|
||||
date: {
|
||||
alias: ' ',
|
||||
},
|
||||
y2: {
|
||||
alias: title,
|
||||
min: 0,
|
||||
sync: true,
|
||||
nice: true,
|
||||
},
|
||||
});
|
||||
chart
|
||||
.line()
|
||||
.position('date*y2')
|
||||
.color(this.selectInputs[0].color).size(10).shape('smooth');
|
||||
} else if (dataBoxNum == 2) {
|
||||
chart.scale({
|
||||
date: {
|
||||
alias: ' ',
|
||||
},
|
||||
y2: {
|
||||
alias: this.selectInputs[1].title,
|
||||
sync: true,
|
||||
nice: true,
|
||||
min: 0
|
||||
},
|
||||
y1: {
|
||||
alias: this.selectInputs[0].title,
|
||||
sync: true,
|
||||
nice: true,
|
||||
min: 0
|
||||
},
|
||||
});
|
||||
chart
|
||||
.line().size(10)
|
||||
.position('date*y1')
|
||||
.color(this.selectInputs[0].color).shape('smooth');
|
||||
chart
|
||||
.line().size(10)
|
||||
.position('date*y2')
|
||||
.color(this.selectInputs[1].color).shape('smooth');
|
||||
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
chart.axis('y1', {
|
||||
grid: null,
|
||||
title: null, //左右不显示坐标提示{}
|
||||
});
|
||||
chart.axis('y2', {
|
||||
title: null,
|
||||
});
|
||||
|
||||
chart.tooltip({
|
||||
showCrosshairs: true, //展示辅助线
|
||||
shared: true,
|
||||
});
|
||||
chart.render();
|
||||
this.allAjax = false;
|
||||
},
|
||||
//选择显示数据
|
||||
selectLine(idx) {
|
||||
this.dataList[idx].checked = !this.dataList[idx].checked
|
||||
if (this.dataList[idx].checked == true) {
|
||||
this.selectInputs.push(this.dataList[idx]);
|
||||
if (this.selectInputs.length > 2) {
|
||||
this.selectInputs[0].checked = false;
|
||||
this.selectInputs.shift();
|
||||
}
|
||||
} else {
|
||||
this.selectInputs.forEach((item, index) => {
|
||||
if (this.dataList[idx].id == item.id)
|
||||
this.selectInputs.splice(index, 1);
|
||||
})
|
||||
}
|
||||
this.countOrderData()
|
||||
},
|
||||
//选择时间段
|
||||
changeTime(index = 1) {
|
||||
this.dropdownDate = this.dropdownList[index].date;
|
||||
this.dropdownName = this.dropdownList[index].name;
|
||||
this.searchTime = this.getTimeSlot();
|
||||
this.getDataInfo();
|
||||
},
|
||||
//选择请求数据
|
||||
getDataInfo() {
|
||||
let that = this
|
||||
that.allAjax = true
|
||||
let timeSlot = this.searchTime.join(' - ')
|
||||
|
||||
let urlData={
|
||||
datetimerange: timeSlot
|
||||
}
|
||||
if(that.storeSelected!='all'){
|
||||
urlData={
|
||||
datetimerange: timeSlot,
|
||||
store_id:that.storeSelected
|
||||
}
|
||||
}
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/store/dashboard/index',
|
||||
loading: false,
|
||||
data: urlData,
|
||||
success: function (res, ret) {
|
||||
that.dataList.forEach(d=>{
|
||||
d.num=res.data[d.type+'Num']
|
||||
d.item=res.data[d.type+'Arr']
|
||||
})
|
||||
|
||||
//判断是否选中
|
||||
that.selectInputs = []
|
||||
that.dataList.forEach((item, index) => {
|
||||
if (item.checked == true) that.selectInputs.push(item);
|
||||
})
|
||||
// 请求数据
|
||||
that.countOrderData();
|
||||
}
|
||||
})
|
||||
},
|
||||
countOrderData() {
|
||||
let that = this;
|
||||
let time = (
|
||||
new Date(that.searchTime[1]).getTime() - new Date(that.searchTime[0]).getTime()
|
||||
) / 1000 + 1;
|
||||
let kld = '';
|
||||
let interval = 0;
|
||||
if (time <= 60 * 60) {
|
||||
interval = parseInt(time / 60);
|
||||
|
||||
kld = 'minutes';
|
||||
} else if (time <= 60 * 60 * 24) {
|
||||
interval = parseInt(time / (60 * 60));
|
||||
|
||||
kld = 'hours';
|
||||
} else if (time <= 60 * 60 * 24 * 30 * 1.5) {
|
||||
interval = parseInt(time / (60 * 60 * 24));
|
||||
|
||||
kld = 'days';
|
||||
|
||||
} else if (time < 60 * 60 * 24 * 30 * 24) {
|
||||
interval = parseInt(time / (60 * 60 * 24 * 30));
|
||||
|
||||
kld = 'months';
|
||||
|
||||
} else if (time >= 60 * 60 * 24 * 30 * 24) {
|
||||
interval = parseInt(time / (60 * 60 * 24 * 30 * 12));
|
||||
|
||||
kld = 'years';
|
||||
|
||||
}
|
||||
this.drawX(interval, kld);
|
||||
|
||||
},
|
||||
drawX(interval, kld) {
|
||||
let that = this
|
||||
let x = [];
|
||||
let selectInputLeng = 0
|
||||
this.selectInputs.forEach(e => {
|
||||
if (e.checked) {
|
||||
selectInputLeng++
|
||||
}
|
||||
})
|
||||
for (let i = 0; i <= interval; i++) {
|
||||
if (kld == 'minutes' || kld == 'hours') {
|
||||
x.push({
|
||||
date: moment(that.searchTime[0]).add(i, kld).format("DD HH:mm"),
|
||||
timeStamp: moment(that.searchTime[0]).add(i, kld).valueOf(),
|
||||
y2: 0,
|
||||
y1: 0
|
||||
});
|
||||
} else if (kld == 'days') {
|
||||
x.push({
|
||||
date: moment(that.searchTime[0]).add(i, kld).format("YYYY-MM-DD"),
|
||||
timeStamp: moment(that.searchTime[0]).add(i, kld).valueOf(),
|
||||
y2: 0,
|
||||
y1: 0
|
||||
});
|
||||
} else if (kld == 'months') {
|
||||
x.push({
|
||||
date: moment(that.searchTime[0]).add(i, kld).format("YYYY-MM"),
|
||||
timeStamp: moment(that.searchTime[0]).add(i, kld).valueOf(),
|
||||
y2: 0,
|
||||
y1: 0
|
||||
});
|
||||
} else {
|
||||
x.push({
|
||||
date: moment(that.searchTime[0]).add(i, kld).format("YYYY"),
|
||||
timeStamp: moment(that.searchTime[0]).add(i, kld).valueOf(),
|
||||
y2: 0,
|
||||
y1: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
if (selectInputLeng == 1) {
|
||||
for (var y = 0; y < x.length; y++) {
|
||||
let y2 = 0
|
||||
let selectItem = []
|
||||
this.selectInputs.forEach(element => {
|
||||
if (element.checked == true) {
|
||||
selectItem = element.item
|
||||
}
|
||||
})
|
||||
selectItem.forEach(se => {
|
||||
if (y != x.length - 1) {
|
||||
if (se.createtime > x[y].timeStamp && se.createtime <= x[y + 1].timeStamp) {
|
||||
y2 += Number(se.counter)
|
||||
}
|
||||
} else {
|
||||
if (se.createtime > x[y].timeStamp) {
|
||||
y2 += Number(se.counter)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
x[y].y2 = y2
|
||||
}
|
||||
}
|
||||
if (selectInputLeng == 2) {
|
||||
for (var y = 0; y < x.length; y++) {
|
||||
let y1 = 0
|
||||
let y2 = 0
|
||||
this.selectInputs.forEach((si,sindex)=>{
|
||||
si.item.forEach(se => {
|
||||
if (y != x.length - 1) {
|
||||
if (se.createtime > x[y].timeStamp && se.createtime <= x[y + 1].timeStamp) {
|
||||
if(sindex==0){
|
||||
y1 += Number(se.counter)
|
||||
}else{
|
||||
y2+= Number(se.counter)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (se.createtime > x[y].timeStamp) {
|
||||
if(sindex==0){
|
||||
y1 += Number(se.counter)
|
||||
}else{
|
||||
y2+= Number(se.counter)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
x[y].y1 = y1
|
||||
x[y].y2 = y2
|
||||
}
|
||||
}
|
||||
that.chartsData = x
|
||||
that.allAjax = false
|
||||
that.charts()
|
||||
},
|
||||
//获取时间
|
||||
getTimeSlot() {
|
||||
let beginTime = '';
|
||||
let endTime = moment().format('YYYY-MM-DD');
|
||||
switch (this.dropdownDate) {
|
||||
case 'yesterday':
|
||||
endTime = moment().subtract(1, 'days').format('YYYY-MM-DD')
|
||||
beginTime = endTime
|
||||
break;
|
||||
case 'today':
|
||||
beginTime = endTime;
|
||||
break;
|
||||
case 'week':
|
||||
beginTime = moment().subtract(1, 'weeks').format('YYYY-MM-DD')
|
||||
break;
|
||||
case 'month':
|
||||
beginTime = moment().subtract(1, 'months').format('YYYY-MM-DD')
|
||||
break;
|
||||
case 'year':
|
||||
beginTime = moment().subtract(1, 'years').format('YYYY-MM-DD')
|
||||
break;
|
||||
}
|
||||
let timeSlot = [beginTime + ' 00:00:00', endTime + ' 23:59:59'];
|
||||
return timeSlot;
|
||||
},
|
||||
goDetail(status) {
|
||||
let that = this;
|
||||
let times = encodeURI(that.searchTime.join(" - "))
|
||||
parent.Fast.api.open(`shopro/order/order/index?status=${status}&datetimerange=${times}&store_id=${that.storeSelected}`, "查看详情", {
|
||||
callback: function (data) {}
|
||||
});
|
||||
return false;
|
||||
},
|
||||
scaleFunc(a, b) {
|
||||
return (a <= 0 ? 0 : a / b).toFixed(2) - 0
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,865 @@
|
||||
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 storeIndex = new Vue({
|
||||
el: "#storeIndex",
|
||||
data() {
|
||||
return {
|
||||
storeData: [],
|
||||
searchKey: '',
|
||||
currentPage: 1,
|
||||
limit: 10,
|
||||
offset: 0,
|
||||
totalPage: 0,
|
||||
allAjax: true,
|
||||
tableAjax: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getData();
|
||||
if (!Config.hasAmap) {
|
||||
Toastr.error('请在商城配置->第三方服务中配置高德地图')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
let that = this;
|
||||
if (!that.allAjax) {
|
||||
that.tableAjax = true;
|
||||
}
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/store/store/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
search: that.searchKey,
|
||||
limit: that.limit,
|
||||
offset: that.offset
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.storeData = res.data.rows;
|
||||
that.totalPage = res.data.total;
|
||||
that.allAjax = false;
|
||||
that.tableAjax = false;
|
||||
return false;
|
||||
}, function (ret, res) {
|
||||
that.allAjax = false;
|
||||
that.tableAjax = false;
|
||||
})
|
||||
},
|
||||
operation(opttype, id, status) {
|
||||
let that = this;
|
||||
switch (opttype) {
|
||||
case 'delete':
|
||||
that.$confirm('此操作将删除门店, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/store/store/del/ids/' + id,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
}, function (ret, res) {
|
||||
that.getData()
|
||||
})
|
||||
}).catch(() => {
|
||||
that.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
break;
|
||||
case 'status':
|
||||
let str = status == 1 ? 0 : 1;
|
||||
that.$confirm('此操作将修改门店状态, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
Fast.api.ajax({
|
||||
url: `shopro/store/store/setStatus/ids/${id}/status/${str}`,
|
||||
loading: false,
|
||||
}, function (ret, res) {
|
||||
that.getData();
|
||||
})
|
||||
}).catch(() => {
|
||||
that.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'create':
|
||||
Fast.api.open("shopro/store/store/add", "创建门店", {
|
||||
area: ['100%', '100%'],
|
||||
callback(data) {
|
||||
if (data.data) {
|
||||
that.getData();
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'edit':
|
||||
Fast.api.open("shopro/store/store/edit?ids=" + id, "编辑门店", {
|
||||
area: ['100%', '100%'],
|
||||
callback(data) {
|
||||
if (data.data) {
|
||||
that.getData();
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'recycle':
|
||||
Fast.api.open("shopro/store/store/recyclebin", "回收站", function () {
|
||||
that.getData();
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
pageSizeChange(val) {
|
||||
this.offset = 0;
|
||||
this.currentPage = 1
|
||||
this.limit = val;
|
||||
this.getData();
|
||||
},
|
||||
pageCurrentChange(val) {
|
||||
this.offset = (val - 1) * this.limit;
|
||||
this.currentPage = val;
|
||||
this.getData();
|
||||
},
|
||||
tableRowClassName({
|
||||
rowIndex
|
||||
}) {
|
||||
if (rowIndex % 2 == 1) {
|
||||
return 'bg-color';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
tableCellClassName({
|
||||
columnIndex
|
||||
}) {
|
||||
if (columnIndex == 1 || columnIndex == 2 || columnIndex == 7) {
|
||||
return 'cell-left';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
debounceFilter: debounce(function () {
|
||||
this.getData()
|
||||
}, 1000),
|
||||
},
|
||||
watch: {
|
||||
searchKey(newVal, oldVal) {
|
||||
if (newVal != oldVal) {
|
||||
this.debounceFilter();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
'dragsort_url': ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: 'shopro/store/store/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/store/store/restore',
|
||||
refresh: true
|
||||
},
|
||||
{
|
||||
name: 'Destroy',
|
||||
text: __('Destroy'),
|
||||
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||||
icon: 'fa fa-times',
|
||||
url: 'shopro/store/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) {
|
||||
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')
|
||||
});
|
||||
}
|
||||
});
|
||||
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 storeDetail = new Vue({
|
||||
el: "#storeDetail",
|
||||
data() {
|
||||
return {
|
||||
opttype: type,
|
||||
storeForm: {},
|
||||
rules: {
|
||||
name: [{
|
||||
required: true,
|
||||
message: '请输入门店名称',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
images: [{
|
||||
required: true,
|
||||
message: '请选择门店图片',
|
||||
trigger: 'change'
|
||||
}],
|
||||
realname: [{
|
||||
required: true,
|
||||
message: '请选择联系人',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
phone: [{
|
||||
required: true,
|
||||
message: '请输入联系电话',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
user_ids: [{
|
||||
required: true,
|
||||
message: '请选择管理员',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
express_type: [{
|
||||
required: true,
|
||||
message: '请选择配送方式',
|
||||
trigger: 'change'
|
||||
}],
|
||||
openhours: [{
|
||||
required: true,
|
||||
message: '请选择营业时间',
|
||||
trigger: 'change'
|
||||
}],
|
||||
openweeks: [{
|
||||
required: true,
|
||||
message: '请选择星期',
|
||||
trigger: 'change'
|
||||
}],
|
||||
store_address: [{
|
||||
required: true,
|
||||
message: '请选择省市区',
|
||||
trigger: 'change'
|
||||
}],
|
||||
address: [{
|
||||
required: true,
|
||||
message: '请输入详细地址',
|
||||
trigger: 'change'
|
||||
}],
|
||||
},
|
||||
storeFormInit: {
|
||||
name: '',
|
||||
realname: '',
|
||||
phone: '',
|
||||
store_address: [],
|
||||
store_address_id: [],
|
||||
address: '',
|
||||
user_ids: [],
|
||||
delivery_fee: 0,
|
||||
express_type: ['store'],
|
||||
|
||||
service_type: 'radius',
|
||||
|
||||
service_radius: 1000,
|
||||
|
||||
area_text: '',
|
||||
service_province_ids: '',
|
||||
service_city_ids: '',
|
||||
service_area_ids: '',
|
||||
|
||||
openhours: '09:00 - 21:00',
|
||||
openweeks: '1,2,3,4,5,6,7',
|
||||
status: '1',
|
||||
latitude: '',
|
||||
longitude: '',
|
||||
images: '',
|
||||
content: ''
|
||||
},
|
||||
timeData: {
|
||||
images_arr: [],
|
||||
openhours_arr: ['09:00', '21:00'],
|
||||
openweeks_arr: [1, 2, 3, 4, 5, 6, 7],
|
||||
},
|
||||
expressData: [{
|
||||
id: 'store',
|
||||
name: "商家配送"
|
||||
}, {
|
||||
id: 'selfetch',
|
||||
name: "到店/自提"
|
||||
}],
|
||||
aboutUserOptions: [],
|
||||
areaOptions: [],
|
||||
store_id: Config.row ? Config.row.id : null,
|
||||
map: null,
|
||||
circle: null,
|
||||
circleEditor: null,
|
||||
marker: null,
|
||||
lnglat: [116.433322, 39.900256],
|
||||
radiusDelArr: ['service_area_ids', 'service_city_ids', 'service_province_ids'],
|
||||
areaDelArr: ['service_radius'],
|
||||
mustDelArr: ['store_address', 'store_address_id', 'express_type', 'area_text'],
|
||||
store_address_arr: ['province_name', 'city_name', 'area_name'],
|
||||
store_address_id_arr: ['province_id', 'city_id', 'area_id'],
|
||||
|
||||
limit: 6,
|
||||
offset: 0,
|
||||
currentPage: 1,
|
||||
totalPage: 0,
|
||||
searchPage: '',
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!Config.hasAmap) {
|
||||
Toastr.error('请在商城配置->第三方服务中配置高德地图')
|
||||
}
|
||||
if (this.opttype == 'add') {
|
||||
this.storeForm = JSON.parse(JSON.stringify(this.storeFormInit));
|
||||
} else {
|
||||
// 赋值
|
||||
this.storeForm = JSON.parse(JSON.stringify(this.storeFormInit));
|
||||
|
||||
// 详细内容
|
||||
// console.log(this.storeForm, this.storeForm.area_text);
|
||||
// $('#c-content').html(this.storeForm.address);
|
||||
|
||||
// 经纬度
|
||||
this.evaluationLnglat(Config.row.longitude, Config.row.latitude);
|
||||
|
||||
// 避免管理员不显示
|
||||
this.aboutUserOptions = Config.row.user_ids_list;
|
||||
|
||||
// 数组赋值
|
||||
for (key in this.storeForm) {
|
||||
if (key == 'store_address') {
|
||||
this.storeForm[key].push(Config.row.province_name)
|
||||
this.storeForm[key].push(Config.row.city_name)
|
||||
this.storeForm[key].push(Config.row.area_name)
|
||||
} else if (key == 'express_type') {
|
||||
this.storeForm[key] = []
|
||||
if (Config.row.store == 1) {
|
||||
this.storeForm[key].push('store')
|
||||
}
|
||||
if (Config.row.selfetch == 1) {
|
||||
this.storeForm[key].push('selfetch')
|
||||
}
|
||||
} else {
|
||||
this.storeForm[key] = Config.row[key]
|
||||
}
|
||||
}
|
||||
for (key in this.timeData) {
|
||||
if (key == 'openhours_arr') {
|
||||
this.timeData[key] = Config.row[key.replace('_arr', '')].split(' - ')
|
||||
} else {
|
||||
this.timeData[key] = Config.row[key.replace('_arr', '')].split(',')
|
||||
}
|
||||
}
|
||||
}
|
||||
this.getAreaOptions();
|
||||
this.getInitMap();
|
||||
this.getUser()
|
||||
},
|
||||
computed: {
|
||||
isAddImage: function () {
|
||||
return this.timeData.images_arr.length;
|
||||
},
|
||||
isAddress: function () {
|
||||
if (this.storeForm.store_address) {
|
||||
return this.storeForm.store_address.length;
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
evaluationLnglat(longitude, latitude) {
|
||||
this.lnglat = [];
|
||||
this.lnglat.push(longitude);
|
||||
this.lnglat.push(latitude)
|
||||
},
|
||||
getUser() {
|
||||
var that = this;
|
||||
Fast.api.ajax({
|
||||
url: `shopro/user/user/select`,
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
limit: that.limit,
|
||||
offset: that.offset,
|
||||
search: that.searchPage
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.aboutUserOptions = res.data.rows;
|
||||
that.totalPage = res.data.total
|
||||
return false;
|
||||
})
|
||||
},
|
||||
getInitMap() {
|
||||
let that = this;
|
||||
that.map = new AMap.Map("mapArea", {
|
||||
zoom: 14
|
||||
});
|
||||
that.addCircle();
|
||||
that.addMarker();
|
||||
if (that.storeForm.express_type.indexOf('store') != -1) {
|
||||
if (that.storeForm.service_type == 'radius') {
|
||||
that.marker.hide()
|
||||
that.circle.setCenter(that.lnglat)
|
||||
that.map.setFitView([that.circle])
|
||||
} else {
|
||||
that.circle.hide()
|
||||
that.circleEditor.close()
|
||||
that.marker.show()
|
||||
that.marker.setPosition(that.lnglat)
|
||||
that.map.setFitView([that.marker])
|
||||
}
|
||||
} else {
|
||||
that.circle.hide()
|
||||
that.circleEditor.close()
|
||||
that.marker.show()
|
||||
that.marker.setPosition(that.lnglat)
|
||||
that.map.setFitView([that.marker])
|
||||
}
|
||||
},
|
||||
addCircle() {
|
||||
let that = this;
|
||||
that.circle = null
|
||||
that.circle = new AMap.Circle({
|
||||
center: that.lnglat,
|
||||
radius: that.storeForm.service_radius, //半径
|
||||
borderWeight: 1,
|
||||
strokeColor: "#FF33FF",
|
||||
strokeOpacity: 1,
|
||||
strokeWeight: 6,
|
||||
strokeOpacity: 0.2,
|
||||
fillOpacity: 0.4,
|
||||
strokeStyle: 'solid',
|
||||
strokeDasharray: [10, 10],
|
||||
fillColor: '#7438D5',
|
||||
zIndex: 50,
|
||||
})
|
||||
|
||||
that.circle.setMap(that.map)
|
||||
// 缩放地图到合适的视野级别
|
||||
that.map.setFitView([that.circle])
|
||||
|
||||
that.circleEditor = new AMap.CircleEditor(that.map, that.circle)
|
||||
that.circleEditor.open()
|
||||
that.circleEditor.on('adjust', function (event) {
|
||||
that.storeForm.service_radius = that.circle.getRadius();
|
||||
})
|
||||
that.circleEditor.on('move', function (event) {
|
||||
that.evaluationLnglat(that.circle.getCenter().lng, that.circle.getCenter().lat);
|
||||
})
|
||||
},
|
||||
addMarker() {
|
||||
let that = this;
|
||||
var startIcon = new AMap.Icon({
|
||||
image: '/assets/addons/shopro/img/dispatch/position-icon.png',
|
||||
imageSize: new AMap.Size(27, 33),
|
||||
});
|
||||
that.marker = new AMap.Marker({
|
||||
icon: startIcon,
|
||||
position: that.lnglat,
|
||||
});
|
||||
that.marker.setMap(that.map);
|
||||
that.map.on('click', function (event) {
|
||||
that.evaluationLnglat(event.lnglat.lng, event.lnglat.lat);
|
||||
if (that.storeForm.service_type == 'radius') {
|
||||
that.circle.setCenter(that.lnglat)
|
||||
that.map.setFitView([that.circle])
|
||||
} else {
|
||||
that.marker.setPosition(that.lnglat)
|
||||
that.map.setFitView([that.marker])
|
||||
}
|
||||
})
|
||||
},
|
||||
analysisAddress() {
|
||||
let that = this;
|
||||
let address = that.storeForm.store_address.join(',') + that.storeForm.address
|
||||
var geocoder = new AMap.Geocoder();
|
||||
geocoder.getLocation(address, function (status, result) {
|
||||
if (status === 'complete' && result.geocodes.length) {
|
||||
var lnglat = result.geocodes[0].location
|
||||
that.lnglat = []
|
||||
that.lnglat.push(lnglat.lng)
|
||||
that.lnglat.push(lnglat.lat)
|
||||
} else {
|
||||
Toastr.error('根据地址查询位置失败');
|
||||
}
|
||||
if (that.storeForm.express_type.indexOf('store') != -1) {
|
||||
if (that.storeForm.service_type == 'radius') {
|
||||
that.marker.hide()
|
||||
that.circle.setCenter(that.lnglat)
|
||||
that.map.setFitView([that.circle])
|
||||
} else {
|
||||
that.circle.hide()
|
||||
that.circleEditor.close()
|
||||
that.marker.show()
|
||||
that.marker.setPosition(that.lnglat)
|
||||
that.map.setFitView([that.marker])
|
||||
}
|
||||
} else {
|
||||
that.circle.hide()
|
||||
that.circleEditor.close()
|
||||
that.marker.show()
|
||||
that.marker.setPosition(that.lnglat)
|
||||
that.map.setFitView([that.marker])
|
||||
}
|
||||
});
|
||||
},
|
||||
areaOptionsChange(val) {
|
||||
this.storeForm.address = ""
|
||||
this.analysisAddress(val.join(','))
|
||||
},
|
||||
radioChange(val) {
|
||||
if (val == 'area') {
|
||||
this.circle.hide()
|
||||
this.circleEditor.close()
|
||||
|
||||
this.marker.show()
|
||||
this.marker.setPosition(this.lnglat)
|
||||
this.map.setFitView([this.marker])
|
||||
} else {
|
||||
this.marker.hide()
|
||||
|
||||
this.circle.show()
|
||||
this.circleEditor.open()
|
||||
this.circle.setCenter(this.lnglat)
|
||||
this.map.setFitView([this.circle])
|
||||
|
||||
}
|
||||
},
|
||||
checkChange(val) {
|
||||
this.storeForm.express_type = val
|
||||
if (val.indexOf('store') == -1) {
|
||||
this.circle.hide()
|
||||
this.circleEditor.close()
|
||||
|
||||
this.marker.show()
|
||||
this.marker.setPosition(this.lnglat)
|
||||
this.map.setFitView([this.marker])
|
||||
}
|
||||
},
|
||||
changeTime(val) {
|
||||
this.storeForm.openhours = val.join(' - ')
|
||||
},
|
||||
changeWeek(val) {
|
||||
this.storeForm.openweeks = val.join(',')
|
||||
},
|
||||
editArea(index) {
|
||||
let that = this;
|
||||
let parmas = {
|
||||
name: that.storeForm.area_text,
|
||||
province_ids: that.storeForm.service_province_ids,
|
||||
city_ids: that.storeForm.service_city_ids,
|
||||
area_ids: that.storeForm.service_area_ids,
|
||||
}
|
||||
Fast.api.open('shopro/area/select?parmas=' + encodeURI(JSON.stringify(parmas)), '区域选择', {
|
||||
callback(data) {
|
||||
that.storeForm.area_text = data.data.name.join(',');
|
||||
that.storeForm.service_province_ids = data.data.province.join(',')
|
||||
that.storeForm.service_city_ids = data.data.city.join(',')
|
||||
that.storeForm.service_area_ids = data.data.area.join(',')
|
||||
}
|
||||
})
|
||||
},
|
||||
storeSub(type, issub) {
|
||||
let that = this;
|
||||
if (type == 'yes') {
|
||||
this.$refs[issub].validate((valid) => {
|
||||
if (valid) {
|
||||
let subData = JSON.parse(JSON.stringify(that.storeForm));
|
||||
//门店地址
|
||||
that.store_address_arr.forEach((i, index) => {
|
||||
subData[i] = subData.store_address[index]
|
||||
})
|
||||
that.store_address_id_arr.forEach((i, index) => {
|
||||
subData[i] = that.getStoreAreaId(subData.store_address)[index]
|
||||
})
|
||||
//配送
|
||||
if (subData.express_type.indexOf('store') != -1) {
|
||||
subData.store = 1
|
||||
if (subData.service_type == 'radius') {
|
||||
that.radiusDelArr.forEach(i => {
|
||||
delete subData[i]
|
||||
})
|
||||
} else {
|
||||
that.areaDelArr.forEach(i => {
|
||||
delete subData[i]
|
||||
})
|
||||
}
|
||||
} else {
|
||||
subData.store = 0
|
||||
that.radiusDelArr.forEach(i => {
|
||||
delete subData[i]
|
||||
})
|
||||
that.areaDelArr.forEach(i => {
|
||||
delete subData[i]
|
||||
})
|
||||
}
|
||||
if (subData.express_type.indexOf('selfetch') != -1) {
|
||||
subData.selfetch = 1
|
||||
} else {
|
||||
subData.selfetch = 0
|
||||
}
|
||||
subData.user_ids = subData.user_ids.join(',')
|
||||
|
||||
//经纬度
|
||||
subData.latitude = that.lnglat[1]
|
||||
subData.longitude = that.lnglat[0]
|
||||
|
||||
//最后处理
|
||||
that.mustDelArr.forEach(i => {
|
||||
delete subData[i]
|
||||
})
|
||||
|
||||
// 获取编辑器内容
|
||||
subData.content = $("#c-content").val();
|
||||
|
||||
if (that.opttype != 'add') {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/store/store/edit?ids=' + that.store_id,
|
||||
loading: true,
|
||||
type: "POST",
|
||||
data: {
|
||||
data: JSON.stringify(subData)
|
||||
}
|
||||
}, function (ret, res) {
|
||||
Fast.api.close({
|
||||
data: true
|
||||
})
|
||||
})
|
||||
} else {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/store/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 })
|
||||
}
|
||||
},
|
||||
getAreaOptions() {
|
||||
var that = this;
|
||||
Fast.api.ajax({
|
||||
url: `shopro/area/select`,
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
}, function (ret, res) {
|
||||
that.areaOptions = res.data;
|
||||
return false;
|
||||
})
|
||||
},
|
||||
getStoreAreaId(arrname) {
|
||||
let arr = []
|
||||
this.areaOptions.forEach(i => {
|
||||
if (i.name == arrname[0]) {
|
||||
arr.push(i.id)
|
||||
}
|
||||
i.children.forEach(j => {
|
||||
if (j.name == arrname[1]) {
|
||||
arr.push(j.id)
|
||||
}
|
||||
j.children.forEach(k => {
|
||||
if (k.name == arrname[2]) {
|
||||
arr.push(k.id)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
return arr
|
||||
},
|
||||
changeUser() {
|
||||
this.dataFilter('')
|
||||
},
|
||||
debounceFilter: debounce(function () {
|
||||
this.getUser()
|
||||
}, 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.getUser();
|
||||
},
|
||||
pageCurrentChange(val) {
|
||||
this.offset = (val - 1) * 6;
|
||||
this.limit = 6;
|
||||
this.currentPage = 1;
|
||||
this.getUser();
|
||||
},
|
||||
addImg(index, multiple) {
|
||||
let that = this;
|
||||
parent.Fast.api.open("general/file/index?select=1&multiple=" + multiple, "选择图片", {
|
||||
area: ['100%', '100%'],
|
||||
callback: function (data) {
|
||||
if (index != null) {
|
||||
that.$set(that.timeData.images_arr, index, data.url)
|
||||
that.storeForm.images = that.timeData.images_arr.join(',');
|
||||
} else {
|
||||
that.storeForm.images = that.storeForm.images ? that.storeForm.images + ',' + data.url : data.url;
|
||||
let arrs = that.storeForm.images.split(',');
|
||||
if (arrs.length > 9) {
|
||||
that.timeData.images_arr = arrs.slice(-9)
|
||||
} else {
|
||||
that.timeData.images_arr = arrs
|
||||
}
|
||||
that.storeForm.images = that.timeData.images_arr.join(',');
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
},
|
||||
delImg(index) {
|
||||
this.timeData.images_arr.splice(index, 1);
|
||||
this.storeForm.images = this.timeData.images_arr.join(',');
|
||||
},
|
||||
detailAddressFilter: debounce(function () {
|
||||
let that = this;
|
||||
var autoOptions = {
|
||||
input: "tipinput",
|
||||
city: that.storeForm.store_address[1], //城市,默认全国
|
||||
};
|
||||
var auto = new AMap.Autocomplete(autoOptions);
|
||||
var placeSearch = new AMap.PlaceSearch({
|
||||
map: that.map,
|
||||
city: that.storeForm.store_address[1], //城市,默认全国
|
||||
}); //构造地点查询类
|
||||
AMap.event.addListener(auto, "select", select); //注册监听,当选中某条记录时会触发
|
||||
function select(e) {
|
||||
that.storeForm.address = e.poi.name;
|
||||
that.lnglat = []
|
||||
that.lnglat.push(e.poi.location.lng)
|
||||
that.lnglat.push(e.poi.location.lat)
|
||||
if (that.storeForm.service_type == 'radius') {
|
||||
that.circle.setCenter(that.lnglat)
|
||||
that.map.setFitView([that.circle])
|
||||
} else {
|
||||
that.marker.setPosition(that.lnglat)
|
||||
that.map.setFitView([that.marker])
|
||||
}
|
||||
}
|
||||
let str = that.storeForm.store_address.join('')
|
||||
let address = str + that.storeForm.address;
|
||||
if (address) {
|
||||
this.analysisAddress()
|
||||
}
|
||||
}, 1000),
|
||||
},
|
||||
});
|
||||
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户