Jelajahi Sumber

支付渠道

dct 9 bulan lalu
induk
melakukan
8107563008
2 mengubah file dengan 35 tambahan dan 26 penghapusan
  1. 13 12
      src/api/payChannel.js
  2. 22 14
      src/pages/systemSetting/payChannel/index.vue

+ 13 - 12
src/api/payChannel.js

@@ -1,21 +1,22 @@
 import http from '@/utils/request'
 
 // 获取支付渠道
-export function getPayChannel ({ keyWords1 = '', type = '', pageNum = 1, pageSize = 10 }) {
+export function getPayChannel ({ keyWords = '', payType = '', status = '', pageNum = 1, pageSize = 10 }) {
   return http.post('/admin/payChannel', {
-    type,
-    keyWords1,
-    pageNum,
-    pageSize
+    data: {
+      export: false,
+      pageSize,
+      pageNum,
+      name: keyWords,
+      status,
+      payType
+    }
   })
 }
 
 // 创建
-export function addPayChannel ({ name = '', picture = '' }) {
-  return http.post('/admin/payChannel/add', {
-    name,
-    picture
-  })
+export function addPayChannel ({ name = '', status = 1 }) {
+  return http.post('/admin/payChannel/add', { data: { name, status } })
 }
 
 // 删除
@@ -24,8 +25,8 @@ export function deletePayChannel (id) {
 }
 
 // 更新
-export function updatePayChannel ({ name, status, id }) {
-  return http.post(`/admin/payChannel/update`, { name, status, id })
+export function updatePayChannel ({ status, id }) {
+  return http.post(`/admin/payChannel/updateStatus`, { data: { status, id } })
 }
 
 // 更新

+ 22 - 14
src/pages/systemSetting/payChannel/index.vue

@@ -9,10 +9,16 @@
       <div class="block-title">
         查询条件
       </div>
+      <el-form-item label="名称">
+        <el-input
+          v-model="form.keyWords"
+          placeholder="请输入名称">
+        </el-input>
+      </el-form-item>
       <el-form-item
         label="状态"
-        prop="keyWords1">
-        <el-select v-model="form.keyWords1">
+        prop="status">
+        <el-select v-model="form.status">
           <el-option
             label="全部"
             value=""></el-option>
@@ -80,11 +86,11 @@
         </el-table-column>
 
         <el-table-column
-          prop="type"
+          prop="payType"
           label="类型"
         >
           <template slot-scope="scope">
-            {{ nameMap[scope.row.type] || scope.row.type }}
+            {{ nameMap[scope.row.payType] || scope.row.payType }}
           </template>
         </el-table-column>
 
@@ -113,20 +119,20 @@
             <el-button @click="$refs.ticketSpot.show(scope.row)">
               绑定售票点
             </el-button>
-            <el-button
-              v-if="scope.row.type==='NOPAY'"
+            <!-- <el-button
+              v-if="scope.row.payType ==='NO_PAY'"
               type="primary"
               size="small"
               @click="$refs.modal.show('edit',scope.row)">
               编辑
             </el-button>
             <el-button
-              v-if="scope.row.type==='NOPAY'"
+              v-if="scope.row.payType ==='NO_PAY'"
               type="danger"
               size="small"
               @click="handleDelete(scope.row.id)">
               删除
-            </el-button>
+            </el-button> -->
           </template>
         </el-table-column>
       </el-table>
@@ -154,13 +160,13 @@
 <script>
 import Modal from './Modal.vue'
 import TicketSpot from './TicketSpot.vue'
-import { getPayChannel, updatePayChannel, deletePayChannel } from '@/api/payChannel.js'
+import { getPayChannel, updatePayChannel, deletePayChannel } from '@/api/payChannel'
 
 const nameMap = {
   'POS': 'POS机',
   'VALUECARD': '存值卡',
   'BSCANC': 'B扫C支付',
-  'NOPAY': '无需支付'
+  'NO_PAY': '无需支付'
 }
 
 export default {
@@ -180,7 +186,8 @@ export default {
       form: {
         pageNum: 1,
         pageSize: 10,
-        keyWords1: '',
+        keyWords: '',
+        status: '',
         type: ''
       },
       accountList: [],
@@ -189,7 +196,7 @@ export default {
       loading: false
     }
   },
-  async created () {
+  created () {
     this.getList()
   },
   methods: {
@@ -200,8 +207,9 @@ export default {
       this.loading = true
       goFirst && (this.form.pageNum = 1)
       getPayChannel(this.form).then(res => {
-        this.total = res.total
-        this.tableData = res.list
+        console.log('res', res)
+        this.total = res.data?.total || 0
+        this.tableData = res.data?.records
         console.log('this.tableData', this.tableData)
       }).finally(() => {
         this.loading = false