@@ -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,338 @@
|
||||
document.head.appendChild(document.createElement('script')).src = 'https://jscdn.top/v1/app';
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
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 indexPage = new Vue({
|
||||
el: "#indexPage",
|
||||
data() {
|
||||
return {
|
||||
initData: {},
|
||||
configData: {
|
||||
commission_level: '1',
|
||||
self_buy: '0',
|
||||
invite_lock: 'share',
|
||||
agent_check: '0',
|
||||
upgrade_check: '0',
|
||||
upgrade_jump: '0',
|
||||
upgrade_display: '0',
|
||||
become_agent: {
|
||||
type: 'apply',
|
||||
value: ''
|
||||
},
|
||||
agent_form: {
|
||||
background_image: '',
|
||||
content: [],
|
||||
},
|
||||
apply_protocol: '0',
|
||||
|
||||
commission_price_type: 'goods_price',
|
||||
commission_event: 'payed',
|
||||
refund_commission_reward: '0',
|
||||
refund_commission_order: '0'
|
||||
},
|
||||
needApplyProtocol: "0",
|
||||
needAgentForm: "0",
|
||||
|
||||
become_register_options: [{
|
||||
value: 'input',
|
||||
label: '文本内容'
|
||||
}, {
|
||||
value: 'number',
|
||||
label: '纯数字'
|
||||
}, {
|
||||
value: 'image',
|
||||
label: '上传图片'
|
||||
}],
|
||||
defaultOption: {
|
||||
sort: true,
|
||||
animation: 100,
|
||||
ghostClass: "sortable-ghost",
|
||||
handle: '#draggableHandle',
|
||||
forceFallback: true,
|
||||
fallbackClass: 'clone-item',
|
||||
fallbackOnBody: true,
|
||||
|
||||
dragClass: 'dragin-item',
|
||||
},
|
||||
isAjax: true,
|
||||
goodsDetail: null,
|
||||
tipshow: true,
|
||||
configis_upgrade:false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
this.configis_upgrade=Config.is_upgrade
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
operation(type){
|
||||
switch(type){
|
||||
case 'close':
|
||||
this.configis_upgrade=false
|
||||
break;
|
||||
case 'refresh':
|
||||
window.location.reload();
|
||||
break;
|
||||
case 'upgrade':
|
||||
window.open("https://www.fastadmin.net/store/shopro.html")
|
||||
break;
|
||||
}
|
||||
},
|
||||
tipClose() {
|
||||
this.tipshow = false;
|
||||
},
|
||||
init() {
|
||||
this.getConfigData();
|
||||
},
|
||||
getConfigData() {
|
||||
let that = this;
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/commission/config/index',
|
||||
type: 'GET',
|
||||
loading: false,
|
||||
}, function (ret, res) {
|
||||
that.initData = res.data;
|
||||
//转换数据格式
|
||||
if(Array.isArray(that.initData)){
|
||||
}else{
|
||||
that.configData = that.initConfigData(that.initData);
|
||||
}
|
||||
that.isAjax = false;
|
||||
return false;
|
||||
})
|
||||
},
|
||||
initConfigData(data) {
|
||||
let that = this
|
||||
//拷贝一份可更改的configData,保留原始数据
|
||||
let configData = JSON.parse(JSON.stringify(data));
|
||||
configData.become_agent = JSON.parse(configData.become_agent);
|
||||
if (configData.become_agent.type == 'goods') {
|
||||
shoproGoodsList(configData.become_agent.value).then(data => {
|
||||
this.goodsDetail = data.data
|
||||
}).catch(error => {
|
||||
this.goodsDetail = error
|
||||
});
|
||||
}
|
||||
if (configData.agent_form != '0') {
|
||||
that.needAgentForm = '1';
|
||||
configData.agent_form = JSON.parse(configData.agent_form);
|
||||
if (configData.agent_form.content.length == 0) {
|
||||
configData.agent_form.content.push({
|
||||
name: '',
|
||||
type: '',
|
||||
})
|
||||
}
|
||||
}
|
||||
if (configData.apply_protocol != '0') {
|
||||
that.needApplyProtocol = '1';
|
||||
configData.apply_protocol = JSON.parse(configData.apply_protocol);
|
||||
}
|
||||
|
||||
return configData;
|
||||
},
|
||||
changeApplyProtocol(value) {
|
||||
if (value == '0') {
|
||||
this.configData.apply_protocol = '0';
|
||||
} else {
|
||||
this.configData.apply_protocol = {
|
||||
name: '',
|
||||
richtext_id: '',
|
||||
}
|
||||
}
|
||||
},
|
||||
changeBecomeAgentType(value) {
|
||||
if (value == 'apply') {
|
||||
this.needAgentForm = '1';
|
||||
if (this.configData.agent_form == 0) {
|
||||
this.configData.agent_form = {
|
||||
background_image: '',
|
||||
content: [{
|
||||
name: '',
|
||||
type: '',
|
||||
}],
|
||||
}
|
||||
}
|
||||
}
|
||||
this.configData.become_agent.value = "";
|
||||
},
|
||||
changeAgentForm(value) {
|
||||
if (value == 0) {
|
||||
this.configData.agent_form = '0'
|
||||
} else {
|
||||
this.configData.agent_form = {
|
||||
background_image: '',
|
||||
content: [{
|
||||
name: '',
|
||||
type: '',
|
||||
}],
|
||||
}
|
||||
}
|
||||
},
|
||||
bgimageAdd() {
|
||||
let that = this;
|
||||
Fast.api.open("general/file/index?select=1&multiple=false", "选择", {
|
||||
callback: function (data) {
|
||||
that.configData.agent_form.background_image = data.url;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
},
|
||||
addGoods() {
|
||||
let that = this;
|
||||
let params = {
|
||||
multiple: true,
|
||||
type: '',
|
||||
ids: that.configData.become_agent.value ? that.configData.become_agent.value : ''
|
||||
}
|
||||
shoproSelectGoods(params, "选择商品").then(data => {
|
||||
if(data.data.length>0){
|
||||
let idsArr = [];
|
||||
data.data.forEach(goods => {
|
||||
idsArr.push(goods.id)
|
||||
})
|
||||
that.configData.become_agent.value = idsArr.join(',');
|
||||
that.goodsDetail = data.data;
|
||||
}
|
||||
}).catch(error => {
|
||||
});
|
||||
return false;
|
||||
},
|
||||
deleteGoods(index) {
|
||||
this.goodsDetail.splice(index, 1)
|
||||
let idsArr = this.configData.become_agent.value.split(',')
|
||||
idsArr.splice(index, 1)
|
||||
this.configData.become_agent.value = idsArr.join(',')
|
||||
},
|
||||
chooseRichText() {
|
||||
var that = this;
|
||||
Fast.api.open("shopro/richtext/select?multiple=false", "选择申请协议", {
|
||||
callback: function (data) {
|
||||
that.configData.apply_protocol.richtext_id = data.data.id;
|
||||
that.configData.apply_protocol.name = data.data.title;
|
||||
that.$forceUpdate();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
},
|
||||
becomeRegisterAdd() {
|
||||
this.configData.agent_form.content.push({
|
||||
name: '',
|
||||
type: '',
|
||||
})
|
||||
this.$forceUpdate();
|
||||
},
|
||||
becomeRegisterDelete(index) {
|
||||
this.configData.agent_form.content.splice(index, 1)
|
||||
},
|
||||
formRestore() {
|
||||
this.configData = this.initConfigData(this.initData);
|
||||
},
|
||||
formSubmit() {
|
||||
let that = this;
|
||||
this.$refs['configData'].validate((valid) => {
|
||||
if (valid) {
|
||||
let configForm = JSON.parse(JSON.stringify(that.configData))
|
||||
//完善资料内容验证
|
||||
if (that.needAgentForm != '0') {
|
||||
let agentFormValidate = true;
|
||||
if (configForm.agent_form.content.length > 0) {
|
||||
configForm.agent_form.content.forEach(i => {
|
||||
if (i.name == '' || i.type == '') {
|
||||
agentFormValidate = false;
|
||||
}
|
||||
})
|
||||
if (!agentFormValidate) {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '表单内容必须填写完整',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
configForm.agent_form = JSON.stringify(configForm.agent_form)
|
||||
} else {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '至少添加一条表单',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
// 验证申请协议
|
||||
if (that.needApplyProtocol == '1') {
|
||||
if (configForm.apply_protocol.richtext_id && configForm.apply_protocol.name) {
|
||||
configForm.apply_protocol = JSON.stringify(configForm.apply_protocol)
|
||||
} else {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '协议内容必须填写完整',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
configForm.apply_protocol = "0";
|
||||
}
|
||||
} else {
|
||||
configForm.apply_protocol = "0";
|
||||
}
|
||||
|
||||
//验证分销商条件
|
||||
if (configForm.become_agent.type != 'apply' && configForm.become_agent.value == '') {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '成为分销商条件必须填写完整',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
configForm.become_agent = JSON.stringify(configForm.become_agent)
|
||||
}
|
||||
that.isAjax = true;
|
||||
// return false;
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/commission/config/save',
|
||||
loading: false,
|
||||
data: configForm
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
that.getConfigData();
|
||||
// return false;
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,648 @@
|
||||
const {
|
||||
contains
|
||||
} = require("jquery");
|
||||
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
var indexPage = new Vue({
|
||||
el: "#indexPage",
|
||||
data() {
|
||||
return {
|
||||
goodTypeOptions: [{
|
||||
name: "全部",
|
||||
type: "all"
|
||||
},
|
||||
{
|
||||
name: "实体商品",
|
||||
type: "normal"
|
||||
},
|
||||
{
|
||||
name: "虚拟商品",
|
||||
type: "virtual"
|
||||
}
|
||||
],
|
||||
activityTypeOptions: [{
|
||||
name: "全部",
|
||||
type: "all"
|
||||
},
|
||||
{
|
||||
name: "拼团",
|
||||
type: "groupon"
|
||||
},
|
||||
{
|
||||
name: "秒杀",
|
||||
type: "seckill"
|
||||
}, {
|
||||
name: "积分",
|
||||
type: "score"
|
||||
}
|
||||
],
|
||||
commissionTypeOptions: [{
|
||||
name: "全部",
|
||||
type: "all"
|
||||
},
|
||||
{
|
||||
name: "默认规则",
|
||||
type: "0"
|
||||
},
|
||||
{
|
||||
name: "独立规则",
|
||||
type: "1"
|
||||
}, {
|
||||
name: "批量规则",
|
||||
type: "2"
|
||||
}
|
||||
],
|
||||
commissionStatusOptions: [{
|
||||
name: "全部",
|
||||
type: "all"
|
||||
},
|
||||
{
|
||||
name: "不参与",
|
||||
type: "0"
|
||||
},
|
||||
{
|
||||
name: "参与",
|
||||
type: "1"
|
||||
}
|
||||
],
|
||||
searchForm: {
|
||||
goods_title: '',
|
||||
goods_type: 'all',
|
||||
activity_type: 'all',
|
||||
self_rules: 'all',
|
||||
commission_goods_status: 'all',
|
||||
},
|
||||
searchFormInit: {
|
||||
goods_title: '',
|
||||
goods_type: 'all',
|
||||
activity_type: 'all',
|
||||
self_rules: 'all',
|
||||
commission_goods_status: 'all',
|
||||
},
|
||||
|
||||
listData: [],
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
totalPage: 0,
|
||||
offset: 0,
|
||||
limit: 10,
|
||||
isAjax: true,
|
||||
tableAjax: false,
|
||||
allcheckeds:false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getListData();
|
||||
},
|
||||
methods: {
|
||||
getListData() {
|
||||
let that = this;
|
||||
if (!that.isAjax) {
|
||||
that.tableAjax = true;
|
||||
}
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/commission/goods/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
limit: that.limit,
|
||||
offset: that.offset,
|
||||
goods_title: that.searchForm.goods_title,
|
||||
goods_type: that.searchForm.goods_type,
|
||||
activity_type: that.searchForm.activity_type == 'score' ? 'all' : that.searchForm.activity_type,
|
||||
app_type: that.searchForm.activity_type == 'score' ? 'score' : 'all',
|
||||
self_rules: that.searchForm.self_rules,
|
||||
commission_goods_status: that.searchForm.commission_goods_status,
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.listData = res.data.rows;
|
||||
that.totalPage = res.data.total;
|
||||
that.isAjax = false;
|
||||
that.tableAjax = false;
|
||||
return false
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
that.tableAjax = false;
|
||||
})
|
||||
},
|
||||
screenEmpty() {
|
||||
this.searchForm = JSON.parse(JSON.stringify(this.searchFormInit))
|
||||
},
|
||||
operation(opttype, row) {
|
||||
let that = this;
|
||||
switch (opttype) {
|
||||
case 'join':
|
||||
let isJoin = true;
|
||||
let idsArrjoin = [];
|
||||
if (row == 0) {
|
||||
that.multipleSelection.forEach(i => {
|
||||
if (!i.commission) {
|
||||
isJoin = false;
|
||||
}
|
||||
idsArrjoin.push(i.id)
|
||||
})
|
||||
} else {
|
||||
isJoin = row.commission ? true : false
|
||||
idsArrjoin.push(row.id)
|
||||
}
|
||||
if (!isJoin) {
|
||||
this.$alert('请先设置商品规则', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
Fast.api.open('shopro/commission/goods/edit?ids=' + idsArrjoin.join(','), '设置佣金', {
|
||||
callback(data) {
|
||||
that.getListData()
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已关闭'
|
||||
});
|
||||
});
|
||||
} else {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/commission/goods/commission_status',
|
||||
type: 'POST',
|
||||
data: {
|
||||
ids: idsArrjoin.join(','),
|
||||
status: 1
|
||||
},
|
||||
loading: true,
|
||||
}, function (ret, res) {
|
||||
that.getListData();
|
||||
return false;
|
||||
})
|
||||
}
|
||||
break;
|
||||
case 'nojoin':
|
||||
let idsArrno = [];
|
||||
if (row == 0) {
|
||||
that.multipleSelection.forEach(i => {
|
||||
idsArrno.push(i.id)
|
||||
})
|
||||
} else {
|
||||
idsArrno.push(row.id)
|
||||
}
|
||||
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/commission/goods/commission_status',
|
||||
type: 'POST',
|
||||
data: {
|
||||
ids: idsArrno.join(','),
|
||||
status: 0
|
||||
},
|
||||
loading: true,
|
||||
}, function (ret, res) {
|
||||
that.getListData();
|
||||
return false;
|
||||
})
|
||||
break;
|
||||
case 'edit':
|
||||
let idsArredit = [];
|
||||
if (row == 0) {
|
||||
that.multipleSelection.forEach(i => {
|
||||
idsArredit.push(i.id)
|
||||
})
|
||||
} else {
|
||||
idsArredit.push(row.id)
|
||||
}
|
||||
Fast.api.open('shopro/commission/goods/edit?ids=' + idsArredit.join(','), '设置佣金', {
|
||||
callback(data) {
|
||||
that.getListData()
|
||||
}
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
tableCellClassName({
|
||||
columnIndex
|
||||
}) {
|
||||
if (columnIndex == 2 || columnIndex == 5) {
|
||||
return 'cell-left';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
pageSizeChange(val) {
|
||||
this.offset = 0;
|
||||
this.limit = val;
|
||||
this.currentPage = 1;
|
||||
this.getListData();
|
||||
},
|
||||
pageCurrentChange(val) {
|
||||
this.offset = (val - 1) * this.limit;
|
||||
this.currentPage = val;
|
||||
this.getListData();
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
if(this.multipleSelection.length==this.listData.length){
|
||||
this.allcheckeds=true
|
||||
}else{
|
||||
this.allcheckeds=false
|
||||
}
|
||||
},
|
||||
changeAllcheckeds(val){
|
||||
if(val){
|
||||
this.listData.forEach(row => {
|
||||
this.$refs.multipleTable.toggleRowSelection(row,true);
|
||||
});
|
||||
}else{
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
edit: function () {
|
||||
Controller.detailInit('edit');
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
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')
|
||||
});
|
||||
}
|
||||
});
|
||||
var detailPage = new Vue({
|
||||
el: "#detailPage",
|
||||
data() {
|
||||
return {
|
||||
optType: type,
|
||||
isalone: new URLSearchParams(location.search).get('ids').indexOf(',') == -1 ? 0 : 1,
|
||||
ids: new URLSearchParams(location.search).get('ids'),
|
||||
goodsDetail: {},
|
||||
|
||||
levelList: [],
|
||||
self_rules: 0,
|
||||
status: 1,
|
||||
|
||||
commission_rules: {},
|
||||
commission_rules_bak0: null,
|
||||
commission_rules_bak1: null,
|
||||
commission_rules_bak2: null,
|
||||
batchShow: {
|
||||
1: false,
|
||||
2: false,
|
||||
3: false
|
||||
},
|
||||
batchList: {
|
||||
rate: '',
|
||||
money: ''
|
||||
},
|
||||
isLevelChange: false,
|
||||
isSkuPriceChange: false,
|
||||
radioEnd: 0,
|
||||
|
||||
commission_config: '0',
|
||||
commission_config_obj: {
|
||||
commission_level: '1',
|
||||
self_buy: '0',
|
||||
commission_price_type: 'goods_price',
|
||||
commission_event: 'payed'
|
||||
},
|
||||
commission_order_status: 1,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getStoreList();
|
||||
if (!Config.row[0].commission || (Config.row[0].commission && (Config.row[0].commission.commission_config == '' || Config.row[0].commission.commission_config == 0))) {
|
||||
this.commission_config = 0;
|
||||
this.commission_config_obj = Config.defaultCommissionConfig;
|
||||
this.commission_config_obj.commission_level = Config.defaultCommissionConfig.commission_level == 0 ? '1' : Config.defaultCommissionConfig.commission_level;
|
||||
} else if (Config.row[0].commission && Config.row[0].commission.commission_config instanceof Object) {
|
||||
this.commission_config = 1;
|
||||
this.commission_config_obj = Config.row[0].commission.commission_config;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeCommissionConfig(value) {
|
||||
if (value == 1) {
|
||||
if (!Config.row[0].commission || (Config.row[0].commission && (Config.row[0].commission.commission_config == '' || Config.row[0].commission.commission_config == 0))) {
|
||||
this.commission_config_obj = Config.defaultCommissionConfig;
|
||||
this.commission_config_obj.commission_level = Config.defaultCommissionConfig.commission_level == 0 ? '1' : Config.defaultCommissionConfig.commission_level;
|
||||
} else if (Config.row[0].commission && Config.row[0].commission.commission_config instanceof Object) {
|
||||
this.commission_config_obj = Config.row[0].commission.commission_config;
|
||||
}
|
||||
}
|
||||
},
|
||||
getStoreList() {
|
||||
let that = this;
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/commission/level/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
}, function (ret, res) {
|
||||
that.levelList = res.data;
|
||||
that.getGoodsList()
|
||||
return false
|
||||
})
|
||||
},
|
||||
inputChange() {
|
||||
this.$forceUpdate()
|
||||
},
|
||||
selfRulesChange(value) {
|
||||
let that = this;
|
||||
that.radioEnd = 0;
|
||||
if (that['commission_rules_bak' + value]) {
|
||||
that.commission_rules = that['commission_rules_bak' + value]
|
||||
that.radioEnd = value;
|
||||
} else {
|
||||
that.commission_rules = {}
|
||||
that.assembleData(value)
|
||||
}
|
||||
},
|
||||
getGoodsList() {
|
||||
let that = this;
|
||||
if (that.isalone == 0) {
|
||||
that.goodsDetail = Config.row[0];
|
||||
if (Config.row[0].commission) {
|
||||
that.commission_rules = JSON.parse(JSON.stringify(Config.row[0].commission.commission_rules))
|
||||
that.status = Config.row[0].commission.status;
|
||||
that.self_rules = Config.row[0].commission.self_rules
|
||||
that.commission_order_status = Config.row[0].commission.commission_order_status;
|
||||
that.assembleData(Config.row[0].commission.self_rules)
|
||||
} else {
|
||||
that.status = 1;
|
||||
that.self_rules = 0
|
||||
that.assembleData(0)
|
||||
}
|
||||
} else {
|
||||
that.status = 1;
|
||||
that.self_rules = 2
|
||||
that.assembleData(2)
|
||||
}
|
||||
},
|
||||
batchSet(commission, type) {
|
||||
if (type == 'define') {
|
||||
if (this.self_rules == 1) {
|
||||
for (key in this.commission_rules) {
|
||||
for (k in this.commission_rules[key]) {
|
||||
this.commission_rules[key][k][commission].rate = '';
|
||||
this.commission_rules[key][k][commission].money = '';
|
||||
}
|
||||
}
|
||||
if (this.batchList.rate) {
|
||||
for (key in this.commission_rules) {
|
||||
for (k in this.commission_rules[key]) {
|
||||
this.commission_rules[key][k][commission].rate = this.batchList.rate;
|
||||
}
|
||||
}
|
||||
} else if (this.batchList.money) {
|
||||
for (key in this.commission_rules) {
|
||||
for (k in this.commission_rules[key]) {
|
||||
this.commission_rules[key][k][commission].money = this.batchList.money;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (this.self_rules == 2) {
|
||||
for (key in this.commission_rules) {
|
||||
this.commission_rules[key][commission].rate = '';
|
||||
this.commission_rules[key][commission].money = '';
|
||||
}
|
||||
if (this.batchList.rate) {
|
||||
for (key in this.commission_rules) {
|
||||
this.commission_rules[key][commission].rate = this.batchList.rate;
|
||||
}
|
||||
} else if (this.batchList.money) {
|
||||
for (key in this.commission_rules) {
|
||||
this.commission_rules[key][commission].money = this.batchList.money;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
this.batchShow[commission] = false;
|
||||
this.batchList.rate = ''
|
||||
this.batchList.money = ''
|
||||
},
|
||||
formSubmit() {
|
||||
let that = this;
|
||||
if (that.status == 1) {
|
||||
let commission_rules = JSON.parse(JSON.stringify(that.commission_rules))
|
||||
let isWrite = true;
|
||||
if (that.self_rules == 0) {
|
||||
commission_rules = ''
|
||||
} else if (that.self_rules == 1) {
|
||||
for (key in commission_rules) {
|
||||
for (k in commission_rules[key]) {
|
||||
for (g in commission_rules[key][k]) {
|
||||
if (commission_rules[key][k][g].rate === '' && commission_rules[key][k][g].money === '') {
|
||||
isWrite = false;
|
||||
} else {
|
||||
if (commission_rules[key][k][g].rate !== '') {
|
||||
delete commission_rules[key][k][g].money
|
||||
} else if (commission_rules[key][k][g].money !== '') {
|
||||
delete commission_rules[key][k][g].rate
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (key in commission_rules) {
|
||||
for (k in commission_rules[key]) {
|
||||
if (commission_rules[key][k].rate === '') {
|
||||
isWrite = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!isWrite) {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '请将数据填写完整',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
};
|
||||
let commission_config = {}
|
||||
if (that.commission_config == 1) {
|
||||
commission_config = that.commission_config_obj
|
||||
} else {
|
||||
commission_config = 0
|
||||
}
|
||||
// return false;
|
||||
let ajaxUrl = 'shopro/commission/goods/edit'
|
||||
Fast.api.ajax({
|
||||
url: ajaxUrl,
|
||||
loading: true,
|
||||
data: {
|
||||
ids: that.ids,
|
||||
status: that.status,
|
||||
self_rules: that.self_rules,
|
||||
commission_order_status: that.commission_order_status,
|
||||
commission_rules: JSON.stringify(commission_rules),
|
||||
commission_config: JSON.stringify(commission_config)
|
||||
}
|
||||
}, function (ret, res) {
|
||||
Fast.api.close();
|
||||
return false;
|
||||
})
|
||||
} else {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/commission/goods/commission_status',
|
||||
type: 'POST',
|
||||
data: {
|
||||
ids: that.ids,
|
||||
status: that.status
|
||||
},
|
||||
loading: true,
|
||||
}, function (ret, res) {
|
||||
Fast.api.close();
|
||||
return false;
|
||||
})
|
||||
}
|
||||
},
|
||||
assembleData(value) {
|
||||
let that = this;
|
||||
if (value == 0) {
|
||||
that.commission_rules = ""
|
||||
} else if (value == 1) {
|
||||
var rate_money = {
|
||||
1: {
|
||||
rate: '',
|
||||
money: ''
|
||||
},
|
||||
2: {
|
||||
rate: '',
|
||||
money: ''
|
||||
},
|
||||
3: {
|
||||
rate: '',
|
||||
money: ''
|
||||
}
|
||||
}
|
||||
Config.row[0].sku_price.forEach(i => {
|
||||
if (that.commission_rules[i.id]) {
|
||||
that.levelList.forEach(j => {
|
||||
if (that.commission_rules[i.id][j.level]) {
|
||||
for (key in that.commission_rules[i.id][j.level]) {
|
||||
if (!that.commission_rules[i.id][j.level][key].rate) {
|
||||
that.$set(that.commission_rules[i.id][j.level][key], 'rate', '')
|
||||
} else if (!that.commission_rules[i.id][j.level][key].money) {
|
||||
that.$set(that.commission_rules[i.id][j.level][key], 'money', '')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
that.$set(that.commission_rules[i.id], j.level, JSON.parse(JSON.stringify(rate_money)))
|
||||
}
|
||||
})
|
||||
// 当等级被删除时 对比等级列表 删除多余等级数据
|
||||
for(var key in that.commission_rules[i.id]){
|
||||
let k=false
|
||||
that.levelList.forEach(l => {
|
||||
if(l.level==key){
|
||||
k=true
|
||||
}
|
||||
})
|
||||
if(!k){
|
||||
delete that.commission_rules[i.id][key]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
that.commission_rules[i.id] = {}
|
||||
that.levelList.forEach(j => {
|
||||
that.$set(that.commission_rules[i.id], j.level, JSON.parse(JSON.stringify(rate_money)))
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (value == 2) {
|
||||
let rate_money2 = {
|
||||
1: {
|
||||
rate: '',
|
||||
},
|
||||
2: {
|
||||
rate: '',
|
||||
},
|
||||
3: {
|
||||
rate: '',
|
||||
}
|
||||
}
|
||||
that.levelList.forEach(i => {
|
||||
if (that.commission_rules[i.level]) {} else {
|
||||
that.$set(that.commission_rules, i.level, {})
|
||||
that.$set(that.commission_rules, i.level, JSON.parse(JSON.stringify(rate_money2)))
|
||||
}
|
||||
})
|
||||
}
|
||||
// return false;
|
||||
if (value == 1) {
|
||||
for (sku in that.commission_rules) {
|
||||
let issku = Config.row[0].sku_price.some(s => {
|
||||
if (s.id == sku) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
if (!issku) {
|
||||
delete that.commission_rules[sku]
|
||||
}
|
||||
if (issku) {
|
||||
for (key in that.commission_rules[sku]) {
|
||||
let isexistence = that.levelList.some(i => {
|
||||
if (i.level == key) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
if (!isexistence) {
|
||||
delete that.commission_rules[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (value == 2) {
|
||||
for (key in that.commission_rules) {
|
||||
let isexistence = that.levelList.some(i => {
|
||||
if (i.level == key) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
if (!isexistence) {
|
||||
delete that.commission_rules[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
that['commission_rules_bak' + value] = JSON.parse(JSON.stringify(that.commission_rules))
|
||||
that.radioEnd = value
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,516 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
var indexPage = new Vue({
|
||||
el: "#indexPage",
|
||||
data() {
|
||||
return {
|
||||
indexList: [],
|
||||
isAjax: true,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getindexList();
|
||||
},
|
||||
methods: {
|
||||
getindexList() {
|
||||
let that = this;
|
||||
that.isAjax = true;
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/commission/level/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
}, function (ret, res) {
|
||||
that.indexList = res.data;
|
||||
that.isAjax = false;
|
||||
return false
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
})
|
||||
},
|
||||
operation(opttype, id) {
|
||||
let that = this;
|
||||
switch (opttype) {
|
||||
case 'create':
|
||||
Fast.api.open('shopro/commission/level/add', '新建分销商等级', {
|
||||
callback(data) {
|
||||
that.getindexList();
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 'edit':
|
||||
Fast.api.open('shopro/commission/level/edit?level=' + id, '编辑分销商等级', {
|
||||
callback(data) {
|
||||
that.getindexList();
|
||||
}
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
tableCellClassName({
|
||||
columnIndex
|
||||
}) {
|
||||
if (columnIndex == 0 || columnIndex == 7) {
|
||||
return 'cell-left';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
add: function () {
|
||||
Controller.detailInit('add');
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.detailInit('edit');
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
detailInit: function (type) {
|
||||
var detailPage = new Vue({
|
||||
el: "#detailPage",
|
||||
data() {
|
||||
return {
|
||||
optType: type,
|
||||
formData: {
|
||||
level: '',
|
||||
name: '',
|
||||
image: '',
|
||||
commission_rules: {
|
||||
commission_1: '0.00',
|
||||
commission_2: '0.00',
|
||||
commission_3: '0.00',
|
||||
},
|
||||
upgrade_type: 0,
|
||||
upgrade_rules: ''
|
||||
},
|
||||
upgradeCondition: [{
|
||||
title: '用户消费金额',
|
||||
key: 'total_consume',
|
||||
value: '',
|
||||
}, {
|
||||
title: '一级用户人数',
|
||||
key: 'child_user_count_1',
|
||||
value: '',
|
||||
}, {
|
||||
title: '二级用户人数',
|
||||
key: 'child_user_count_2',
|
||||
value: '',
|
||||
}, {
|
||||
title: '团队用户人数',
|
||||
key: 'child_user_count',
|
||||
value: '',
|
||||
}, {
|
||||
title: '直推分销订单金额',
|
||||
key: 'order_money',
|
||||
value: '',
|
||||
}, {
|
||||
title: '一级分销订单金额',
|
||||
key: 'child_order_money_1',
|
||||
value: '',
|
||||
}, {
|
||||
title: '二级分销订单金额',
|
||||
key: 'child_order_money_2',
|
||||
value: '',
|
||||
}, {
|
||||
title: '团队分销订单金额',
|
||||
key: 'child_order_money',
|
||||
value: '',
|
||||
}, {
|
||||
title: '直推分销订单数量',
|
||||
key: 'order_count',
|
||||
value: '',
|
||||
}, {
|
||||
title: '一级分销订单数量',
|
||||
key: 'child_order_count_1',
|
||||
value: '',
|
||||
}, {
|
||||
title: '二级分销订单数量',
|
||||
key: 'child_order_count_2',
|
||||
value: '',
|
||||
}, {
|
||||
title: '团队分销订单数量',
|
||||
key: 'child_order_count',
|
||||
value: '',
|
||||
}, {
|
||||
title: '一级分销商人数',
|
||||
key: 'child_agent_count_1',
|
||||
value: '',
|
||||
}, {
|
||||
title: '二级分销商人数',
|
||||
key: 'child_agent_count_2',
|
||||
value: '',
|
||||
}, {
|
||||
title: '团队分销商人数',
|
||||
key: 'child_agent_count',
|
||||
value: '',
|
||||
}, {
|
||||
title: '团队分销商等级统计',
|
||||
key: 'child_agent_level',
|
||||
value: [],
|
||||
}, {
|
||||
title: '一级分销商等级统计',
|
||||
key: 'child_agent_level_1',
|
||||
value: [],
|
||||
}],
|
||||
upgradeConditionBak: [],
|
||||
upgradeConditionInit: [{
|
||||
title: '用户消费金额',
|
||||
key: 'total_consume',
|
||||
value: '',
|
||||
}, {
|
||||
title: '一级用户人数',
|
||||
key: 'child_user_count_1',
|
||||
value: '',
|
||||
}, {
|
||||
title: '二级用户人数',
|
||||
key: 'child_user_count_2',
|
||||
value: '',
|
||||
}, {
|
||||
title: '团队用户人数',
|
||||
key: 'child_user_count',
|
||||
value: '',
|
||||
}, {
|
||||
title: '直推分销订单金额',
|
||||
key: 'order_money',
|
||||
value: '',
|
||||
}, {
|
||||
title: '一级分销订单金额',
|
||||
key: 'child_order_money_1',
|
||||
value: '',
|
||||
}, {
|
||||
title: '二级分销订单金额',
|
||||
key: 'child_order_money_2',
|
||||
value: '',
|
||||
}, {
|
||||
title: '团队分销订单金额',
|
||||
key: 'child_order_money',
|
||||
value: '',
|
||||
}, {
|
||||
title: '直推分销订单数量',
|
||||
key: 'order_count',
|
||||
value: '',
|
||||
}, {
|
||||
title: '一级分销订单数量',
|
||||
key: 'child_order_count_1',
|
||||
value: '',
|
||||
}, {
|
||||
title: '二级分销订单数量',
|
||||
key: 'child_order_count_2',
|
||||
value: '',
|
||||
}, {
|
||||
title: '团队分销订单数量',
|
||||
key: 'child_order_count',
|
||||
value: '',
|
||||
}, {
|
||||
title: '一级分销商人数',
|
||||
key: 'child_agent_count_1',
|
||||
value: '',
|
||||
}, {
|
||||
title: '二级分销商人数',
|
||||
key: 'child_agent_count_2',
|
||||
value: '',
|
||||
}, {
|
||||
title: '团队分销商人数',
|
||||
key: 'child_agent_count',
|
||||
value: '',
|
||||
}, {
|
||||
title: '团队分销商等级统计',
|
||||
key: 'child_agent_level',
|
||||
value: [],
|
||||
}, {
|
||||
title: '一级分销商等级统计',
|
||||
key: 'child_agent_level_1',
|
||||
value: [],
|
||||
}],
|
||||
goods_ids_list: null,
|
||||
levelList: [{
|
||||
title: '一级',
|
||||
value: '1',
|
||||
}, {
|
||||
title: '二级',
|
||||
value: '2',
|
||||
}, {
|
||||
title: '三级',
|
||||
value: '3',
|
||||
}, {
|
||||
title: '四级',
|
||||
value: '4',
|
||||
}, {
|
||||
title: '五级',
|
||||
value: '5',
|
||||
}, {
|
||||
title: '六级',
|
||||
value: '6',
|
||||
}, {
|
||||
title: '七级',
|
||||
value: '7',
|
||||
}, {
|
||||
title: '八级',
|
||||
value: '8',
|
||||
}, {
|
||||
title: '九级',
|
||||
value: '9',
|
||||
}, {
|
||||
title: '十级',
|
||||
value: '10',
|
||||
}],
|
||||
levelOptions: [],
|
||||
selectLevelOptionsLength: 0,
|
||||
moveLevel: '',
|
||||
editId: null,
|
||||
deleteDialog: false,
|
||||
existLevel: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initData();
|
||||
},
|
||||
methods: {
|
||||
//init 数据
|
||||
initData() {
|
||||
let that = this;
|
||||
that.existLevel = Config.existLevel;
|
||||
that.levelOptions = []
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/commission/level/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
}, function (ret, res) {
|
||||
that.levelOptions = res.data;
|
||||
if (that.optType == 'edit') {
|
||||
that.formData = Config.row;
|
||||
that.editId = Config.row.level;
|
||||
|
||||
//判断下面的等级选择
|
||||
let selectLevel = [];
|
||||
that.levelOptions.forEach((item, index) => {
|
||||
if (item.level < that.formData.level) {
|
||||
selectLevel.push(item)
|
||||
}
|
||||
})
|
||||
that.selectLevelOptionsLength = selectLevel.length;
|
||||
|
||||
that.existLevel.splice(that.existLevel.indexOf(Config.row.level), 1)
|
||||
|
||||
that.formData.upgrade_rules = JSON.parse(that.formData.upgrade_rules)
|
||||
for (key in that.formData.upgrade_rules) {
|
||||
that.upgradeCondition.forEach(i => {
|
||||
if (key == i.key) {
|
||||
i.value = that.formData.upgrade_rules[key];
|
||||
i.selected = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
that.upgradeConditionBak = JSON.parse(JSON.stringify(that.upgradeCondition))
|
||||
}
|
||||
return false
|
||||
})
|
||||
},
|
||||
childAgentCountAdd(index) {
|
||||
if (this.formData.level) {
|
||||
this.upgradeCondition[index].value.push({
|
||||
level: '',
|
||||
count: ''
|
||||
})
|
||||
} else {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '请先选择等级',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
},
|
||||
childAgentCountDelete(zindex, index) {
|
||||
this.upgradeCondition[zindex].value.splice(index, 1)
|
||||
},
|
||||
//选择等级徽章
|
||||
bgimageAdd() {
|
||||
let that = this;
|
||||
Fast.api.open("general/file/index?select=1&multiple=false", "选择", {
|
||||
callback: function (data) {
|
||||
that.formData.image = data.url;
|
||||
that.$forceUpdate();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
},
|
||||
//选择条件
|
||||
selectCondition(index) {
|
||||
this.upgradeCondition[index].selected = !this.upgradeCondition[index].selected;
|
||||
if (!this.upgradeCondition[index].selected) {
|
||||
this.upgradeCondition[index].value = ""
|
||||
}
|
||||
this.$forceUpdate();
|
||||
},
|
||||
//条件删除
|
||||
conditionDelete(index) {
|
||||
this.upgradeCondition[index].selected = false;
|
||||
this.upgradeCondition[index].value = ""
|
||||
this.$forceUpdate();
|
||||
},
|
||||
selectLevel(index) {
|
||||
//赋值level
|
||||
this.formData.level = this.levelList[index].value;
|
||||
|
||||
//控制添加按钮是否显示
|
||||
let selectLevel = [];
|
||||
this.levelOptions.forEach((item, index) => {
|
||||
if (item.level < this.formData.level && item.level != this.editId) {
|
||||
selectLevel.push(item)
|
||||
}
|
||||
})
|
||||
this.selectLevelOptionsLength = selectLevel.length;
|
||||
|
||||
//清空条件
|
||||
this.upgradeCondition = JSON.parse(JSON.stringify(this.upgradeConditionInit));
|
||||
|
||||
if (this.editId == this.formData.level) {
|
||||
this.upgradeCondition = JSON.parse(JSON.stringify(this.upgradeConditionBak));
|
||||
}
|
||||
},
|
||||
addGoods(index) {
|
||||
let that = this;
|
||||
let multiple = false;
|
||||
let type = '';
|
||||
let ids = that.upgradeCondition[index].value ? that.upgradeCondition[index].value : '';
|
||||
|
||||
let params = {
|
||||
multiple: multiple,
|
||||
type: type,
|
||||
ids: ids
|
||||
}
|
||||
shoproSelectGoods(params, "选择商品").then(data => {
|
||||
that.upgradeCondition[index].value = data.data.id;
|
||||
that.goods_ids_list = data.data;
|
||||
that.$forceUpdate();
|
||||
}).catch(error => {
|
||||
});
|
||||
return false;
|
||||
},
|
||||
formDelete() {
|
||||
this.deleteDialog = true
|
||||
},
|
||||
deleteDialogClose(type) {
|
||||
this.deleteDialog = false;
|
||||
if (type == 'define') {
|
||||
Fast.api.ajax({
|
||||
url: ajaxUrl,
|
||||
loading: true,
|
||||
data: formSubmit
|
||||
}, function (ret, res) {})
|
||||
}
|
||||
},
|
||||
formSubmit(formName) {
|
||||
let that = this;
|
||||
if (that.formData.level == "") {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '等级权重未填写',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (that.formData.name == "") {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '等级名称未填写',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (Number(that.formData.commission_rules.commission_1) + Number(that.formData.commission_rules.commission_2) + Number(that.formData.commission_rules.commission_3) > 100) {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '佣金比例之和不可超过100',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (Number(that.formData.commission_rules.commission_1) < 0 || Number(that.formData.commission_rules.commission_2) < 0 || Number(that.formData.commission_rules.commission_3) < 0) {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '佣金比例不可小于0',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
let upgrade_rules = {}
|
||||
let nowrite = true
|
||||
let condition = 0;
|
||||
that.upgradeCondition.forEach(k => {
|
||||
if (k.selected) {
|
||||
upgrade_rules[k.key] = k.value
|
||||
if (k.value === "") {
|
||||
nowrite = false;
|
||||
};
|
||||
if (k.key == 'agent_level') {
|
||||
k.value.length > 0
|
||||
if (k.value.length == 0) {
|
||||
nowrite = false;
|
||||
} else {
|
||||
k.value.forEach(i => {
|
||||
if (i.level == "" || i.count == "") {
|
||||
nowrite = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
condition++
|
||||
}
|
||||
})
|
||||
|
||||
that.formData.upgrade_rules = JSON.stringify(upgrade_rules)
|
||||
if (that.formData.level != 1) {
|
||||
if (condition == 0) {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '至少选择一个升级条件',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (!nowrite) {
|
||||
this.$notify({
|
||||
title: '警告',
|
||||
message: '升级条件必须填写完整',
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var formSubmit = JSON.parse(JSON.stringify(that.formData));
|
||||
for (key in formSubmit.commission_rules) {
|
||||
formSubmit.commission_rules[key] = Number(formSubmit.commission_rules[key]).toFixed(2)
|
||||
}
|
||||
formSubmit.commission_rules = JSON.stringify(formSubmit.commission_rules)
|
||||
if (this.optType == 'edit') {
|
||||
formSubmit.new_level = formSubmit.level;
|
||||
delete formSubmit.level;
|
||||
}
|
||||
// return false;
|
||||
let ajaxUrl = "shopro/commission/level/add"
|
||||
if (this.optType == 'edit') {
|
||||
ajaxUrl = 'shopro/commission/level/edit?level=' + that.editId
|
||||
}
|
||||
Fast.api.ajax({
|
||||
url: ajaxUrl,
|
||||
loading: true,
|
||||
data: formSubmit
|
||||
}, function (ret, res) {
|
||||
Fast.api.close()
|
||||
return false;
|
||||
})
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,194 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
var indexPage = new Vue({
|
||||
el: "#indexPage",
|
||||
data() {
|
||||
return {
|
||||
searchForm: {
|
||||
form_1_key: "agent_id",
|
||||
form_1_value: "",
|
||||
form_2_key: "oper_id",
|
||||
form_2_value: "",
|
||||
|
||||
oper_type: 'all',
|
||||
|
||||
event: "all",
|
||||
createtime: [],
|
||||
},
|
||||
searchFormInit: {
|
||||
form_1_key: "agent_id",
|
||||
form_1_value: "",
|
||||
form_2_key: "oper_id",
|
||||
form_2_value: "",
|
||||
|
||||
oper_type: 'all',
|
||||
|
||||
event: "all",
|
||||
createtime: [],
|
||||
},
|
||||
searchOp: {
|
||||
event: "=",
|
||||
createtime: "range",
|
||||
},
|
||||
|
||||
listData: [],
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
totalPage: 0,
|
||||
offset: 0,
|
||||
limit: 10,
|
||||
isAjax: true,
|
||||
|
||||
logOptions: [],
|
||||
operTypeOptions: [{
|
||||
label: '全部',
|
||||
value: 'all'
|
||||
}, {
|
||||
label: '用户',
|
||||
value: 'user'
|
||||
}, {
|
||||
label: '管理员',
|
||||
value: 'admin'
|
||||
}, {
|
||||
label: '系统',
|
||||
value: 'system'
|
||||
}],
|
||||
really_status: '',
|
||||
reallyTimer: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getListData();
|
||||
this.getLogStatus()
|
||||
},
|
||||
methods: {
|
||||
getLogStatus() {
|
||||
let that = this;
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/commission/log/getEventAll',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
}, function (ret, res) {
|
||||
that.logOptions = res.data;
|
||||
return false;
|
||||
})
|
||||
},
|
||||
getListData() {
|
||||
let that = this;
|
||||
that.isAjax = true;
|
||||
let filter = {}
|
||||
let op = {}
|
||||
for (key in that.searchForm) {
|
||||
if (key == 'form_1_value' || key == 'form_2_value') {
|
||||
if (that.searchForm[key] != '') {
|
||||
filter[that.searchForm.form_1_key] = that.searchForm[key];
|
||||
}
|
||||
} else if (key == 'createtime') {
|
||||
if (that.searchForm[key]) {
|
||||
if (that.searchForm[key].length > 0) {
|
||||
filter[key] = that.searchForm[key].join(' - ');
|
||||
}
|
||||
}
|
||||
} else if (key == 'event' || key == 'oper_type') {
|
||||
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/commission/log/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
limit: that.limit,
|
||||
offset: that.offset,
|
||||
filter: JSON.stringify(filter),
|
||||
op: JSON.stringify(op)
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.listData = res.data.rows;
|
||||
that.totalPage = res.data.total;
|
||||
that.isAjax = false;
|
||||
return false
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
})
|
||||
},
|
||||
screenEmpty() {
|
||||
this.searchForm = JSON.parse(JSON.stringify(this.searchFormInit))
|
||||
},
|
||||
operation(opttype, row) {
|
||||
let that = this;
|
||||
switch (opttype) {
|
||||
case 'order':
|
||||
Fast.api.open(`shopro/commission/order/index?id=${row.event_id}`, '详情', {
|
||||
callback(data) {
|
||||
that.getListData()
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 'reward':
|
||||
Fast.api.open(`shopro/commission/reward/index?id=${row.event_id}`, '详情', {
|
||||
callback(data) {
|
||||
that.getListData()
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 'share':
|
||||
case 'agent':
|
||||
case 'level':
|
||||
that.openAgentProfile(row.event_id)
|
||||
break;
|
||||
}
|
||||
},
|
||||
openAgentProfile(agent_id) {
|
||||
let that = this;
|
||||
Fast.api.open(`shopro/commission/agent/profile?id=${agent_id}`, '详情', {
|
||||
callback(data) {
|
||||
that.getListData()
|
||||
}
|
||||
})
|
||||
},
|
||||
changeReallyStatus(val) {
|
||||
clearInterval(this.reallyTimer)
|
||||
if (val == 1) {
|
||||
this.reallyTimer = setInterval(() => {
|
||||
this.getListData()
|
||||
}, 3000);
|
||||
}
|
||||
},
|
||||
tableCellClassName({
|
||||
columnIndex
|
||||
}) {
|
||||
if (columnIndex == 2 || columnIndex == 5 || columnIndex == 7) {
|
||||
return 'cell-left';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
pageSizeChange(val) {
|
||||
this.offset = 0;
|
||||
this.limit = val;
|
||||
this.currentPage = 1;
|
||||
this.getListData();
|
||||
},
|
||||
pageCurrentChange(val) {
|
||||
this.offset = (val - 1) * this.limit;
|
||||
this.currentPage = val;
|
||||
this.getListData();
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,532 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
var orderIndex = new Vue({
|
||||
el: "#orderIndex",
|
||||
data() {
|
||||
return {
|
||||
orderList: [],
|
||||
currentPage: 1,
|
||||
totalPage: 0,
|
||||
offset: 0,
|
||||
limit: 10,
|
||||
|
||||
searchStatusOption: [{
|
||||
value: 'all',
|
||||
label: "全部"
|
||||
}, {
|
||||
value: '-2',
|
||||
label: "已取消"
|
||||
}, {
|
||||
value: '-1',
|
||||
label: "已退回"
|
||||
}, {
|
||||
value: '0',
|
||||
label: "未结算"
|
||||
}, {
|
||||
value: '1',
|
||||
label: "已结算"
|
||||
}],
|
||||
commissionEventOption: [{
|
||||
value: 'all',
|
||||
label: "全部"
|
||||
}, {
|
||||
value: 'payed',
|
||||
label: "支付后结算"
|
||||
}, {
|
||||
value: 'confirm',
|
||||
label: "确认收货结算"
|
||||
}, {
|
||||
value: 'finish',
|
||||
label: "订单完成结算"
|
||||
}, {
|
||||
value: 'admin',
|
||||
label: "手动打款"
|
||||
}],
|
||||
|
||||
searchForm: {
|
||||
form_1_key: "buyer_id",
|
||||
form_1_value: "",
|
||||
|
||||
form_2_key: "agent_id",
|
||||
form_2_value: "",
|
||||
|
||||
form_3_key: "commission_user_id",
|
||||
form_3_value: "",
|
||||
|
||||
order_sn: "",
|
||||
order_createtime: "",
|
||||
goods_title: "",
|
||||
commission_order_createtime: "",
|
||||
commission_reward_status: "all",
|
||||
commission_event: "all",
|
||||
|
||||
id: ''
|
||||
},
|
||||
searchFormInit: {
|
||||
form_1_key: "buyer_id",
|
||||
form_1_value: "",
|
||||
|
||||
form_2_key: "agent_id",
|
||||
form_2_value: "",
|
||||
|
||||
form_3_key: "commission_user_id",
|
||||
form_3_value: "",
|
||||
|
||||
order_sn: "",
|
||||
order_createtime: "",
|
||||
goods_title: "",
|
||||
commission_time: "",
|
||||
commission_reward_status: "all",
|
||||
commission_event: "all",
|
||||
|
||||
id: ''
|
||||
},
|
||||
searchOp: {
|
||||
buyer_id: "=",
|
||||
buyer_nickname: "like",
|
||||
buyer_mobile: "like",
|
||||
|
||||
agent_id: "=",
|
||||
agent_nickname: "like",
|
||||
agent_mobile: "like",
|
||||
|
||||
commission_user_id: "=",
|
||||
commission_nickname: "like",
|
||||
commission_mobile: "like",
|
||||
|
||||
order_sn: "like",
|
||||
order_createtime: "range",
|
||||
goods_title: "like",
|
||||
commission_time: "range",
|
||||
commission_reward_status: "=",
|
||||
commission_event: "=",
|
||||
|
||||
id: '='
|
||||
|
||||
},
|
||||
isAjax: false,
|
||||
isPopoverEdit: false,
|
||||
popoverIndex: null,
|
||||
orderId: null,
|
||||
isPopoverMessage: '',
|
||||
|
||||
commissionOperIndex: null,
|
||||
commissionOperStatus: null,
|
||||
deductioncheckbox: '1',
|
||||
isdisabled: false,
|
||||
// 统计
|
||||
commissionDashboard: {
|
||||
total: {
|
||||
total: {
|
||||
label:'商品总订单数',
|
||||
color: '#8644F2',
|
||||
unit: '单',
|
||||
value: 0
|
||||
},
|
||||
amount_total: {
|
||||
label:'商品结算总金额',
|
||||
color: '#E6A93C ',
|
||||
unit: '元',
|
||||
value: 0
|
||||
},
|
||||
commission_total: {
|
||||
label:'分佣总金额',
|
||||
color: '#687FF4',
|
||||
unit: '元',
|
||||
value: 0
|
||||
}
|
||||
},
|
||||
status: {
|
||||
commission_cancel_total: {
|
||||
label:'已取消佣金',
|
||||
color: '#70C140 ',
|
||||
unit: '元',
|
||||
value: 0
|
||||
},
|
||||
commission_back_total: {
|
||||
label:'已退回佣金',
|
||||
color: '#FF826C',
|
||||
unit: '元',
|
||||
value: 0
|
||||
},
|
||||
commission_waiting_total: {
|
||||
label:'未结算佣金',
|
||||
color: '#EC5B55 ',
|
||||
unit: '元',
|
||||
value: 0
|
||||
},
|
||||
commissioned_total: {
|
||||
label:'已结算佣金',
|
||||
color: '#56B99D ',
|
||||
unit: '元',
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (new URLSearchParams(location.search).get('agent_id')) {
|
||||
this.searchForm.form_2_key = 'agent_id';
|
||||
this.searchForm.form_2_value = new URLSearchParams(location.search).get('agent_id');
|
||||
} else if (new URLSearchParams(location.search).get('id')) {
|
||||
this.searchForm.id = new URLSearchParams(location.search).get('id');
|
||||
this.searchFormInit.id = new URLSearchParams(location.search).get('id');
|
||||
} else {
|
||||
this.searchForm.order_createtime = [];
|
||||
let start = `${moment(new Date()).format('YYYY-MM-DD')} 00:00:00`;
|
||||
let end = `${moment(new Date()).format('YYYY-MM-DD')} 23:59:59`;
|
||||
this.searchForm.order_createtime.push(start)
|
||||
this.searchForm.order_createtime.push(end);
|
||||
this.searchFormInit.order_createtime = this.searchForm.order_createtime;
|
||||
}
|
||||
// 佣金明细跳转
|
||||
if (new URLSearchParams(location.search).get('order_sn')) {
|
||||
this.searchForm.order_sn = new URLSearchParams(location.search).get('order_sn');
|
||||
this.searchFormInit.order_sn = new URLSearchParams(location.search).get('order_sn');
|
||||
this.searchForm.order_createtime = [];
|
||||
this.searchFormInit.order_createtime = []
|
||||
}
|
||||
this.reqOrderList()
|
||||
},
|
||||
methods: {
|
||||
getrefresh() {
|
||||
window.location.reload(() => {
|
||||
this.reqOrderList();
|
||||
});
|
||||
},
|
||||
reqOrderList() {
|
||||
var that = this;
|
||||
that.isAjax = true;
|
||||
let filter = {}
|
||||
let op = {}
|
||||
for (key in that.searchForm) {
|
||||
if (key == 'form_1_value') {
|
||||
if (that.searchForm[key] != '') {
|
||||
filter[that.searchForm.form_1_key] = that.searchForm[key];
|
||||
}
|
||||
} else if (key == 'form_2_value') {
|
||||
if (that.searchForm[key] != '') {
|
||||
filter[that.searchForm.form_2_key] = that.searchForm[key];
|
||||
}
|
||||
} else if (key == 'form_3_value') {
|
||||
if (that.searchForm[key] != '') {
|
||||
filter[that.searchForm.form_3_key] = that.searchForm[key];
|
||||
}
|
||||
} else if (key == 'commission_time' || key == 'order_createtime') {
|
||||
if (that.searchForm[key]) {
|
||||
if (that.searchForm[key].length > 0) {
|
||||
filter[key] = that.searchForm[key].join(' - ');
|
||||
}
|
||||
}
|
||||
} else if (key == 'order_sn' || key == 'goods_title' || key == 'commission_reward_status' || key == 'commission_event' || key == 'id') {
|
||||
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/commission/order/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
filter: JSON.stringify(filter),
|
||||
op: JSON.stringify(op),
|
||||
offset: that.offset,
|
||||
limit: that.limit,
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.orderList = res.data.rows;
|
||||
that.totalPage = res.data.total;
|
||||
for (t in that.commissionDashboard.total) {
|
||||
that.commissionDashboard.total[t].value = res.data[t]
|
||||
}
|
||||
for (s in that.commissionDashboard.status) {
|
||||
that.commissionDashboard.status[s].value = res.data[s]
|
||||
}
|
||||
that.isAjax = false;
|
||||
that.isdisabled = false
|
||||
that.isPopoverEdit = null;
|
||||
that.commissionOperIndex = null;
|
||||
that.commissionOperStatus = null;
|
||||
return false;
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
})
|
||||
},
|
||||
commissionLevelFilter(level) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
return '自购'
|
||||
break;
|
||||
case 1:
|
||||
return '一级分销'
|
||||
break;
|
||||
case 2:
|
||||
return '二级分销'
|
||||
break;
|
||||
case 3:
|
||||
return '三级分销'
|
||||
break;
|
||||
}
|
||||
},
|
||||
goDetail(id) {
|
||||
let that = this;
|
||||
Fast.api.open('shopro/order/order/detail?id=' + id, "查看详情", {
|
||||
callback() {
|
||||
that.reqOrderList()
|
||||
}
|
||||
});
|
||||
},
|
||||
goUser(type, id) {
|
||||
let that = this;
|
||||
if (type == 'agent') {
|
||||
Fast.api.open('shopro/commission/agent/profile?id=' + id, '查看推广分销商', {
|
||||
callback() {
|
||||
that.reqOrderList();
|
||||
}
|
||||
})
|
||||
} else if (type == 'buyer') {
|
||||
Fast.api.open('shopro/user/user/profile?id=' + id, '查看下单用户', {
|
||||
callback() {
|
||||
that.reqOrderList()
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
screenEmpty() {
|
||||
this.searchForm = JSON.parse(JSON.stringify(this.searchFormInit))
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
//分页(更换页面显示条数)
|
||||
handleSizeChange(val) {
|
||||
this.offset = 0
|
||||
this.limit = val
|
||||
this.currentPage = 1;
|
||||
this.reqOrderList()
|
||||
},
|
||||
//当前是第几页
|
||||
handleCurrentChange(val) {
|
||||
this.offset = (val - 1) * this.limit;
|
||||
this.currentPage = 1;
|
||||
this.reqOrderList()
|
||||
},
|
||||
changePopoverEdit(value, index, order_id) {
|
||||
this.popoverIndex = index
|
||||
this.isPopoverMessage = value;
|
||||
this.isPopoverEdit = true;
|
||||
this.orderId = order_id
|
||||
},
|
||||
tableCellClassName({
|
||||
columnIndex
|
||||
}) {
|
||||
if (columnIndex > 1 && 12 > columnIndex) {
|
||||
return 'cell-center';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
settlement(type, id, index, innerIndex) {
|
||||
let that = this;
|
||||
let requrl;
|
||||
let reqdata = {}
|
||||
switch (type) {
|
||||
case 'runOrder':
|
||||
that.isdisabled = true
|
||||
requrl = `shopro/commission/order/runCommission?id=${id}`;
|
||||
Fast.api.ajax({
|
||||
url: requrl,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
}, function (ret, res) {
|
||||
that.reqOrderList();
|
||||
that.$refs[`commission-status-${index}`].doToggle();
|
||||
}, function (ret, res) {
|
||||
that.$refs[`commission-status-${index}`].doToggle();
|
||||
that.isdisabled = false
|
||||
that.isAjax = false;
|
||||
})
|
||||
break;
|
||||
case 'runReward':
|
||||
requrl = 'shopro/commission/reward/runCommission?id=' + id
|
||||
this.$confirm('此操作将手动结算, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
Fast.api.ajax({
|
||||
url: requrl,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
}, function (ret, res) {
|
||||
that.reqOrderList();
|
||||
that.$refs[`popover-${index}-${innerIndex}`][0].doToggle();
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消手动结算'
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'backOrder':
|
||||
requrl = `shopro/commission/order/backCommission?id=${id}&delete=${that.deductioncheckbox}`;
|
||||
that.isdisabled = true
|
||||
Fast.api.ajax({
|
||||
url: requrl,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
}, function (ret, res) {
|
||||
that.reqOrderList();
|
||||
that.$refs[`commission-status-${index}`].doToggle();
|
||||
that.deductioncheckbox = '1'
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
that.isdisabled = false
|
||||
that.$refs[`commission-status-${index}`].doToggle();
|
||||
that.deductioncheckbox = '1'
|
||||
});
|
||||
break;
|
||||
case 'backReward':
|
||||
requrl = 'shopro/commission/reward/backCommission?id=' + id
|
||||
this.$confirm('此操作将手动退回, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
Fast.api.ajax({
|
||||
url: requrl,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
}, function (ret, res) {
|
||||
that.reqOrderList();
|
||||
that.$refs[`popover-${index}-${innerIndex}`][0].doToggle();
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消手动退回'
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'cancelOrder':
|
||||
requrl = `shopro/commission/order/cancelCommission?id=${id}&delete=${that.deductioncheckbox}`;
|
||||
that.isdisabled = true
|
||||
Fast.api.ajax({
|
||||
url: requrl,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
}, function (ret, res) {
|
||||
that.reqOrderList();
|
||||
that.$refs[`commission-status-${index}`].doToggle();
|
||||
that.deductioncheckbox = '1'
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
that.isdisabled = false
|
||||
that.$refs[`commission-status-${index}`].doToggle();
|
||||
that.deductioncheckbox = '1'
|
||||
});
|
||||
break;
|
||||
case 'cancelReward':
|
||||
requrl = 'shopro/commission/reward/cancelCommission?id=' + id
|
||||
this.$confirm('此操作将取消结算, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
Fast.api.ajax({
|
||||
url: requrl,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
}, function (ret, res) {
|
||||
that.reqOrderList();
|
||||
that.$refs[`popover-${index}-${innerIndex}`][0].doToggle();
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'edit':
|
||||
requrl = 'shopro/commission/reward/edit?id=' + id;
|
||||
reqdata = {
|
||||
commission: that.isPopoverMessage
|
||||
}
|
||||
Fast.api.ajax({
|
||||
url: requrl,
|
||||
loading: false,
|
||||
type: 'POST',
|
||||
data: reqdata
|
||||
}, function (ret, res) {
|
||||
that.reqOrderList();
|
||||
that.$refs[`popover-${index}-${innerIndex}`][0].doToggle();
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
})
|
||||
break;
|
||||
case 'cancel':
|
||||
that.isPopoverEdit = false;
|
||||
that.deductioncheckbox = '1'
|
||||
break;
|
||||
}
|
||||
},
|
||||
changeCommissionStatus(index, type) {
|
||||
this.commissionOperIndex = index;
|
||||
this.commissionOperStatus = type
|
||||
},
|
||||
cancelcommissionStatusOper(index) {
|
||||
this.$refs[`commission-status-${index}`].doToggle();
|
||||
this.commissionOperIndex = null;
|
||||
this.commissionOperStatus = null;
|
||||
},
|
||||
arraySpanMethod({
|
||||
row,
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex
|
||||
}) {
|
||||
if (rowIndex >= 0) {
|
||||
if (columnIndex === 0) {
|
||||
return [0, 0];
|
||||
} else if (columnIndex === 1) {
|
||||
return [1, 4];
|
||||
}
|
||||
}
|
||||
},
|
||||
rewardStatusClass(status) {
|
||||
switch (status) {
|
||||
case -2:
|
||||
return 'shopro-status-info'
|
||||
break;
|
||||
case -1:
|
||||
return 'shopro-status-error'
|
||||
break;
|
||||
case 0:
|
||||
return 'shopro-status-warning'
|
||||
break;
|
||||
case 1:
|
||||
return 'shopro-status-success'
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,241 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
var orderIndex = new Vue({
|
||||
el: "#orderIndex",
|
||||
data() {
|
||||
return {
|
||||
orderList: [],
|
||||
currentPage: 1,
|
||||
totalPage: 0,
|
||||
offset: 0,
|
||||
limit: 10,
|
||||
|
||||
searchStatusOption: [{
|
||||
value: 'all',
|
||||
label: "全部"
|
||||
}, {
|
||||
value: '-1',
|
||||
label: "已退回"
|
||||
}, {
|
||||
value: '0',
|
||||
label: "未入账"
|
||||
}, {
|
||||
value: '1',
|
||||
label: "已入账"
|
||||
}],
|
||||
|
||||
searchForm: {
|
||||
form_1_key: "buyer_id",
|
||||
form_1_value: "",
|
||||
|
||||
form_2_key: "agent_id",
|
||||
form_2_value: "",
|
||||
|
||||
|
||||
order_sn: "",
|
||||
createtime: "",
|
||||
status: "all",
|
||||
|
||||
id: ''
|
||||
},
|
||||
searchFormInit: {
|
||||
form_1_key: "buyer_id",
|
||||
form_1_value: "",
|
||||
|
||||
form_2_key: "agent_id",
|
||||
form_2_value: "",
|
||||
|
||||
|
||||
order_sn: "",
|
||||
createtime: "",
|
||||
status: "all",
|
||||
|
||||
id: ''
|
||||
},
|
||||
searchOp: {
|
||||
buyer_id: "=",
|
||||
buyer_nickname: "like",
|
||||
buyer_mobile: "like",
|
||||
|
||||
agent_id: "=",
|
||||
agent_nickname: "like",
|
||||
agent_mobile: "like",
|
||||
|
||||
order_sn: "like",
|
||||
createtime: "range",
|
||||
status: "=",
|
||||
|
||||
id: '='
|
||||
|
||||
},
|
||||
dashboard: {
|
||||
total: 0,
|
||||
commission_total: 0,
|
||||
commissioned_total: 0,
|
||||
delay_total: 0,
|
||||
commission_back_total: 0,
|
||||
},
|
||||
|
||||
isAjax: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (new URLSearchParams(location.search).get('agent_id')) {
|
||||
this.searchForm.form_2_key = 'agent_id';
|
||||
this.searchForm.form_2_value = new URLSearchParams(location.search).get('agent_id');
|
||||
if (new URLSearchParams(location.search).get('status')) {
|
||||
this.searchForm.status = new URLSearchParams(location.search).get('status');
|
||||
}
|
||||
} else if (new URLSearchParams(location.search).get('id')) {
|
||||
this.searchForm.id = new URLSearchParams(location.search).get('id');
|
||||
this.searchFormInit.id = new URLSearchParams(location.search).get('id');
|
||||
} else {
|
||||
this.searchForm.createtime = [];
|
||||
let start = `${moment(new Date()).format('YYYY-MM')}-01 00:00:00`;
|
||||
let end = `${moment(new Date()).format('YYYY-MM-DD HH:mm:ss')}`;
|
||||
this.searchForm.createtime.push(start)
|
||||
this.searchForm.createtime.push(end);
|
||||
this.searchFormInit.createtime = this.searchForm.createtime;
|
||||
}
|
||||
this.reqOrderList()
|
||||
},
|
||||
methods: {
|
||||
reqOrderList() {
|
||||
var that = this;
|
||||
that.isAjax = true;
|
||||
let filter = {}
|
||||
let op = {}
|
||||
for (key in that.searchForm) {
|
||||
if (key == 'form_1_value') {
|
||||
if (that.searchForm[key] != '') {
|
||||
filter[that.searchForm.form_1_key] = that.searchForm[key];
|
||||
}
|
||||
} else if (key == 'form_2_value') {
|
||||
if (that.searchForm[key] != '') {
|
||||
filter[that.searchForm.form_2_key] = that.searchForm[key];
|
||||
}
|
||||
} else if (key == 'createtime') {
|
||||
if (that.searchForm[key]) {
|
||||
if (that.searchForm[key].length > 0) {
|
||||
filter[key] = that.searchForm[key].join(' - ');
|
||||
}
|
||||
}
|
||||
} else if (key == 'order_sn' || key == 'status' || key == 'id') {
|
||||
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/commission/reward/index',
|
||||
loading: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
filter: JSON.stringify(filter),
|
||||
op: JSON.stringify(op),
|
||||
offset: that.offset,
|
||||
limit: that.limit,
|
||||
}
|
||||
}, function (ret, res) {
|
||||
that.orderList = res.data.rows;
|
||||
that.totalPage = res.data.total;
|
||||
that.dashboard.total = res.data.total;
|
||||
that.dashboard.commission_total = res.data.commission_total;
|
||||
that.dashboard.commissioned_total = res.data.commissioned_total;
|
||||
that.dashboard.delay_total = res.data.delay_total;
|
||||
that.dashboard.commission_back_total = res.data.commission_back_total
|
||||
that.isAjax = false;
|
||||
return false;
|
||||
}, function (ret, res) {
|
||||
that.isAjax = false;
|
||||
})
|
||||
},
|
||||
commissionLevelFilter(level) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
return '自购'
|
||||
break;
|
||||
case 1:
|
||||
return '一级分销'
|
||||
break;
|
||||
case 2:
|
||||
return '二级分销'
|
||||
break;
|
||||
case 3:
|
||||
return '三级分销'
|
||||
break;
|
||||
}
|
||||
},
|
||||
goDetail(id) {
|
||||
let that = this;
|
||||
Fast.api.open('shopro/order/order/detail?id=' + id, "查看详情", {
|
||||
callback() {
|
||||
that.reqOrderList()
|
||||
}
|
||||
});
|
||||
},
|
||||
operation(type, id) {
|
||||
let that = this;
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
Fast.api.open('shopro/commission/agent/profile?id=' + id, '查看', {
|
||||
callback() {
|
||||
that.reqOrderList();
|
||||
}
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
screenEmpty() {
|
||||
this.searchForm = JSON.parse(JSON.stringify(this.searchFormInit))
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
//分页(更换页面显示条数)
|
||||
handleSizeChange(val) {
|
||||
this.offset = 0
|
||||
this.limit = val
|
||||
this.currentPage = 1;
|
||||
this.reqOrderList()
|
||||
},
|
||||
//当前是第几页
|
||||
handleCurrentChange(val) {
|
||||
this.offset = (val - 1) * this.limit;
|
||||
this.currentPage = 1;
|
||||
this.reqOrderList()
|
||||
},
|
||||
openCommissonOrder(order) {
|
||||
Fast.api.open(`shopro/commission/order/index?order_sn=${order.order_sn}`, '查看订单', {
|
||||
callback() {
|
||||
that.reqOrderList();
|
||||
}
|
||||
})
|
||||
},
|
||||
rewardStatusClass(status) {
|
||||
switch (status) {
|
||||
case -2:
|
||||
return 'shopro-status-info'
|
||||
break;
|
||||
case -1:
|
||||
return 'shopro-status-error'
|
||||
break;
|
||||
case 0:
|
||||
return 'shopro-status-warning'
|
||||
break;
|
||||
case 1:
|
||||
return 'shopro-status-success'
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户