9.18王德鹏/1
This commit is contained in:
@@ -27,7 +27,10 @@ const _sfc_main = {
|
||||
activeCategory: "sale_income",
|
||||
trxAmount: 0,
|
||||
selectedAccountId: null,
|
||||
selectedAccountName: ""
|
||||
selectedAccountName: "",
|
||||
// 收款/付款输入
|
||||
payments: { cash: 0, bank: 0, wechat: 0 },
|
||||
showMore: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -54,6 +57,11 @@ const _sfc_main = {
|
||||
},
|
||||
counterpartyLabel() {
|
||||
return this.customerName || this.supplierName || "—";
|
||||
},
|
||||
// 收款/付款合计
|
||||
payTotal() {
|
||||
const p = this.payments || { cash: 0, bank: 0, wechat: 0 };
|
||||
return Number(p.cash || 0) + Number(p.bank || 0) + Number(p.wechat || 0);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -83,10 +91,19 @@ const _sfc_main = {
|
||||
recalc() {
|
||||
this.$forceUpdate();
|
||||
},
|
||||
recalcPay() {
|
||||
this.$forceUpdate();
|
||||
},
|
||||
async submit() {
|
||||
const isSaleOrPurchase = this.biz === "sale" || this.biz === "purchase";
|
||||
const payload = isSaleOrPurchase ? {
|
||||
type: this.biz === "sale" ? this.saleType : "purchase." + this.purchaseType,
|
||||
const isCollectOrPay = this.biz === "sale" && this.saleType === "collect" || this.biz === "purchase" && this.purchaseType === "pay";
|
||||
const saleTypeValue = this.biz === "sale" ? "sale." + this.saleType : "purchase." + this.purchaseType;
|
||||
const payload = isSaleOrPurchase ? isCollectOrPay ? [
|
||||
{ method: "cash", amount: Number(this.payments.cash || 0) },
|
||||
{ method: "bank", amount: Number(this.payments.bank || 0) },
|
||||
{ method: "wechat", amount: Number(this.payments.wechat || 0) }
|
||||
].filter((p) => p.amount > 0) : {
|
||||
type: saleTypeValue,
|
||||
orderTime: this.order.orderTime,
|
||||
customerId: this.order.customerId,
|
||||
supplierId: this.order.supplierId,
|
||||
@@ -102,7 +119,7 @@ const _sfc_main = {
|
||||
remark: this.order.remark
|
||||
};
|
||||
try {
|
||||
const url = isSaleOrPurchase ? "/api/orders" : "/api/other-transactions";
|
||||
const url = isSaleOrPurchase ? isCollectOrPay ? `/api/payments/${this.biz}` : "/api/orders" : "/api/other-transactions";
|
||||
await common_http.post(url, payload);
|
||||
common_vendor.index.showToast({ title: "已保存", icon: "success" });
|
||||
setTimeout(() => {
|
||||
@@ -116,6 +133,7 @@ const _sfc_main = {
|
||||
this.items = [];
|
||||
this.trxAmount = 0;
|
||||
this.order.remark = "";
|
||||
this.payments = { cash: 0, bank: 0, wechat: 0 };
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -158,13 +176,42 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
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))
|
||||
G: $data.biz === "sale" && $data.saleType === "collect" || $data.biz === "purchase" && $data.purchaseType === "pay"
|
||||
}, $data.biz === "sale" && $data.saleType === "collect" || $data.biz === "purchase" && $data.purchaseType === "pay" ? common_vendor.e({
|
||||
H: $data.biz === "sale"
|
||||
}, $data.biz === "sale" ? {
|
||||
I: common_vendor.t($options.customerLabel),
|
||||
J: common_vendor.o((...args) => $options.chooseCustomer && $options.chooseCustomer(...args))
|
||||
} : {
|
||||
K: common_vendor.f($data.biz === "income" ? $options.incomeCategories : $options.expenseCategories, (c, k0, i0) => {
|
||||
K: common_vendor.t($options.supplierLabel),
|
||||
L: common_vendor.o((...args) => $options.chooseSupplier && $options.chooseSupplier(...args))
|
||||
}, {
|
||||
M: common_vendor.o([common_vendor.m(($event) => $data.payments.cash = $event.detail.value, {
|
||||
number: true
|
||||
}), ($event) => $options.recalcPay()]),
|
||||
N: $data.payments.cash,
|
||||
O: common_vendor.o([common_vendor.m(($event) => $data.payments.bank = $event.detail.value, {
|
||||
number: true
|
||||
}), ($event) => $options.recalcPay()]),
|
||||
P: $data.payments.bank,
|
||||
Q: common_vendor.o([common_vendor.m(($event) => $data.payments.wechat = $event.detail.value, {
|
||||
number: true
|
||||
}), ($event) => $options.recalcPay()]),
|
||||
R: $data.payments.wechat,
|
||||
S: common_vendor.t($data.showMore ? "收起" : ""),
|
||||
T: common_vendor.o(($event) => $data.showMore = !$data.showMore),
|
||||
U: common_vendor.t($options.payTotal.toFixed(2)),
|
||||
V: $data.order.remark,
|
||||
W: common_vendor.o(($event) => $data.order.remark = $event.detail.value),
|
||||
X: common_vendor.t($data.order.orderTime),
|
||||
Y: $data.order.orderTime,
|
||||
Z: common_vendor.o((...args) => $options.onDateChange && $options.onDateChange(...args))
|
||||
}) : $data.biz === "sale" || $data.biz === "purchase" ? {
|
||||
ab: common_vendor.t($options.totalQuantity),
|
||||
ac: common_vendor.t($options.totalAmount.toFixed(2)),
|
||||
ad: common_vendor.o((...args) => $options.chooseProduct && $options.chooseProduct(...args))
|
||||
} : {
|
||||
ae: common_vendor.f($data.biz === "income" ? $options.incomeCategories : $options.expenseCategories, (c, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(c.label),
|
||||
b: c.key,
|
||||
@@ -172,22 +219,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
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, {
|
||||
af: common_vendor.t($options.counterpartyLabel),
|
||||
ag: common_vendor.o((...args) => $options.chooseCounterparty && $options.chooseCounterparty(...args)),
|
||||
ah: common_vendor.t($options.accountLabel),
|
||||
ai: common_vendor.o((...args) => $options.chooseAccount && $options.chooseAccount(...args)),
|
||||
aj: $data.trxAmount,
|
||||
ak: 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)
|
||||
al: $data.order.remark,
|
||||
am: common_vendor.o(($event) => $data.order.remark = $event.detail.value)
|
||||
}, {
|
||||
T: !$data.items.length
|
||||
aa: $data.biz === "sale" || $data.biz === "purchase",
|
||||
an: !$data.items.length
|
||||
}, !$data.items.length ? {
|
||||
U: common_assets._imports_0$1
|
||||
ao: common_assets._imports_0$1
|
||||
} : {
|
||||
V: common_vendor.f($data.items, (it, idx, i0) => {
|
||||
ap: 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, {
|
||||
@@ -203,8 +251,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
};
|
||||
})
|
||||
}, {
|
||||
W: common_vendor.o((...args) => $options.saveAndReset && $options.saveAndReset(...args)),
|
||||
X: common_vendor.o((...args) => $options.submit && $options.submit(...args))
|
||||
aq: common_vendor.o((...args) => $options.saveAndReset && $options.saveAndReset(...args)),
|
||||
ar: common_vendor.o((...args) => $options.submit && $options.submit(...args))
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
@@ -1 +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>
|
||||
<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 wx:if="{{H}}" class="field" bindtap="{{J}}"><text class="label">客户</text><text class="value">{{I}}</text></view><view wx:else class="field" bindtap="{{L}}"><text class="label">供应商</text><text class="value">{{K}}</text></view><view class="field pay-row"><text class="label">现金</text><input class="pay-input" type="digit" placeholder="0.00" bindinput="{{M}}" value="{{N}}"/></view><view class="field pay-row"><text class="label">银行存款</text><input class="pay-input" type="digit" placeholder="0.00" bindinput="{{O}}" value="{{P}}"/></view><view class="field pay-row"><text class="label">微信</text><input class="pay-input" type="digit" placeholder="0.00" bindinput="{{Q}}" value="{{R}}"/></view><view class="collapse-trigger" bindtap="{{T}}">{{S}}</view><view class="textarea"><view class="amount-badge">总金额:{{U}}</view><block wx:if="{{r0}}"><textarea maxlength="200" placeholder="备注(最多输入200个字)" value="{{V}}" bindinput="{{W}}"></textarea></block><view class="date-mini"><picker mode="date" value="{{Y}}" bindchange="{{Z}}"><text>{{X}}</text></picker></view></view></view><view wx:elif="{{aa}}"><view class="summary"><text>选中货品({{ab}})</text><text>合计金额:¥ {{ac}}</text></view><view class="add" bindtap="{{ad}}">+</view></view><view wx:else><view class="chips"><view wx:for="{{ae}}" wx:for-item="c" wx:key="b" class="{{['chip', c.c && 'active']}}" bindtap="{{c.d}}">{{c.a}}</view></view><view class="field" bindtap="{{ag}}"><text class="label">往来单位</text><text class="value">{{af}}</text></view><view class="field" bindtap="{{ai}}"><text class="label">结算账户</text><text class="value">{{ah}}</text></view><view class="field"><text class="label">金额</text><input class="value" type="digit" placeholder="0.00" value="{{aj}}" bindinput="{{ak}}"/></view><view class="textarea"><block wx:if="{{r0}}"><textarea maxlength="200" placeholder="备注(最多输入200个字)" value="{{al}}" bindinput="{{am}}"></textarea></block></view></view><view wx:if="{{an}}" class="empty"><image src="{{ao}}" 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="{{ap}}" 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="{{aq}}">再记一笔</button><button class="primary" bindtap="{{ar}}">保存</button></view></view>
|
||||
@@ -40,4 +40,13 @@
|
||||
.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;
|
||||
}
|
||||
/* 收款/付款页样式 */
|
||||
.pay-row .pay-input { text-align: right; color:#333;
|
||||
}
|
||||
.textarea { position: relative; padding: 16rpx 24rpx; background:#fff; border-top: 1rpx solid #eee;
|
||||
}
|
||||
.amount-badge { position: absolute; right: 24rpx; top: -36rpx; background: #d1f0ff; color:#107e9b; padding: 8rpx 16rpx; border-radius: 12rpx; font-size: 24rpx;
|
||||
}
|
||||
.date-mini { position: absolute; right: 24rpx; bottom: 20rpx; color:#666; font-size: 24rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user