acdr-ui/dist/build/mp-weixin/pages/service/my-service.js

2 lines
1.3 KiB
JavaScript

"use strict";var e=(e,t,o)=>new Promise(((i,n)=>{var s=e=>{try{r(o.next(e))}catch(t){n(t)}},a=e=>{try{r(o.throw(e))}catch(t){n(t)}},r=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,a);r((o=o.apply(e,t)).next())}));const t=require("../../common/vendor.js"),o=require("../../utils/http.js");if(!Array){t.resolveComponent("layout-default-uni")()}const i={__name:"my-service",setup(i){const n=t.ref([]),s=()=>e(this,null,(function*(){try{const e=yield o.httpPost("/personal-service/list",{pageNo:1,pageSize:10});200==e.code?n.value=e.records||[]:t.index.showToast({title:"获取服务列表失败",icon:"none"})}catch(e){t.index.showToast({title:"获取服务列表失败",icon:"none"})}})),a=i=>e(this,null,(function*(){try{const e=yield o.httpPost("/personal-service/delete",{id:i});e&&e.data?(n.value=n.value.filter((e=>e.id!==i)),t.index.showToast({title:"服务已删除",icon:"success"})):t.index.showToast({title:"删除服务失败",icon:"none"})}catch(e){t.index.showToast({title:"删除服务失败",icon:"none"})}}));return t.onMounted((()=>{s()})),(e,o)=>({a:t.f(n.value,((e,o,i)=>({a:t.t(e.serviceName),b:t.o((o=>(e=>{t.index.navigateTo({url:`/pages/push/door?id=${e.id}`})})(e)),e.id),c:t.o((t=>a(e.id)),e.id),d:t.t(e.description),e:t.t(e.price),f:t.t(e.address),g:e.id})))})}},n=t._export_sfc(i,[["__scopeId","data-v-8dd39825"]]);wx.createPage(n);