This commit is contained in:
2026-01-05 12:47:14 +08:00
commit 1fc846fae3
1614 changed files with 162035 additions and 0 deletions

View File

@@ -0,0 +1,691 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const api_config = require("../../api/config.js");
const api_house_goods = require("../../api/house_goods.js");
if (!Array) {
const _easycom_z_tabs2 = common_vendor.resolveComponent("z-tabs");
const _easycom_nut_noticebar2 = common_vendor.resolveComponent("nut-noticebar");
const _easycom_nut_button2 = common_vendor.resolveComponent("nut-button");
const _easycom_nut_input2 = common_vendor.resolveComponent("nut-input");
const _easycom_nut_radio2 = common_vendor.resolveComponent("nut-radio");
const _easycom_nut_radio_group2 = common_vendor.resolveComponent("nut-radio-group");
const _easycom_nut_menu_item2 = common_vendor.resolveComponent("nut-menu-item");
const _easycom_nut_menu2 = common_vendor.resolveComponent("nut-menu");
const _easycom_nut_tag2 = common_vendor.resolveComponent("nut-tag");
const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
const _easycom_nut_popup2 = common_vendor.resolveComponent("nut-popup");
const _easycom_nut_switch2 = common_vendor.resolveComponent("nut-switch");
const _easycom_nut_cell2 = common_vendor.resolveComponent("nut-cell");
(_easycom_z_tabs2 + _easycom_nut_noticebar2 + _easycom_nut_button2 + _easycom_nut_input2 + _easycom_nut_radio2 + _easycom_nut_radio_group2 + _easycom_nut_menu_item2 + _easycom_nut_menu2 + _easycom_nut_tag2 + _easycom_z_paging2 + _easycom_nut_popup2 + _easycom_nut_switch2 + _easycom_nut_cell2)();
}
const _easycom_z_tabs = () => "../../uni_modules/z-tabs/components/z-tabs/z-tabs.js";
const _easycom_nut_noticebar = () => "../../uni_modules/nutui-uni/components/noticebar/noticebar.js";
const _easycom_nut_button = () => "../../uni_modules/nutui-uni/components/button/button.js";
const _easycom_nut_input = () => "../../uni_modules/nutui-uni/components/input/input.js";
const _easycom_nut_radio = () => "../../uni_modules/nutui-uni/components/radio/radio.js";
const _easycom_nut_radio_group = () => "../../uni_modules/nutui-uni/components/radiogroup/radiogroup.js";
const _easycom_nut_menu_item = () => "../../uni_modules/nutui-uni/components/menuitem/menuitem.js";
const _easycom_nut_menu = () => "../../uni_modules/nutui-uni/components/menu/menu.js";
const _easycom_nut_tag = () => "../../uni_modules/nutui-uni/components/tag/tag.js";
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
const _easycom_nut_popup = () => "../../uni_modules/nutui-uni/components/popup/popup.js";
const _easycom_nut_switch = () => "../../uni_modules/nutui-uni/components/switch/switch.js";
const _easycom_nut_cell = () => "../../uni_modules/nutui-uni/components/cell/cell.js";
if (!Math) {
(_easycom_z_tabs + _easycom_nut_noticebar + _easycom_nut_button + _easycom_nut_input + _easycom_nut_radio + _easycom_nut_radio_group + _easycom_nut_menu_item + _easycom_nut_menu + _easycom_nut_tag + _easycom_z_paging + _easycom_nut_popup + _easycom_nut_switch + _easycom_nut_cell)();
}
const _sfc_main = {
__name: "price",
setup(__props) {
common_vendor.onLoad((options) => {
});
const getImg = (goods) => {
var _a, _b, _c;
const url = (_c = (_b = (_a = goods == null ? void 0 : goods.goods_house) == null ? void 0 : _a.image) == null ? void 0 : _b[0]) == null ? void 0 : _c.file_path;
return url ? url + "?imageView2/1/w/200/h/200" : "";
};
const getConfig = () => {
api_config.fetchGetConfig().then((res) => {
common_vendor.index.__f__("log", "at pages/config/price.vue:329", "getConfig=====>", res);
isWarehouse.value = res.appConfig.is_warehouse == 1;
});
};
const setConfig = () => {
let form = {
is_warehouse: Number(isWarehouse.value)
};
api_config.fetchSetConfig(form).then((res) => {
common_vendor.index.showToast({
icon: "none",
title: "操作成功"
});
});
};
const getPrice = (goods) => {
const list = singleRule.value || singleRule;
const rule = list.find((item) => item.product_id === goods.goods_id);
if (!rule) {
return "未单独设置";
}
const basePrice = Number(goods.goods_price);
const val = Number(rule.val);
let finalPrice = basePrice;
if (rule.val_type == 1) {
finalPrice = basePrice + val;
} else if (rule.val_type == 2) {
finalPrice = basePrice + basePrice * val / 100;
}
return finalPrice.toFixed(2);
};
const paging = common_vendor.ref(null);
const dataList = common_vendor.ref([]);
const user_goods_cart_ids = common_vendor.ref([]);
const goods_cart_ids = common_vendor.ref([]);
const selectPriceSortRef = common_vendor.ref(null);
const selectDegreeRef = common_vendor.ref(null);
const selectProductRef = common_vendor.ref(null);
const state = common_vendor.reactive({
type_params: [],
// 产品类型
drop_down_options: [],
// 产品类型下的品牌列表
o_drop_down_options: [],
// 价格排序
price_sort_params: [
{
text: "默认排序",
value: ""
},
{
text: "价格升序",
value: "ascend"
},
{
text: "价格降序",
value: "descend"
}
],
// 成色所有选项
degree_params: [],
price_sort: "",
price_sort_name: "默认排序",
degree_ids: [],
degree_name: "成色",
product_name: "机型",
type_id: 1,
// 产品类型id 默认 1 手机
type_name: "手机",
brand_id: 0,
// 品牌id // 默认 0 全部
brand_name: "全部",
product_ids: [0]
// 机型ids 默认 0 全部
// search_val: '', // 搜索
});
const onResetProduct = () => {
common_vendor.index.__f__("log", "at pages/config/price.vue:427", "重置产品");
state.type_id = 1;
state.type_name = "手机";
state.brand_id = 0;
state.brand_name = "全部";
state.product_ids = [0];
state.product_name = "机型";
};
const onConfirmProduct = () => {
var _a;
common_vendor.index.__f__("log", "at pages/config/price.vue:438", "当前产品类型", {
"type_id": state.type_id,
"type_name": state.type_name,
"brand_id": state.brand_id,
"brand_name": state.brand_name,
"product_ids": state.product_ids
});
(_a = selectProductRef.value) == null ? void 0 : _a.toggle(false);
paging.value.reload();
};
const selectProduct = (product) => {
if (product.value === 0) {
state.product_ids = [0];
} else {
state.product_ids = state.product_ids.filter((e) => e != 0);
const index = state.product_ids.indexOf(product.value);
if (index > -1) {
state.product_ids.splice(index, 1);
if (state.product_ids.length === 0) {
state.product_ids = [0];
}
} else {
state.product_ids.push(product.value);
}
}
common_vendor.index.__f__("log", "at pages/config/price.vue:466", product);
};
const productOptions = common_vendor.computed(() => {
var _a;
return (_a = state == null ? void 0 : state.o_drop_down_options[state.type_id]) == null ? void 0 : _a.children[state.brand_id].children;
});
const selectBrand = (brand) => {
common_vendor.index.__f__("log", "at pages/config/price.vue:475", brand);
state.brand_id = brand.value;
state.brand_name = brand.label;
state.product_ids = [0];
state.product_name = brand.label;
};
const selectType = (type) => {
common_vendor.index.__f__("log", "at pages/config/price.vue:487", type);
state.type_id = type.type_id;
state.type_name = type.name;
state.brand_id = 0;
state.brand_name = "全部";
state.product_ids = [0];
};
const selectPriceSort = (item) => {
var _a;
if (state.price_sort !== item.value) {
state.price_sort = item.value;
state.price_sort_name = item.text;
} else {
state.price_sort_name = "默认排序";
state.price_sort = "";
}
(_a = selectPriceSortRef.value) == null ? void 0 : _a.toggle(false);
paging.value.reload();
};
const selectDegree = (item) => {
const index = state.degree_ids.indexOf(item.value);
if (index > -1) {
state.degree_ids.splice(index, 1);
} else {
state.degree_ids.push(item.value);
}
if (state.degree_ids.length > 0) {
state.degree_name = "已选" + state.degree_ids.length.toString() + "项";
} else {
state.degree_name = "成色";
}
};
const onResetDegree = () => {
var _a;
state.degree_ids = [];
state.degree_name = "成色";
(_a = selectDegreeRef.value) == null ? void 0 : _a.toggle(false);
paging.value.reload();
};
const onConfirmDegree = () => {
var _a;
if (state.degree_ids.length > 0) {
state.degree_name = "已选" + state.degree_ids.length.toString() + "项";
} else {
state.degree_name = "成色";
}
(_a = selectDegreeRef.value) == null ? void 0 : _a.toggle(false);
paging.value.reload();
};
const queryList = (pageNo, pageSize) => {
const params = {
pageSize,
page: pageNo,
price_sort: state.price_sort,
degree_ids: state.degree_ids,
type_id: state.type_id,
brand_id: state.brand_id,
product_ids: state.product_ids,
search: state.search_val
};
api_house_goods.houseFetchGoodsList(params).then((res) => {
common_vendor.index.__f__("log", "at pages/config/price.vue:561", res);
paging.value.complete(res.list);
user_goods_cart_ids.value = res.user_cart_goods_ids;
goods_cart_ids.value = res.cart_goods_ids;
}).catch((res) => {
paging.value.complete(false);
user_goods_cart_ids.value = [];
goods_cart_ids.value = [];
});
};
common_vendor.onMounted(() => {
init();
});
const init = () => {
common_vendor.index.__f__("log", "at pages/config/price.vue:587", "init");
getConfig();
api_config.fetchGetPriceRules().then((res) => {
var _a;
common_vendor.index.__f__("log", "at pages/config/price.vue:594", "res", res);
rangeRule.value = (res == null ? void 0 : res.range) ?? [];
singleRule.value = (res == null ? void 0 : res.single) ?? [];
Object.assign(warehouseRule, ((_a = res == null ? void 0 : res.warehouse) == null ? void 0 : _a[0]) ?? {
val: "",
val_type: 1
});
});
api_house_goods.houseFetchFilterParmas().then((res) => {
common_vendor.index.__f__("log", "at pages/config/price.vue:609", res);
let degree_params = res.degree_list;
state.degree_params = degree_params.reduce((it, cit) => {
it.push({
text: cit.degree_name,
value: cit.degree_id
});
return it;
}, state.degree_params) || [];
state.type_params = res.type_list;
state.drop_down_options = res.drop_down_options;
state.o_drop_down_options = res.o_drop_down_options;
});
};
const showGoodsImages = (goods) => {
var _a;
common_vendor.index.__f__("log", "at pages/config/price.vue:633", goods.goods_house);
common_vendor.index.previewImage({
// current: index, // 指定当前显示的图片索引
urls: (_a = goods == null ? void 0 : goods.goods_house) == null ? void 0 : _a.image.map((e) => {
return e.file_path;
})
});
};
const tabList = common_vendor.ref(["区间调价", "单机调价", "整仓调价"]);
const tabIndex = common_vendor.ref(0);
const tabsChange = (index) => {
tabIndex.value = index;
};
const isWarehouse = common_vendor.ref(false);
const warehouseRule = common_vendor.reactive({
val: "",
val_type: 1
});
const onIsWarehouseChange = (val) => {
common_vendor.index.__f__("log", "at pages/config/price.vue:667", isWarehouse.value);
setConfig();
};
const saveWarehouseRule = () => {
common_vendor.index.__f__("log", "at pages/config/price.vue:673", warehouseRule);
let data = {
warehouseRule: {
...warehouseRule
}
};
common_vendor.index.__f__("log", "at pages/config/price.vue:679", data);
submit(data, 3);
};
const singleRule = common_vendor.ref([]);
const tempSingleRule = common_vendor.reactive({
val: "",
val_type: 1,
product_id: 0
});
const showEdit = common_vendor.ref(false);
const detail = common_vendor.reactive({});
const onEdit = (goods) => {
common_vendor.index.__f__("log", "at pages/config/price.vue:698", "----", goods);
Object.assign(detail, goods);
showEdit.value = true;
common_vendor.index.__f__("log", "at pages/config/price.vue:701", "----", detail.value);
};
const onClosePopup = () => {
Object.assign(detail, {});
Object.assign(tempSingleRule, {
val: "",
val_type: 1,
product_id: 0
});
showEdit.value = false;
common_vendor.index.__f__("log", "at pages/config/price.vue:712", "关闭");
};
const saveSingleRule = () => {
tempSingleRule.product_id = detail.goods_id;
common_vendor.index.__f__("log", "at pages/config/price.vue:719", "tempSingleRule.value", tempSingleRule);
let data = {
singleRule: {
...tempSingleRule
}
};
common_vendor.index.__f__("log", "at pages/config/price.vue:725", data);
submit(data, 2);
};
const rangeRule = common_vendor.ref([]);
const addRule = () => {
common_vendor.index.__f__("log", "at pages/config/price.vue:735", rangeRule.value);
rangeRule.value.unshift({
min_price: "",
max_price: "",
val: "",
val_type: 1
});
};
const removeRule = (index) => {
rangeRule.value.splice(index, 1);
};
const saveRangeRule = () => {
common_vendor.index.__f__("log", "at pages/config/price.vue:749", rangeRule.value);
let data = {
rangeRule: rangeRule.value
};
common_vendor.index.__f__("log", "at pages/config/price.vue:753", data);
submit(data, 1);
};
const submit = (data, type) => {
api_config.fetchSetPriceRules(data).then((res) => {
common_vendor.index.showToast({
icon: "none",
title: "规则配置成功"
});
api_config.fetchGetPriceRules().then((res2) => {
var _a;
common_vendor.index.__f__("log", "at pages/config/price.vue:767", "res", res2);
rangeRule.value = (res2 == null ? void 0 : res2.range) ?? [];
singleRule.value = (res2 == null ? void 0 : res2.single) ?? [];
Object.assign(warehouseRule, ((_a = res2 == null ? void 0 : res2.warehouse) == null ? void 0 : _a[0]) ?? {
val: "",
val_type: 1
});
if (type == 2) {
onClosePopup();
paging.value.refresh();
}
if (type == 3) {
getConfig();
}
});
});
};
return (_ctx, _cache) => {
var _a, _b, _c, _d, _e, _f;
return common_vendor.e({
a: common_vendor.o(tabsChange),
b: common_vendor.p({
list: tabList.value,
["active-color"]: "rgba(233, 100, 67, 1)"
}),
c: tabIndex.value == 0
}, tabIndex.value == 0 ? {
d: common_vendor.p({
text: "区间调价:可以针对价格区间进行批量固定加价,或者按照原价的百分比加价",
background: `rgba(251, 248, 220, 1)`,
["custom-color"]: `#D9500B`
})
} : {}, {
e: tabIndex.value == 1
}, tabIndex.value == 1 ? {
f: common_vendor.p({
text: "单机调价:针对某款机器进行固定加价,或者按照原价的百分比加价",
background: `rgba(251, 248, 220, 1)`,
["custom-color"]: `#D9500B`
})
} : {}, {
g: tabIndex.value == 2
}, tabIndex.value == 2 ? {
h: common_vendor.p({
text: "整仓调价:针对整个仓库进行固定加价,或者按照原价的百分比加价",
background: `rgba(251, 248, 220, 1)`,
["custom-color"]: `#D9500B`
})
} : {}, {
i: tabIndex.value == 0
}, tabIndex.value == 0 ? {
j: common_vendor.o(addRule),
k: common_vendor.p({
type: "primary",
plain: true
}),
l: common_vendor.o(saveRangeRule),
m: common_vendor.p({
type: "primary"
}),
n: common_vendor.f(rangeRule.value, (item, index, i0) => {
return {
a: "9320a8b3-6-" + i0,
b: common_vendor.o(($event) => item.min_price = $event, index),
c: common_vendor.p({
type: "number",
placeholder: "0",
["input-align"]: "right",
modelValue: item.min_price
}),
d: "9320a8b3-7-" + i0,
e: common_vendor.o(($event) => item.max_price = $event, index),
f: common_vendor.p({
type: "number",
placeholder: "0",
["input-align"]: "right",
modelValue: item.max_price
}),
g: "9320a8b3-8-" + i0,
h: common_vendor.o(($event) => item.val = $event, index),
i: common_vendor.p({
type: "number",
placeholder: "0",
["input-align"]: "right",
modelValue: item.val
}),
j: "9320a8b3-10-" + i0 + "," + ("9320a8b3-9-" + i0),
k: "9320a8b3-11-" + i0 + "," + ("9320a8b3-9-" + i0),
l: "9320a8b3-9-" + i0,
m: common_vendor.o(($event) => item.val_type = $event, index),
n: common_vendor.p({
direction: "horizontal",
modelValue: item.val_type
}),
o: common_vendor.o(($event) => removeRule(index), index),
p: "9320a8b3-12-" + i0,
q: index
};
}),
o: common_vendor.p({
label: 1
}),
p: common_vendor.p({
label: 2
}),
q: common_vendor.p({
type: "danger",
size: "mini"
})
} : {}, {
r: tabIndex.value == 1
}, tabIndex.value == 1 ? {
s: common_vendor.f(state.price_sort_params, (item, idx, i0) => {
return {
a: common_vendor.t(item.text),
b: state.price_sort === item.value ? 1 : "",
c: idx,
d: common_vendor.o(($event) => selectPriceSort(item), idx)
};
}),
t: common_vendor.sr(selectPriceSortRef, "9320a8b3-14,9320a8b3-13", {
"k": "selectPriceSortRef"
}),
v: common_vendor.p({
title: state.price_sort_name
}),
w: common_vendor.f(state.type_params, (type, idx, i0) => {
return {
a: common_vendor.t(type.name),
b: idx,
c: common_vendor.o(($event) => selectType(type), idx),
d: state.type_id == type.type_id ? 1 : ""
};
}),
x: common_vendor.f((_a = state == null ? void 0 : state.drop_down_options[state.type_id]) == null ? void 0 : _a.children, (item, idx, i0) => {
return {
a: common_vendor.t(item.label),
b: idx,
c: common_vendor.o(($event) => selectBrand(item), idx),
d: item.value == state.brand_id ? 1 : ""
};
}),
y: common_vendor.f(productOptions.value, (item, idx, i0) => {
return {
a: common_vendor.t(item.label),
b: idx,
c: state.product_ids.includes(item.value) ? 1 : "",
d: common_vendor.o(($event) => selectProduct(item), idx)
};
}),
z: common_vendor.o(($event) => onResetProduct()),
A: common_vendor.p({
plain: true,
type: "default"
}),
B: common_vendor.o(($event) => onConfirmProduct()),
C: common_vendor.p({
block: true,
type: "primary"
}),
D: common_vendor.sr(selectProductRef, "9320a8b3-15,9320a8b3-13", {
"k": "selectProductRef"
}),
E: common_vendor.p({
title: state.product_name
}),
F: common_vendor.f(state.degree_params, (item, idx, i0) => {
return {
a: common_vendor.t(item.text),
b: state.degree_ids.includes(item.value) ? 1 : "",
c: idx,
d: common_vendor.o(($event) => selectDegree(item), idx)
};
}),
G: common_vendor.o(($event) => onResetDegree()),
H: common_vendor.p({
plain: true,
type: "default"
}),
I: common_vendor.o(($event) => onConfirmDegree()),
J: common_vendor.p({
block: true,
type: "primary"
}),
K: common_vendor.sr(selectDegreeRef, "9320a8b3-18,9320a8b3-13", {
"k": "selectDegreeRef"
}),
L: common_vendor.p({
title: state.degree_name
}),
M: common_vendor.p({
["title-class"]: "titleClass"
}),
N: common_vendor.f(dataList.value, (item, index, i0) => {
return common_vendor.e({
a: getImg(item),
b: common_vendor.o(($event) => showGoodsImages(item), index),
c: common_vendor.t(item.goods_house.degree.degree_name),
d: "9320a8b3-22-" + i0 + ",9320a8b3-21",
e: common_vendor.t(item.goods_house.goods_name),
f: common_vendor.t(item.goods_house.content),
g: common_vendor.t(item.goods_house.goods_price),
h: common_vendor.t(getPrice(item)),
i: !goods_cart_ids.value.includes(item.goods_id) && !user_goods_cart_ids.value.includes(item.goods_id)
}, !goods_cart_ids.value.includes(item.goods_id) && !user_goods_cart_ids.value.includes(item.goods_id) ? {
j: common_vendor.o(($event) => onEdit(item), index),
k: "9320a8b3-23-" + i0 + ",9320a8b3-21",
l: common_vendor.p({
size: "small",
type: "primary"
})
} : {
m: "9320a8b3-24-" + i0 + ",9320a8b3-21",
n: common_vendor.p({
size: "small",
plain: true
})
}, {
o: index
});
}),
O: common_vendor.p({
["custom-color"]: "#1a1a1a"
}),
P: common_vendor.sr(paging, "9320a8b3-21", {
"k": "paging"
}),
Q: common_vendor.o(queryList),
R: common_vendor.o(($event) => dataList.value = $event),
S: common_vendor.p({
fixed: false,
["refresher-enabled"]: false,
["auto-clean-list-when-reload"]: false,
["auto-scroll-to-top-when-reload"]: false,
modelValue: dataList.value
})
} : {}, {
T: getImg(detail),
U: common_vendor.o(($event) => showGoodsImages(detail)),
V: common_vendor.t((_c = (_b = detail == null ? void 0 : detail.goods_house) == null ? void 0 : _b.degree) == null ? void 0 : _c.degree_name),
W: common_vendor.p({
["custom-color"]: "#1a1a1a"
}),
X: common_vendor.t((_d = detail == null ? void 0 : detail.goods_house) == null ? void 0 : _d.goods_name),
Y: common_vendor.t((_e = detail == null ? void 0 : detail.goods_house) == null ? void 0 : _e.content),
Z: common_vendor.t((_f = detail == null ? void 0 : detail.goods_house) == null ? void 0 : _f.goods_price),
aa: common_vendor.t(getPrice(detail)),
ab: common_vendor.o(($event) => tempSingleRule.val = $event),
ac: common_vendor.p({
type: "number",
placeholder: "0",
["input-align"]: "right",
modelValue: tempSingleRule.val
}),
ad: common_vendor.p({
label: 1
}),
ae: common_vendor.p({
label: 2
}),
af: common_vendor.o(($event) => tempSingleRule.val_type = $event),
ag: common_vendor.p({
direction: "horizontal",
modelValue: tempSingleRule.val_type
}),
ah: common_vendor.o(($event) => saveSingleRule()),
ai: common_vendor.p({
type: "primary",
block: true
}),
aj: common_vendor.o(onClosePopup),
ak: common_vendor.o(($event) => showEdit.value = $event),
al: common_vendor.p({
["custom-style"]: {
height: "45%"
},
position: "bottom",
["safe-area-inset-bottom"]: true,
visible: showEdit.value
}),
am: tabIndex.value == 2
}, tabIndex.value == 2 ? {
an: common_vendor.o(onIsWarehouseChange),
ao: common_vendor.o(($event) => isWarehouse.value = $event),
ap: common_vendor.p({
modelValue: isWarehouse.value
}),
aq: common_vendor.o(($event) => warehouseRule.val = $event),
ar: common_vendor.p({
type: "number",
placeholder: "0",
["input-align"]: "right",
modelValue: warehouseRule.val
}),
as: common_vendor.p({
label: 1
}),
at: common_vendor.p({
label: 2
}),
av: common_vendor.o(($event) => warehouseRule.val_type = $event),
aw: common_vendor.p({
direction: "horizontal",
modelValue: warehouseRule.val_type
}),
ax: common_vendor.o(($event) => saveWarehouseRule()),
ay: common_vendor.p({
type: "primary",
block: true
})
} : {});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9320a8b3"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/config/price.js.map