9.16/1
This commit is contained in:
47
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.js
vendored
Normal file
47
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.js
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const TYPE_MAP = { cash: "现金", bank: "银行", alipay: "支付宝", wechat: "微信", other: "其他" };
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return { accounts: [] };
|
||||
},
|
||||
async onLoad() {
|
||||
try {
|
||||
const res = await common_http.get("/api/accounts");
|
||||
this.accounts = Array.isArray(res) ? res : (res == null ? void 0 : res.list) || [];
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: "加载失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
select(a) {
|
||||
const opener = getCurrentPages()[getCurrentPages().length - 2];
|
||||
if (opener && opener.$vm) {
|
||||
opener.$vm.selectedAccountId = a.id;
|
||||
opener.$vm.selectedAccountName = a.name;
|
||||
}
|
||||
common_vendor.index.navigateBack();
|
||||
},
|
||||
typeLabel(t) {
|
||||
return TYPE_MAP[t] || t;
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.f($data.accounts, (a, k0, i0) => {
|
||||
var _a;
|
||||
return {
|
||||
a: common_vendor.t(a.name),
|
||||
b: common_vendor.t($options.typeLabel(a.type)),
|
||||
c: common_vendor.t(((_a = a.balance) == null ? void 0 : _a.toFixed) ? a.balance.toFixed(2) : a.balance),
|
||||
d: a.id,
|
||||
e: common_vendor.o(($event) => $options.select(a), a.id)
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/account/select.js.map
|
||||
4
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.json
vendored
Normal file
4
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "选择账户",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.wxml
vendored
Normal file
1
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="page"><scroll-view scroll-y class="list"><view wx:for="{{a}}" wx:for-item="a" wx:key="d" class="item" bindtap="{{a.e}}"><view class="name">{{a.a}}</view><view class="meta">{{a.b}} · 余额:{{a.c}}</view></view></scroll-view></view>
|
||||
11
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.wxss
vendored
Normal file
11
frontend/unpackage/dist/dev/mp-weixin/pages/account/select.wxss
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
.page { display:flex; flex-direction: column; height: 100vh;
|
||||
}
|
||||
.list { flex:1;
|
||||
}
|
||||
.item { padding: 20rpx 24rpx; background:#fff; border-bottom: 1rpx solid #f1f1f1;
|
||||
}
|
||||
.name { color:#333; margin-bottom: 6rpx;
|
||||
}
|
||||
.meta { color:#888; font-size: 24rpx;
|
||||
}
|
||||
48
frontend/unpackage/dist/dev/mp-weixin/pages/customer/select.js
vendored
Normal file
48
frontend/unpackage/dist/dev/mp-weixin/pages/customer/select.js
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return { kw: "", customers: [] };
|
||||
},
|
||||
onLoad() {
|
||||
this.search();
|
||||
},
|
||||
methods: {
|
||||
async search() {
|
||||
try {
|
||||
const res = await common_http.get("/api/customers", { kw: this.kw, page: 1, size: 50 });
|
||||
this.customers = Array.isArray(res == null ? void 0 : res.list) ? res.list : Array.isArray(res) ? res : [];
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: "加载失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
select(c) {
|
||||
const opener = getCurrentPages()[getCurrentPages().length - 2];
|
||||
if (opener && opener.$vm) {
|
||||
opener.$vm.order.customerId = c.id;
|
||||
opener.$vm.customerName = c.name;
|
||||
}
|
||||
common_vendor.index.navigateBack();
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.o((...args) => $options.search && $options.search(...args)),
|
||||
b: $data.kw,
|
||||
c: common_vendor.o(($event) => $data.kw = $event.detail.value),
|
||||
d: common_vendor.o((...args) => $options.search && $options.search(...args)),
|
||||
e: common_vendor.f($data.customers, (c, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(c.name),
|
||||
b: common_vendor.t(c.mobile || "—"),
|
||||
c: c.id,
|
||||
d: common_vendor.o(($event) => $options.select(c), c.id)
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/customer/select.js.map
|
||||
4
frontend/unpackage/dist/dev/mp-weixin/pages/customer/select.json
vendored
Normal file
4
frontend/unpackage/dist/dev/mp-weixin/pages/customer/select.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "选择客户",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
frontend/unpackage/dist/dev/mp-weixin/pages/customer/select.wxml
vendored
Normal file
1
frontend/unpackage/dist/dev/mp-weixin/pages/customer/select.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="page"><view class="search"><input placeholder="搜索客户名称/电话" bindconfirm="{{a}}" value="{{b}}" bindinput="{{c}}"/><button size="mini" bindtap="{{d}}">搜索</button></view><scroll-view scroll-y class="list"><view wx:for="{{e}}" wx:for-item="c" wx:key="c" class="item" bindtap="{{c.d}}"><view class="name">{{c.a}}</view><view class="meta">{{c.b}}</view></view></scroll-view></view>
|
||||
15
frontend/unpackage/dist/dev/mp-weixin/pages/customer/select.wxss
vendored
Normal file
15
frontend/unpackage/dist/dev/mp-weixin/pages/customer/select.wxss
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
.page { display:flex; flex-direction: column; height: 100vh;
|
||||
}
|
||||
.search { display:flex; gap: 12rpx; padding: 16rpx; background:#fff;
|
||||
}
|
||||
.search input { flex:1; background:#f6f6f6; border-radius: 12rpx; padding: 12rpx;
|
||||
}
|
||||
.list { flex:1;
|
||||
}
|
||||
.item { padding: 20rpx 24rpx; background:#fff; border-bottom: 1rpx solid #f1f1f1;
|
||||
}
|
||||
.name { color:#333; margin-bottom: 6rpx;
|
||||
}
|
||||
.meta { color:#888; font-size: 24rpx;
|
||||
}
|
||||
135
frontend/unpackage/dist/dev/mp-weixin/pages/detail/index.js
vendored
Normal file
135
frontend/unpackage/dist/dev/mp-weixin/pages/detail/index.js
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
function toDateString(d) {
|
||||
const m = (d.getMonth() + 1).toString().padStart(2, "0");
|
||||
const day = d.getDate().toString().padStart(2, "0");
|
||||
return `${d.getFullYear()}-${m}-${day}`;
|
||||
}
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
const today = /* @__PURE__ */ new Date();
|
||||
const first = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
return {
|
||||
range: "month",
|
||||
biz: "sale",
|
||||
sub: "out",
|
||||
kw: "",
|
||||
begin: toDateString(first),
|
||||
end: toDateString(today),
|
||||
list: [],
|
||||
loading: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
totalAmount() {
|
||||
return this.list.reduce((s, o) => s + Number(o.amount || 0), 0);
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.reload();
|
||||
},
|
||||
methods: {
|
||||
setRange(r) {
|
||||
this.range = r;
|
||||
const now = /* @__PURE__ */ new Date();
|
||||
if (r === "today") {
|
||||
this.begin = this.end = toDateString(now);
|
||||
} else if (r === "week") {
|
||||
const day = now.getDay() || 7;
|
||||
const start = new Date(now);
|
||||
start.setDate(now.getDate() - day + 1);
|
||||
this.begin = toDateString(start);
|
||||
this.end = toDateString(now);
|
||||
} else if (r === "month") {
|
||||
const first = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
this.begin = toDateString(first);
|
||||
this.end = toDateString(now);
|
||||
} else if (r === "year") {
|
||||
const first = new Date(now.getFullYear(), 0, 1);
|
||||
this.begin = toDateString(first);
|
||||
this.end = toDateString(now);
|
||||
}
|
||||
this.reload();
|
||||
},
|
||||
async reload() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const res = await common_http.get("/api/sales/orders", { begin: this.begin, end: this.end, kw: this.kw, sub: this.sub });
|
||||
this.list = Array.isArray(res == null ? void 0 : res.list) ? res.list : Array.isArray(res) ? res : [];
|
||||
} catch (e) {
|
||||
this.list = [];
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
goCreate() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/order/create" });
|
||||
},
|
||||
open(o) {
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.range === "custom" ? 1 : "",
|
||||
b: common_vendor.o(($event) => $options.setRange("custom")),
|
||||
c: $data.range === "week" ? 1 : "",
|
||||
d: common_vendor.o(($event) => $options.setRange("week")),
|
||||
e: $data.range === "today" ? 1 : "",
|
||||
f: common_vendor.o(($event) => $options.setRange("today")),
|
||||
g: $data.range === "month" ? 1 : "",
|
||||
h: common_vendor.o(($event) => $options.setRange("month")),
|
||||
i: $data.range === "year" ? 1 : "",
|
||||
j: common_vendor.o(($event) => $options.setRange("year")),
|
||||
k: $data.biz === "sale" ? 1 : "",
|
||||
l: common_vendor.o(($event) => $data.biz = "sale"),
|
||||
m: $data.biz === "purchase" ? 1 : "",
|
||||
n: common_vendor.o(($event) => $data.biz = "purchase"),
|
||||
o: $data.biz === "collection" ? 1 : "",
|
||||
p: common_vendor.o(($event) => $data.biz = "collection"),
|
||||
q: $data.biz === "capital" ? 1 : "",
|
||||
r: common_vendor.o(($event) => $data.biz = "capital"),
|
||||
s: $data.biz === "inventory" ? 1 : "",
|
||||
t: common_vendor.o(($event) => $data.biz = "inventory"),
|
||||
v: $data.sub === "out" ? 1 : "",
|
||||
w: common_vendor.o(($event) => $data.sub = "out"),
|
||||
x: $data.sub === "return" ? 1 : "",
|
||||
y: common_vendor.o(($event) => $data.sub = "return"),
|
||||
z: $data.sub === "receive" ? 1 : "",
|
||||
A: common_vendor.o(($event) => $data.sub = "receive"),
|
||||
B: common_vendor.o((...args) => $options.goCreate && $options.goCreate(...args)),
|
||||
C: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
|
||||
D: $data.kw,
|
||||
E: common_vendor.o(($event) => $data.kw = $event.detail.value),
|
||||
F: $data.range === "custom"
|
||||
}, $data.range === "custom" ? {
|
||||
G: common_vendor.t($data.begin),
|
||||
H: $data.begin,
|
||||
I: common_vendor.o((e) => {
|
||||
$data.begin = e.detail.value;
|
||||
$options.reload();
|
||||
}),
|
||||
J: common_vendor.t($data.end),
|
||||
K: $data.end,
|
||||
L: common_vendor.o((e) => {
|
||||
$data.end = e.detail.value;
|
||||
$options.reload();
|
||||
})
|
||||
} : {}, {
|
||||
M: common_vendor.t($options.totalAmount.toFixed(2)),
|
||||
N: common_vendor.f($data.list, (o, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(o.orderDate),
|
||||
b: common_vendor.t(o.customerName),
|
||||
c: common_vendor.t(o.orderNo),
|
||||
d: common_vendor.t(Number(o.amount).toFixed(2)),
|
||||
e: o.id,
|
||||
f: common_vendor.o(($event) => $options.open(o), o.id)
|
||||
};
|
||||
})
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/detail/index.js.map
|
||||
4
frontend/unpackage/dist/dev/mp-weixin/pages/detail/index.json
vendored
Normal file
4
frontend/unpackage/dist/dev/mp-weixin/pages/detail/index.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "明细",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
frontend/unpackage/dist/dev/mp-weixin/pages/detail/index.wxml
vendored
Normal file
1
frontend/unpackage/dist/dev/mp-weixin/pages/detail/index.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="detail"><view class="filter-tabs"><view class="{{['tab', a && 'active']}}" bindtap="{{b}}">自定义</view><view class="{{['tab', c && 'active']}}" bindtap="{{d}}">本周</view><view class="{{['tab', e && 'active']}}" bindtap="{{f}}">今日</view><view class="{{['tab', g && 'active']}}" bindtap="{{h}}">本月</view><view class="{{['tab', i && 'active']}}" bindtap="{{j}}">本年</view></view><view class="biz-tabs"><view class="{{['biz', k && 'active']}}" bindtap="{{l}}">销售</view><view class="{{['biz', m && 'active']}}" bindtap="{{n}}">进货</view><view class="{{['biz', o && 'active']}}" bindtap="{{p}}">收款</view><view class="{{['biz', q && 'active']}}" bindtap="{{r}}">资金</view><view class="{{['biz', s && 'active']}}" bindtap="{{t}}">盘点</view></view><view class="card"><view class="subtabs"><view class="{{['sub', v && 'active']}}" bindtap="{{w}}">出货</view><view class="{{['sub', x && 'active']}}" bindtap="{{y}}">退货</view><view class="{{['sub', z && 'active']}}" bindtap="{{A}}">收款</view><view class="plus" bindtap="{{B}}">+</view></view><view class="search"><input placeholder="单据号/客户/名称/规格/备注" bindconfirm="{{C}}" value="{{D}}" bindinput="{{E}}"/></view><view wx:if="{{F}}" class="daterange"><picker mode="date" value="{{H}}" bindchange="{{I}}"><text>{{G}}</text></picker><text class="sep">—</text><picker mode="date" value="{{K}}" bindchange="{{L}}"><text>{{J}}</text></picker></view><view class="total">合计:¥ {{M}}</view><scroll-view scroll-y class="list"><view wx:for="{{N}}" wx:for-item="o" wx:key="e" class="row" bindtap="{{o.f}}"><view class="left"><view class="date">{{o.a}}</view><view class="name">{{o.b}}</view><view class="no">{{o.c}}</view></view><view class="right">¥ {{o.d}}</view></view></scroll-view></view></view>
|
||||
43
frontend/unpackage/dist/dev/mp-weixin/pages/detail/index.wxss
vendored
Normal file
43
frontend/unpackage/dist/dev/mp-weixin/pages/detail/index.wxss
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
.detail { display:flex;
|
||||
}
|
||||
.filter-tabs { display:flex; gap: 24rpx; padding: 18rpx 24rpx; color:#666;
|
||||
}
|
||||
.filter-tabs .tab.active { color:#2aa7b6; font-weight: 700;
|
||||
}
|
||||
.biz-tabs { position: fixed; left:0; top: 160rpx; bottom: 120rpx; width: 120rpx; display:flex; flex-direction: column; gap: 24rpx; padding: 12rpx;
|
||||
}
|
||||
.biz { background:#6aa9ff; color:#fff; border-radius: 16rpx; padding: 20rpx 0; text-align:center; opacity: .85;
|
||||
}
|
||||
.biz.active { opacity: 1;
|
||||
}
|
||||
.card { margin-left: 140rpx; background:#fff; border-radius: 24rpx; padding: 16rpx;
|
||||
}
|
||||
.subtabs { display:flex; align-items:center; gap: 24rpx; padding: 8rpx 6rpx 12rpx;
|
||||
}
|
||||
.sub { color:#57c2cf; padding: 8rpx 12rpx;
|
||||
}
|
||||
.sub.active { border-bottom: 4rpx solid #57c2cf; font-weight:700;
|
||||
}
|
||||
.plus { margin-left:auto; width: 60rpx; height: 60rpx; border-radius: 30rpx; background:#2ec0d0; color:#fff; font-size: 40rpx; display:flex; align-items:center; justify-content:center;
|
||||
}
|
||||
.search { background:#f6f7fb; border-radius: 999rpx; padding: 14rpx 20rpx; margin: 8rpx 0 12rpx;
|
||||
}
|
||||
.daterange { display:flex; align-items:center; gap: 12rpx; color:#888; padding-bottom: 8rpx;
|
||||
}
|
||||
.daterange .sep { color:#ccc;
|
||||
}
|
||||
.total { color:#2ec0d0; font-weight: 800; padding: 12rpx 0; border-top: 2rpx solid #eaeaea;
|
||||
}
|
||||
.list { height: calc(100vh - 420rpx);
|
||||
}
|
||||
.row { display:flex; justify-content: space-between; align-items:center; padding: 22rpx 10rpx; border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
.left .date { color:#999; margin-bottom: 6rpx;
|
||||
}
|
||||
.left .name { color:#333; margin-bottom: 6rpx;
|
||||
}
|
||||
.left .no { color:#bbb;
|
||||
}
|
||||
.right { color:#555;
|
||||
}
|
||||
@@ -5,9 +5,7 @@ const common_assets = require("../../common/assets.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
todayAmount: "0.00",
|
||||
monthProfit: "0.00",
|
||||
stockQty: "0.00",
|
||||
kpi: { todaySales: "0.00", monthSales: "0.00", monthProfit: "0.00", stockCount: "0" },
|
||||
activeTab: "home",
|
||||
notices: [],
|
||||
loadingNotices: false,
|
||||
@@ -26,9 +24,22 @@ const _sfc_main = {
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.fetchMetrics();
|
||||
this.fetchNotices();
|
||||
},
|
||||
methods: {
|
||||
async fetchMetrics() {
|
||||
try {
|
||||
const d = await common_http.get("/api/metrics/overview");
|
||||
this.kpi = {
|
||||
todaySales: d && d.todaySales || "0.00",
|
||||
monthSales: d && d.monthSales || "0.00",
|
||||
monthProfit: d && d.monthProfit || "0.00",
|
||||
stockCount: d && d.stockCount || "0"
|
||||
};
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
async fetchNotices() {
|
||||
this.loadingNotices = true;
|
||||
this.noticeError = "";
|
||||
@@ -48,18 +59,15 @@ const _sfc_main = {
|
||||
common_vendor.index.showToast({ title: item.title + "(开发中)", icon: "none" });
|
||||
},
|
||||
onCreateOrder() {
|
||||
common_vendor.index.showToast({ title: "开单(开发中)", icon: "none" });
|
||||
common_vendor.index.navigateTo({ url: "/pages/order/create" });
|
||||
},
|
||||
onNoticeTap(n) {
|
||||
common_vendor.index.showModal({
|
||||
title: "公告",
|
||||
title: "广告",
|
||||
content: n && (n.text || n.title || n.content) || "",
|
||||
showCancel: false
|
||||
});
|
||||
},
|
||||
onNoticeList() {
|
||||
common_vendor.index.showToast({ title: "公告列表(开发中)", icon: "none" });
|
||||
},
|
||||
onIconError(item) {
|
||||
item.img = "";
|
||||
}
|
||||
@@ -68,14 +76,15 @@ const _sfc_main = {
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_assets._imports_0,
|
||||
b: common_vendor.t($data.todayAmount),
|
||||
c: common_vendor.t($data.monthProfit),
|
||||
d: common_vendor.t($data.stockQty),
|
||||
e: $data.loadingNotices
|
||||
b: common_vendor.t($data.kpi.todaySales),
|
||||
c: common_vendor.t($data.kpi.monthSales),
|
||||
d: common_vendor.t($data.kpi.monthProfit),
|
||||
e: common_vendor.t($data.kpi.stockCount),
|
||||
f: $data.loadingNotices
|
||||
}, $data.loadingNotices ? {} : $data.noticeError ? {
|
||||
g: common_vendor.t($data.noticeError)
|
||||
h: common_vendor.t($data.noticeError)
|
||||
} : !$data.notices.length ? {} : {
|
||||
i: common_vendor.f($data.notices, (n, idx, i0) => {
|
||||
j: common_vendor.f($data.notices, (n, idx, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(n.text),
|
||||
b: n.tag
|
||||
@@ -87,9 +96,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
});
|
||||
})
|
||||
}, {
|
||||
f: $data.noticeError,
|
||||
h: !$data.notices.length,
|
||||
j: common_vendor.o((...args) => $options.onNoticeList && $options.onNoticeList(...args)),
|
||||
g: $data.noticeError,
|
||||
i: !$data.notices.length,
|
||||
k: common_vendor.f($data.features, (item, k0, i0) => {
|
||||
return common_vendor.e({
|
||||
a: item.img
|
||||
@@ -107,11 +115,15 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
}),
|
||||
l: $data.activeTab === "home" ? 1 : "",
|
||||
m: common_vendor.o(($event) => $data.activeTab = "home"),
|
||||
n: common_vendor.o((...args) => $options.onCreateOrder && $options.onCreateOrder(...args)),
|
||||
o: $data.activeTab === "detail" ? 1 : "",
|
||||
p: common_vendor.o(($event) => $data.activeTab = "detail"),
|
||||
q: $data.activeTab === "me" ? 1 : "",
|
||||
r: common_vendor.o(($event) => $data.activeTab = "me")
|
||||
n: $data.activeTab === "product" ? 1 : "",
|
||||
o: common_vendor.o(($event) => $data.activeTab = "product"),
|
||||
p: common_vendor.o((...args) => $options.onCreateOrder && $options.onCreateOrder(...args)),
|
||||
q: $data.activeTab === "detail" ? 1 : "",
|
||||
r: common_vendor.o(($event) => $data.activeTab = "detail"),
|
||||
s: $data.activeTab === "report" ? 1 : "",
|
||||
t: common_vendor.o(($event) => $data.activeTab = "report"),
|
||||
v: $data.activeTab === "me" ? 1 : "",
|
||||
w: common_vendor.o(($event) => $data.activeTab = "me")
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view class="home"><image class="home-bg" src="{{a}}" mode="aspectFill"></image><view class="hero"><view class="hero-top"><text class="brand">五金配件管家</text><view class="cta"><text class="cta-text">咨询</text></view></view><view class="kpi"><view class="kpi-item"><text class="kpi-label">今日销售额</text><text class="kpi-value">{{b}}</text></view><view class="kpi-item"><text class="kpi-label">本月利润</text><text class="kpi-value">{{c}}</text></view><view class="kpi-item"><text class="kpi-label">库存数量</text><text class="kpi-value">{{d}}</text></view></view></view><view class="notice"><view class="notice-left">公告</view><view wx:if="{{e}}" class="notice-swiper" style="display:flex;align-items:center;color:#6b5a2a">加载中...</view><view wx:elif="{{f}}" class="notice-swiper" style="display:flex;align-items:center;color:#dd524d">{{g}}</view><view wx:elif="{{h}}" class="notice-swiper" style="display:flex;align-items:center;color:#6b5a2a">暂无公告</view><swiper wx:else class="notice-swiper" circular autoplay interval="4000" duration="400" vertical><swiper-item wx:for="{{i}}" wx:for-item="n" wx:key="e"><view class="notice-item" bindtap="{{n.d}}"><text class="notice-text">{{n.a}}</text><text wx:if="{{n.b}}" class="notice-tag">{{n.c}}</text></view></swiper-item></swiper><view class="notice-right" bindtap="{{j}}">更多</view></view><view class="section-title"><text class="section-text">常用功能</text></view><view class="grid-wrap"><view class="grid"><view wx:for="{{k}}" wx:for-item="item" wx:key="g" class="grid-item" bindtap="{{item.h}}"><view class="icon icon-squircle"><image wx:if="{{item.a}}" src="{{item.b}}" class="icon-img" mode="aspectFit" binderror="{{item.c}}"></image><text wx:elif="{{item.d}}" class="icon-emoji">{{item.e}}</text><view wx:else class="icon-placeholder"></view></view><text class="grid-chip">{{item.f}}</text></view></view></view><view class="bottom-bar"><view class="{{['tab', l && 'active']}}" bindtap="{{m}}"><text>首页</text></view><view class="tab primary" bindtap="{{n}}"><text>开单</text></view><view class="{{['tab', o && 'active']}}" bindtap="{{p}}"><text>明细</text></view><view class="{{['tab', q && 'active']}}" bindtap="{{r}}"><text>我的</text></view></view></view>
|
||||
<view class="home"><image class="home-bg" src="{{a}}" mode="aspectFill"></image><view class="hero"><view class="hero-top"><text class="brand">五金配件管家</text><view class="cta"><text class="cta-text">咨询</text></view></view><view class="kpi"><view class="kpi-item"><text class="kpi-label">今日销售额</text><text class="kpi-value">{{b}}</text></view><view class="kpi-item"><text class="kpi-label">本月销售额</text><text class="kpi-value">{{c}}</text></view><view class="kpi-item"><text class="kpi-label">本月利润</text><text class="kpi-value">{{d}}</text></view><view class="kpi-item"><text class="kpi-label">库存商品数量</text><text class="kpi-value">{{e}}</text></view></view></view><view class="notice"><view class="notice-left">广告</view><view wx:if="{{f}}" class="notice-swiper" style="display:flex;align-items:center;color:#6b5a2a">加载中...</view><view wx:elif="{{g}}" class="notice-swiper" style="display:flex;align-items:center;color:#dd524d">{{h}}</view><view wx:elif="{{i}}" class="notice-swiper" style="display:flex;align-items:center;color:#6b5a2a">暂无公告</view><swiper wx:else class="notice-swiper" circular autoplay interval="4000" duration="400" vertical><swiper-item wx:for="{{j}}" wx:for-item="n" wx:key="e"><view class="notice-item" bindtap="{{n.d}}"><text class="notice-text">{{n.a}}</text><text wx:if="{{n.b}}" class="notice-tag">{{n.c}}</text></view></swiper-item></swiper></view><view class="section-title"><text class="section-text">常用功能</text></view><view class="grid-wrap"><view class="grid"><view wx:for="{{k}}" wx:for-item="item" wx:key="g" class="grid-item" bindtap="{{item.h}}"><view class="icon icon-squircle"><image wx:if="{{item.a}}" src="{{item.b}}" class="icon-img" mode="aspectFit" binderror="{{item.c}}"></image><text wx:elif="{{item.d}}" class="icon-emoji">{{item.e}}</text><view wx:else class="icon-placeholder"></view></view><text class="grid-chip">{{item.f}}</text></view></view></view><view class="bottom-bar"><view class="{{['tab', l && 'active']}}" bindtap="{{m}}"><text>首页</text></view><view class="{{['tab', n && 'active']}}" bindtap="{{o}}"><text>货品</text></view><view class="tab primary" bindtap="{{p}}"><text>开单</text></view><view class="{{['tab', q && 'active']}}" bindtap="{{r}}"><text>明细</text></view><view class="{{['tab', s && 'active']}}" bindtap="{{t}}"><text>报表</text></view><view class="{{['tab', v && 'active']}}" bindtap="{{w}}"><text>我的</text></view></view></view>
|
||||
@@ -48,8 +48,7 @@
|
||||
}
|
||||
.notice-tag { color: #B4880F; font-size: 22rpx; padding: 4rpx 10rpx; border-radius: 999rpx; background: rgba(215,167,46,0.18);
|
||||
}
|
||||
.notice-right { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 72rpx; height: 44rpx; color: #B4880F; font-size: 26rpx; padding-left: 8rpx;
|
||||
}
|
||||
|
||||
|
||||
/* 分割标题 */
|
||||
.section-title { display: flex; align-items: center; gap: 16rpx; padding: 10rpx 28rpx 0;
|
||||
|
||||
212
frontend/unpackage/dist/dev/mp-weixin/pages/order/create.js
vendored
Normal file
212
frontend/unpackage/dist/dev/mp-weixin/pages/order/create.js
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const common_constants = require("../../common/constants.js");
|
||||
const common_assets = require("../../common/assets.js");
|
||||
function todayString() {
|
||||
const d = /* @__PURE__ */ new Date();
|
||||
const m = (d.getMonth() + 1).toString().padStart(2, "0");
|
||||
const day = d.getDate().toString().padStart(2, "0");
|
||||
return `${d.getFullYear()}-${m}-${day}`;
|
||||
}
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
biz: "sale",
|
||||
saleType: "out",
|
||||
purchaseType: "in",
|
||||
order: {
|
||||
orderTime: todayString(),
|
||||
customerId: null,
|
||||
supplierId: null,
|
||||
remark: ""
|
||||
},
|
||||
customerName: "",
|
||||
supplierName: "",
|
||||
items: [],
|
||||
activeCategory: "sale_income",
|
||||
trxAmount: 0,
|
||||
selectedAccountId: null,
|
||||
selectedAccountName: ""
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
totalQuantity() {
|
||||
return this.items.reduce((s, it) => s + Number(it.quantity || 0), 0);
|
||||
},
|
||||
totalAmount() {
|
||||
return this.items.reduce((s, it) => s + Number(it.quantity || 0) * Number(it.unitPrice || 0), 0);
|
||||
},
|
||||
customerLabel() {
|
||||
return this.customerName || "零售客户";
|
||||
},
|
||||
supplierLabel() {
|
||||
return this.supplierName || "零散供应商";
|
||||
},
|
||||
incomeCategories() {
|
||||
return common_constants.INCOME_CATEGORIES;
|
||||
},
|
||||
expenseCategories() {
|
||||
return common_constants.EXPENSE_CATEGORIES;
|
||||
},
|
||||
accountLabel() {
|
||||
return this.selectedAccountName || "现金";
|
||||
},
|
||||
counterpartyLabel() {
|
||||
return this.customerName || this.supplierName || "—";
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
switchBiz(type) {
|
||||
this.biz = type;
|
||||
},
|
||||
onDateChange(e) {
|
||||
this.order.orderTime = e.detail.value;
|
||||
},
|
||||
chooseCustomer() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/customer/select" });
|
||||
},
|
||||
chooseSupplier() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/supplier/select" });
|
||||
},
|
||||
chooseProduct() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/product/select" });
|
||||
},
|
||||
chooseAccount() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/account/select" });
|
||||
},
|
||||
chooseCounterparty() {
|
||||
if (this.biz === "income" || this.biz === "expense") {
|
||||
common_vendor.index.navigateTo({ url: "/pages/customer/select" });
|
||||
}
|
||||
},
|
||||
recalc() {
|
||||
this.$forceUpdate();
|
||||
},
|
||||
async submit() {
|
||||
const isSaleOrPurchase = this.biz === "sale" || this.biz === "purchase";
|
||||
const payload = isSaleOrPurchase ? {
|
||||
type: this.biz === "sale" ? this.saleType : "purchase." + this.purchaseType,
|
||||
orderTime: this.order.orderTime,
|
||||
customerId: this.order.customerId,
|
||||
supplierId: this.order.supplierId,
|
||||
items: this.items.map((it) => ({ productId: it.productId, quantity: Number(it.quantity || 0), unitPrice: Number(it.unitPrice || 0) })),
|
||||
amount: this.totalAmount
|
||||
} : {
|
||||
type: this.biz,
|
||||
category: this.activeCategory,
|
||||
counterpartyId: this.order.customerId || null,
|
||||
accountId: this.selectedAccountId || null,
|
||||
amount: Number(this.trxAmount || 0),
|
||||
txTime: this.order.orderTime,
|
||||
remark: this.order.remark
|
||||
};
|
||||
try {
|
||||
const url = isSaleOrPurchase ? "/api/orders" : "/api/other-transactions";
|
||||
await common_http.post(url, payload);
|
||||
common_vendor.index.showToast({ title: "已保存", icon: "success" });
|
||||
setTimeout(() => {
|
||||
common_vendor.index.navigateBack();
|
||||
}, 600);
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: e && e.message || "保存失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
saveAndReset() {
|
||||
this.items = [];
|
||||
this.trxAmount = 0;
|
||||
this.order.remark = "";
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.biz === "sale" ? 1 : "",
|
||||
b: common_vendor.o(($event) => $options.switchBiz("sale")),
|
||||
c: $data.biz === "purchase" ? 1 : "",
|
||||
d: common_vendor.o(($event) => $options.switchBiz("purchase")),
|
||||
e: $data.biz === "income" ? 1 : "",
|
||||
f: common_vendor.o(($event) => $options.switchBiz("income")),
|
||||
g: $data.biz === "expense" ? 1 : "",
|
||||
h: common_vendor.o(($event) => $options.switchBiz("expense")),
|
||||
i: $data.biz === "sale"
|
||||
}, $data.biz === "sale" ? {
|
||||
j: $data.saleType === "out" ? 1 : "",
|
||||
k: common_vendor.o(($event) => $data.saleType = "out"),
|
||||
l: $data.saleType === "return" ? 1 : "",
|
||||
m: common_vendor.o(($event) => $data.saleType = "return"),
|
||||
n: $data.saleType === "collect" ? 1 : "",
|
||||
o: common_vendor.o(($event) => $data.saleType = "collect")
|
||||
} : $data.biz === "purchase" ? {
|
||||
q: $data.purchaseType === "in" ? 1 : "",
|
||||
r: common_vendor.o(($event) => $data.purchaseType = "in"),
|
||||
s: $data.purchaseType === "return" ? 1 : "",
|
||||
t: common_vendor.o(($event) => $data.purchaseType = "return"),
|
||||
v: $data.purchaseType === "pay" ? 1 : "",
|
||||
w: common_vendor.o(($event) => $data.purchaseType = "pay")
|
||||
} : {}, {
|
||||
p: $data.biz === "purchase",
|
||||
x: common_vendor.t($data.order.orderTime),
|
||||
y: $data.order.orderTime,
|
||||
z: common_vendor.o((...args) => $options.onDateChange && $options.onDateChange(...args)),
|
||||
A: $data.biz === "sale"
|
||||
}, $data.biz === "sale" ? {
|
||||
B: common_vendor.t($options.customerLabel),
|
||||
C: common_vendor.o((...args) => $options.chooseCustomer && $options.chooseCustomer(...args))
|
||||
} : $data.biz === "purchase" ? {
|
||||
E: common_vendor.t($options.supplierLabel),
|
||||
F: common_vendor.o((...args) => $options.chooseSupplier && $options.chooseSupplier(...args))
|
||||
} : {}, {
|
||||
D: $data.biz === "purchase",
|
||||
G: $data.biz === "sale" || $data.biz === "purchase"
|
||||
}, $data.biz === "sale" || $data.biz === "purchase" ? {
|
||||
H: common_vendor.t($options.totalQuantity),
|
||||
I: common_vendor.t($options.totalAmount.toFixed(2)),
|
||||
J: common_vendor.o((...args) => $options.chooseProduct && $options.chooseProduct(...args))
|
||||
} : {
|
||||
K: common_vendor.f($data.biz === "income" ? $options.incomeCategories : $options.expenseCategories, (c, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(c.label),
|
||||
b: c.key,
|
||||
c: $data.activeCategory === c.key ? 1 : "",
|
||||
d: common_vendor.o(($event) => $data.activeCategory = c.key, c.key)
|
||||
};
|
||||
}),
|
||||
L: common_vendor.t($options.counterpartyLabel),
|
||||
M: common_vendor.o((...args) => $options.chooseCounterparty && $options.chooseCounterparty(...args)),
|
||||
N: common_vendor.t($options.accountLabel),
|
||||
O: common_vendor.o((...args) => $options.chooseAccount && $options.chooseAccount(...args)),
|
||||
P: $data.trxAmount,
|
||||
Q: common_vendor.o(common_vendor.m(($event) => $data.trxAmount = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
R: $data.order.remark,
|
||||
S: common_vendor.o(($event) => $data.order.remark = $event.detail.value)
|
||||
}, {
|
||||
T: !$data.items.length
|
||||
}, !$data.items.length ? {
|
||||
U: common_assets._imports_0$1
|
||||
} : {
|
||||
V: common_vendor.f($data.items, (it, idx, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(it.productName),
|
||||
b: common_vendor.o([common_vendor.m(($event) => it.quantity = $event.detail.value, {
|
||||
number: true
|
||||
}), ($event) => $options.recalc()], idx),
|
||||
c: it.quantity,
|
||||
d: common_vendor.o([common_vendor.m(($event) => it.unitPrice = $event.detail.value, {
|
||||
number: true
|
||||
}), ($event) => $options.recalc()], idx),
|
||||
e: it.unitPrice,
|
||||
f: common_vendor.t((Number(it.quantity) * Number(it.unitPrice)).toFixed(2)),
|
||||
g: idx
|
||||
};
|
||||
})
|
||||
}, {
|
||||
W: common_vendor.o((...args) => $options.saveAndReset && $options.saveAndReset(...args)),
|
||||
X: common_vendor.o((...args) => $options.submit && $options.submit(...args))
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/order/create.js.map
|
||||
4
frontend/unpackage/dist/dev/mp-weixin/pages/order/create.json
vendored
Normal file
4
frontend/unpackage/dist/dev/mp-weixin/pages/order/create.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "开单",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
frontend/unpackage/dist/dev/mp-weixin/pages/order/create.wxml
vendored
Normal file
1
frontend/unpackage/dist/dev/mp-weixin/pages/order/create.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="order"><view class="tabs"><text class="{{[a && 'active']}}" bindtap="{{b}}">销售</text><text class="{{[c && 'active']}}" bindtap="{{d}}">进货</text><text class="{{[e && 'active']}}" bindtap="{{f}}">其他收入</text><text class="{{[g && 'active']}}" bindtap="{{h}}">其他支出</text></view><view wx:if="{{i}}" class="subtabs"><button class="{{['subbtn', j && 'active']}}" bindtap="{{k}}">出货</button><button class="{{['subbtn', l && 'active']}}" bindtap="{{m}}">退货</button><button class="{{['subbtn', n && 'active']}}" bindtap="{{o}}">收款</button></view><view wx:elif="{{p}}" class="subtabs"><button class="{{['subbtn', q && 'active']}}" bindtap="{{r}}">进货</button><button class="{{['subbtn', s && 'active']}}" bindtap="{{t}}">退货</button><button class="{{['subbtn', v && 'active']}}" bindtap="{{w}}">付款</button></view><picker mode="date" value="{{y}}" bindchange="{{z}}"><view class="field"><text class="label">时间</text><text class="value">{{x}}</text></view></picker><view wx:if="{{A}}" class="field" bindtap="{{C}}"><text class="label">客户</text><text class="value">{{B}}</text></view><view wx:elif="{{D}}" class="field" bindtap="{{F}}"><text class="label">供应商</text><text class="value">{{E}}</text></view><view wx:if="{{G}}"><view class="summary"><text>选中货品({{H}})</text><text>合计金额:¥ {{I}}</text></view><view class="add" bindtap="{{J}}">+</view></view><view wx:else><view class="chips"><view wx:for="{{K}}" wx:for-item="c" wx:key="b" class="{{['chip', c.c && 'active']}}" bindtap="{{c.d}}">{{c.a}}</view></view><view class="field" bindtap="{{M}}"><text class="label">往来单位</text><text class="value">{{L}}</text></view><view class="field" bindtap="{{O}}"><text class="label">结算账户</text><text class="value">{{N}}</text></view><view class="field"><text class="label">金额</text><input class="value" type="digit" placeholder="0.00" value="{{P}}" bindinput="{{Q}}"/></view><view class="textarea"><block wx:if="{{r0}}"><textarea maxlength="200" placeholder="备注(最多输入200个字)" value="{{R}}" bindinput="{{S}}"></textarea></block></view></view><view wx:if="{{T}}" class="empty"><image src="{{U}}" mode="widthFix" class="empty-img"></image><text class="empty-text">购物车里空空如也</text><text class="empty-sub">扫描或点击 “+” 选择商品吧</text></view><view wx:else class="list"><view wx:for="{{V}}" wx:for-item="it" wx:key="g" class="row"><view class="col name">{{it.a}}</view><view class="col qty"><input type="number" bindinput="{{it.b}}" value="{{it.c}}"/></view><view class="col price"><input type="number" bindinput="{{it.d}}" value="{{it.e}}"/></view><view class="col amount">¥ {{it.f}}</view></view></view><view class="bottom"><button class="ghost" bindtap="{{W}}">再记一笔</button><button class="primary" bindtap="{{X}}">保存</button></view></view>
|
||||
43
frontend/unpackage/dist/dev/mp-weixin/pages/order/create.wxss
vendored
Normal file
43
frontend/unpackage/dist/dev/mp-weixin/pages/order/create.wxss
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
.order { padding-bottom: 140rpx;
|
||||
}
|
||||
.tabs { display: flex; justify-content: space-around; padding: 16rpx 24rpx;
|
||||
}
|
||||
.tabs text { color: #666;
|
||||
}
|
||||
.tabs text.active { color: #333; font-weight: 700;
|
||||
}
|
||||
.subtabs { display: flex; gap: 16rpx; padding: 0 24rpx 16rpx;
|
||||
}
|
||||
.subbtn { padding: 10rpx 20rpx; border-radius: 999rpx; background: #f4f4f4; color: #666;
|
||||
}
|
||||
.subbtn.active { background: #ffe69a; color: #3f320f;
|
||||
}
|
||||
.field { display:flex; justify-content: space-between; padding: 22rpx 24rpx; background: #fff; border-bottom: 1rpx solid #eee;
|
||||
}
|
||||
.label { color:#666;
|
||||
}
|
||||
.value { color:#333;
|
||||
}
|
||||
.summary { display:flex; justify-content: space-between; padding: 22rpx 24rpx; color:#333;
|
||||
}
|
||||
.add { margin: 24rpx auto; width: 120rpx; height: 120rpx; border-radius: 20rpx; background: #c7eef7; color:#16a1c4; font-size: 72rpx; display:flex; align-items:center; justify-content:center;
|
||||
}
|
||||
.empty { display:flex; flex-direction: column; align-items:center; padding: 60rpx 0; color:#888;
|
||||
}
|
||||
.empty-img { width: 220rpx; margin-bottom: 20rpx;
|
||||
}
|
||||
.empty-text { margin-bottom: 8rpx;
|
||||
}
|
||||
.list { background:#fff;
|
||||
}
|
||||
.row { display:grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 12rpx; padding: 16rpx 12rpx; align-items:center; border-bottom: 1rpx solid #f3f3f3;
|
||||
}
|
||||
.col.name { padding-left: 12rpx;
|
||||
}
|
||||
.col.amount { text-align:right; padding-right: 12rpx; color:#333;
|
||||
}
|
||||
.bottom { position: fixed; left:0; right:0; bottom:0; background:#fff; padding: 16rpx 24rpx calc(env(safe-area-inset-bottom) + 16rpx); box-shadow: 0 -4rpx 12rpx rgba(0,0,0,0.06);
|
||||
}
|
||||
.primary { width: 100%; background: linear-gradient(135deg, #FFE69A 0%, #F4CF62 45%, #D7A72E 100%); color:#493c1b; border-radius: 999rpx; padding: 20rpx 0; font-weight:800;
|
||||
}
|
||||
48
frontend/unpackage/dist/dev/mp-weixin/pages/product/select.js
vendored
Normal file
48
frontend/unpackage/dist/dev/mp-weixin/pages/product/select.js
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return { kw: "", products: [] };
|
||||
},
|
||||
onLoad() {
|
||||
this.search();
|
||||
},
|
||||
methods: {
|
||||
async search() {
|
||||
try {
|
||||
const res = await common_http.get("/api/products", { kw: this.kw, page: 1, size: 50 });
|
||||
this.products = Array.isArray(res == null ? void 0 : res.list) ? res.list : Array.isArray(res) ? res : [];
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: "加载失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
select(p) {
|
||||
const opener = getCurrentPages()[getCurrentPages().length - 2];
|
||||
if (opener && opener.$vm && opener.$vm.items) {
|
||||
opener.$vm.items.push({ productId: p.id, productName: p.name, quantity: 1, unitPrice: Number(p.price || 0) });
|
||||
}
|
||||
common_vendor.index.navigateBack();
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.o((...args) => $options.search && $options.search(...args)),
|
||||
b: $data.kw,
|
||||
c: common_vendor.o(($event) => $data.kw = $event.detail.value),
|
||||
d: common_vendor.o((...args) => $options.search && $options.search(...args)),
|
||||
e: common_vendor.f($data.products, (p, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(p.name),
|
||||
b: common_vendor.t(p.code),
|
||||
c: common_vendor.t(p.stock || 0),
|
||||
d: p.id,
|
||||
e: common_vendor.o(($event) => $options.select(p), p.id)
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/product/select.js.map
|
||||
4
frontend/unpackage/dist/dev/mp-weixin/pages/product/select.json
vendored
Normal file
4
frontend/unpackage/dist/dev/mp-weixin/pages/product/select.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "选择商品",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
frontend/unpackage/dist/dev/mp-weixin/pages/product/select.wxml
vendored
Normal file
1
frontend/unpackage/dist/dev/mp-weixin/pages/product/select.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="page"><view class="search"><input placeholder="搜索商品名称/编码" bindconfirm="{{a}}" value="{{b}}" bindinput="{{c}}"/><button size="mini" bindtap="{{d}}">搜索</button></view><scroll-view scroll-y class="list"><view wx:for="{{e}}" wx:for-item="p" wx:key="d" class="item" bindtap="{{p.e}}"><view class="name">{{p.a}}</view><view class="meta">{{p.b}} · 库存:{{p.c}}</view></view></scroll-view></view>
|
||||
15
frontend/unpackage/dist/dev/mp-weixin/pages/product/select.wxss
vendored
Normal file
15
frontend/unpackage/dist/dev/mp-weixin/pages/product/select.wxss
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
.page { display:flex; flex-direction: column; height: 100vh;
|
||||
}
|
||||
.search { display:flex; gap: 12rpx; padding: 16rpx; background:#fff;
|
||||
}
|
||||
.search input { flex:1; background:#f6f6f6; border-radius: 12rpx; padding: 12rpx;
|
||||
}
|
||||
.list { flex:1;
|
||||
}
|
||||
.item { padding: 20rpx 24rpx; background:#fff; border-bottom: 1rpx solid #f1f1f1;
|
||||
}
|
||||
.name { color:#333; margin-bottom: 6rpx;
|
||||
}
|
||||
.meta { color:#888; font-size: 24rpx;
|
||||
}
|
||||
48
frontend/unpackage/dist/dev/mp-weixin/pages/supplier/select.js
vendored
Normal file
48
frontend/unpackage/dist/dev/mp-weixin/pages/supplier/select.js
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return { kw: "", suppliers: [] };
|
||||
},
|
||||
onLoad() {
|
||||
this.search();
|
||||
},
|
||||
methods: {
|
||||
async search() {
|
||||
try {
|
||||
const res = await common_http.get("/api/suppliers", { kw: this.kw, page: 1, size: 50 });
|
||||
this.suppliers = Array.isArray(res == null ? void 0 : res.list) ? res.list : Array.isArray(res) ? res : [];
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: "加载失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
select(s) {
|
||||
const opener = getCurrentPages()[getCurrentPages().length - 2];
|
||||
if (opener && opener.$vm) {
|
||||
opener.$vm.order.supplierId = s.id;
|
||||
opener.$vm.supplierName = s.name;
|
||||
}
|
||||
common_vendor.index.navigateBack();
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.o((...args) => $options.search && $options.search(...args)),
|
||||
b: $data.kw,
|
||||
c: common_vendor.o(($event) => $data.kw = $event.detail.value),
|
||||
d: common_vendor.o((...args) => $options.search && $options.search(...args)),
|
||||
e: common_vendor.f($data.suppliers, (s, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(s.name),
|
||||
b: common_vendor.t(s.mobile || "—"),
|
||||
c: s.id,
|
||||
d: common_vendor.o(($event) => $options.select(s), s.id)
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/supplier/select.js.map
|
||||
4
frontend/unpackage/dist/dev/mp-weixin/pages/supplier/select.json
vendored
Normal file
4
frontend/unpackage/dist/dev/mp-weixin/pages/supplier/select.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "选择供应商",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
frontend/unpackage/dist/dev/mp-weixin/pages/supplier/select.wxml
vendored
Normal file
1
frontend/unpackage/dist/dev/mp-weixin/pages/supplier/select.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="page"><view class="search"><input placeholder="搜索供应商名称/电话" bindconfirm="{{a}}" value="{{b}}" bindinput="{{c}}"/><button size="mini" bindtap="{{d}}">搜索</button></view><scroll-view scroll-y class="list"><view wx:for="{{e}}" wx:for-item="s" wx:key="c" class="item" bindtap="{{s.d}}"><view class="name">{{s.a}}</view><view class="meta">{{s.b}}</view></view></scroll-view></view>
|
||||
15
frontend/unpackage/dist/dev/mp-weixin/pages/supplier/select.wxss
vendored
Normal file
15
frontend/unpackage/dist/dev/mp-weixin/pages/supplier/select.wxss
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
.page { display:flex; flex-direction: column; height: 100vh;
|
||||
}
|
||||
.search { display:flex; gap: 12rpx; padding: 16rpx; background:#fff;
|
||||
}
|
||||
.search input { flex:1; background:#f6f6f6; border-radius: 12rpx; padding: 12rpx;
|
||||
}
|
||||
.list { flex:1;
|
||||
}
|
||||
.item { padding: 20rpx 24rpx; background:#fff; border-bottom: 1rpx solid #f1f1f1;
|
||||
}
|
||||
.name { color:#333; margin-bottom: 6rpx;
|
||||
}
|
||||
.meta { color:#888; font-size: 24rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user