فهرست منبع

前端 客户管理更新sdy

zhongtianhaoyuan 3 سال پیش
والد
کامیت
fe991d77f1

+ 10 - 2
src/api/V2/houseSelfCollect/index.js

@@ -1,4 +1,12 @@
 //客户管理列表
 export const API_GET_CUSTOMER_MANAGE = '/identityAuthenticationInfo/selectIdentityAuthenticationInfoPurchase'
-//新增粮商
-export const API_GET_CUSTOMER_ADD = '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo'
+//新增粮商1
+export const API_POST_CUSTOMER_ADD = '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo'
+//新增粮商2
+export const API_GET_CUSTOMER_IDENTITY = '/identityAuthenticationInfo/saveCompanyIdentity'
+//客户管理删除
+export const API_GET_CUSTOMER_DELETE = '/identityAuthenticationInfo/api/deleteCompanyIdentity'
+//客户查看
+export const API_GET_CUSTOMER_LOOK = '/identityAuthenticationInfo/api/getIdentityAuthenticationInfo'
+
+

+ 12 - 3
src/model/houseSelfCollect/index.js

@@ -3,12 +3,21 @@ import { appRx } from '../defalutConfig/indexRx'
 
 import {
   API_GET_CUSTOMER_MANAGE,
-  API_GET_CUSTOMER_ADD
+  API_POST_CUSTOMER_ADD,
+  API_GET_CUSTOMER_IDENTITY,
+  API_GET_CUSTOMER_DELETE,
+  API_GET_CUSTOMER_LOOK
 
 } from '@/api/V2/houseSelfCollect'
 //客户管理列表
 export const getCustomerManage = appRx.get(API_GET_CUSTOMER_MANAGE, errorCatcher, errorHandle, filter)
-//新增粮商
-export const customerAdd = appRx.post(API_GET_CUSTOMER_ADD, errorCatcher, errorHandle, filter)
+//新增粮商1
+export const customerAdd = appRx.post(API_POST_CUSTOMER_ADD, errorCatcher, errorHandle, filter)
+//新增粮商2
+export const customerIdentity = appRx.get(API_GET_CUSTOMER_IDENTITY, errorCatcher, errorHandle, filter)
+//客户管理删除
+export const getCustomerDelete = appRx.post(API_GET_CUSTOMER_DELETE, errorCatcher, errorHandle, filter)
+//客户查看
+export const getCustomerLook = appRx.get(API_GET_CUSTOMER_LOOK, errorCatcher, errorHandle, filter)
 
 

+ 32 - 24
src/views/houseSelfCollect/customerManagement.vue

@@ -4,7 +4,7 @@
     <BaseHeaderLayout :leftSpan="12">
       <template slot="left">
         <ws-button type="primary" @click="getCustomer()">获取客户</ws-button>
-        <ws-button type="primary" @click="createCustomer()"
+        <ws-button type="primary" @click="createCustomer(1)"
           >创建新客户</ws-button
         >
       </template>
@@ -95,12 +95,12 @@
       <el-table-column prop="customerName" label="客户"></el-table-column>
       <el-table-column prop="customerPhone" label="手机号"></el-table-column>
       <el-table-column prop="bankCard" label="银行卡号"></el-table-column>
+      <el-table-column prop="bankDeposit" label="开户行"></el-table-column>
+      <el-table-column prop="payeeName" label="收款人"></el-table-column>
       <el-table-column
-        prop="bankDeposit"
-        label="开户行"
+        prop="authenticationStatus"
+        label="状态"
       ></el-table-column>
-      <el-table-column prop="payeeName" label="收款人"></el-table-column>
-      <el-table-column prop="authenticationStatus" label="状态"></el-table-column>
       <el-table-column prop="address" label="操作">
         <template slot-scope="scope">
           <img
@@ -108,7 +108,7 @@
             height="16"
             style="vertical-align: text-top; margin: 0 6px"
             src="../../../public/img/chakan.png"
-            @click="handleExamine(scope.row)"
+            @click="createCustomer(scope.row,2)"
             v-hasPermission="
               `contractManagement.buyContract.buyContractInfo.view`
             "
@@ -119,7 +119,7 @@
             height="16"
             style="vertical-align: text-top; margin: 0 6px"
             src="../../../public/img/bianji.png"
-            @click="handleEdit(scope.row)"
+            @click="createCustomer(scope.row,3)"
             v-hasPermission="
               `contractManagement.buyContract.buyContractInfo.edit`
             "
@@ -158,7 +158,10 @@
   </div>
 </template>
 <script>
-import { getCustomerManage } from '@/model/houseSelfCollect/index'
+import {
+  getCustomerManage,
+  getCustomerDelete,
+} from '@/model/houseSelfCollect/index'
 import QRCode from 'qrcodejs2'
 import customerManagementAdd from './customerManagementAdd.vue'
 export default {
@@ -186,7 +189,7 @@ export default {
   },
   methods: {
     find() {
-      console.log('搜索')
+      this.getList()
     },
     //获取客户
     getCustomer() {
@@ -205,11 +208,11 @@ export default {
     //选择仓库改变事件
     selecttaskType() {},
     //创建客户
-    createCustomer() {
-      // this.creatNewCustomerDialogVisible = true
+    createCustomer(row,num) {
+      let type = num
       this.$router.push({
         name: 'customerManagementAdd',
-        // query: { id: row.id },
+        query: { types: type ,id:row.id},
       })
     },
     handleSizeChange(val) {
@@ -222,15 +225,8 @@ export default {
       console.log(`当前页: ${val}`)
       this.getList()
     },
-    handleExamine(row) {
-      console.log(row)
-      // this.$router.push({
-      //   name: 'purchaseContractExamine',
-      //   query: { id: row.id, status: row.status },
-      // })
-    },
+    
     handleEdit(row) {
-      console.log(row)
       this.$router.push({
         name: 'customerManagementEdit',
         query: {
@@ -244,21 +240,33 @@ export default {
         cancelButtonText: '取消',
         type: 'warning',
       })
-        .then(() => {})
+        .then(() => {
+          getCustomerDelete({
+            compId: sessionStorage.getItem('ws-pf_compId'),
+            id:row.id
+          })
+            .toPromise()
+            .then((response) => {
+             this.$message.success('删除成功')
+             this.getList()
+            })
+        })
         .catch(() => {
           return false
         })
     },
     getList() {
-         getCustomerManage({
+      getCustomerManage({
         compId: sessionStorage.getItem('ws-pf_compId'),
         currentPage: this.currentPage,
         pageSize: this.pageSize,
+        searchKeyWord: this.searchKeyWord
       })
         .toPromise()
         .then((response) => {
-         console.log(response)
-         this.customertList = response.records
+          console.log(response)
+          this.customertList = response.records
+           this.deptBudgetTotal = response.total
         })
     },
   },

+ 255 - 123
src/views/houseSelfCollect/customerManagementAdd.vue

@@ -3,7 +3,7 @@
   <div class="center">
     <el-row>
       <el-col :span="12">
-        <h2 class="bg-left titleup">新增粮商</h2>
+        <h2 class="bg-left titleup">{{ trader }}粮商</h2>
       </el-col>
       <el-col :span="12" class="bg-right">
         <el-button class="bg-bottom" type="primary" size="small" @click="cancel"
@@ -25,34 +25,69 @@
       <ws-form ref="customerList" :model="customerList" label-width="120px">
         <ws-info-table>
           <div style="display: flex; width: 100%; text-align: center">
-              <div style="width: 50%;margin:0 auto">
-                上传身份证正面
-                <el-upload
-                    action="https://www.zthymaoyi.com/upload/admin"
-                  :limit="1"
-                  list-type="picture-card"
-                  :on-preview="handlePictureCardPreview"
-                  :on-remove="handleRemove"
-                  :auto-upload="true"
-                  :on-success="upLoadSuccess1"
-                >
-                  <i class="el-icon-plus"></i>
-                </el-upload>
-              </div>
-              <div style="width: 50%;margin:0 auto">
-                上传身份证反面
-                <el-upload
-                    action="https://www.zthymaoyi.com/upload/admin"
-                  :limit="1"
-                  list-type="picture-card"
-                  :on-preview="handlePictureCardPreview"
-                  :on-remove="handleRemove"
-                   :auto-upload="true"
-                   :on-success="upLoadSuccess2"
-                >
-                  <i class="el-icon-plus"></i>
-                </el-upload>
-              </div>
+            <div v-if="switchType==1" style="width: 50%; margin: 0 auto">
+               上传身份证正面
+              <el-upload
+                action="https://www.zthymaoyi.com/upload/admin"
+                :limit="1"
+                list-type="picture-card"
+                :on-preview="handlePictureCardPreview"
+                :on-remove="handleRemove"
+                :auto-upload="true"
+                :on-success="upLoadSuccess1"
+                :disabled="disabled"
+              >
+                <i class="el-icon-plus"></i>
+              </el-upload>
+            </div>
+            <div style="width: 50%; margin: 0 auto" :class="identityUp" v-if="switchType==2||switchType==3">
+              上传身份证正面
+              <el-upload
+                action="https://www.zthymaoyi.com/upload/admin"
+                :limit="1"
+                list-type="picture-card"
+                :on-preview="handlePictureCardPreview"
+                :on-remove="(file) => {handleRemove(file,identityUp)}"
+                :auto-upload="true"
+                :on-success="upLoadSuccess1"
+                :disabled="disabled"
+                :file-list="identityImgUp"
+              >
+                <i class="el-icon-plus"></i>
+              </el-upload>
+            </div>
+            <div v-if="switchType==1" style="width: 50%; margin: 0 auto">
+               上传身份证反面
+              <el-upload
+                action="https://www.zthymaoyi.com/upload/admin"
+                :limit="1"
+                list-type="picture-card"
+                :on-preview="handlePictureCardPreview"
+                :on-remove="handleRemove"
+                :auto-upload="true"
+                :on-success="upLoadSuccess2"
+                :disabled = "disabled"
+              >
+                <i class="el-icon-plus"></i>
+              </el-upload>
+
+            </div>
+            <div style="width: 50%; margin: 0 auto" v-if="switchType==2||switchType==3" class="low">
+              上传身份证反面
+              <el-upload
+                action="https://www.zthymaoyi.com/upload/admin"
+                :limit="1"
+                list-type="picture-card"
+                :on-preview="handlePictureCardPreview"
+                :on-remove="handleRemove"
+                :auto-upload="true"
+                :on-success="upLoadSuccess2"
+                :disabled="disabled"
+                :file-list="identityImgLow"
+              >
+                <i class="el-icon-plus"></i>
+              </el-upload>
+            </div>
           </div>
 
           <ws-form-item label="姓名" span="1" prop="customerName">
@@ -66,7 +101,7 @@
           </ws-form-item>
           <ws-form-item label="身份证号" span="1" prop="customerNumberCard">
             <ws-input
-            v-model="customerList.customerNumberCard"
+              v-model="customerList.customerNumberCard"
               placeholder="请输入身份证号"
               maxlength="100"
               size="small"
@@ -74,38 +109,72 @@
             />
           </ws-form-item>
           <div style="display: flex; width: 100%; text-align: center">
-              <div style="width: 50%;margin:0 auto">
-                上传银行卡正面
-                <el-upload
-                    action="https://www.zthymaoyi.com/upload/admin"
-                  :limit="1"
-                  list-type="picture-card"
-                  :on-preview="handlePictureCardPreview"
-                  :on-remove="handleRemove1"
-                  :auto-upload="true"
-                  :on-success="bankSuccess1"
-                >
-                  <i class="el-icon-plus"></i>
-                </el-upload>
-              </div>
-              <div style="width: 50%;margin:0 auto">
-                上传银行卡反面
-                <el-upload
-                    action="https://www.zthymaoyi.com/upload/admin"
-                  :limit="1"
-                  list-type="picture-card"
-                  :on-preview="handlePictureCardPreview"
-                  :on-remove="handleRemove1"
-                   :auto-upload="true"
-                   :on-success="bankSuccess2"
-                >
-                  <i class="el-icon-plus"></i>
-                </el-upload>
-              </div>
+            <div style="width: 50%; margin: 0 auto" v-if="switchType==1" >
+               上传银行卡正面
+              <el-upload
+                action="https://www.zthymaoyi.com/upload/admin"
+                :limit="1"
+                list-type="picture-card"
+                :on-preview="handlePictureCardPreview"
+                :on-remove="handleRemove1"
+                :auto-upload="true"
+                :on-success="bankSuccess1"
+                :disabled="disabled"
+              >
+                <i class="el-icon-plus"></i>
+              </el-upload>
+            </div>
+            <div style="width: 50%; margin: 0 auto" v-if="switchType==2||switchType==3" class="bankUp">
+              上传银行卡正面
+              <el-upload
+                action="https://www.zthymaoyi.com/upload/admin"
+                :limit="1"
+                list-type="picture-card"
+                :on-preview="handlePictureCardPreview"
+                :on-remove="handleRemove1"
+                :auto-upload="true"
+                :on-success="bankSuccess1"
+                :disabled="disabled"
+                :file-list="bankImgUp"
+              >
+                <i class="el-icon-plus"></i>
+              </el-upload>
+            </div>
+            <div style="width: 50%; margin: 0 auto" v-if="switchType==1">
+              上传银行卡反面
+              <el-upload
+                action="https://www.zthymaoyi.com/upload/admin"
+                :limit="1"
+                list-type="picture-card"
+                :on-preview="handlePictureCardPreview"
+                :on-remove="handleRemove1"
+                :auto-upload="true"
+                :on-success="bankSuccess2"
+                :disabled="disabled"
+              >
+                <i class="el-icon-plus"></i>
+              </el-upload>
+            </div>
+            <div style="width: 50%; margin: 0 auto" v-if="switchType==2||switchType==3" class="bankLow">
+              上传银行卡反面
+              <el-upload
+                action="https://www.zthymaoyi.com/upload/admin"
+                :limit="1"
+                list-type="picture-card"
+                :on-preview="handlePictureCardPreview"
+                :on-remove="handleRemove1"
+                :auto-upload="true"
+                :on-success="bankSuccess2"
+                :disabled="disabled"
+                :file-list="bankImgLow"
+              >
+                <i class="el-icon-plus"></i>
+              </el-upload>
+            </div>
           </div>
           <ws-form-item label="银行卡号" span="1" prop="bankCard">
             <ws-input
-            v-model="customerList.bankCard"
+              v-model="customerList.bankCard"
               placeholder="请输入银行卡号"
               maxlength="100"
               size="small"
@@ -114,7 +183,7 @@
           </ws-form-item>
           <ws-form-item label="开户行" span="1" prop="bankDeposit">
             <ws-input
-            v-model="customerList.bankDeposit"
+              v-model="customerList.bankDeposit"
               placeholder="请输入开户行"
               maxlength="100"
               size="small"
@@ -123,7 +192,7 @@
           </ws-form-item>
           <ws-form-item label="开户支行" span="1" prop="bankDepositBranch">
             <ws-input
-            v-model="customerList.bankDepositBranch"
+              v-model="customerList.bankDepositBranch"
               placeholder="请输入开户支行"
               maxlength="100"
               size="small"
@@ -132,7 +201,7 @@
           </ws-form-item>
           <ws-form-item label="收款人姓名" span="1" prop="payeeName">
             <ws-input
-            v-model="customerList.payeeName"
+              v-model="customerList.payeeName"
               placeholder="请输入收款人姓名"
               maxlength="100"
               size="small"
@@ -141,7 +210,7 @@
           </ws-form-item>
           <ws-form-item label="收款人身份证号" span="1" prop="payeeNumberCard">
             <ws-input
-            v-model="customerList.payeeNumberCard"
+              v-model="customerList.payeeNumberCard"
               placeholder="请输入收款人身份证号"
               maxlength="100"
               size="small"
@@ -150,7 +219,7 @@
           </ws-form-item>
           <ws-form-item label="手机号" span="1" prop="customerPhone">
             <ws-input
-            v-model="customerList.customerPhone"
+              v-model="customerList.customerPhone"
               placeholder="请输入手机号"
               maxlength="100"
               size="small"
@@ -182,7 +251,7 @@
         </el-form-item> -->
           <ws-form-item label="联系地址" span="1" prop="compAddress">
             <ws-input
-            v-model="customerList.compAddress"
+              v-model="customerList.compAddress"
               placeholder="请输入联系地址"
               maxlength="100"
               size="small"
@@ -190,18 +259,20 @@
             />
           </ws-form-item>
         </ws-info-table>
-         <div class="but">
-            <el-button type="primary" @click="commit">提交</el-button>
-            <!-- <el-button  type="primary">关闭</el-button> -->
-          </div>
+        <div class="but">
+          <el-button type="primary" @click="commit" v-if="switchType==1 || switchType==3">提交</el-button>
+          <el-button type="primary" @click = "cancel" v-if="switchType==2">关闭</el-button>
+        </div>
       </ws-form>
     </div>
   </div>
 </template>
 <script>
- import {
-  customerAdd
-  }from '@/model/houseSelfCollect/index'
+import {
+  customerAdd,
+  customerIdentity,
+  getCustomerLook,
+} from '@/model/houseSelfCollect/index'
 
 export default {
   components: {},
@@ -210,27 +281,69 @@ export default {
     return {
       dialogImageUrl: '',
       dialogVisible: false,
-     customerList:{},
+      customerList: {},
       disabledFlag: true,
       disabled: false,
-      identity:[],
-      bank:[],
+      identity: [],
+      bank: [],
+      trader: '新增',
+      switchType:"",
+      identityImgUp:[
+        {
+          url:"",
+        }
+      ],
+      identityImgLow:[
+        {
+          url:"",
+        }
+      ],
+      bankImgUp:[
+        {
+          url:"",
+        }
+      ],
+      bankImgLow:[
+        {
+          url:""
+        }
+      ],
+      identityUp:"up",
+    }
+  },
+  activated() {
+   this.switchType = this.$route.query.types
+    if(this.$route.query.types == null){
+       this.switchType = 1
+    } 
+    let id = this.$route.query.id
+    if ( this.switchType == 2) {
+      this.disabled = true
+      this.trader = '查看'
+      this.getList(id)
+    } else if (this.switchType == 3) {
+      this.disabled = false
+      this.trader = '编辑'
+      this.getList(id)
     }
+    console.log( this.switchType)
   },
   methods: {
-    handleRemove(file) {
-      for(let i = 0 ; i < this.identity.length; i++){
-        if(file.response.url == this.identity[i]){
-          this.identity.splice(i,1,"")
+    handleRemove(file,a) {
+      console.log(file)
+      console.log(a)
+      for (let i = 0; i < this.identity.length; i++) {
+        if (file.response.url == this.identity[i]) {
+          this.identity.splice(i, 1, '')
         }
-      } 
+      }
     },
-    handleRemove1(file){
-        for(let i = 0 ; i < this.bank.length; i++){
-        if(file.response.url == this.bank[i]){
-          this.bank.splice(i,1,"")
+    handleRemove1(file) {
+      for (let i = 0; i < this.bank.length; i++) {
+        if (file.response.url == this.bank[i]) {
+          this.bank.splice(i, 1, '')
         }
-      } 
+      }
       console.log(this.bank)
     },
     handlePictureCardPreview(file) {
@@ -276,59 +389,66 @@ export default {
       }
     },
     cancel() {
-       this.$router.push({ path: 'customerManagement' })
+      this.$router.push({ path: 'customerManagement' })
     },
-    upLoadSuccess1(e){
+    upLoadSuccess1(e) {
       this.identity[0] = e.url
     },
-     upLoadSuccess2(e){
+    upLoadSuccess2(e) {
       this.identity[1] = e.url
     },
-    bankSuccess1(e){
+    bankSuccess1(e) {
       this.bank[0] = e.url
     },
-     bankSuccess2(e){
+    bankSuccess2(e) {
       this.bank[1] = e.url
-     },
-     commit(){
-       this.$confirm(
-        '确定提交客户信息?',
-        '提示',
-        {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning',
-        }
-      )
+    },
+    commit() {
+      this.$confirm('确定提交客户信息?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
         .then(() => {
-          this.customerList. compId = sessionStorage.getItem('ws-pf_compId')
-         this.customerList.cardAddressUrl = this.identity.toString()
-         this.customerList.payeeAddressUrl = this.bank.toString()
-         this.customerList.customerTypeFlag = 1
-         this.customerList.customerType ="个人"
-         console.log( this.customerList)
-         
-
+          this.customerList.compId = sessionStorage.getItem('ws-pf_compId')
+          this.customerList.cardAddressUrl = this.identity.toString()
+          this.customerList.payeeAddressUrl = this.bank.toString()
+          this.customerList.customerTypeFlag = 1
+          this.customerList.customerType = '个人'
           customerAdd(this.customerList)
-        .toPromise()
-        .then((response) => {
-
-          // if(response.code == 200){
-          this.$message.success('添加成功')
-          this.$router.push({path:'customerManagement'})
-
-          // }
-         
-        
-        })
-
-
+            .toPromise()
+            .then((response) => {
+              this.customerList.id = response
+              customerIdentity(this.customerList)
+                .toPromise()
+                .then((response) => {
+                  console.log(response.code)
+                  this.$message.success('添加成功')
+                  this.$router.push({ path: 'customerManagement' })
+                })
 
+              // this.$message.success('添加成功')
+              // this.$router.push({ path: 'customerManagement' })
+            })
         })
         .catch(() => {
           return false
         })
-     }
+    },
+    getList(ids) {
+       getCustomerLook({id:ids})
+        .toPromise()
+        .then((response) => {
+          this.customerList = response
+          this.identity = this.customerList.cardAddressUrl.split(",")
+          this.identityImgUp[0].url = this.identity[0]
+          this.identityImgLow[0].url = this.identity[1]
+          this.bank = this.customerList.payeeAddressUrl.split(",")
+             this.bankImgUp[0].url = this.bank[0] 
+             this.bankImgLow[0].url = this.bank[1]
+          
+        })
+    },
   },
 }
 </script>
@@ -402,4 +522,16 @@ export default {
   text-align: center;
   margin: 20px auto;
 }
+/deep/.up .el-upload--picture-card{
+  display: none;
+}
+/deep/.low .el-upload--picture-card{
+  display: none;
+}
+/deep/.bankUp .el-upload--picture-card{
+  display: none;
+}
+/deep/.bankLow .el-upload--picture-card{
+  display: none;
+}
 </style>