test_lgq/niucloud/public/admin/assets/pay-1ad59aaf.js

2 lines
8.0 KiB
JavaScript
Raw Normal View History

2024-01-24 17:36:08 +08:00
import{d as defineComponent,O as useRoute,r as ref,s as watch,D as nextTick,y as withDirectives,h as openBlock,I as createBlock,w as withCtx,c as createElementBlock,a as createBaseVNode,t as toDisplayString,u as unref,e as createVNode,i as createTextVNode,N as t,B as createCommentVNode,F as Fragment,G as renderList,R as img,a4 as ElMessage,E as ElButton,aM as ElSwitch,aw as ElTag,$ as ElCard,a0 as vLoading,_ as _export_sfc}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{X as getPayConfigList,Y as setPatConfig}from"./sys-8ead7f22.js";import{_ as _sfc_main$1}from"./pay-wechatpay.vue_vue_type_script_setup_true_lang-2f434b35.js";import{_ as _sfc_main$2}from"./pay-alipay.vue_vue_type_script_setup_true_lang-4630f466.js";import{_ as _sfc_main$3}from"./pay-offlinepay.vue_vue_type_script_setup_true_lang-229d2a29.js";import{S as Sortable}from"./sortable.esm-be94e56d.js";/* empty css *//* empty css */import"./index.vue_vue_type_style_index_0_lang-cd8f78e9.js";/* empty css *//* empty css */import"./el-form-item-4ed993c7.js";const _hoisted_1={key:0,class:"flex justify-between items-center"},_hoisted_2={class:"text-[20px]"},_hoisted_3={class:"flex mb-3"},_hoisted_4={class:"text-base"},_hoisted_5={class:"pay-table"},_hoisted_6={class:"flex items-center pay-table-head table-bg table-item-pd table-item-border justify-between table-bg"},_hoisted_7={class:"text-base text-[#999] w-[150px]"},_hoisted_8={class:"text-base text-[#999] w-[110px] text-center"},_hoisted_9={key:0,class:"text-base text-[#999] w-[80px] text-center"},_hoisted_10=["data-key"],_hoisted_11=["id"],_hoisted_12={class:"table-item-flex w-[150px]"},_hoisted_13={key:0,class:"iconfont icontuodong mr-2 handle cursor-pointer"},_hoisted_14={class:"flex items-center select-none"},_hoisted_15={class:"mr-[15px] w-[30px] h-[30px]"},_hoisted_16=["src"],_hoisted_17={class:"text-base text-[#666]"},_hoisted_18={class:"table-item-flex w-[110px] justify-center select-none"},_hoisted_19={key:1},_hoisted_20={key:0,class:"table-item-flex w-[80px] justify-center select-none"},_hoisted_21=["onClick"],_hoisted_22={key:1},_hoisted_23={key:1,class:"fixed-footer-wrap"},_hoisted_24={class:"fixed-footer"},_sfc_main=defineComponent({__name:"pay",setup(__props){const route=useRoute(),pageName=route.meta.title,wechatpayDialog=ref(null),alipayDialog=ref(null),offlinepayDialog=ref(null),payLoading=ref(!0),isEdit=ref(!1),setConfigBtn=ref(),payConfigData=ref([]),checkPayConfigList=()=>{getPayConfigList().then(e=>{const a=e.data;for(const o in a){const s=a[o].pay_type,n=[];let c="";s.forEach((i,r)=>{i.redio_key=a[o].key+"_"+i.key,i.defauit_key="",i.is_default==1&&(c=i.redio_key),i.status=Boolean(i.status),n.push(i)}),a[a[o].key].default_pay_type=c,a[a[o].key].pay_type=n}payConfigData.value=a,payLoading.value=!1,nextTick(()=>{fieldBoxRefs.value.forEach((o,s)=>{sortableFn(o)})})}).catch(()=>{})};checkPayConfigList();const setConfigInfo=e=>{console.log(e),payConfigData.value[e.channel].pay_type.forEach(a=>{a.key==e.type&&(a.config=e.config)}),console.log(payConfigData.value)},configPayFn=data=>{eval(data.key+"Dialog.value.setFormData(data)"),eval(data.key+"Dialog.value.showDialog = true;")},enablePaymentMode=e=>{var a,o;if(e.key=="wechatpay"&&!((a=e==null?void 0:e.config)!=null&&a.mch_secret_cert)||e.key=="alipay"&&!((o=e==null?void 0:e.config)!=null&&o.alipay_root_cert_path))return e.status=!1,ElMessage(t("configurePaymentMethod")),!1},fieldBoxRefs=ref([]);watch(isEdit,(e,a)=>{e&&nextTick(()=>{fieldBoxRefs.value.forEach((o,s)=>{sortableFn(o)})})});const sortableFn=(e,a)=>{Sortable.create(e,{group:{put:!1},handle:".handle",animation:200,disabled:!1,onEnd:o=>{const s=o.target.getAttribute("data-key"),n=payConfigData.value[s].pay_type;n.splice(o.newIndex,0,...n.splice(o.oldIndex,1))}})},saveFn=()=>{payLoading.value=!0;const e=JSON.parse(JSON.stringify(payConfigData.value));Object.values(e).forEach((a,o)=>{a.