Browse Source

( $ _ $ )

aliyun0758874076 1 year ago
parent
commit
cf3fb8531b

+ 14 - 0
src/api/voucherManagement/businessRechargeAmounts.js

@@ -41,3 +41,17 @@ export const disableAcount = (data) => request({
   method: 'post',
   data
 })
+
+// /businessRechargeAmounts/switchRecharge
+export const switchRecharge = (data) => request({
+  url: '/businessRechargeAmounts/switchRecharge',
+  method: 'post',
+  data
+})
+
+// /businessRechargeAmounts/switchRechargeOf
+export const switchRechargeOf = (data) => request({
+  url: '/businessRechargeAmounts/switchRechargeOf',
+  method: 'post',
+  data
+})

+ 29 - 1
src/views/voucherManagement/rechargeManagement/index.vue

@@ -12,6 +12,17 @@
         <el-form-item>
           <!-- <el-button type="primary" plain @click="search">查询</el-button> -->
           <el-button type="success" plain @click="isCreate = true;isUpdata = false">新增充值额度</el-button>
+          <el-switch
+            v-model.number="isOpenUp"
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+            :active-value="1"
+            :inactive-value="0"
+            active-text="开启商家充值"
+            inactive-text="关闭商家充值"
+            @change="openUp()"
+          >
+          </el-switch>
           <!-- <el-button type="info" plain @click="clear">重置</el-button> -->
         </el-form-item>
       </el-form>
@@ -114,12 +125,13 @@
 
 <script>
 import Cookies from 'js-cookie'
-import { saveAcount, updateAcount, deleteAcount, getAllAcount, getByIdAcount, disableAcount } from '@/api/voucherManagement/businessRechargeAmounts'
+import { saveAcount, updateAcount, deleteAcount, getAllAcount, getByIdAcount, disableAcount, switchRecharge, switchRechargeOf } from '@/api/voucherManagement/businessRechargeAmounts'
 export default {
   // eslint-disable-next-line vue/match-component-file-name
   name: 'RechargeManagement',
   data() {
     return {
+      isOpenUp: 0,
       isShowDelete: false,
       isCreate: false,
       querySelect: {
@@ -152,6 +164,13 @@ export default {
   created() {
     // this.formData.shopId = Cookies.get('shopID')
     this.getDataList()
+    switchRechargeOf().then((res) => {
+      this.isOpenUp = Number(res.data.switchRecharge)
+      console.log(res)
+    })
+      .catch((err) => {
+        console.log(err)
+      })
   },
   methods: {
     getDataList() {
@@ -253,6 +272,15 @@ export default {
         })
         this.getDataList()
       })
+    },
+    openUp(value) {
+      // console.log(value)
+      // console.log(this.isOpenUp)
+      switchRecharge({
+        switchOf: this.isOpenUp
+      }).then((res) => {
+        console.log(res)
+      })
     }
   }
 }