Files
cmgd-mini-app/unpackage/dist/build/mp-weixin/pages/config/store.js
2026-01-05 12:47:14 +08:00

2 lines
3.7 KiB
JavaScript

"use strict";const e=require("../../common/vendor.js"),t=require("../../api/config.js"),o=require("../../api/request.js");if(!Array){(e.resolveComponent("nut-input")+e.resolveComponent("nut-form-item")+e.resolveComponent("nut-textarea")+e.resolveComponent("nut-switch")+e.resolveComponent("shmily-drag-image")+e.resolveComponent("nut-button")+e.resolveComponent("nut-form"))()}Math||((()=>"../../uni_modules/nutui-uni/components/input/input.js")+(()=>"../../uni_modules/nutui-uni/components/formitem/formitem.js")+(()=>"../../uni_modules/nutui-uni/components/textarea/textarea.js")+(()=>"../../uni_modules/nutui-uni/components/switch/switch.js")+(()=>"../../uni_modules/shmily-drag-image/components/shmily-drag-image/shmily-drag-image.js")+(()=>"../../uni_modules/nutui-uni/components/button/button.js")+(()=>"../../uni_modules/nutui-uni/components/form/form.js"))();const a={__name:"store",setup(a){const i=e.ref(!1),s=e.ref(!1),p=e.reactive({shop_name:"",shop_desc:"",shop_phone:"",is_audit:0,bulletin_txt:"",service_txt:"",pay_imgs:[],wechat_imgs:[]}),n=e=>{p.is_audit=Number(s.value),console.log(p)},l=()=>{t.fetchSetConfig(p).then((t=>{e.index.showToast({icon:"none",title:"更新商城配置成功"}),setTimeout((()=>{e.index.redirectTo({url:"/pages/config/store",success:e=>{},fail:()=>{},complete:()=>{}})}),500)}))};e.onMounted((()=>{t.fetchGetConfig().then((e=>{console.log("res=====>",e),p.shop_name=e.appConfig.shop_name,p.shop_desc=e.appConfig.shop_desc,p.shop_phone=e.appConfig.shop_phone,p.bulletin_txt=e.appConfig.bulletin_txt,p.service_txt=e.appConfig.service_txt,p.is_audit=e.appConfig.is_audit,s.value=1==e.appConfig.is_audit,e.appConfig.bucket&&(i.value=!0);let t=JSON.parse(e.appConfig.pay_imgs),o=JSON.parse(e.appConfig.wechat_imgs);t.forEach((e=>{p.pay_imgs.push({id:e.image_id,file_path:e.file_path})})),o.forEach((e=>{p.wechat_imgs.push({id:e.image_id,file_path:e.file_path})})),console.log("form=====>",p)}))}));const u=()=>{e.index.chooseImage({count:9-(p.pay_imgs.length||0),sourceType:["album","camera"],success:t=>{t.tempFiles.forEach((t=>{e.index.uploadFile({url:o.getUploadImageUrl(),filePath:t.path,name:"iFile",formData:{group_id:1},success:e=>{let t=JSON.parse(e.data).data;p.pay_imgs.push({id:parseInt(t.file_id),file_path:t.file_path})}})}))}})},m=()=>{e.index.chooseImage({count:9-(p.wechat_imgs.length||0),sourceType:["album","camera"],success:t=>{t.tempFiles.forEach((t=>{e.index.uploadFile({url:o.getUploadImageUrl(),filePath:t.path,name:"iFile",formData:{group_id:1},success:e=>{let t=JSON.parse(e.data).data;p.wechat_imgs.push({id:parseInt(t.file_id),file_path:t.file_path})}})}))}})};return(t,o)=>e.e({a:e.o((e=>p.shop_name=e)),b:e.p({placeholder:"请输入店铺名称",type:"text",modelValue:p.shop_name}),c:e.p({label:"商城名称"}),d:e.o((e=>p.shop_desc=e)),e:e.p({autosize:!0,placeholder:"请输入店铺介绍",type:"text",modelValue:p.shop_desc}),f:e.p({label:"商城介绍"}),g:e.o((e=>p.shop_phone=e)),h:e.p({placeholder:"请输入手机号码",type:"text",modelValue:p.shop_phone}),i:e.p({label:"手机号码"}),j:e.o((e=>p.bulletin_txt=e)),k:e.p({autosize:!0,placeholder:"请输入首页公告",type:"text",modelValue:p.bulletin_txt}),l:e.p({label:"首页公告"}),m:e.o((e=>p.service_txt=e)),n:e.p({autosize:!0,placeholder:"请输入服务描述",type:"text",modelValue:p.service_txt}),o:e.p({label:"服务描述"}),p:e.o(n),q:e.o((e=>s.value=e)),r:e.p({modelValue:s.value}),s:e.p({label:"是否审核模式"}),t:i.value},i.value?{v:e.o((e=>p.pay_imgs=e)),w:e.p({number:9,"add-image":u,keyName:"file_path",modelValue:p.pay_imgs})}:{},{x:i.value},i.value?{y:e.o((e=>p.wechat_imgs=e)),z:e.p({number:9,"add-image":m,keyName:"file_path",modelValue:p.wechat_imgs})}:{},{A:e.o(l),B:e.p({type:"primary"})})}},i=e._export_sfc(a,[["__scopeId","data-v-914575b5"]]);wx.createPage(i);