@@ -26,6 +26,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
level: '',
|
||||
status: '',
|
||||
createtime: [],
|
||||
identity: '',
|
||||
is_venue: '',
|
||||
is_county: '',
|
||||
active_30d: '',
|
||||
county_code: '',
|
||||
},
|
||||
tools: {
|
||||
user: {
|
||||
@@ -95,6 +100,43 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
label: '更新时间',
|
||||
value: [],
|
||||
},
|
||||
identity: {
|
||||
type: 'tselect',
|
||||
label: '身份',
|
||||
value: '',
|
||||
options: {
|
||||
data: [
|
||||
{ value: 'taster', label: '品酒师' },
|
||||
{ value: 'maker', label: '创客' },
|
||||
{ value: 'venue', label: '酒道馆' },
|
||||
{ value: 'county', label: '区县' },
|
||||
]
|
||||
},
|
||||
},
|
||||
is_venue: {
|
||||
type: 'tselect',
|
||||
label: '酒道馆',
|
||||
value: '',
|
||||
options: { data: [{ value: '1', label: '是' }, { value: '0', label: '否' }] },
|
||||
},
|
||||
is_county: {
|
||||
type: 'tselect',
|
||||
label: '区县',
|
||||
value: '',
|
||||
options: { data: [{ value: '1', label: '是' }, { value: '0', label: '否' }] },
|
||||
},
|
||||
active_30d: {
|
||||
type: 'tselect',
|
||||
label: '30日活跃',
|
||||
value: '',
|
||||
options: { data: [{ value: '1', label: '有自购' }, { value: '0', label: '已暂停' }] },
|
||||
},
|
||||
county_code: {
|
||||
type: 'tinput',
|
||||
label: '区县编码',
|
||||
placeholder: '请输入区县编码',
|
||||
value: '',
|
||||
},
|
||||
},
|
||||
condition: {},
|
||||
}
|
||||
@@ -198,6 +240,138 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
})
|
||||
}
|
||||
|
||||
const identity = reactive({
|
||||
visible: false,
|
||||
loading: false,
|
||||
levels: [],
|
||||
areaSelect: [],
|
||||
form: {
|
||||
user_id: '',
|
||||
nickname: '',
|
||||
before_text: '',
|
||||
level: 1,
|
||||
is_venue: 0,
|
||||
is_county: 0,
|
||||
county_code: '',
|
||||
area_arr: [],
|
||||
upgrade_lock: 0,
|
||||
remark: '',
|
||||
}
|
||||
})
|
||||
|
||||
function getIdentityLevels() {
|
||||
Fast.api.ajax({
|
||||
url: `shopro/commission/level/select`,
|
||||
type: 'GET',
|
||||
}, function (ret, res) {
|
||||
identity.levels = res.data || []
|
||||
return false
|
||||
}, function () { })
|
||||
}
|
||||
|
||||
function getIdentityArea() {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/data/area/select',
|
||||
type: 'GET',
|
||||
}, function (ret, res) {
|
||||
identity.areaSelect = res.data || []
|
||||
return false
|
||||
}, function () { })
|
||||
}
|
||||
|
||||
function findAreaPath(nodes, targetId, path = []) {
|
||||
for (const node of (nodes || [])) {
|
||||
const next = path.concat([node.id])
|
||||
if (String(node.id) === String(targetId)) {
|
||||
return next
|
||||
}
|
||||
const found = findAreaPath(node.children, targetId, next)
|
||||
if (found) return found
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function onOpenIdentity(row) {
|
||||
getIdentityLevels()
|
||||
getIdentityArea()
|
||||
identity.form = {
|
||||
user_id: row.user_id,
|
||||
nickname: row.user?.nickname || row.user_id,
|
||||
before_text: row.identity_text || '',
|
||||
level: Number(row.level || 1),
|
||||
is_venue: Number(row.is_venue || 0),
|
||||
is_county: Number(row.is_county || 0),
|
||||
county_code: row.county_code || '',
|
||||
area_arr: row.county_code ? findAreaPath(identity.areaSelect, row.county_code) || [] : [],
|
||||
upgrade_lock: Number(row.upgrade_lock || 0),
|
||||
remark: '',
|
||||
}
|
||||
identity.visible = true
|
||||
// area may load async; retry path once loaded
|
||||
setTimeout(() => {
|
||||
if (identity.form.county_code && (!identity.form.area_arr || !identity.form.area_arr.length)) {
|
||||
identity.form.area_arr = findAreaPath(identity.areaSelect, identity.form.county_code) || []
|
||||
}
|
||||
}, 400)
|
||||
}
|
||||
|
||||
function onIdentityAreaChange(val) {
|
||||
if (Array.isArray(val) && val.length) {
|
||||
identity.form.county_code = String(val[val.length - 1])
|
||||
} else {
|
||||
identity.form.county_code = ''
|
||||
}
|
||||
}
|
||||
|
||||
function identityLabel(level, isVenue, isCounty) {
|
||||
const lv = identity.levels.find(i => Number(i.level) === Number(level))
|
||||
let name = lv?.name || (Number(level) === 1 ? '品酒师' : `创客V${Number(level) - 1}`)
|
||||
const tags = []
|
||||
if (Number(level) >= 2) tags.push(name)
|
||||
else tags.push(name)
|
||||
if (Number(isVenue)) tags.push('酒道馆')
|
||||
if (Number(isCounty)) tags.push('区县代理')
|
||||
if (Number(level) >= 2 || Number(isVenue) || Number(isCounty)) {
|
||||
return '合伙股东 · ' + tags.filter((v, i, a) => a.indexOf(v) === i).join(' · ')
|
||||
}
|
||||
return tags[0]
|
||||
}
|
||||
|
||||
function onSubmitIdentity() {
|
||||
if (identity.form.is_county && !identity.form.county_code) {
|
||||
ElementPlus.ElMessage.error('开通区县代理时请选择区县')
|
||||
return
|
||||
}
|
||||
const { ElMessageBox } = ElementPlus
|
||||
const afterText = identityLabel(identity.form.level, identity.form.is_venue, identity.form.is_county)
|
||||
const name = identity.form.nickname || identity.form.user_id
|
||||
ElMessageBox.confirm(
|
||||
`将「${name}」从 ${identity.form.before_text || '当前身份'} 调整为 ${afterText}。已入账收益不追溯。确定?`,
|
||||
'确认调整身份',
|
||||
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
|
||||
).then(() => {
|
||||
identity.loading = true
|
||||
Fast.api.ajax({
|
||||
url: `shopro/commission/agent/identity/id/${identity.form.user_id}`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
level: identity.form.level,
|
||||
is_venue: identity.form.is_venue,
|
||||
is_county: identity.form.is_county,
|
||||
county_code: identity.form.county_code,
|
||||
upgrade_lock: identity.form.upgrade_lock,
|
||||
remark: identity.form.remark,
|
||||
},
|
||||
}, function () {
|
||||
identity.loading = false
|
||||
identity.visible = false
|
||||
getData()
|
||||
}, function () {
|
||||
identity.loading = false
|
||||
})
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getLevelSelect()
|
||||
getData()
|
||||
@@ -214,6 +388,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
pagination,
|
||||
onEdit,
|
||||
onDetail,
|
||||
identity,
|
||||
onOpenIdentity,
|
||||
onIdentityAreaChange,
|
||||
onSubmitIdentity,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -248,7 +426,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
function onChangeLevel() {
|
||||
Fast.api.open(`shopro/commission/level/select?level=${state.data.level}`, "更换分销等级", {
|
||||
callback(level) {
|
||||
onEdit({ level });
|
||||
onEditIdentity({ level });
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -287,6 +465,108 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
}, function (ret, res) { })
|
||||
}
|
||||
|
||||
function onEditIdentity(data) {
|
||||
onOpenIdentity()
|
||||
}
|
||||
|
||||
const identity = reactive({
|
||||
visible: false,
|
||||
loading: false,
|
||||
levels: [],
|
||||
areaSelect: [],
|
||||
form: {
|
||||
nickname: '',
|
||||
before_text: '',
|
||||
level: 1,
|
||||
is_venue: 0,
|
||||
is_county: 0,
|
||||
county_code: '',
|
||||
area_arr: [],
|
||||
upgrade_lock: 0,
|
||||
remark: '',
|
||||
}
|
||||
})
|
||||
|
||||
function findAreaPath(nodes, targetId, path = []) {
|
||||
for (const node of (nodes || [])) {
|
||||
const next = path.concat([node.id])
|
||||
if (String(node.id) === String(targetId)) return next
|
||||
const found = findAreaPath(node.children, targetId, next)
|
||||
if (found) return found
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function onOpenIdentity() {
|
||||
Fast.api.ajax({ url: 'shopro/commission/level/select', type: 'GET' }, function (ret, res) {
|
||||
identity.levels = res.data || []
|
||||
return false
|
||||
}, function () { })
|
||||
Fast.api.ajax({ url: 'shopro/data/area/select', type: 'GET' }, function (ret, res) {
|
||||
identity.areaSelect = res.data || []
|
||||
if (identity.form.county_code) {
|
||||
identity.form.area_arr = findAreaPath(identity.areaSelect, identity.form.county_code) || []
|
||||
}
|
||||
return false
|
||||
}, function () { })
|
||||
identity.form = {
|
||||
nickname: state.data.user?.nickname || state.data.user_id,
|
||||
before_text: state.data.identity_text || '',
|
||||
level: Number(state.data.level || 1),
|
||||
is_venue: Number(state.data.is_venue || 0),
|
||||
is_county: Number(state.data.is_county || 0),
|
||||
county_code: state.data.county_code || '',
|
||||
area_arr: [],
|
||||
upgrade_lock: Number(state.data.upgrade_lock || 0),
|
||||
remark: '',
|
||||
}
|
||||
identity.visible = true
|
||||
}
|
||||
|
||||
function onIdentityAreaChange(val) {
|
||||
identity.form.county_code = Array.isArray(val) && val.length ? String(val[val.length - 1]) : ''
|
||||
}
|
||||
|
||||
function onSubmitIdentity() {
|
||||
if (identity.form.is_county && !identity.form.county_code) {
|
||||
ElementPlus.ElMessage.error('开通区县代理时请选择区县')
|
||||
return
|
||||
}
|
||||
const { ElMessageBox } = ElementPlus
|
||||
const lv = identity.levels.find(i => Number(i.level) === Number(identity.form.level))
|
||||
let after = lv?.name || '品酒师'
|
||||
if (Number(identity.form.is_venue) || Number(identity.form.is_county) || Number(identity.form.level) >= 2) {
|
||||
const parts = ['合伙股东']
|
||||
if (Number(identity.form.level) >= 2) parts.push(lv?.name || `创客V${identity.form.level - 1}`)
|
||||
if (Number(identity.form.is_venue)) parts.push('酒道馆')
|
||||
if (Number(identity.form.is_county)) parts.push('区县代理')
|
||||
after = parts.join(' · ')
|
||||
}
|
||||
ElMessageBox.confirm(
|
||||
`将「${identity.form.nickname}」从 ${identity.form.before_text || '当前身份'} 调整为 ${after}。已入账收益不追溯。确定?`,
|
||||
'确认调整身份',
|
||||
{ type: 'warning' }
|
||||
).then(() => {
|
||||
identity.loading = true
|
||||
Fast.api.ajax({
|
||||
url: `shopro/commission/agent/identity/id/${state.id}`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
level: identity.form.level,
|
||||
is_venue: identity.form.is_venue,
|
||||
is_county: identity.form.is_county,
|
||||
county_code: identity.form.county_code,
|
||||
upgrade_lock: identity.form.upgrade_lock,
|
||||
remark: identity.form.remark,
|
||||
},
|
||||
}, function () {
|
||||
identity.loading = false
|
||||
identity.visible = false
|
||||
getDetail()
|
||||
}, function () { identity.loading = false })
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
function onTeam() {
|
||||
Fast.api.open(`shopro/commission/agent/team?id=${state.id}`, "查看团队")
|
||||
}
|
||||
@@ -367,6 +647,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
onSaveApplyInfo,
|
||||
onDeleteApplyInfo,
|
||||
onEdit,
|
||||
onEditIdentity,
|
||||
onOpenIdentity,
|
||||
onIdentityAreaChange,
|
||||
onSubmitIdentity,
|
||||
identity,
|
||||
onTeam,
|
||||
log,
|
||||
getLog,
|
||||
|
||||
@@ -7,6 +7,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
setup() {
|
||||
const state = reactive({
|
||||
data: [],
|
||||
makerBonus: { 2: 20, 3: 40, 4: 60, 5: 80, 6: 100, 7: 120 },
|
||||
})
|
||||
|
||||
function getData() {
|
||||
@@ -19,6 +20,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
}, function (ret, res) { })
|
||||
}
|
||||
|
||||
function getMakerBonus() {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/config/partner',
|
||||
type: 'GET',
|
||||
}, function (ret, res) {
|
||||
if (res.data?.partner_maker_bonus) {
|
||||
state.makerBonus = res.data.partner_maker_bonus
|
||||
}
|
||||
return false
|
||||
}, function () { })
|
||||
}
|
||||
|
||||
function onGotoPartnerConfig() {
|
||||
Fast.api.open('shopro/config?tab=shopro/config/partner', '合伙股东规则')
|
||||
}
|
||||
|
||||
function onAdd() {
|
||||
Fast.api.open(`shopro/commission/level/add?type=add`, "添加", {
|
||||
callback() {
|
||||
@@ -43,6 +60,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getMakerBonus()
|
||||
getData()
|
||||
})
|
||||
|
||||
@@ -52,6 +70,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
onAdd,
|
||||
onEdit,
|
||||
onDelete,
|
||||
onGotoPartnerConfig,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
|
||||
}
|
||||
}
|
||||
if (state.tabActive == 'shopro/config/partner') {
|
||||
if (!Array.isArray(form.model.partner_push3_amounts)) {
|
||||
form.model.partner_push3_amounts = [398, 400, 600]
|
||||
}
|
||||
if (!form.model.partner_maker_bonus) {
|
||||
form.model.partner_maker_bonus = { 2: 20, 3: 40, 4: 60, 5: 80, 6: 100, 7: 120 }
|
||||
}
|
||||
}
|
||||
|
||||
if (state.tabActive == 'shopro/config/chat') {
|
||||
getChatConfig()
|
||||
@@ -404,16 +412,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
delete submitForm.password
|
||||
}
|
||||
}
|
||||
proxy.$refs['formRef'].validate((valid) => {
|
||||
if (valid) {
|
||||
Fast.api.ajax({
|
||||
url: state.tabActive,
|
||||
type: 'POST',
|
||||
data: submitForm,
|
||||
}, function (ret, res) {
|
||||
}, function (ret, res) { })
|
||||
}
|
||||
});
|
||||
const doSave = () => {
|
||||
proxy.$refs['formRef'].validate((valid) => {
|
||||
if (valid) {
|
||||
Fast.api.ajax({
|
||||
url: state.tabActive,
|
||||
type: 'POST',
|
||||
data: submitForm,
|
||||
}, function (ret, res) {
|
||||
}, function (ret, res) { })
|
||||
}
|
||||
});
|
||||
}
|
||||
if (state.tabActive == 'shopro/config/partner' && submitForm.partner_madow_mode === 'cash') {
|
||||
const { ElMessageBox } = ElementPlus
|
||||
ElMessageBox.confirm('马豆改为现金模式后,日结将按当日 GMV 发放现金。确定保存?', '二次确认', {
|
||||
confirmButtonText: '确定保存',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(doSave).catch(() => {})
|
||||
return
|
||||
}
|
||||
doSave()
|
||||
}
|
||||
|
||||
function onOper(type) {
|
||||
|
||||
@@ -666,6 +666,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
express.isEdit = false
|
||||
}
|
||||
|
||||
const partnerStatusStyle = {
|
||||
'-2': 'danger',
|
||||
'-1': 'warning',
|
||||
'0': 'info',
|
||||
'1': 'success',
|
||||
}
|
||||
|
||||
// 编辑订单收货地址
|
||||
const address = reactive({
|
||||
flag: false,
|
||||
@@ -885,6 +892,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
onChangeFee,
|
||||
orderTab,
|
||||
onChangeTabOrder,
|
||||
partnerStatusStyle,
|
||||
address,
|
||||
onChangeAddressEdit,
|
||||
onConfirmAddress,
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: () => {
|
||||
const { reactive, onMounted } = Vue
|
||||
const index = {
|
||||
setup() {
|
||||
const state = reactive({ data: [], kpi: {} })
|
||||
const pagination = reactive({ page: 1, list_rows: 10, total: 0 })
|
||||
function getData() {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/partner/daily',
|
||||
type: 'GET',
|
||||
data: { page: pagination.page, list_rows: pagination.list_rows },
|
||||
}, function (ret, res) {
|
||||
state.data = res.data.data
|
||||
state.kpi = res.data.kpi || {}
|
||||
pagination.total = res.data.total
|
||||
return false
|
||||
}, function () { })
|
||||
}
|
||||
function onDetail(row) {
|
||||
Fast.api.open(`shopro/partner/reward/index?settle_date=${row.settle_date}`, '当日流水')
|
||||
}
|
||||
function onRerun(row) {
|
||||
const { ElMessageBox } = ElementPlus
|
||||
ElMessageBox.confirm('将删除当天日结流水后重算,即时奖(推三返一等)不重跑。确定?', '重跑日结', {
|
||||
confirmButtonText: '确定重跑',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/partner/daily/rerun',
|
||||
type: 'POST',
|
||||
data: { settle_date: row.settle_date },
|
||||
}, function () { getData() })
|
||||
}).catch(() => {})
|
||||
}
|
||||
onMounted(() => { getData() })
|
||||
return { state, pagination, getData, onDetail, onRerun }
|
||||
}
|
||||
}
|
||||
createApp('index', index);
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,204 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: () => {
|
||||
const { reactive, onMounted, ref } = Vue
|
||||
const index = {
|
||||
setup() {
|
||||
const state = reactive({
|
||||
data: [],
|
||||
filter: {
|
||||
drawer: false,
|
||||
data: {
|
||||
user: { field: 'user_id', value: '' },
|
||||
buyer: { field: 'buyer_id', value: '' },
|
||||
'order.order_sn': '',
|
||||
reward_type: '',
|
||||
role: '',
|
||||
status: '',
|
||||
settle_date: '',
|
||||
show_skip: '0',
|
||||
createtime: [],
|
||||
},
|
||||
tools: {
|
||||
user: {
|
||||
type: 'tinputprepend',
|
||||
label: '受益人',
|
||||
placeholder: '请输入查询内容',
|
||||
value: { field: 'user_id', value: '' },
|
||||
options: {
|
||||
data: [
|
||||
{ label: '用户ID', value: 'user_id' },
|
||||
{ label: '用户昵称', value: 'user.nickname' },
|
||||
{ label: '用户手机号', value: 'user.mobile' },
|
||||
],
|
||||
}
|
||||
},
|
||||
buyer: {
|
||||
type: 'tinputprepend',
|
||||
label: '买家',
|
||||
placeholder: '请输入查询内容',
|
||||
value: { field: 'buyer_id', value: '' },
|
||||
options: {
|
||||
data: [
|
||||
{ label: '用户ID', value: 'buyer_id' },
|
||||
{ label: '用户昵称', value: 'buyer.nickname' },
|
||||
{ label: '用户手机号', value: 'buyer.mobile' },
|
||||
],
|
||||
}
|
||||
},
|
||||
'order.order_sn': { type: 'tinput', label: '订单号', placeholder: '请输入查询内容', value: '' },
|
||||
reward_type: {
|
||||
type: 'tselect', label: '奖项类型', value: '',
|
||||
options: {
|
||||
data: [
|
||||
{ label: '推三返一', value: 'push3' },
|
||||
{ label: '创客极差奖', value: 'maker_diff' },
|
||||
{ label: '创客平级奖', value: 'maker_peer' },
|
||||
{ label: '创客超越奖', value: 'maker_overtaken' },
|
||||
{ label: '酒道馆团队奖', value: 'team_venue' },
|
||||
{ label: '区县团队奖', value: 'team_county' },
|
||||
{ label: '酒道馆平级奖', value: 'venue_peer' },
|
||||
{ label: '区县平级奖', value: 'county_peer' },
|
||||
{ label: '酒道馆平台均分', value: 'venue_share' },
|
||||
{ label: '区县平台均分', value: 'county_share' },
|
||||
{ label: '每日分红马豆', value: 'madow_share' },
|
||||
{ label: '兑换券发放', value: 'voucher_grant' },
|
||||
{ label: '兑换券释放', value: 'voucher_release' },
|
||||
]
|
||||
}
|
||||
},
|
||||
role: {
|
||||
type: 'tselect', label: '角色', value: '',
|
||||
options: { data: [{ label: '品酒师', value: 'taster' }, { label: '创客', value: 'maker' }, { label: '酒道馆', value: 'venue' }, { label: '区县', value: 'county' }] }
|
||||
},
|
||||
status: {
|
||||
type: 'tselect', label: '状态', value: '',
|
||||
options: { data: [{ label: '已退回', value: '-2' }, { label: '已取消', value: '-1' }, { label: '待入账', value: '0' }, { label: '已入账', value: '1' }] }
|
||||
},
|
||||
settle_date: { type: 'tinput', label: '日结日期', placeholder: 'Y-m-d', value: '' },
|
||||
show_skip: {
|
||||
type: 'tselect', label: '显示未发放原因', value: '0',
|
||||
options: { data: [{ label: '隐藏金额为0', value: '0' }, { label: '显示未发放', value: '1' }] }
|
||||
},
|
||||
createtime: { type: 'tdatetimerange', label: '时间范围', value: [] },
|
||||
},
|
||||
condition: {},
|
||||
},
|
||||
statusStyle: { '-2': 'danger', '-1': 'warning', 0: 'info', 1: 'success' },
|
||||
})
|
||||
const ext = reactive({ visible: false, text: '' })
|
||||
const reissue = reactive({ visible: false, form: { user_id: '', reward_type: 'push3', amount: '', order_id: '', memo: '' } })
|
||||
|
||||
function getData() {
|
||||
let tempSearch = JSON.parse(JSON.stringify(state.filter.data));
|
||||
const showSkip = tempSearch.show_skip || '0'
|
||||
delete tempSearch.show_skip
|
||||
let search = composeFilter(tempSearch, {
|
||||
'user.nickname': 'like',
|
||||
'user.mobile': 'like',
|
||||
'buyer.nickname': 'like',
|
||||
'buyer.mobile': 'like',
|
||||
'order.order_sn': 'like',
|
||||
createtime: 'range',
|
||||
});
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/partner/reward',
|
||||
type: 'GET',
|
||||
data: { page: pagination.page, list_rows: pagination.list_rows, show_skip: showSkip, ...search },
|
||||
}, function (ret, res) {
|
||||
state.data = res.data.data
|
||||
pagination.total = res.data.total
|
||||
return false
|
||||
}, function () { })
|
||||
}
|
||||
function onOpenFilter() { state.filter.drawer = true }
|
||||
function onChangeFilter() {
|
||||
pagination.page = 1
|
||||
getData()
|
||||
state.filter.drawer && (state.filter.drawer = false)
|
||||
}
|
||||
const pagination = reactive({ page: 1, list_rows: 10, total: 0 })
|
||||
const exportLoading = ref(false);
|
||||
function onExport(type) {
|
||||
exportLoading.value = true;
|
||||
let tempSearch = JSON.parse(JSON.stringify(state.filter.data));
|
||||
let search = composeFilter(tempSearch, {
|
||||
'user.nickname': 'like', 'user.mobile': 'like',
|
||||
'buyer.nickname': 'like', 'buyer.mobile': 'like',
|
||||
'order.order_sn': 'like', createtime: 'range',
|
||||
});
|
||||
if (Config.save_type == 'download') {
|
||||
window.location.href = `${Config.moduleurl}/shopro/partner/reward/${type}?page=${pagination.page}&list_rows=${pagination.list_rows}&search=${search.search}`;
|
||||
exportLoading.value = false;
|
||||
} else {
|
||||
Fast.api.ajax({
|
||||
url: `shopro/partner/reward/${type}`,
|
||||
type: 'GET',
|
||||
data: { page: pagination.page, list_rows: pagination.list_rows, ...search },
|
||||
}, function () { exportLoading.value = false; }, function () { })
|
||||
}
|
||||
}
|
||||
function onViewExt(row) {
|
||||
ext.text = JSON.stringify(row.ext || {}, null, 2)
|
||||
ext.visible = true
|
||||
}
|
||||
function onBack(row) {
|
||||
const { ElMessageBox } = ElementPlus
|
||||
ElMessageBox.prompt('请填写退回原因', '退回收益', {
|
||||
confirmButtonText: '确定退回',
|
||||
cancelButtonText: '取消',
|
||||
inputPlaceholder: '必填',
|
||||
inputValidator: (v) => !!(v && String(v).trim()) || '请填写原因',
|
||||
}).then(({ value }) => {
|
||||
Fast.api.ajax({
|
||||
url: `shopro/partner/reward/back`,
|
||||
type: 'POST',
|
||||
data: { id: row.id, memo: value },
|
||||
}, function () { getData() })
|
||||
}).catch(() => {})
|
||||
}
|
||||
function onBackOrder(row) {
|
||||
const { ElMessageBox } = ElementPlus
|
||||
ElMessageBox.confirm('将退回该订单全部即时奖并关闭兑换券计划。确定?', '整单退回', {
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/partner/reward/backOrder',
|
||||
type: 'POST',
|
||||
data: { order_id: row.order_id },
|
||||
}, function () { getData() })
|
||||
}).catch(() => {})
|
||||
}
|
||||
function onReissue() {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/partner/reward/reissue',
|
||||
type: 'POST',
|
||||
data: reissue.form,
|
||||
}, function () {
|
||||
reissue.visible = false
|
||||
getData()
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
const params = new URLSearchParams(location.search)
|
||||
if (params.get('user_id')) {
|
||||
state.filter.data.user = { field: 'user_id', value: params.get('user_id') }
|
||||
reissue.form.user_id = params.get('user_id')
|
||||
}
|
||||
if (params.get('settle_date')) {
|
||||
state.filter.data.settle_date = params.get('settle_date')
|
||||
}
|
||||
if (params.get('reissue') === '1') {
|
||||
reissue.visible = true
|
||||
}
|
||||
getData()
|
||||
})
|
||||
return { state, getData, onOpenFilter, onChangeFilter, pagination, exportLoading, onExport, ext, onViewExt, onBack, onBackOrder, reissue, onReissue }
|
||||
}
|
||||
}
|
||||
createApp('index', index);
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: () => {
|
||||
const { reactive, onMounted } = Vue
|
||||
const index = {
|
||||
setup() {
|
||||
const state = reactive({ data: [] })
|
||||
const pagination = reactive({ page: 1, list_rows: 10, total: 0 })
|
||||
const logs = reactive({ visible: false, plan: null, rows: [] })
|
||||
function getData() {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/partner/voucher',
|
||||
type: 'GET',
|
||||
data: { page: pagination.page, list_rows: pagination.list_rows },
|
||||
}, function (ret, res) {
|
||||
state.data = res.data.data
|
||||
pagination.total = res.data.total
|
||||
return false
|
||||
}, function () { })
|
||||
}
|
||||
function onClose(row) {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/partner/voucher/close',
|
||||
type: 'POST',
|
||||
data: { id: row.id },
|
||||
}, function () { getData() })
|
||||
}
|
||||
function onLogs(row) {
|
||||
Fast.api.ajax({
|
||||
url: 'shopro/partner/voucher/logs',
|
||||
type: 'GET',
|
||||
data: { id: row.id },
|
||||
}, function (ret, res) {
|
||||
logs.plan = res.data.plan
|
||||
logs.rows = res.data.logs || []
|
||||
logs.visible = true
|
||||
return false
|
||||
}, function () { })
|
||||
}
|
||||
onMounted(() => { getData() })
|
||||
return { state, pagination, getData, onClose, onLogs, logs }
|
||||
}
|
||||
}
|
||||
createApp('index', index);
|
||||
},
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户