Initial commit

This commit is contained in:
jiapengyu
2026-07-27 13:37:48 +08:00
commit ecba71e2a5
39123 changed files with 5989154 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
"use strict";var e=(e,t,o)=>new Promise((u,a)=>{var l=e=>{try{i(o.next(e))}catch(t){a(t)}},n=e=>{try{i(o.throw(e))}catch(t){a(t)}},i=e=>e.done?u(e.value):Promise.resolve(e.value).then(l,n);i((o=o.apply(e,t)).next())});const t=require("../../common/vendor.js"),o=require("../../common/assets.js"),u=require("../../stores/price.js"),a=require("../../stores/bluetooth.js"),l=require("../../stores/order.js"),n=require("../../stores/region.js"),i=t.defineComponent({__name:"weigh",setup(i){const r=u.usePriceStore(),v=a.useBluetoothStore(),s=l.useOrderStore(),c=n.useRegionStore(),d=t.ref(""),g=t.ref(0),h=t.ref(0),m=t.ref(""),p=t.ref("bluetooth"),f=t.ref(""),x=t.computed(()=>r.getPriceByCategory(d.value)),b=t.computed(()=>{if(!x.value)return 0;const e="kg"===x.value.unit?"bluetooth"===p.value?g.value:parseFloat(f.value)||0:h.value;return Number((e*x.value.price).toFixed(2))});t.onLoad(t=>e(this,null,function*(){(null==t?void 0:t.category)&&(d.value=t.category),yield r.loadPrices(),v.init()}));const w=()=>{t.index.navigateTo({url:"/pages/bluetooth/bluetooth"})},k=()=>{v.resetWeight(),g.value=0},y=()=>{h.value>0&&(h.value--,m.value=h.value.toString())},F=()=>{h.value++,m.value=h.value.toString()},_=()=>{const e=parseInt(m.value)||0;h.value=Math.max(0,e)},S=e=>{h.value+=e,m.value=h.value.toString()},j=e=>{p.value=e,"manual"===e&&(f.value=g.value>0?g.value.toString():"")},q=()=>{const e=parseFloat(f.value);!isNaN(e)&&e>=0&&(g.value=e)},P=e=>{const t=parseFloat(f.value)||0;f.value=(t+e).toFixed(2),q()},$=()=>e(this,null,function*(){if(!x.value)return void t.index.showToast({title:"请选择回收种类",icon:"none"});const o="kg"===x.value.unit?"bluetooth"===p.value?g.value:parseFloat(f.value)||0:h.value;if(o<=0)return void t.index.showToast({title:"kg"===x.value.unit?"请输入重量":"请输入数量",icon:"none"});const u={category:x.value.category,name:x.value.name,weight:"kg"===x.value.unit?o:void 0,count:"piece"===x.value.unit?h.value:void 0,unit:x.value.unit,price:x.value.price,amount:b.value};t.index.showModal({title:"确认回收",content:`确定回收${x.value.name} ${o}${"kg"===x.value.unit?"kg":"个"},金额¥${b.value.toFixed(2)}`,success:o=>e(this,null,function*(){if(o.confirm){t.index.showLoading({title:"保存中..."});const e=c.getRegion(),o=yield s.createOrder([u],e);t.index.hideLoading(),o?(t.index.showToast({title:"回收成功",icon:"success"}),setTimeout(()=>{t.index.navigateBack()},1500)):t.index.showToast({title:"保存失败",icon:"none"})}})})});return t.onMounted(()=>{const e=()=>{g.value=v.currentWeight};v.$subscribe(()=>{e()}),e()}),t.onShow(()=>{r.loadPrices()}),(e,u)=>{var a,l,n,i,r;return t.e({a:t.t(t.unref(v).isConnected?"🔵":"⚪"),b:t.t(t.unref(v).isConnected?"已连接":"未连接"),c:t.unref(v).isConnected?1:"",d:t.t((null==(a=x.value)?void 0:a.name)||"-"),e:t.t((null==(l=x.value)?void 0:l.price)||0),f:t.t("kg"===(null==(n=x.value)?void 0:n.unit)?"kg":"个"),g:"kg"===(null==(i=x.value)?void 0:i.unit)},"kg"===(null==(r=x.value)?void 0:r.unit)?t.e({h:"bluetooth"===p.value?1:"",i:t.o(e=>j("bluetooth")),j:"manual"===p.value?1:"",k:t.o(e=>j("manual")),l:"bluetooth"===p.value},"bluetooth"===p.value?{m:t.t(g.value.toFixed(2))}:{n:t.o([e=>f.value=e.detail.value,q]),o:f.value},{p:"bluetooth"===p.value},"bluetooth"===p.value?{q:o._imports_0$2,r:t.o(w),s:o._imports_1$1,t:t.o(k)}:{v:t.o(e=>P(.5)),w:t.o(e=>P(1)),x:t.o(e=>P(2)),y:t.o(e=>P(5))}):{z:t.o([e=>m.value=e.detail.value,_]),A:m.value,B:t.o(y),C:t.o(F),D:t.o(e=>S(1)),E:t.o(e=>S(5)),F:t.o(e=>S(10)),G:t.o(e=>S(50))},{H:t.t(b.value.toFixed(2)),I:t.o($)})}}}),r=t._export_sfc(i,[["__scopeId","data-v-95ce5baf"]]);wx.createPage(r);
+6
View File
@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "称重回收",
"navigationBarBackgroundColor": "#3366ff",
"navigationBarTextStyle": "white",
"usingComponents": {}
}
+1
View File
@@ -0,0 +1 @@
<view class="container data-v-95ce5baf"><view class="status-bar data-v-95ce5baf"><view class="{{['bluetooth-status', 'data-v-95ce5baf', c && 'connected']}}"><text class="status-icon data-v-95ce5baf">{{a}}</text><text class="data-v-95ce5baf">{{b}}</text></view></view><view class="info-card data-v-95ce5baf"><view class="info-item data-v-95ce5baf"><text class="info-label data-v-95ce5baf">回收种类</text><text class="info-value data-v-95ce5baf">{{d}}</text></view><view class="info-item data-v-95ce5baf"><text class="info-label data-v-95ce5baf">单价</text><text class="info-value price-text data-v-95ce5baf">¥{{e}}/{{f}}</text></view></view><view wx:if="{{g}}" class="display-card data-v-95ce5baf"><view class="mode-switch data-v-95ce5baf"><view class="{{['mode-btn', 'data-v-95ce5baf', h && 'active']}}" bindtap="{{i}}"><text class="data-v-95ce5baf">蓝牙称重</text></view><view class="{{['mode-btn', 'data-v-95ce5baf', j && 'active']}}" bindtap="{{k}}"><text class="data-v-95ce5baf">手动输入</text></view></view><view wx:if="{{l}}" class="display-value-wrap data-v-95ce5baf"><text class="display-value data-v-95ce5baf">{{m}}</text><text class="display-unit data-v-95ce5baf">kg</text></view><view wx:else class="manual-input data-v-95ce5baf"><input class="data-v-95ce5baf" type="digit" placeholder="请输入重量" bindinput="{{n}}" value="{{o}}"/><text class="input-unit data-v-95ce5baf">kg</text></view><view wx:if="{{p}}" class="control-row data-v-95ce5baf"><view class="control-btn data-v-95ce5baf" bindtap="{{r}}"><image class="control-icon-img data-v-95ce5baf" src="{{q}}" mode="aspectFit"/><text class="data-v-95ce5baf">蓝牙连接</text></view><view class="control-btn data-v-95ce5baf" bindtap="{{t}}"><image class="control-icon-img data-v-95ce5baf" src="{{s}}" mode="aspectFit"/><text class="data-v-95ce5baf">归零</text></view></view><view wx:else class="quick-input data-v-95ce5baf"><view class="quick-btn data-v-95ce5baf" bindtap="{{v}}">+0.5kg</view><view class="quick-btn data-v-95ce5baf" bindtap="{{w}}">+1kg</view><view class="quick-btn data-v-95ce5baf" bindtap="{{x}}">+2kg</view><view class="quick-btn data-v-95ce5baf" bindtap="{{y}}">+5kg</view></view></view><view wx:else class="display-card data-v-95ce5baf"><view class="display-icon data-v-95ce5baf">🥫</view><view class="display-title data-v-95ce5baf">个数统计</view><view class="manual-input data-v-95ce5baf"><input class="data-v-95ce5baf" type="number" placeholder="请输入数量" bindinput="{{z}}" value="{{A}}"/><text class="input-unit data-v-95ce5baf">个</text></view><view class="count-controls data-v-95ce5baf"><view class="count-btn minus data-v-95ce5baf" bindtap="{{B}}"><text class="data-v-95ce5baf">-</text></view><view class="count-btn plus data-v-95ce5baf" bindtap="{{C}}"><text class="data-v-95ce5baf">+</text></view></view><view class="quick-input data-v-95ce5baf"><view class="quick-btn data-v-95ce5baf" bindtap="{{D}}">+1</view><view class="quick-btn data-v-95ce5baf" bindtap="{{E}}">+5</view><view class="quick-btn data-v-95ce5baf" bindtap="{{F}}">+10</view><view class="quick-btn data-v-95ce5baf" bindtap="{{G}}">+50</view></view></view><view class="amount-card data-v-95ce5baf"><view class="amount-title data-v-95ce5baf">💰 预估金额</view><view class="amount-value-wrap data-v-95ce5baf"><text class="amount-currency data-v-95ce5baf">¥</text><text class="amount-num data-v-95ce5baf">{{H}}</text></view></view><view class="confirm-btn data-v-95ce5baf" bindtap="{{I}}"><text class="data-v-95ce5baf">确认回收</text></view></view>
File diff suppressed because one or more lines are too long