acdr-ui/dist/build/mp-weixin/pages/address/index.js

2 lines
2.7 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";var e=Object.defineProperty,t=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,s=(t,o,n)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,d=(e,t,o)=>new Promise(((n,s)=>{var d=e=>{try{a(o.next(e))}catch(t){s(t)}},i=e=>{try{a(o.throw(e))}catch(t){s(t)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(d,i);a((o=o.apply(e,t)).next())}));const i=require("../../common/vendor.js"),a=require("../../utils/http.js");if(!Array){(i.resolveComponent("wd-icon")+i.resolveComponent("wd-status-tip")+i.resolveComponent("wd-popup")+i.resolveComponent("layout-default-uni"))()}Math||((()=>"../../node-modules/wot-design-uni/components/wd-icon/wd-icon.js")+(()=>"../../node-modules/wot-design-uni/components/wd-status-tip/wd-status-tip.js")+l+(()=>"../../node-modules/wot-design-uni/components/wd-popup/wd-popup.js"))();const l=()=>"./components/AddAddress.js",c={__name:"index",setup(e){const l=i.ref([]),c=i.ref({id:null,name:"",phone:"",address:""}),r=i.ref(!1),u=()=>d(this,null,(function*(){const e=yield a.httpPost("/china-address/page");l.value=e.records}));i.onMounted((()=>{u()}));const p=()=>{c.value={id:null,name:"",phone:"",address:""},r.value=!0},v=e=>{const d=l.value[e];l.value[e].address=`${d.province}-${d.city}-${d.district}`,c.value=((e,d)=>{for(var i in d||(d={}))o.call(d,i)&&s(e,i,d[i]);if(t)for(var i of t(d))n.call(d,i)&&s(e,i,d[i]);return e})({},l.value[e]),r.value=!0},h=e=>d(this,null,(function*(){let t;if(""!=e.address){const t=e.address.split("-");e.province=t[0],e.city=t[1],e.district=t[2]}t=e.id?yield a.httpPost("/china-address/modify",e):yield a.httpPost("/china-address/add",e),200==t.code&&(i.index.showToast({title:"操作成功",icon:""}),u(),r.value=!1)})),m=e=>d(this,null,(function*(){const t=l.value[e].id;i.index.showModal({title:"确认删除",content:"你确定要删除这个地址吗?",success:e=>d(this,null,(function*(){if(e.confirm){200===(yield a.httpGet(`/china-address/remove/${t}`)).code&&(i.index.showToast({title:"删除成功",icon:"success"}),u())}}))})}));return(e,t)=>i.e({a:i.f(l.value,((e,t,o)=>({a:i.t(e.type),b:i.t(e.name),c:i.t(e.phone),d:i.t(`${e.province}-${e.city}-${e.district}`),e:i.o((e=>v(t)),t),f:"d00dceb9-1-"+o+",d00dceb9-0",g:i.o((e=>m(t)),t),h:"d00dceb9-2-"+o+",d00dceb9-0",i:t}))),b:i.p({name:"edit",size:"20px"}),c:i.p({name:"delete",size:"20px"}),d:0==l.value.length},0==l.value.length?{e:i.p({image:"content",tip:"暂无内容"})}:{},{f:i.o(p),g:i.o(h),h:i.p({initialAddress:c.value}),i:i.o(e.handleClose),j:i.o((e=>r.value=e)),k:i.p({position:"bottom","custom-style":"height: 60%; width: 100%;",modelValue:r.value})})}},r=i._export_sfc(c,[["__scopeId","data-v-d00dceb9"]]);wx.createPage(r);