feat(withdraw): 落地方案B一体化商城余额提现与手续费内扣模式,完善多端打款退款与对账闭环
这个提交包含在:
@@ -97,23 +97,31 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
}, function (ret, res) { })
|
||||
}
|
||||
|
||||
function openTab(url, title, icon) {
|
||||
if (top && top.Backend && top.Backend.api && typeof top.Backend.api.addtabs === 'function') {
|
||||
top.Backend.api.addtabs(url, title, icon);
|
||||
} else if (typeof Backend !== 'undefined' && Backend.api && typeof Backend.api.addtabs === 'function') {
|
||||
Backend.api.addtabs(url, title, icon);
|
||||
} else if (Fast && Fast.api && typeof Fast.api.addtabs === 'function') {
|
||||
Fast.api.addtabs(url, title, icon);
|
||||
} else if (top && top.Fast && top.Fast.api && typeof top.Fast.api.addtabs === 'function') {
|
||||
top.Fast.api.addtabs(url, title, icon);
|
||||
} else {
|
||||
window.location.href = Fast.api.fixurl(url);
|
||||
}
|
||||
}
|
||||
|
||||
function onAdd() {
|
||||
Fast.api.open(`shopro/goods/goods/select?data_type=score_shop`, "选择商品", {
|
||||
callback(data) {
|
||||
Fast.api.open(`shopro/app/score_shop/add?type=add&goods_id=${data.id}&title=${data.title}`, "添加", {
|
||||
callback() {
|
||||
getData()
|
||||
}
|
||||
})
|
||||
if (data && data.id) {
|
||||
openTab(`shopro/app/score_shop/add?type=add&goods_id=${data.id}&title=${encodeURIComponent(data.title || '')}&ref=addtabs`, `添加兑换商品 - ${data.title || data.id}`, "fa fa-plus");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function onEdit(item) {
|
||||
Fast.api.open(`shopro/app/score_shop/edit?type=edit&goods_id=${item.id}&title=${item.title}`, "编辑", {
|
||||
callback() {
|
||||
getData()
|
||||
}
|
||||
})
|
||||
openTab(`shopro/app/score_shop/edit/goods_id/${item.id}?type=edit&goods_id=${item.id}&title=${encodeURIComponent(item.title || '')}&ref=addtabs`, `编辑兑换商品 - ${item.title || item.id}`, "fa fa-pencil");
|
||||
}
|
||||
function onDelete(id) {
|
||||
Fast.api.ajax({
|
||||
@@ -164,10 +172,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
const { reactive, onMounted } = Vue
|
||||
const addEdit = {
|
||||
setup() {
|
||||
let searchParams = new URLSearchParams(location.search);
|
||||
let pathMatches = location.pathname.match(/goods_id\/(\d+)/);
|
||||
let goodsIdFromPath = pathMatches ? pathMatches[1] : '';
|
||||
|
||||
const state = reactive({
|
||||
type: new URLSearchParams(location.search).get('type'),
|
||||
goods_id: new URLSearchParams(location.search).get('goods_id'),
|
||||
title: new URLSearchParams(location.search).get('title'),
|
||||
type: searchParams.get('type') || (location.pathname.includes('/edit') ? 'edit' : 'add'),
|
||||
goods_id: searchParams.get('goods_id') || goodsIdFromPath,
|
||||
title: searchParams.get('title') || '',
|
||||
})
|
||||
|
||||
const goods = reactive({
|
||||
@@ -184,10 +196,42 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
goods.skus = res.data.skus;
|
||||
goods.sku_prices = res.data.sku_prices;
|
||||
goods.score_sku_prices = res.data.score_sku_prices;
|
||||
if (res.data.goods && res.data.goods.title) {
|
||||
state.title = res.data.goods.title;
|
||||
}
|
||||
return false
|
||||
}, function (ret, res) { })
|
||||
}
|
||||
|
||||
function closeCurrentTab() {
|
||||
if (parent && parent.Layer && typeof parent.Layer.getFrameIndex === 'function') {
|
||||
try {
|
||||
var index = parent.Layer.getFrameIndex(window.name);
|
||||
if (index) {
|
||||
parent.Layer.close(index);
|
||||
return true;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
if (top && top.Backend && top.Backend.api && typeof top.Backend.api.closetabs === 'function') {
|
||||
top.Backend.api.closetabs();
|
||||
return true;
|
||||
} else if (typeof Backend !== 'undefined' && Backend.api && typeof Backend.api.closetabs === 'function') {
|
||||
Backend.api.closetabs();
|
||||
return true;
|
||||
} else if (window.history.length > 1) {
|
||||
window.history.back();
|
||||
return true;
|
||||
} else {
|
||||
window.location.href = Fast.api.fixurl('shopro/app/score_shop');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
closeCurrentTab();
|
||||
}
|
||||
|
||||
function onConfirm() {
|
||||
let cleanedPrices = (goods.score_sku_prices || []).map(item => {
|
||||
let clone = { ...item };
|
||||
@@ -212,18 +256,39 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
type: 'POST',
|
||||
data: submitForm,
|
||||
}, function (ret, res) {
|
||||
Fast.api.close()
|
||||
try {
|
||||
var iframes = top && top.$ ? top.$("iframe[src*='shopro/app/score_shop']") : null;
|
||||
if (iframes && iframes.length) {
|
||||
iframes.each(function () {
|
||||
try {
|
||||
if (this.contentWindow && this.contentWindow !== window) {
|
||||
if (typeof this.contentWindow.location.reload === 'function') {
|
||||
this.contentWindow.location.reload();
|
||||
}
|
||||
}
|
||||
} catch (err) {}
|
||||
});
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
setTimeout(() => {
|
||||
closeCurrentTab();
|
||||
}, 300);
|
||||
return false;
|
||||
}, function (ret, res) { })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getSkus()
|
||||
if (state.goods_id) {
|
||||
getSkus()
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
state,
|
||||
goods,
|
||||
onConfirm
|
||||
onConfirm,
|
||||
onCancel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户