lilei 4 سال پیش
والد
کامیت
bd2301a03f
2فایلهای تغییر یافته به همراه31 افزوده شده و 3 حذف شده
  1. 9 0
      src/api/customer.js
  2. 22 3
      src/views/customerManagement/customerInfo/list.vue

+ 9 - 0
src/api/customer.js

@@ -62,3 +62,12 @@ export const settleStyleFindAllList = (params) => {
     method: 'post'
   })
 }
+
+// 启用禁用
+export const updateEnableStatus = params => {
+  return axios({
+    url: `/cust/enable/${params.id}/${params.flag}`,
+    data: {},
+    method: 'get'
+  })
+}

+ 22 - 3
src/views/customerManagement/customerInfo/list.vue

@@ -124,13 +124,16 @@
           class="button-success"
           @click="handleDetail(record)"
           id="customerManagementList-detail-btn">详情</a-button>
-        <a-button
+        <!-- <a-button
           size="small"
           v-if="$hasPermissions('B_customer_customerInfo_del') && record.satelliteFlag!=1"
           type="link"
           class="button-error"
           @click="handleDel(record)"
-          id="customerManagementList-del-btn">删除</a-button>
+          id="customerManagementList-del-btn">删除</a-button> -->
+      </template>
+      <template slot="enableAction" slot-scope="text, record">
+        <a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.enabledFlag" @change="changeFlagHandle(text, record)"/>
       </template>
     </s-table>
     <!-- 客户详情 -->
@@ -141,7 +144,7 @@
 <script>
 import moment from 'moment'
 import { getArea } from '@/api/data'
-import { custList, custDel } from '@/api/customer'
+import { custList, custDel, updateEnableStatus } from '@/api/customer'
 import { custTypeFindAllList } from '@/api/custType'
 import { STable, VSelect } from '@/components'
 import customerManagementDetailModal from './detailModal.vue'
@@ -172,6 +175,7 @@ export default {
         { title: '联系电话', dataIndex: 'contactTel', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '最后销售时间', dataIndex: 'lastSaleTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '是否卫星仓', dataIndex: 'satelliteFlagDictValue', width: 110, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '启用禁用', scopedSlots: { customRender: 'enableAction' }, width: 200, align: 'center', fixed: 'right' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
@@ -201,6 +205,7 @@ export default {
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
+            data.list[i].enabledFlag = data.list[i].enabledFlag + '' === '1'
           }
           this.disabled = false
           return data
@@ -259,6 +264,20 @@ export default {
         }
       })
     },
+    // 修改状态
+    changeFlagHandle (text, record) {
+      const _data = {
+        id: record.id,
+        flag: record.enabledFlag ? '1' : '0'
+      }
+      updateEnableStatus(_data).then(res => {
+        if (res.status + '' === '200') {
+          this.$message.success(res.message)
+        } else {
+          record.enabledFlag = !record.enabledFlag
+        }
+      })
+    },
     //  客户合并
     handleMerge () {},
     //  客户信息详情