9.18/2
This commit is contained in:
1
frontend/unpackage/dist/dev/mp-weixin/app.js
vendored
1
frontend/unpackage/dist/dev/mp-weixin/app.js
vendored
@@ -11,6 +11,7 @@ if (!Math) {
|
||||
"./pages/product/units.js";
|
||||
"./pages/product/settings.js";
|
||||
"./pages/customer/select.js";
|
||||
"./pages/customer/form.js";
|
||||
"./pages/supplier/select.js";
|
||||
"./pages/account/select.js";
|
||||
"./pages/detail/index.js";
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"pages/product/units",
|
||||
"pages/product/settings",
|
||||
"pages/customer/select",
|
||||
"pages/customer/form",
|
||||
"pages/supplier/select",
|
||||
"pages/account/select",
|
||||
"pages/detail/index"
|
||||
|
||||
68
frontend/unpackage/dist/dev/mp-weixin/pages/customer/form.js
vendored
Normal file
68
frontend/unpackage/dist/dev/mp-weixin/pages/customer/form.js
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
id: null,
|
||||
form: { name: "", level: "", priceLevel: "retail", contactName: "", mobile: "", phone: "", address: "", arOpening: 0, remark: "" },
|
||||
priceLevels: ["retail", "distribution", "wholesale", "big_client"],
|
||||
priceIdx: 0
|
||||
};
|
||||
},
|
||||
onLoad(query) {
|
||||
if (query && query.id) {
|
||||
this.id = Number(query.id);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onPriceChange(e) {
|
||||
this.priceIdx = Number(e.detail.value);
|
||||
this.form.priceLevel = this.priceLevels[this.priceIdx];
|
||||
},
|
||||
async save() {
|
||||
if (!this.form.name)
|
||||
return common_vendor.index.showToast({ title: "请填写客户名称", icon: "none" });
|
||||
try {
|
||||
if (this.id)
|
||||
await common_http.put(`/api/customers/${this.id}`, this.form);
|
||||
else
|
||||
await common_http.post("/api/customers", this.form);
|
||||
common_vendor.index.showToast({ title: "保存成功", icon: "success" });
|
||||
setTimeout(() => common_vendor.index.navigateBack(), 500);
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: (e == null ? void 0 : e.message) || "保存失败", icon: "none" });
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: $data.form.name,
|
||||
b: common_vendor.o(($event) => $data.form.name = $event.detail.value),
|
||||
c: $data.form.level,
|
||||
d: common_vendor.o(($event) => $data.form.level = $event.detail.value),
|
||||
e: common_vendor.t($data.priceLevels[$data.priceIdx]),
|
||||
f: $data.priceLevels,
|
||||
g: $data.priceIdx,
|
||||
h: common_vendor.o((...args) => $options.onPriceChange && $options.onPriceChange(...args)),
|
||||
i: $data.form.contactName,
|
||||
j: common_vendor.o(($event) => $data.form.contactName = $event.detail.value),
|
||||
k: $data.form.mobile,
|
||||
l: common_vendor.o(($event) => $data.form.mobile = $event.detail.value),
|
||||
m: $data.form.phone,
|
||||
n: common_vendor.o(($event) => $data.form.phone = $event.detail.value),
|
||||
o: $data.form.address,
|
||||
p: common_vendor.o(($event) => $data.form.address = $event.detail.value),
|
||||
q: $data.form.arOpening,
|
||||
r: common_vendor.o(common_vendor.m(($event) => $data.form.arOpening = $event.detail.value, {
|
||||
number: true
|
||||
})),
|
||||
s: $data.form.remark,
|
||||
t: common_vendor.o(($event) => $data.form.remark = $event.detail.value),
|
||||
v: common_vendor.o((...args) => $options.save && $options.save(...args))
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/customer/form.js.map
|
||||
4
frontend/unpackage/dist/dev/mp-weixin/pages/customer/form.json
vendored
Normal file
4
frontend/unpackage/dist/dev/mp-weixin/pages/customer/form.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "新增客户",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
frontend/unpackage/dist/dev/mp-weixin/pages/customer/form.wxml
vendored
Normal file
1
frontend/unpackage/dist/dev/mp-weixin/pages/customer/form.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="page"><view class="field"><text class="label">客户名称</text><input class="value" placeholder="必填" value="{{a}}" bindinput="{{b}}"/></view><view class="field"><text class="label">客户等级</text><input class="value" placeholder="可选,如 VIP/A/B" value="{{c}}" bindinput="{{d}}"/></view><view class="field"><text class="label">售价档位</text><picker range="{{f}}" value="{{g}}" bindchange="{{h}}"><view class="value">{{e}}</view></picker></view><view class="field"><text class="label">联系人</text><input class="value" placeholder="可选" value="{{i}}" bindinput="{{j}}"/></view><view class="field"><text class="label">手机</text><input class="value" placeholder="可选" value="{{k}}" bindinput="{{l}}"/></view><view class="field"><text class="label">电话</text><input class="value" placeholder="可选(座机)" value="{{m}}" bindinput="{{n}}"/></view><view class="field"><text class="label">送货地址</text><input class="value" placeholder="可选" value="{{o}}" bindinput="{{p}}"/></view><view class="field"><text class="label">初始应收</text><input class="value" type="digit" placeholder="默认 0.00" value="{{q}}" bindinput="{{r}}"/></view><view class="textarea"><block wx:if="{{r0}}"><textarea maxlength="200" placeholder="备注(最多200字)" value="{{s}}" bindinput="{{t}}"></textarea></block></view><view class="bottom"><button class="primary" bindtap="{{v}}">保存</button></view></view>
|
||||
15
frontend/unpackage/dist/dev/mp-weixin/pages/customer/form.wxss
vendored
Normal file
15
frontend/unpackage/dist/dev/mp-weixin/pages/customer/form.wxss
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
.page { padding-bottom: 140rpx;
|
||||
}
|
||||
.field { display:flex; justify-content: space-between; padding: 22rpx 24rpx; background:#fff; border-bottom:1rpx solid #eee;
|
||||
}
|
||||
.label { color:#666;
|
||||
}
|
||||
.value { color:#333; text-align: right; flex: 1;
|
||||
}
|
||||
.textarea { padding: 16rpx 24rpx; background:#fff; margin-top: 12rpx;
|
||||
}
|
||||
.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, #A0E4FF 0%, #17A2C4 100%); color:#fff; border-radius: 999rpx; padding: 20rpx 0;
|
||||
}
|
||||
@@ -3,20 +3,27 @@ const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return { kw: "", customers: [] };
|
||||
return { kw: "", debtOnly: false, customers: [] };
|
||||
},
|
||||
onLoad() {
|
||||
this.search();
|
||||
},
|
||||
methods: {
|
||||
toggleDebtOnly() {
|
||||
this.debtOnly = !this.debtOnly;
|
||||
this.search();
|
||||
},
|
||||
async search() {
|
||||
try {
|
||||
const res = await common_http.get("/api/customers", { kw: this.kw, page: 1, size: 50 });
|
||||
const res = await common_http.get("/api/customers", { kw: this.kw, debtOnly: this.debtOnly, 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" });
|
||||
}
|
||||
},
|
||||
createCustomer() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/customer/form" });
|
||||
},
|
||||
select(c) {
|
||||
const opener = getCurrentPages()[getCurrentPages().length - 2];
|
||||
if (opener && opener.$vm) {
|
||||
@@ -33,14 +40,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
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 {
|
||||
e: $data.debtOnly ? "primary" : "default",
|
||||
f: common_vendor.o((...args) => $options.toggleDebtOnly && $options.toggleDebtOnly(...args)),
|
||||
g: common_vendor.f($data.customers, (c, k0, i0) => {
|
||||
return common_vendor.e({
|
||||
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)
|
||||
};
|
||||
})
|
||||
c: typeof c.receivable === "number"
|
||||
}, typeof c.receivable === "number" ? {
|
||||
d: common_vendor.t(Number(c.receivable).toFixed(2))
|
||||
} : {}, {
|
||||
e: c.id,
|
||||
f: common_vendor.o(($event) => $options.select(c), c.id)
|
||||
});
|
||||
}),
|
||||
h: common_vendor.o((...args) => $options.createCustomer && $options.createCustomer(...args))
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
@@ -1 +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>
|
||||
<view class="page"><view class="search"><input placeholder="搜索客户名称/电话" bindconfirm="{{a}}" value="{{b}}" bindinput="{{c}}"/><button size="mini" bindtap="{{d}}">搜索</button><button size="mini" type="{{e}}" bindtap="{{f}}">只看欠款</button></view><scroll-view scroll-y class="list"><view wx:for="{{g}}" wx:for-item="c" wx:key="e" class="item" bindtap="{{c.f}}"><view class="name">{{c.a}}</view><view class="meta">{{c.b}} <text wx:if="{{c.c}}">|应收:¥ {{c.d}}</text></view></view></scroll-view><view class="bottom"><button class="primary" bindtap="{{h}}">新增客户</button></view></view>
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
.page { display:flex; flex-direction: column; height: 100vh;
|
||||
}
|
||||
.search { display:flex; gap: 12rpx; padding: 16rpx; background:#fff;
|
||||
.search { display:flex; gap: 12rpx; padding: 16rpx; background:#fff; align-items:center;
|
||||
}
|
||||
.search input { flex:1; background:#f6f6f6; border-radius: 12rpx; padding: 12rpx;
|
||||
}
|
||||
@@ -13,3 +13,7 @@
|
||||
}
|
||||
.meta { color:#888; font-size: 24rpx;
|
||||
}
|
||||
.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, #A0E4FF 0%, #17A2C4 100%); color:#fff; border-radius: 999rpx; padding: 20rpx 0;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,10 @@ const _sfc_main = {
|
||||
common_vendor.index.navigateTo({ url: "/pages/product/list" });
|
||||
return;
|
||||
}
|
||||
if (item.key === "customer") {
|
||||
common_vendor.index.navigateTo({ url: "/pages/customer/select" });
|
||||
return;
|
||||
}
|
||||
common_vendor.index.showToast({ title: item.title + "(开发中)", icon: "none" });
|
||||
},
|
||||
goProduct() {
|
||||
@@ -75,7 +79,7 @@ const _sfc_main = {
|
||||
goDetail() {
|
||||
this.activeTab = "detail";
|
||||
try {
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:166", "[index] goDetail → /pages/detail/index");
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:170", "[index] goDetail → /pages/detail/index");
|
||||
} catch (e) {
|
||||
}
|
||||
common_vendor.index.navigateTo({ url: "/pages/detail/index" });
|
||||
|
||||
Reference in New Issue
Block a user