Initial commit - full huishou project

This commit is contained in:
jiapengyu
2026-07-27 14:07:26 +08:00
commit 60790ad1b3
39127 changed files with 5989265 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
"use strict";const e=require("../../common/vendor.js"),t=require("../../stores/price.js"),o=require("../../stores/bluetooth.js"),u=require("../../stores/order.js"),a=require("../../stores/region.js"),l=e.defineComponent({__name:"weigh",setup(l){const n=t.usePriceStore(),i=o.useBluetoothStore(),v=u.useOrderStore(),r=a.useRegionStore(),s=e.ref(""),c=e.ref(0),d=e.ref(0),g=e.ref(""),h=e.ref("bluetooth"),m=e.ref(""),p=e.computed(()=>n.getPriceByCategory(s.value)),f=e.computed(()=>{if(!p.value)return 0;const e="kg"===p.value.unit?"bluetooth"===h.value?c.value:parseFloat(m.value)||0:d.value;return Number((e*p.value.price).toFixed(2))});e.onLoad(async e=>{(null==e?void 0:e.category)&&(s.value=e.category),await n.loadPrices(),i.init()});const x=()=>{e.index.navigateTo({url:"/pages/bluetooth/bluetooth"})},b=()=>{i.resetWeight(),c.value=0},w=()=>{d.value>0&&(d.value--,g.value=d.value.toString())},k=()=>{d.value++,g.value=d.value.toString()},y=()=>{const e=parseInt(g.value)||0;d.value=Math.max(0,e)},F=e=>{d.value+=e,g.value=d.value.toString()},S=e=>{h.value=e,"manual"===e&&(m.value=c.value>0?c.value.toString():"")},j=()=>{const e=parseFloat(m.value);!isNaN(e)&&e>=0&&(c.value=e)},q=e=>{const t=parseFloat(m.value)||0;m.value=(t+e).toFixed(2),j()},C=async()=>{if(!p.value)return void e.index.showToast({title:"请选择回收种类",icon:"none"});const t="kg"===p.value.unit?"bluetooth"===h.value?c.value:parseFloat(m.value)||0:d.value;if(t<=0)return void e.index.showToast({title:"kg"===p.value.unit?"请输入重量":"请输入数量",icon:"none"});const o={category:p.value.category,name:p.value.name,weight:"kg"===p.value.unit?t:void 0,count:"piece"===p.value.unit?d.value:void 0,unit:p.value.unit,price:p.value.price,amount:f.value};e.index.showModal({title:"确认回收",content:`确定回收${p.value.name} ${t}${"kg"===p.value.unit?"kg":"个"},金额¥${f.value.toFixed(2)}`,success:async t=>{if(t.confirm){e.index.showLoading({title:"保存中..."});const t=r.getRegion(),u=await v.createOrder([o],t);e.index.hideLoading(),u?(e.index.showToast({title:"回收成功",icon:"success"}),setTimeout(()=>{e.index.navigateBack()},1500)):e.index.showToast({title:"保存失败",icon:"none"})}}})};return e.onMounted(()=>{const e=()=>{c.value=i.currentWeight};i.$subscribe(()=>{e()}),e()}),e.onShow(()=>{n.loadPrices()}),(t,o)=>{var u,a,l,n,v;return e.e({a:e.t(e.unref(i).isConnected?"🔵":"⚪"),b:e.t(e.unref(i).isConnected?"已连接":"未连接"),c:e.unref(i).isConnected?1:"",d:e.t((null==(u=p.value)?void 0:u.name)||"-"),e:e.t((null==(a=p.value)?void 0:a.price)||0),f:e.t("kg"===(null==(l=p.value)?void 0:l.unit)?"kg":"个"),g:"kg"===(null==(n=p.value)?void 0:n.unit)},"kg"===(null==(v=p.value)?void 0:v.unit)?e.e({h:"bluetooth"===h.value?1:"",i:e.o(e=>S("bluetooth")),j:"manual"===h.value?1:"",k:e.o(e=>S("manual")),l:"bluetooth"===h.value},"bluetooth"===h.value?{m:e.t(c.value.toFixed(2))}:{n:e.o([e=>m.value=e.detail.value,j]),o:m.value},{p:"bluetooth"===h.value},"bluetooth"===h.value?{q:e.o(x),r:e.o(b)}:{s:e.o(e=>q(.5)),t:e.o(e=>q(1)),v:e.o(e=>q(2)),w:e.o(e=>q(5))}):{x:e.o([e=>g.value=e.detail.value,y]),y:g.value,z:e.o(w),A:e.o(k),B:e.o(e=>F(1)),C:e.o(e=>F(5)),D:e.o(e=>F(10)),E:e.o(e=>F(50))},{F:e.t(f.value.toFixed(2)),G:e.o(C)})}}}),n=e._export_sfc(l,[["__scopeId","data-v-594d2caf"]]);wx.createPage(n);