3
This commit is contained in:
@@ -13,22 +13,12 @@ const _sfc_main = {
|
||||
brand: "",
|
||||
model: "",
|
||||
spec: "",
|
||||
origin: "",
|
||||
categoryId: "",
|
||||
unitId: "",
|
||||
stock: null,
|
||||
safeMin: null,
|
||||
safeMax: null,
|
||||
purchasePrice: null,
|
||||
retailPrice: null,
|
||||
wholesalePrice: null,
|
||||
bigClientPrice: null,
|
||||
images: [],
|
||||
remark: "",
|
||||
platformStatus: "",
|
||||
sourceSubmissionId: ""
|
||||
},
|
||||
units: [],
|
||||
categories: [],
|
||||
keyboardHeight: 0
|
||||
};
|
||||
@@ -42,16 +32,9 @@ const _sfc_main = {
|
||||
this.disposeKeyboardListener();
|
||||
},
|
||||
computed: {
|
||||
unitNames() {
|
||||
return this.units.map((u) => u.name);
|
||||
},
|
||||
categoryNames() {
|
||||
return this.categories.map((c) => c.name);
|
||||
},
|
||||
unitLabel() {
|
||||
const u = this.units.find((x) => String(x.id) === String(this.form.unitId));
|
||||
return u ? u.name : "选择单位";
|
||||
},
|
||||
categoryLabel() {
|
||||
const c = this.categories.find((x) => String(x.id) === String(this.form.categoryId));
|
||||
return c ? c.name : "选择类别";
|
||||
@@ -59,7 +42,7 @@ const _sfc_main = {
|
||||
},
|
||||
methods: {
|
||||
async bootstrap() {
|
||||
await Promise.all([this.fetchUnits(), this.fetchCategories()]);
|
||||
await Promise.all([this.fetchCategories()]);
|
||||
if (this.id)
|
||||
this.loadDetail();
|
||||
},
|
||||
@@ -81,13 +64,6 @@ const _sfc_main = {
|
||||
} catch (_) {
|
||||
}
|
||||
},
|
||||
async fetchUnits() {
|
||||
try {
|
||||
const res = await common_http.get("/api/product-units");
|
||||
this.units = Array.isArray(res == null ? void 0 : res.list) ? res.list : Array.isArray(res) ? res : [];
|
||||
} catch (_) {
|
||||
}
|
||||
},
|
||||
async fetchCategories() {
|
||||
try {
|
||||
const res = await common_http.get("/api/product-categories");
|
||||
@@ -95,11 +71,6 @@ const _sfc_main = {
|
||||
} catch (_) {
|
||||
}
|
||||
},
|
||||
onPickUnit(e) {
|
||||
const idx = Number(e.detail.value);
|
||||
const u = this.units[idx];
|
||||
this.form.unitId = u ? u.id : "";
|
||||
},
|
||||
onPickCategory(e) {
|
||||
const idx = Number(e.detail.value);
|
||||
const c = this.categories[idx];
|
||||
@@ -136,16 +107,7 @@ const _sfc_main = {
|
||||
brand: data.brand,
|
||||
model: data.model,
|
||||
spec: data.spec,
|
||||
origin: data.origin,
|
||||
categoryId: data.categoryId,
|
||||
unitId: data.unitId,
|
||||
stock: data.stock,
|
||||
safeMin: data.safeMin,
|
||||
safeMax: data.safeMax,
|
||||
purchasePrice: data.purchasePrice,
|
||||
retailPrice: data.retailPrice,
|
||||
wholesalePrice: data.wholesalePrice,
|
||||
bigClientPrice: data.bigClientPrice,
|
||||
images: (data.images || []).map((i) => i.url || i),
|
||||
remark: data.remark || "",
|
||||
platformStatus: data.platformStatus || "",
|
||||
@@ -159,10 +121,6 @@ const _sfc_main = {
|
||||
common_vendor.index.showToast({ title: "请填写名称", icon: "none" });
|
||||
return false;
|
||||
}
|
||||
if (this.form.safeMin != null && this.form.safeMax != null && Number(this.form.safeMin) > Number(this.form.safeMax)) {
|
||||
common_vendor.index.showToast({ title: "安全库存区间不合法", icon: "none" });
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
buildPayload() {
|
||||
@@ -173,18 +131,7 @@ const _sfc_main = {
|
||||
brand: f.brand,
|
||||
model: f.model,
|
||||
spec: f.spec,
|
||||
origin: f.origin,
|
||||
categoryId: f.categoryId || null,
|
||||
unitId: f.unitId,
|
||||
safeMin: f.safeMin,
|
||||
safeMax: f.safeMax,
|
||||
prices: {
|
||||
purchasePrice: f.purchasePrice,
|
||||
retailPrice: f.retailPrice,
|
||||
wholesalePrice: f.wholesalePrice,
|
||||
bigClientPrice: f.bigClientPrice
|
||||
},
|
||||
stock: f.stock,
|
||||
images: f.images,
|
||||
remark: f.remark
|
||||
};
|
||||
@@ -204,7 +151,7 @@ const _sfc_main = {
|
||||
await common_http.post("/api/products", payload);
|
||||
common_vendor.index.showToast({ title: "保存成功", icon: "success", mask: false });
|
||||
if (goOn && !this.id) {
|
||||
this.form = { name: "", barcode: "", brand: "", model: "", spec: "", origin: "", categoryId: "", unitId: "", stock: null, safeMin: null, safeMax: null, purchasePrice: null, retailPrice: null, wholesalePrice: null, bigClientPrice: null, images: [], remark: "", platformStatus: "", sourceSubmissionId: "" };
|
||||
this.form = { name: "", barcode: "", brand: "", model: "", spec: "", categoryId: "", images: [], remark: "", platformStatus: "", sourceSubmissionId: "" };
|
||||
} else {
|
||||
setTimeout(() => common_vendor.index.navigateBack(), 400);
|
||||
}
|
||||
@@ -244,58 +191,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
m: common_vendor.o(common_vendor.m(($event) => $data.form.spec = $event.detail.value, {
|
||||
trim: true
|
||||
})),
|
||||
n: $data.form.origin,
|
||||
o: common_vendor.o(common_vendor.m(($event) => $data.form.origin = $event.detail.value, {
|
||||
trim: true
|
||||
})),
|
||||
p: common_vendor.t($options.unitLabel),
|
||||
q: $options.unitNames,
|
||||
r: common_vendor.o((...args) => $options.onPickUnit && $options.onPickUnit(...args)),
|
||||
s: common_vendor.t($options.categoryLabel),
|
||||
t: $options.categoryNames,
|
||||
v: common_vendor.o((...args) => $options.onPickCategory && $options.onPickCategory(...args)),
|
||||
w: $data.form.stock,
|
||||
x: common_vendor.o(common_vendor.m(($event) => $data.form.stock = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
y: $data.form.safeMin,
|
||||
z: common_vendor.o(common_vendor.m(($event) => $data.form.safeMin = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
A: $data.form.safeMax,
|
||||
B: common_vendor.o(common_vendor.m(($event) => $data.form.safeMax = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
C: $data.form.purchasePrice,
|
||||
D: common_vendor.o(common_vendor.m(($event) => $data.form.purchasePrice = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
E: $data.form.retailPrice,
|
||||
F: common_vendor.o(common_vendor.m(($event) => $data.form.retailPrice = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
G: $data.form.wholesalePrice,
|
||||
H: common_vendor.o(common_vendor.m(($event) => $data.form.wholesalePrice = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
I: $data.form.bigClientPrice,
|
||||
J: common_vendor.o(common_vendor.m(($event) => $data.form.bigClientPrice = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
K: common_vendor.o(($event) => $data.form.images = $event),
|
||||
L: common_vendor.p({
|
||||
n: common_vendor.t($options.categoryLabel),
|
||||
o: $options.categoryNames,
|
||||
p: common_vendor.o((...args) => $options.onPickCategory && $options.onPickCategory(...args)),
|
||||
q: common_vendor.o(($event) => $data.form.images = $event),
|
||||
r: common_vendor.p({
|
||||
formData: {
|
||||
ownerType: "product"
|
||||
},
|
||||
modelValue: $data.form.images
|
||||
}),
|
||||
M: $data.form.remark,
|
||||
N: common_vendor.o(common_vendor.m(($event) => $data.form.remark = $event.detail.value, {
|
||||
s: $data.form.remark,
|
||||
t: common_vendor.o(common_vendor.m(($event) => $data.form.remark = $event.detail.value, {
|
||||
trim: true
|
||||
})),
|
||||
O: common_vendor.o(($event) => $options.save(false)),
|
||||
P: common_vendor.o(($event) => $options.save(true)),
|
||||
Q: ($data.keyboardHeight || 0) + "px"
|
||||
v: common_vendor.o(($event) => $options.save(false)),
|
||||
w: common_vendor.o(($event) => $options.save(true)),
|
||||
x: ($data.keyboardHeight || 0) + "px"
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
@@ -1 +1 @@
|
||||
<scroll-view scroll-y class="page"><view class="hero small"><text class="title">编辑货品</text><text class="sub">完善基础信息与价格</text></view><view wx:if="{{a}}" class="tip platform">平台推荐货品,建议谨慎修改核心字段</view><view wx:elif="{{b}}" class="tip custom">此货品源于我的提交,审核通过后已入库</view><view class="section"><view class="row"><text class="label">商品名称</text><input placeholder="必填" value="{{c}}" bindinput="{{d}}"/></view><view class="row"><text class="label">条形码</text><input class="input-long" placeholder="可扫码或输入" value="{{e}}" bindinput="{{f}}"/><button size="mini" class="picker-btn" bindtap="{{g}}">图片识码</button></view><view class="row"><input placeholder="品牌" value="{{h}}" bindinput="{{i}}"/></view><view class="row"><input placeholder="型号" value="{{j}}" bindinput="{{k}}"/></view><view class="row"><input placeholder="规格" value="{{l}}" bindinput="{{m}}"/></view><view class="row"><input placeholder="产地" value="{{n}}" bindinput="{{o}}"/></view><view class="row"><picker mode="selector" range="{{q}}" bindchange="{{r}}"><view class="picker">主单位:{{p}}</view></picker><picker mode="selector" range="{{t}}" bindchange="{{v}}"><view class="picker">类别:{{s}}</view></picker></view></view><view class="section"><view class="row"><text class="label">库存与安全库存</text></view><view class="row"><input type="number" placeholder="当前库存" value="{{w}}" bindinput="{{x}}"/><input type="number" placeholder="安全库存下限" value="{{y}}" bindinput="{{z}}"/><input type="number" placeholder="安全库存上限" value="{{A}}" bindinput="{{B}}"/></view></view><view class="section"><view class="row"><text class="label">价格(进价/零售/批发/大单)</text></view><view class="row prices"><input type="number" placeholder="进货价" value="{{C}}" bindinput="{{D}}"/><input type="number" placeholder="零售价" value="{{E}}" bindinput="{{F}}"/><input type="number" placeholder="批发价" value="{{G}}" bindinput="{{H}}"/><input type="number" placeholder="大单价" value="{{I}}" bindinput="{{J}}"/></view></view><view class="section"><text class="label">图片</text><image-uploader wx:if="{{L}}" u-i="4a3f460a-0" bind:__l="__l" bindupdateModelValue="{{K}}" u-p="{{L}}"/></view><view class="section"><text class="label">备注</text><block wx:if="{{r0}}"><textarea placeholder="可选" auto-height value="{{M}}" bindinput="{{N}}"/></block></view><view class="fixed" style="{{'bottom:' + Q}}"><button class="ghost" bindtap="{{O}}">保存</button><button class="primary" bindtap="{{P}}">保存并继续</button></view></scroll-view>
|
||||
<scroll-view scroll-y class="page"><view class="hero small"><text class="title">编辑货品</text><text class="sub">完善基础信息与价格</text></view><view wx:if="{{a}}" class="tip platform">平台推荐货品,建议谨慎修改核心字段</view><view wx:elif="{{b}}" class="tip custom">此货品源于我的提交,审核通过后已入库</view><view class="section"><view class="row"><text class="label">商品名称</text><input placeholder="必填" value="{{c}}" bindinput="{{d}}"/></view><view class="row"><text class="label">条形码</text><input class="input-long" placeholder="可扫码或输入" value="{{e}}" bindinput="{{f}}"/><button size="mini" class="picker-btn" bindtap="{{g}}">图片识码</button></view><view class="row"><input placeholder="品牌" value="{{h}}" bindinput="{{i}}"/></view><view class="row"><input placeholder="型号" value="{{j}}" bindinput="{{k}}"/></view><view class="row"><input placeholder="规格" value="{{l}}" bindinput="{{m}}"/></view><view class="row"><picker mode="selector" range="{{o}}" bindchange="{{p}}"><view class="picker">类别:{{n}}</view></picker></view></view><view class="section"><text class="label">图片</text><image-uploader wx:if="{{r}}" u-i="4a3f460a-0" bind:__l="__l" bindupdateModelValue="{{q}}" u-p="{{r}}"/></view><view class="section"><text class="label">备注</text><block wx:if="{{r0}}"><textarea placeholder="可选" auto-height value="{{s}}" bindinput="{{t}}"/></block></view><view class="fixed" style="{{'bottom:' + x}}"><button class="ghost" bindtap="{{v}}">保存</button><button class="primary" bindtap="{{w}}">保存并继续</button></view></scroll-view>
|
||||
@@ -24,6 +24,7 @@
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
/* 表单控件尺寸(统一配置,避免页面内硬编码) */
|
||||
.page {
|
||||
background: #ffffff;
|
||||
min-height: 100vh;
|
||||
|
||||
@@ -5,11 +5,13 @@ const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
query: { kw: "", page: 1, size: 20, categoryId: "" },
|
||||
query: { kw: "", page: 1, size: 20, categoryId: "", mode: "direct", templateId: "", params: {} },
|
||||
finished: false,
|
||||
loading: false,
|
||||
tab: "all",
|
||||
categories: []
|
||||
categories: [],
|
||||
templates: [],
|
||||
paramValues: {}
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
@@ -48,19 +50,57 @@ const _sfc_main = {
|
||||
categoryLabel() {
|
||||
const c = this.categories.find((x) => String(x.id) === String(this.query.categoryId));
|
||||
return c ? "类别:" + c.name : "选择类别";
|
||||
},
|
||||
modeLabel() {
|
||||
const map = { direct: "直接查询", nameLike: "名称模糊查询", template: "按模板参数查询" };
|
||||
return map[this.query.mode] || "直接查询";
|
||||
},
|
||||
templateNames() {
|
||||
return this.templates.map((t) => t.name);
|
||||
},
|
||||
templateLabel() {
|
||||
const t = this.templates.find((x) => String(x.id) === String(this.query.templateId));
|
||||
return t ? "模板:" + t.name : "选择模板";
|
||||
},
|
||||
selectedTemplate() {
|
||||
return this.templates.find((t) => String(t.id) === String(this.query.templateId)) || null;
|
||||
},
|
||||
selectedTemplateParams() {
|
||||
return this.selectedTemplate && Array.isArray(this.selectedTemplate.params) ? this.selectedTemplate.params : [];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
switchTab(t) {
|
||||
this.tab = t;
|
||||
this.query.categoryId = "";
|
||||
this.query.templateId = "";
|
||||
this.paramValues = {};
|
||||
this.reload();
|
||||
},
|
||||
onPickCategory(e) {
|
||||
const idx = Number(e.detail.value);
|
||||
const c = this.categories[idx];
|
||||
this.query.categoryId = c ? c.id : "";
|
||||
this.reload();
|
||||
this.fetchTemplates();
|
||||
},
|
||||
onPickTemplate(e) {
|
||||
const idx = Number(e.detail.value);
|
||||
const t = this.templates[idx];
|
||||
this.query.templateId = t ? t.id : "";
|
||||
this.paramValues = {};
|
||||
},
|
||||
onPickParamEnumWrapper(p, e) {
|
||||
const idx = Number(e.detail.value);
|
||||
const arr = p.enumOptions || [];
|
||||
this.paramValues[p.fieldKey] = arr[idx];
|
||||
},
|
||||
onParamBoolChange(p, e) {
|
||||
var _a;
|
||||
this.paramValues[p.fieldKey] = ((_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value) ? true : false;
|
||||
},
|
||||
onParamDateChange(p, e) {
|
||||
var _a;
|
||||
this.paramValues[p.fieldKey] = ((_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value) || "";
|
||||
},
|
||||
async fetchCategories() {
|
||||
try {
|
||||
@@ -69,6 +109,15 @@ const _sfc_main = {
|
||||
} catch (_) {
|
||||
}
|
||||
},
|
||||
async fetchTemplates() {
|
||||
try {
|
||||
const res = await common_http.get("/api/product-templates", this.query.categoryId ? { categoryId: this.query.categoryId } : {});
|
||||
const list = Array.isArray(res == null ? void 0 : res.list) ? res.list : Array.isArray(res) ? res : [];
|
||||
this.templates = list;
|
||||
} catch (_) {
|
||||
this.templates = [];
|
||||
}
|
||||
},
|
||||
reload() {
|
||||
this.items = [];
|
||||
this.query.page = 1;
|
||||
@@ -81,8 +130,19 @@ const _sfc_main = {
|
||||
this.loading = true;
|
||||
try {
|
||||
const params = { kw: this.query.kw, page: this.query.page, size: this.query.size };
|
||||
if (this.tab === "category" && this.query.categoryId)
|
||||
params.categoryId = this.query.categoryId;
|
||||
if (this.tab === "search") {
|
||||
if (this.query.categoryId)
|
||||
params.categoryId = this.query.categoryId;
|
||||
if (this.query.templateId)
|
||||
params.templateId = this.query.templateId;
|
||||
if (this.paramValues && Object.keys(this.paramValues).length) {
|
||||
for (const k of Object.keys(this.paramValues)) {
|
||||
const v = this.paramValues[k];
|
||||
if (v !== void 0 && v !== null && v !== "")
|
||||
params["param_" + k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
const res = await common_http.get("/api/products", params);
|
||||
const list = Array.isArray(res == null ? void 0 : res.list) ? res.list : Array.isArray(res) ? res : [];
|
||||
this.items = this.items.concat(list);
|
||||
@@ -95,12 +155,26 @@ const _sfc_main = {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
openForm(id) {
|
||||
const url = "/pages/product/form" + (id ? "?id=" + id : "");
|
||||
common_vendor.index.navigateTo({ url });
|
||||
openDetail(id) {
|
||||
common_vendor.index.navigateTo({ url: "/pages/product/product-detail?id=" + id });
|
||||
},
|
||||
goMySubmissions() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/product/submissions" });
|
||||
},
|
||||
async remove(it) {
|
||||
try {
|
||||
const r = await new Promise((resolve) => {
|
||||
common_vendor.index.showModal({ content: "确认删除该货品?删除后可在后台恢复", success: resolve });
|
||||
});
|
||||
if (!r || !r.confirm)
|
||||
return;
|
||||
const { del } = require("../../common/http.js");
|
||||
await del("/api/products/" + it.id);
|
||||
common_vendor.index.showToast({ title: "已删除", icon: "success" });
|
||||
this.reload();
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: "删除失败", icon: "none" });
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -108,44 +182,96 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.tab === "all" ? 1 : "",
|
||||
b: common_vendor.o(($event) => $options.switchTab("all")),
|
||||
c: $data.tab === "category" ? 1 : "",
|
||||
d: common_vendor.o(($event) => $options.switchTab("category")),
|
||||
c: $data.tab === "search" ? 1 : "",
|
||||
d: common_vendor.o(($event) => $options.switchTab("search")),
|
||||
e: common_vendor.o((...args) => $options.goMySubmissions && $options.goMySubmissions(...args)),
|
||||
f: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
|
||||
g: $data.query.kw,
|
||||
h: common_vendor.o(common_vendor.m(($event) => $data.query.kw = $event.detail.value, {
|
||||
f: $data.tab === "search"
|
||||
}, $data.tab === "search" ? common_vendor.e({
|
||||
g: common_vendor.t($options.modeLabel),
|
||||
h: ["直接查询", "名称模糊查询", "按模板参数查询"],
|
||||
i: common_vendor.o((e) => $data.query.mode = ["direct", "nameLike", "template"][Number(e.detail.value)] || "direct"),
|
||||
j: $data.query.mode === "direct" || $data.query.mode === "nameLike"
|
||||
}, $data.query.mode === "direct" || $data.query.mode === "nameLike" ? {
|
||||
k: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
|
||||
l: $data.query.kw,
|
||||
m: common_vendor.o(common_vendor.m(($event) => $data.query.kw = $event.detail.value, {
|
||||
trim: true
|
||||
})),
|
||||
i: $data.tab === "category"
|
||||
}, $data.tab === "category" ? {
|
||||
j: common_vendor.t($options.categoryLabel),
|
||||
k: $options.categoryNames,
|
||||
l: common_vendor.o((...args) => $options.onPickCategory && $options.onPickCategory(...args))
|
||||
}))
|
||||
} : {}, {
|
||||
m: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
|
||||
n: $data.items.length
|
||||
n: $data.query.mode === "template"
|
||||
}, $data.query.mode === "template" ? {
|
||||
o: common_vendor.t($options.categoryLabel),
|
||||
p: $options.categoryNames,
|
||||
q: common_vendor.o((...args) => $options.onPickCategory && $options.onPickCategory(...args)),
|
||||
r: common_vendor.t($options.templateLabel),
|
||||
s: $options.templateNames,
|
||||
t: common_vendor.o((...args) => $options.onPickTemplate && $options.onPickTemplate(...args)),
|
||||
v: common_vendor.f($options.selectedTemplateParams, (p, idx, i0) => {
|
||||
return common_vendor.e({
|
||||
a: p.type === "string"
|
||||
}, p.type === "string" ? {
|
||||
b: "输入" + p.fieldLabel,
|
||||
c: $data.paramValues[p.fieldKey],
|
||||
d: common_vendor.o(common_vendor.m(($event) => $data.paramValues[p.fieldKey] = $event.detail.value, {
|
||||
trim: true
|
||||
}), p.fieldKey)
|
||||
} : p.type === "number" ? {
|
||||
f: "输入" + p.fieldLabel,
|
||||
g: $data.paramValues[p.fieldKey],
|
||||
h: common_vendor.o(common_vendor.m(($event) => $data.paramValues[p.fieldKey] = $event.detail.value, {
|
||||
number: true
|
||||
}), p.fieldKey)
|
||||
} : p.type === "boolean" ? {
|
||||
j: !!$data.paramValues[p.fieldKey],
|
||||
k: common_vendor.o(($event) => $options.onParamBoolChange(p, $event), p.fieldKey)
|
||||
} : p.type === "enum" ? {
|
||||
m: common_vendor.t(_ctx.displayParamEnum(p)),
|
||||
n: p.enumOptions || [],
|
||||
o: common_vendor.o(($event) => $options.onPickParamEnumWrapper(p, $event), p.fieldKey)
|
||||
} : p.type === "date" ? {
|
||||
q: common_vendor.t($data.paramValues[p.fieldKey] || "选择" + p.fieldLabel),
|
||||
r: common_vendor.o(($event) => $options.onParamDateChange(p, $event), p.fieldKey)
|
||||
} : {
|
||||
s: "输入" + p.fieldLabel,
|
||||
t: $data.paramValues[p.fieldKey],
|
||||
v: common_vendor.o(common_vendor.m(($event) => $data.paramValues[p.fieldKey] = $event.detail.value, {
|
||||
trim: true
|
||||
}), p.fieldKey)
|
||||
}, {
|
||||
e: p.type === "number",
|
||||
i: p.type === "boolean",
|
||||
l: p.type === "enum",
|
||||
p: p.type === "date",
|
||||
w: p.fieldKey
|
||||
});
|
||||
})
|
||||
} : {}, {
|
||||
w: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
|
||||
x: $data.query.mode === "template" ? 1 : ""
|
||||
}) : {}, {
|
||||
y: $data.items.length
|
||||
}, $data.items.length ? {
|
||||
o: common_vendor.f($data.items, (it, k0, i0) => {
|
||||
z: common_vendor.f($data.items, (it, k0, i0) => {
|
||||
return common_vendor.e({
|
||||
a: it.cover
|
||||
}, it.cover ? {
|
||||
b: it.cover
|
||||
} : {}, {
|
||||
c: common_vendor.t(it.name),
|
||||
d: it.platformStatus === "platform"
|
||||
d: it.deleted
|
||||
}, it.deleted ? {} : {}, {
|
||||
e: it.platformStatus === "platform"
|
||||
}, it.platformStatus === "platform" ? {} : it.sourceSubmissionId ? {} : {}, {
|
||||
e: it.sourceSubmissionId,
|
||||
f: common_vendor.t(it.brand || "-"),
|
||||
g: common_vendor.t(it.model || ""),
|
||||
h: common_vendor.t(it.spec || ""),
|
||||
i: common_vendor.t(it.stock ?? 0),
|
||||
j: common_vendor.t((it.retailPrice ?? it.price ?? 0).toFixed(2)),
|
||||
k: it.id,
|
||||
l: common_vendor.o(($event) => $options.openForm(it.id), it.id)
|
||||
f: it.sourceSubmissionId,
|
||||
g: common_vendor.t(it.brand || "-"),
|
||||
h: common_vendor.t(it.model || ""),
|
||||
i: common_vendor.t(it.spec || ""),
|
||||
j: it.id,
|
||||
k: common_vendor.o(($event) => $options.openDetail(it.id), it.id)
|
||||
});
|
||||
})
|
||||
} : {}, {
|
||||
p: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args))
|
||||
A: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args))
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view class="page"><view class="tabs"><view class="{{['tab', a && 'active']}}" bindtap="{{b}}">全部</view><view class="{{['tab', c && 'active']}}" bindtap="{{d}}">按类别</view><view class="tab extra" bindtap="{{e}}">我的提交</view></view><view class="search"><input placeholder="输入名称/条码/规格查询" bindconfirm="{{f}}" value="{{g}}" bindinput="{{h}}"/><picker wx:if="{{i}}" mode="selector" range="{{k}}" bindchange="{{l}}"><view class="picker">{{j}}</view></picker><button size="mini" bindtap="{{m}}">查询</button></view><scroll-view scroll-y class="list" bindscrolltolower="{{p}}"><block wx:if="{{n}}"><view wx:for="{{o}}" wx:for-item="it" wx:key="k" class="item" bindtap="{{it.l}}"><image wx:if="{{it.a}}" src="{{it.b}}" class="thumb" mode="aspectFill"/><view class="content"><view class="name"><text>{{it.c}}</text><text wx:if="{{it.d}}" class="tag-platform">平台推荐</text><text wx:elif="{{it.e}}" class="tag-custom">我的提交</text></view><view class="meta">{{it.f}} {{it.g}} {{it.h}}</view><view class="meta">库存:{{it.i}} <text class="price">零售价:¥{{it.j}}</text></view></view></view></block><view wx:else class="empty"><text>暂无数据,点击右上角“+”新增</text></view></scroll-view></view>
|
||||
<view class="page"><view class="tabs"><view class="{{['tab', a && 'active']}}" bindtap="{{b}}">全部</view><view class="{{['tab', c && 'active']}}" bindtap="{{d}}">查询</view><view class="tab extra" bindtap="{{e}}">我的提交</view></view><view wx:if="{{f}}" class="{{['search', x && 'template-mode']}}"><view class="mode"><picker mode="selector" range="{{h}}" bindchange="{{i}}"><view class="picker">{{g}}</view></picker></view><block wx:if="{{j}}"><input placeholder="输入名称/条码/规格查询" bindconfirm="{{k}}" value="{{l}}" bindinput="{{m}}"/></block><block wx:if="{{n}}"><view class="picker-row"><picker mode="selector" range="{{p}}" bindchange="{{q}}"><view class="picker">{{o}}</view></picker><picker mode="selector" range="{{s}}" bindchange="{{t}}"><view class="picker">{{r}}</view></picker></view><view class="params-wrap"><view wx:for="{{v}}" wx:for-item="p" wx:key="w" class="param-row"><input wx:if="{{p.a}}" placeholder="{{p.b}}" value="{{p.c}}" bindinput="{{p.d}}"/><input wx:elif="{{p.e}}" type="number" placeholder="{{p.f}}" value="{{p.g}}" bindinput="{{p.h}}"/><switch wx:elif="{{p.i}}" checked="{{p.j}}" bindchange="{{p.k}}"/><picker wx:elif="{{p.l}}" mode="selector" range="{{p.n}}" bindchange="{{p.o}}"><view class="picker">{{p.m}}</view></picker><picker wx:elif="{{p.p}}" mode="date" bindchange="{{p.r}}"><view class="picker">{{p.q}}</view></picker><input wx:else placeholder="{{p.s}}" value="{{p.t}}" bindinput="{{p.v}}"/></view></view></block><button size="mini" bindtap="{{w}}">查询</button></view><scroll-view scroll-y class="list" bindscrolltolower="{{A}}"><block wx:if="{{y}}"><view wx:for="{{z}}" wx:for-item="it" wx:key="j" class="item" bindtap="{{it.k}}"><image wx:if="{{it.a}}" src="{{it.b}}" class="thumb" mode="aspectFill"/><view class="content"><view class="name"><text>{{it.c}}</text><text wx:if="{{it.d}}" class="tag-deleted">已删除</text><text wx:if="{{it.e}}" class="tag-platform">平台推荐</text><text wx:elif="{{it.f}}" class="tag-custom">我的提交</text></view><view class="meta">{{it.g}} {{it.h}} {{it.i}}</view></view></view></block><view wx:else class="empty"><text>暂无数据,点击右上角“+”新增</text></view></scroll-view></view>
|
||||
@@ -24,6 +24,7 @@
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
/* 表单控件尺寸(统一配置,避免页面内硬编码) */
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -68,6 +69,21 @@
|
||||
border-radius: 10rpx;
|
||||
color: #444;
|
||||
}
|
||||
.template-mode {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 8rpx;
|
||||
}
|
||||
.picker-row {
|
||||
display: flex;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.params-wrap {
|
||||
margin-top: 6rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
padding: 8rpx 8rpx;
|
||||
}
|
||||
.list {
|
||||
flex: 1;
|
||||
}
|
||||
@@ -109,6 +125,13 @@
|
||||
padding: 4rpx 10rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.tag-deleted {
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
background: #909399;
|
||||
padding: 4rpx 10rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.meta {
|
||||
color: #444;
|
||||
font-size: 24rpx;
|
||||
|
||||
170
frontend/unpackage/dist/dev/mp-weixin/pages/product/product-detail.js
vendored
Normal file
170
frontend/unpackage/dist/dev/mp-weixin/pages/product/product-detail.js
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return { id: "", detail: null, categoryName: "-", templateName: "-" };
|
||||
},
|
||||
async onLoad(query) {
|
||||
this.id = (query == null ? void 0 : query.id) || "";
|
||||
if (!this.id) {
|
||||
common_vendor.index.showToast({ title: "参数缺失", icon: "none" });
|
||||
return;
|
||||
}
|
||||
await this.preloadDictionaries();
|
||||
await this.loadDetail();
|
||||
},
|
||||
methods: {
|
||||
async preloadDictionaries() {
|
||||
try {
|
||||
const needCats = !Array.isArray(common_vendor.index.getStorageSync("CACHE_CATEGORIES"));
|
||||
const needTpls = !Array.isArray(common_vendor.index.getStorageSync("CACHE_TEMPLATES"));
|
||||
if (!needCats && !needTpls)
|
||||
return;
|
||||
const reqs = [];
|
||||
if (needCats)
|
||||
reqs.push(common_http.get("/api/product-categories"));
|
||||
if (needTpls)
|
||||
reqs.push(common_http.get("/api/product-templates"));
|
||||
const res = await Promise.all(reqs);
|
||||
let idx = 0;
|
||||
if (needCats) {
|
||||
const r = res[idx++];
|
||||
const list = Array.isArray(r == null ? void 0 : r.list) ? r.list : Array.isArray(r) ? r : [];
|
||||
common_vendor.index.setStorageSync("CACHE_CATEGORIES", list);
|
||||
}
|
||||
if (needTpls) {
|
||||
const r = res[idx++];
|
||||
const list = Array.isArray(r == null ? void 0 : r.list) ? r.list : Array.isArray(r) ? r : [];
|
||||
common_vendor.index.setStorageSync("CACHE_TEMPLATES", list);
|
||||
}
|
||||
} catch (_) {
|
||||
}
|
||||
},
|
||||
async loadDetail() {
|
||||
try {
|
||||
const data = await common_http.get("/api/products/" + this.id);
|
||||
this.detail = data;
|
||||
this.categoryName = this.categoryLookup(data.categoryId);
|
||||
this.templateName = this.templateLookup(data.templateId);
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: (e == null ? void 0 : e.message) || "加载失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
preview(idx) {
|
||||
var _a;
|
||||
try {
|
||||
const list = (((_a = this.detail) == null ? void 0 : _a.images) || []).map((i) => i.url || i);
|
||||
common_vendor.index.previewImage({ urls: list, current: idx });
|
||||
} catch (_) {
|
||||
}
|
||||
},
|
||||
categoryLookup(id) {
|
||||
try {
|
||||
const list = common_vendor.index.getStorageSync("CACHE_CATEGORIES") || [];
|
||||
const f = list.find((x) => String(x.id) === String(id));
|
||||
return f ? f.name : "-";
|
||||
} catch (_) {
|
||||
return "-";
|
||||
}
|
||||
},
|
||||
templateLookup(id) {
|
||||
try {
|
||||
const list = common_vendor.index.getStorageSync("CACHE_TEMPLATES") || [];
|
||||
const f = list.find((x) => String(x.id) === String(id));
|
||||
return f ? f.name : "-";
|
||||
} catch (_) {
|
||||
return "-";
|
||||
}
|
||||
},
|
||||
async remove() {
|
||||
try {
|
||||
const r = await new Promise((resolve) => {
|
||||
common_vendor.index.showModal({ content: "确认删除该货品?删除后可在后台恢复", success: resolve });
|
||||
});
|
||||
if (!r || !r.confirm)
|
||||
return;
|
||||
await common_http.del("/api/products/" + this.id);
|
||||
common_vendor.index.showToast({ title: "已删除", icon: "success" });
|
||||
setTimeout(() => common_vendor.index.navigateBack(), 400);
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: "删除失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
back() {
|
||||
common_vendor.index.navigateBack({ delta: 1 });
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
labeledPairs() {
|
||||
var _a;
|
||||
const params = (_a = this.detail) == null ? void 0 : _a.parameters;
|
||||
if (!params || typeof params !== "object")
|
||||
return [];
|
||||
let labelMap = {}, unitMap = {};
|
||||
try {
|
||||
const templates = common_vendor.index.getStorageSync("CACHE_TEMPLATES") || [];
|
||||
const tpl = templates.find((t) => {
|
||||
var _a2;
|
||||
return String(t.id) === String((_a2 = this.detail) == null ? void 0 : _a2.templateId);
|
||||
});
|
||||
if (tpl && Array.isArray(tpl.params))
|
||||
for (const p of tpl.params) {
|
||||
labelMap[p.fieldKey] = p.fieldLabel;
|
||||
unitMap[p.fieldKey] = p.unit;
|
||||
}
|
||||
} catch (_) {
|
||||
}
|
||||
return Object.keys(params).map((k) => ({ key: k, label: labelMap[k] || k, unit: unitMap[k] || "", value: params[k] }));
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.detail
|
||||
}, $data.detail ? common_vendor.e({
|
||||
b: common_vendor.t($data.detail.model),
|
||||
c: $data.detail.deleted
|
||||
}, $data.detail.deleted ? {} : {}, {
|
||||
d: common_vendor.t($data.detail.name || "-"),
|
||||
e: common_vendor.t($data.detail.brand || "-"),
|
||||
f: common_vendor.t($data.detail.model || "-"),
|
||||
g: common_vendor.t($data.detail.barcode || "-"),
|
||||
h: common_vendor.t($data.categoryName),
|
||||
i: common_vendor.t($data.templateName),
|
||||
j: $data.detail.externalCode
|
||||
}, $data.detail.externalCode ? {
|
||||
k: common_vendor.t($data.detail.externalCode)
|
||||
} : {}, {
|
||||
l: $options.labeledPairs.length
|
||||
}, $options.labeledPairs.length ? {
|
||||
m: common_vendor.f($options.labeledPairs, (item, k0, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item.label),
|
||||
b: item.unit
|
||||
}, item.unit ? {
|
||||
c: common_vendor.t(item.unit)
|
||||
} : {}, {
|
||||
d: common_vendor.t(item.value),
|
||||
e: item.key
|
||||
});
|
||||
})
|
||||
} : {}, {
|
||||
n: $data.detail.images && $data.detail.images.length
|
||||
}, $data.detail.images && $data.detail.images.length ? {
|
||||
o: common_vendor.f($data.detail.images, (img, idx, i0) => {
|
||||
return {
|
||||
a: idx,
|
||||
b: img.url || img,
|
||||
c: common_vendor.o(($event) => $options.preview(idx), idx)
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
p: common_vendor.t($data.detail.remark || "无"),
|
||||
q: common_vendor.o((...args) => $options.back && $options.back(...args)),
|
||||
r: common_vendor.o((...args) => $options.remove && $options.remove(...args))
|
||||
}) : {});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/product/product-detail.js.map
|
||||
4
frontend/unpackage/dist/dev/mp-weixin/pages/product/product-detail.json
vendored
Normal file
4
frontend/unpackage/dist/dev/mp-weixin/pages/product/product-detail.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "货品详情",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
frontend/unpackage/dist/dev/mp-weixin/pages/product/product-detail.wxml
vendored
Normal file
1
frontend/unpackage/dist/dev/mp-weixin/pages/product/product-detail.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<scroll-view wx:if="{{a}}" scroll-y class="page"><view class="header"><text class="model">{{b}}</text><text wx:if="{{c}}" class="status deleted">已删除</text></view><view class="section"><view class="row"><text class="label">名称</text><text class="value">{{d}}</text></view><view class="row"><text class="label">品牌</text><text class="value">{{e}}</text></view><view class="row"><text class="label">型号</text><text class="value">{{f}}</text></view><view class="row"><text class="label">条码</text><text class="value">{{g}}</text></view><view class="row"><text class="label">类别</text><text class="value">{{h}}</text></view><view class="row"><text class="label">模板</text><text class="value">{{i}}</text></view><view wx:if="{{j}}" class="row"><text class="label">编号</text><text class="value">{{k}}</text></view></view><view class="section"><view class="block-title">参数</view><view wx:if="{{l}}" class="params"><view wx:for="{{m}}" wx:for-item="item" wx:key="e" class="param"><text class="param-key">{{item.a}}<text wx:if="{{item.b}}">({{item.c}})</text></text><text class="param-val">{{item.d}}</text></view></view><view wx:else class="placeholder">未填写参数</view></view><view class="section"><view class="block-title">图片</view><view wx:if="{{n}}" class="images"><image wx:for="{{o}}" wx:for-item="img" wx:key="a" src="{{img.b}}" class="image" mode="aspectFill" bindtap="{{img.c}}"/></view><view wx:else class="placeholder">未上传图片</view></view><view class="section"><view class="block-title">备注</view><view class="placeholder">{{p}}</view></view><view class="footer"><button size="mini" bindtap="{{q}}">返回</button><button size="mini" type="warn" bindtap="{{r}}">删除</button></view></scroll-view><view wx:else class="loading">加载中...</view>
|
||||
124
frontend/unpackage/dist/dev/mp-weixin/pages/product/product-detail.wxss
vendored
Normal file
124
frontend/unpackage/dist/dev/mp-weixin/pages/product/product-detail.wxss
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 藏青系主色(高亮) */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
/* 表单控件尺寸(统一配置,避免页面内硬编码) */
|
||||
.page {
|
||||
padding: 24rpx 24rpx 160rpx;
|
||||
background: #f6f7fb;
|
||||
}
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.model {
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
color: #2d3a4a;
|
||||
}
|
||||
.status.deleted {
|
||||
font-size: 24rpx;
|
||||
padding: 6rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #c0c4cc;
|
||||
color: #fff;
|
||||
}
|
||||
.section {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 20rpx 22rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 12rpx 0;
|
||||
border-bottom: 1rpx solid #f1f2f5;
|
||||
}
|
||||
.row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.label {
|
||||
width: 160rpx;
|
||||
font-size: 26rpx;
|
||||
color: #7a8899;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
font-size: 26rpx;
|
||||
color: #2d3a4a;
|
||||
word-break: break-all;
|
||||
}
|
||||
.block-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #2d3a4a;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.placeholder {
|
||||
font-size: 26rpx;
|
||||
color: #7a8899;
|
||||
}
|
||||
.params {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.param {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 26rpx;
|
||||
color: #2d3a4a;
|
||||
}
|
||||
.param-key {
|
||||
color: #7a8899;
|
||||
}
|
||||
.images {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 12rpx;
|
||||
}
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #f0f2f5;
|
||||
}
|
||||
.footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 20rpx;
|
||||
}
|
||||
.loading {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #7a8899;
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
/* 表单控件尺寸(统一配置,避免页面内硬编码) */
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
201
frontend/unpackage/dist/dev/mp-weixin/pages/product/submission-detail.js
vendored
Normal file
201
frontend/unpackage/dist/dev/mp-weixin/pages/product/submission-detail.js
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
id: "",
|
||||
detail: null,
|
||||
unitName: "-",
|
||||
categoryName: "-",
|
||||
templateName: "-"
|
||||
};
|
||||
},
|
||||
async onLoad(query) {
|
||||
this.id = (query == null ? void 0 : query.id) || "";
|
||||
if (!this.id) {
|
||||
common_vendor.index.showToast({ title: "参数缺失", icon: "none" });
|
||||
return;
|
||||
}
|
||||
await this.loadDetail();
|
||||
},
|
||||
methods: {
|
||||
async loadDetail() {
|
||||
try {
|
||||
const data = await common_http.get(`/api/products/submissions/${this.id}`);
|
||||
this.detail = data;
|
||||
this.categoryName = this.categoryLookup(data.categoryId);
|
||||
this.templateName = this.templateLookup(data.templateId);
|
||||
} catch (e) {
|
||||
const msg = (e == null ? void 0 : e.message) || "加载失败";
|
||||
common_vendor.index.showToast({ title: msg, icon: "none" });
|
||||
}
|
||||
},
|
||||
statusLabel(s) {
|
||||
if (s === "approved")
|
||||
return "已通过";
|
||||
if (s === "rejected")
|
||||
return "已驳回";
|
||||
return "待审核";
|
||||
},
|
||||
statusClass(s) {
|
||||
if (s === "approved")
|
||||
return "approved";
|
||||
if (s === "rejected")
|
||||
return "rejected";
|
||||
return "pending";
|
||||
},
|
||||
preview(idx) {
|
||||
var _a;
|
||||
if (!((_a = this.detail) == null ? void 0 : _a.images) || !this.detail.images.length)
|
||||
return;
|
||||
common_vendor.index.previewImage({ urls: this.detail.images, current: idx });
|
||||
},
|
||||
formatTime(value) {
|
||||
if (!value)
|
||||
return "-";
|
||||
try {
|
||||
const d = new Date(value);
|
||||
if (!Number.isFinite(d.getTime()))
|
||||
return value;
|
||||
const y = d.getFullYear();
|
||||
const m = String(d.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(d.getDate()).padStart(2, "0");
|
||||
const hh = String(d.getHours()).padStart(2, "0");
|
||||
const mm = String(d.getMinutes()).padStart(2, "0");
|
||||
return `${y}-${m}-${day} ${hh}:${mm}`;
|
||||
} catch (_) {
|
||||
return value;
|
||||
}
|
||||
},
|
||||
unitLookup(id) {
|
||||
try {
|
||||
const list = [];
|
||||
const found = list.find((x) => String(x.id) === String(id));
|
||||
return found ? found.name : "-";
|
||||
} catch (_) {
|
||||
return "-";
|
||||
}
|
||||
},
|
||||
categoryLookup(id) {
|
||||
try {
|
||||
const list = common_vendor.index.getStorageSync("CACHE_CATEGORIES") || [];
|
||||
const found = list.find((x) => String(x.id) === String(id));
|
||||
return found ? found.name : "-";
|
||||
} catch (_) {
|
||||
return "-";
|
||||
}
|
||||
},
|
||||
templateLookup(id) {
|
||||
try {
|
||||
const list = common_vendor.index.getStorageSync("CACHE_TEMPLATES") || [];
|
||||
const found = list.find((x) => String(x.id) === String(id));
|
||||
return found ? found.name : "-";
|
||||
} catch (_) {
|
||||
return "-";
|
||||
}
|
||||
},
|
||||
back() {
|
||||
common_vendor.index.navigateBack({ delta: 1 });
|
||||
},
|
||||
resubmit() {
|
||||
const payload = {
|
||||
model: this.detail.model,
|
||||
name: this.detail.name,
|
||||
brand: this.detail.brand,
|
||||
spec: this.detail.spec,
|
||||
origin: this.detail.origin,
|
||||
unitId: this.detail.unitId,
|
||||
categoryId: this.detail.categoryId,
|
||||
remark: this.detail.remark,
|
||||
barcode: this.detail.barcode,
|
||||
parameters: this.detail.parameters
|
||||
};
|
||||
const query = encodeURIComponent(JSON.stringify(payload));
|
||||
common_vendor.index.navigateTo({ url: `/pages/product/submit?prefill=${query}` });
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
stockRange() {
|
||||
var _a, _b;
|
||||
const min = (_a = this.detail) == null ? void 0 : _a.safeMin;
|
||||
const max = (_b = this.detail) == null ? void 0 : _b.safeMax;
|
||||
if (min == null && max == null)
|
||||
return "-";
|
||||
if (min != null && max != null)
|
||||
return `${min} ~ ${max}`;
|
||||
if (min != null)
|
||||
return `≥ ${min}`;
|
||||
return `≤ ${max}`;
|
||||
},
|
||||
labeledPairs() {
|
||||
var _a;
|
||||
const params = (_a = this.detail) == null ? void 0 : _a.parameters;
|
||||
if (!params || typeof params !== "object")
|
||||
return [];
|
||||
let labelMap = {};
|
||||
try {
|
||||
const templates = common_vendor.index.getStorageSync("CACHE_TEMPLATES") || [];
|
||||
const tpl = templates.find((t) => {
|
||||
var _a2;
|
||||
return String(t.id) === String((_a2 = this.detail) == null ? void 0 : _a2.templateId);
|
||||
});
|
||||
if (tpl && Array.isArray(tpl.params)) {
|
||||
for (const p of tpl.params)
|
||||
labelMap[p.fieldKey] = p.fieldLabel;
|
||||
}
|
||||
} catch (_) {
|
||||
}
|
||||
return Object.keys(params).map((k) => ({ key: k, label: labelMap[k] || k, value: params[k] }));
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.detail
|
||||
}, $data.detail ? common_vendor.e({
|
||||
b: common_vendor.t($data.detail.model),
|
||||
c: common_vendor.t($options.statusLabel($data.detail.status)),
|
||||
d: common_vendor.n($options.statusClass($data.detail.status)),
|
||||
e: common_vendor.t($data.detail.name || "-"),
|
||||
f: common_vendor.t($data.detail.brand || "-"),
|
||||
g: common_vendor.t($data.detail.spec || "-"),
|
||||
h: common_vendor.t($data.detail.barcode || "-"),
|
||||
i: common_vendor.t($data.categoryName),
|
||||
j: common_vendor.t($data.templateName),
|
||||
k: $options.labeledPairs.length
|
||||
}, $options.labeledPairs.length ? {
|
||||
l: common_vendor.f($options.labeledPairs, (item, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.label),
|
||||
b: common_vendor.t(item.value),
|
||||
c: item.key
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
m: $data.detail.images && $data.detail.images.length
|
||||
}, $data.detail.images && $data.detail.images.length ? {
|
||||
n: common_vendor.f($data.detail.images, (img, idx, i0) => {
|
||||
return {
|
||||
a: idx,
|
||||
b: img,
|
||||
c: common_vendor.o(($event) => $options.preview(idx), idx)
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
o: common_vendor.t($data.detail.remark || "无"),
|
||||
p: common_vendor.t($options.formatTime($data.detail.createdAt)),
|
||||
q: common_vendor.t($options.formatTime($data.detail.reviewedAt)),
|
||||
r: $data.detail.reviewRemark
|
||||
}, $data.detail.reviewRemark ? {
|
||||
s: common_vendor.t($data.detail.reviewRemark)
|
||||
} : {}, {
|
||||
t: common_vendor.o((...args) => $options.back && $options.back(...args)),
|
||||
v: $data.detail.status === "rejected"
|
||||
}, $data.detail.status === "rejected" ? {
|
||||
w: common_vendor.o((...args) => $options.resubmit && $options.resubmit(...args))
|
||||
} : {}) : {});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/product/submission-detail.js.map
|
||||
4
frontend/unpackage/dist/dev/mp-weixin/pages/product/submission-detail.json
vendored
Normal file
4
frontend/unpackage/dist/dev/mp-weixin/pages/product/submission-detail.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "提交详情",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
frontend/unpackage/dist/dev/mp-weixin/pages/product/submission-detail.wxml
vendored
Normal file
1
frontend/unpackage/dist/dev/mp-weixin/pages/product/submission-detail.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<scroll-view wx:if="{{a}}" scroll-y class="page"><view class="header"><text class="model">{{b}}</text><text class="{{['status', d]}}">{{c}}</text></view><view class="section"><view class="row"><text class="label">名称</text><text class="value">{{e}}</text></view><view class="row"><text class="label">品牌</text><text class="value">{{f}}</text></view><view class="row"><text class="label">规格</text><text class="value">{{g}}</text></view><view class="row"><text class="label">条码</text><text class="value">{{h}}</text></view><view class="row"><text class="label">类别</text><text class="value">{{i}}</text></view><view class="row"><text class="label">模板</text><text class="value">{{j}}</text></view></view><view class="section"><view class="block-title">参数</view><view wx:if="{{k}}" class="params"><view wx:for="{{l}}" wx:for-item="item" wx:key="c" class="param"><text class="param-key">{{item.a}}</text><text class="param-val">{{item.b}}</text></view></view><view wx:else class="placeholder">未填写参数</view></view><view class="section"><view class="block-title">图片</view><view wx:if="{{m}}" class="images"><image wx:for="{{n}}" wx:for-item="img" wx:key="a" src="{{img.b}}" class="image" mode="aspectFill" bindtap="{{img.c}}"/></view><view wx:else class="placeholder">未上传图片</view></view><view class="section"><view class="block-title">备注</view><view class="placeholder">{{o}}</view></view><view class="section"><view class="row"><text class="label">提交时间</text><text class="value">{{p}}</text></view><view class="row"><text class="label">审核时间</text><text class="value">{{q}}</text></view><view wx:if="{{r}}" class="row"><text class="label">审核说明</text><text class="value">{{s}}</text></view></view><view class="footer"><button size="mini" bindtap="{{t}}">返回</button><button wx:if="{{v}}" size="mini" type="warn" bindtap="{{w}}">重新提交</button></view></scroll-view><view wx:else class="loading">加载中...</view>
|
||||
134
frontend/unpackage/dist/dev/mp-weixin/pages/product/submission-detail.wxss
vendored
Normal file
134
frontend/unpackage/dist/dev/mp-weixin/pages/product/submission-detail.wxss
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 藏青系主色(高亮) */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
/* 表单控件尺寸(统一配置,避免页面内硬编码) */
|
||||
.page {
|
||||
padding: 24rpx 24rpx 160rpx;
|
||||
background: #f6f7fb;
|
||||
}
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.model {
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
color: #2d3a4a;
|
||||
}
|
||||
.status {
|
||||
font-size: 26rpx;
|
||||
padding: 6rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
}
|
||||
.status.pending {
|
||||
background: rgba(246, 190, 0, 0.15);
|
||||
color: #c47f00;
|
||||
}
|
||||
.status.approved {
|
||||
background: rgba(103, 194, 58, 0.15);
|
||||
color: #409eff;
|
||||
}
|
||||
.status.rejected {
|
||||
background: rgba(255, 87, 115, 0.18);
|
||||
color: #f56c6c;
|
||||
}
|
||||
.section {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 20rpx 22rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 12rpx 0;
|
||||
border-bottom: 1rpx solid #f1f2f5;
|
||||
}
|
||||
.row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.label {
|
||||
width: 160rpx;
|
||||
font-size: 26rpx;
|
||||
color: #7a8899;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
font-size: 26rpx;
|
||||
color: #2d3a4a;
|
||||
word-break: break-all;
|
||||
}
|
||||
.block-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #2d3a4a;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.placeholder {
|
||||
font-size: 26rpx;
|
||||
color: #7a8899;
|
||||
}
|
||||
.params {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.param {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 26rpx;
|
||||
color: #2d3a4a;
|
||||
}
|
||||
.param-key {
|
||||
color: #7a8899;
|
||||
}
|
||||
.images {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 12rpx;
|
||||
}
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #f0f2f5;
|
||||
}
|
||||
.footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 20rpx;
|
||||
}
|
||||
.loading {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #7a8899;
|
||||
}
|
||||
@@ -22,9 +22,10 @@ const _sfc_main = {
|
||||
methods: {
|
||||
async preloadDictionaries() {
|
||||
try {
|
||||
const [units, categories] = await Promise.all([
|
||||
const [units, categories, templates] = await Promise.all([
|
||||
this.cacheUnitsLoaded ? Promise.resolve(null) : common_http.get("/api/product-units"),
|
||||
this.cacheCategoriesLoaded ? Promise.resolve(null) : common_http.get("/api/product-categories")
|
||||
this.cacheCategoriesLoaded ? Promise.resolve(null) : common_http.get("/api/product-categories"),
|
||||
common_http.get("/api/product-templates")
|
||||
]);
|
||||
if (units) {
|
||||
const list = Array.isArray(units == null ? void 0 : units.list) ? units.list : Array.isArray(units) ? units : [];
|
||||
@@ -36,6 +37,10 @@ const _sfc_main = {
|
||||
common_vendor.index.setStorageSync("CACHE_CATEGORIES", list);
|
||||
this.cacheCategoriesLoaded = true;
|
||||
}
|
||||
if (templates) {
|
||||
const list = Array.isArray(templates == null ? void 0 : templates.list) ? templates.list : Array.isArray(templates) ? templates : [];
|
||||
common_vendor.index.setStorageSync("CACHE_TEMPLATES", list);
|
||||
}
|
||||
} catch (_) {
|
||||
}
|
||||
},
|
||||
@@ -67,7 +72,7 @@ const _sfc_main = {
|
||||
this.finished = true;
|
||||
this.page += 1;
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("warn", "at pages/product/submissions.vue:113", "加载提交记录失败", e);
|
||||
common_vendor.index.__f__("warn", "at pages/product/submissions.vue:118", "加载提交记录失败", e);
|
||||
const msg = (e == null ? void 0 : e.message) || "加载失败";
|
||||
common_vendor.index.showToast({ title: msg, icon: "none" });
|
||||
} finally {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
/* 表单控件尺寸(统一配置,避免页面内硬编码) */
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -12,6 +12,7 @@ const _sfc_main = {
|
||||
barcode: "",
|
||||
categoryId: "",
|
||||
templateId: "",
|
||||
externalCode: "",
|
||||
parameters: {},
|
||||
images: [],
|
||||
remark: "",
|
||||
@@ -99,11 +100,19 @@ const _sfc_main = {
|
||||
this.form.templateId = t ? t.id : "";
|
||||
this.paramValues = {};
|
||||
},
|
||||
onPickDate(p, e) {
|
||||
var _a;
|
||||
this.paramValues[p.fieldKey] = ((_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value) || "";
|
||||
},
|
||||
onPickEnum(p, e) {
|
||||
const idx = Number(e.detail.value);
|
||||
const arr = p.enumOptions || [];
|
||||
this.paramValues[p.fieldKey] = arr[idx];
|
||||
},
|
||||
displayEnum(p) {
|
||||
const v = this.paramValues[p.fieldKey];
|
||||
return v === void 0 || v === null || v === "" ? "选择" + p.fieldLabel : String(v);
|
||||
},
|
||||
async scanBarcode() {
|
||||
var _a;
|
||||
try {
|
||||
@@ -184,6 +193,7 @@ const _sfc_main = {
|
||||
model: this.form.model,
|
||||
brand: this.form.brand,
|
||||
barcode: this.form.barcode,
|
||||
externalCode: this.form.externalCode || null,
|
||||
categoryId: this.form.categoryId || null,
|
||||
templateId: this.form.templateId || null,
|
||||
parameters: paramsForSubmit,
|
||||
@@ -213,7 +223,7 @@ if (!Array) {
|
||||
_component_ImageUploader();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
return common_vendor.e({
|
||||
a: $data.form.model,
|
||||
b: common_vendor.o(common_vendor.m(($event) => $data.form.model = $event.detail.value, {
|
||||
trim: true
|
||||
@@ -230,34 +240,87 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
h: common_vendor.t($options.categoryLabel),
|
||||
i: $options.categoryNames,
|
||||
j: common_vendor.o((...args) => $options.onPickCategory && $options.onPickCategory(...args)),
|
||||
k: common_vendor.t($options.templateLabel),
|
||||
l: $options.templateNames,
|
||||
m: common_vendor.o((...args) => $options.onPickTemplate && $options.onPickTemplate(...args)),
|
||||
n: common_vendor.o(($event) => $data.form.images = $event),
|
||||
o: common_vendor.p({
|
||||
k: $data.form.externalCode,
|
||||
l: common_vendor.o(common_vendor.m(($event) => $data.form.externalCode = $event.detail.value, {
|
||||
trim: true
|
||||
})),
|
||||
m: common_vendor.t($options.templateLabel),
|
||||
n: $options.templateNames,
|
||||
o: common_vendor.o((...args) => $options.onPickTemplate && $options.onPickTemplate(...args)),
|
||||
p: $options.selectedTemplate
|
||||
}, $options.selectedTemplate ? {
|
||||
q: common_vendor.f($options.selectedTemplate.params || [], (p, idx, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(p.fieldLabel),
|
||||
b: p.unit
|
||||
}, p.unit ? {
|
||||
c: common_vendor.t(p.unit)
|
||||
} : {}, {
|
||||
d: p.required
|
||||
}, p.required ? {} : {}, {
|
||||
e: p.type === "string"
|
||||
}, p.type === "string" ? {
|
||||
f: "请输入" + p.fieldLabel,
|
||||
g: $data.paramValues[p.fieldKey],
|
||||
h: common_vendor.o(common_vendor.m(($event) => $data.paramValues[p.fieldKey] = $event.detail.value, {
|
||||
trim: true
|
||||
}), p.fieldKey)
|
||||
} : p.type === "number" ? {
|
||||
j: "请输入" + p.fieldLabel,
|
||||
k: $data.paramValues[p.fieldKey],
|
||||
l: common_vendor.o(common_vendor.m(($event) => $data.paramValues[p.fieldKey] = $event.detail.value, {
|
||||
number: true
|
||||
}), p.fieldKey)
|
||||
} : p.type === "boolean" ? {
|
||||
n: !!$data.paramValues[p.fieldKey],
|
||||
o: common_vendor.o((e) => $data.paramValues[p.fieldKey] = e.detail.value, p.fieldKey)
|
||||
} : p.type === "enum" ? {
|
||||
q: common_vendor.t($options.displayEnum(p)),
|
||||
r: p.enumOptions || [],
|
||||
s: common_vendor.o(($event) => $options.onPickEnum(p, $event), p.fieldKey)
|
||||
} : p.type === "date" ? {
|
||||
v: common_vendor.t($data.paramValues[p.fieldKey] || "选择" + p.fieldLabel),
|
||||
w: common_vendor.o(($event) => $options.onPickDate(p, $event), p.fieldKey)
|
||||
} : {
|
||||
x: "请输入" + p.fieldLabel,
|
||||
y: $data.paramValues[p.fieldKey],
|
||||
z: common_vendor.o(common_vendor.m(($event) => $data.paramValues[p.fieldKey] = $event.detail.value, {
|
||||
trim: true
|
||||
}), p.fieldKey)
|
||||
}, {
|
||||
i: p.type === "number",
|
||||
m: p.type === "boolean",
|
||||
p: p.type === "enum",
|
||||
t: p.type === "date",
|
||||
A: p.fieldKey
|
||||
});
|
||||
})
|
||||
} : {}, {
|
||||
r: common_vendor.o(($event) => $data.form.images = $event),
|
||||
s: common_vendor.p({
|
||||
max: 9,
|
||||
formData: {
|
||||
ownerType: "submission"
|
||||
},
|
||||
modelValue: $data.form.images
|
||||
}),
|
||||
p: $data.form.remark,
|
||||
q: common_vendor.o(common_vendor.m(($event) => $data.form.remark = $event.detail.value, {
|
||||
t: $data.form.remark,
|
||||
v: common_vendor.o(common_vendor.m(($event) => $data.form.remark = $event.detail.value, {
|
||||
trim: true
|
||||
})),
|
||||
r: $data.form.safeMin,
|
||||
s: common_vendor.o(common_vendor.m(($event) => $data.form.safeMin = $event.detail.value, {
|
||||
w: $data.form.safeMin,
|
||||
x: common_vendor.o(common_vendor.m(($event) => $data.form.safeMin = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
t: $data.form.safeMax,
|
||||
v: common_vendor.o(common_vendor.m(($event) => $data.form.safeMax = $event.detail.value, {
|
||||
y: $data.form.safeMax,
|
||||
z: common_vendor.o(common_vendor.m(($event) => $data.form.safeMax = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
w: $data.submitting,
|
||||
x: common_vendor.o((...args) => $options.submit && $options.submit(...args)),
|
||||
y: $data.checking,
|
||||
z: common_vendor.o((...args) => $options.checkModel && $options.checkModel(...args))
|
||||
};
|
||||
A: $data.submitting,
|
||||
B: common_vendor.o((...args) => $options.submit && $options.submit(...args)),
|
||||
C: $data.checking,
|
||||
D: common_vendor.o((...args) => $options.checkModel && $options.checkModel(...args))
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
|
||||
@@ -1 +1 @@
|
||||
<scroll-view scroll-y class="page"><view class="hero"><text class="title">提交配件</text><text class="desc">填写型号、名称、参数与图片,提交后进入待审核状态</text></view><view class="section"><view class="row required"><text class="label">型号</text><input placeholder="请输入型号(必填)" value="{{a}}" bindinput="{{b}}"/></view><view class="row"><text class="label">品牌</text><input placeholder="品牌/厂商" value="{{c}}" bindinput="{{d}}"/></view><view class="row"><text class="label">条码</text><input placeholder="可选,建议扫码录入" value="{{e}}" bindinput="{{f}}"/><button size="mini" class="picker-btn" bindtap="{{g}}">识码</button></view></view><view class="section"><view class="row"><text class="label">类别</text><picker mode="selector" range="{{i}}" bindchange="{{j}}"><view class="picker">{{h}}</view></picker></view></view><view class="section"><view class="row"><text class="label">模板</text></view><view class="row"><picker mode="selector" range="{{l}}" bindchange="{{m}}"><view class="picker">{{k}}</view></picker></view></view><view class="section"><view class="row"><text class="label">图片</text></view><image-uploader wx:if="{{o}}" u-i="7f3a3bde-0" bind:__l="__l" bindupdateModelValue="{{n}}" u-p="{{o}}"/></view><view class="section"><view class="row"><text class="label">备注</text></view><block wx:if="{{r0}}"><textarea class="textarea" placeholder="选填:补充说明" value="{{p}}" bindinput="{{q}}"/></block></view><view class="section"><view class="row"><text class="label">安全库存</text></view><view class="row triple"><input type="number" placeholder="下限" value="{{r}}" bindinput="{{s}}"/><input type="number" placeholder="上限" value="{{t}}" bindinput="{{v}}"/></view></view><view class="fixed"><button class="primary" loading="{{w}}" bindtap="{{x}}">提交审核</button><button class="primary" style="margin-top:16rpx;background:#7aa9ff" loading="{{y}}" bindtap="{{z}}">查重</button></view></scroll-view>
|
||||
<scroll-view scroll-y class="page"><view class="hero"><text class="title">提交配件</text><text class="desc">填写型号、名称、参数与图片,提交后进入待审核状态</text></view><view class="section"><view class="row required"><text class="label">型号</text><input placeholder="请输入型号(必填)" value="{{a}}" bindinput="{{b}}"/></view><view class="row"><text class="label">品牌</text><input placeholder="品牌/厂商" value="{{c}}" bindinput="{{d}}"/></view><view class="row"><text class="label">条码</text><input placeholder="可选,建议扫码录入" value="{{e}}" bindinput="{{f}}"/><button size="mini" class="picker-btn" bindtap="{{g}}">识码</button></view></view><view class="section"><view class="row"><text class="label">类别</text><picker mode="selector" range="{{i}}" bindchange="{{j}}"><view class="picker">{{h}}</view></picker></view></view><view class="section"><view class="row"><text class="label">编号</text><input placeholder="内部/外部编号(可选)" value="{{k}}" bindinput="{{l}}"/></view></view><view class="section"><view class="row"><text class="label">模板</text></view><view class="row"><picker mode="selector" range="{{n}}" bindchange="{{o}}"><view class="picker">{{m}}</view></picker></view></view><view wx:if="{{p}}" class="section"><view class="row"><text class="label">参数</text></view><view class="param-list"><view wx:for="{{q}}" wx:for-item="p" wx:key="A" class="row"><text class="label">{{p.a}}<text wx:if="{{p.b}}">({{p.c}})</text><text wx:if="{{p.d}}" style="color:#ff5b5b">*</text></text><block wx:if="{{p.e}}"><input placeholder="{{p.f}}" value="{{p.g}}" bindinput="{{p.h}}"/></block><block wx:elif="{{p.i}}"><input type="number" placeholder="{{p.j}}" value="{{p.k}}" bindinput="{{p.l}}"/></block><block wx:elif="{{p.m}}"><switch checked="{{p.n}}" bindchange="{{p.o}}"/></block><block wx:elif="{{p.p}}"><picker mode="selector" range="{{p.r}}" bindchange="{{p.s}}"><view class="picker">{{p.q}}</view></picker></block><block wx:elif="{{p.t}}"><picker mode="date" bindchange="{{p.w}}"><view class="picker">{{p.v}}</view></picker></block><block wx:else><input placeholder="{{p.x}}" value="{{p.y}}" bindinput="{{p.z}}"/></block></view></view></view><view class="section"><view class="row"><text class="label">图片</text></view><image-uploader wx:if="{{s}}" u-i="7f3a3bde-0" bind:__l="__l" bindupdateModelValue="{{r}}" u-p="{{s}}"/></view><view class="section"><view class="row"><text class="label">备注</text></view><block wx:if="{{r0}}"><textarea class="textarea" placeholder="选填:补充说明" value="{{t}}" bindinput="{{v}}"/></block></view><view class="section"><view class="row"><text class="label">安全库存</text></view><view class="row triple"><input type="number" placeholder="下限" value="{{w}}" bindinput="{{x}}"/><input type="number" placeholder="上限" value="{{y}}" bindinput="{{z}}"/></view></view><view class="fixed"><button class="primary" loading="{{A}}" bindtap="{{B}}">提交审核</button><button class="primary" style="margin-top:16rpx;background:#7aa9ff" loading="{{C}}" bindtap="{{D}}">查重</button></view></scroll-view>
|
||||
@@ -24,6 +24,7 @@
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
/* 表单控件尺寸(统一配置,避免页面内硬编码) */
|
||||
.page {
|
||||
padding: 24rpx 24rpx 120rpx;
|
||||
background: #f6f7fb;
|
||||
|
||||
Reference in New Issue
Block a user