Browse Source

完成了会员管理的指定关系

wzy 1 year ago
parent
commit
6c1e2c025e
2 changed files with 99 additions and 2 deletions
  1. 9 0
      src/api/customerMage.js
  2. 90 2
      src/views/member/memberList/index.vue

+ 9 - 0
src/api/customerMage.js

@@ -111,3 +111,12 @@ export function tipsGetById(data) {
     data
   })
 }
+
+// 指定关系
+export function appointRelationship(data){
+  return request({
+    url:"/buyer/appoint",
+    method:"post",
+    data
+  })
+}

+ 90 - 2
src/views/member/memberList/index.vue

@@ -86,6 +86,8 @@
                 <el-button type="text" size="small" @click.native.prevent="addBlackList(scope.row)">
                   {{ scope.row.ifBlack ? "取消黑名单" : "加入黑名单" }}
                 </el-button>
+                <el-button type="text" size="small" @click.native.prevent="appointBtn(scope.row)">指定关系</el-button>
+                
               </template>
             </el-table-column>
           </el-table>
@@ -153,6 +155,26 @@
         <el-button type="primary" @click="saveIntegral">确定</el-button>
       </span>
     </el-dialog>
+
+    <!--  指定关系 -->
+    <el-dialog title="选择关系" :visible.sync="appointDialog" width="25%" center :close-on-click-modal="false" @close="appintClose">
+      <span slot="footer" class="dialog-footer">
+        <el-form  label-width="120px">
+          <el-form-item label="请选择区域:">
+            <el-cascader :props="areaData" ref="cascaderRef" @change="handleCascaderChange"></el-cascader>
+          </el-form-item>
+          <el-form-item label="是否为加盟商:">
+            <template>
+              <el-radio v-model="appintForm.isType" label="1">加盟商</el-radio>
+              <el-radio  v-model="appintForm.isType"  label="2">代理商</el-radio>
+              <el-radio  v-model="appintForm.isType"  label="3">撤销状态</el-radio>
+            </template>
+          </el-form-item>
+        </el-form>
+        <el-button @click="appintCan">取消</el-button>
+        <el-button type="primary" @click="appintDetermine">确定</el-button>
+      </span>
+    </el-dialog>
     <member-details ref="memberDetails" @reset="reset" />
   </div>
 </template>
@@ -164,8 +186,10 @@ import {
   customerSaveUserLabel,
   customerBlacklist,
   updateBuyerCredit,
-  exportBuyerUser
+  exportBuyerUser,
+  appointRelationship
 } from '@/api/customerMage'
+import { getProvinceList,getChildAreaList } from '@/api/address'
 // import { getSelect } from '../../../api/renovation'
 import memberDetails from './details'
 // import { constants } from 'fs';
@@ -202,7 +226,33 @@ export default {
       editIntegral: false,
       buyerUserId: '', // 用户id
       credit: '', // 积分值 扣减积分则传负数
-      updateWay: true // 修改积分单选绑定
+      updateWay: true, // 修改积分单选绑定
+      appointDialog:false, // 指定关系的弹出框
+      areaData: {
+        lazy: true,
+        label: 'name',
+        value: 'id',
+        lazyLoad(node, resolve) {
+          const { level, value } = node;
+          if (level === 0) {
+            getProvinceList().then(res => {
+              resolve(res.data)
+            })
+          } else if (level != 0) {
+            getChildAreaList(value).then(res => {
+              resolve(res.data.map(item => {
+                item.leaf = level === 3
+                return item
+              }))
+            })
+          }
+        }
+      },
+      appintForm:{
+        buyerUserId:null,
+        region:null,
+        isType:'1'
+      }
     }
   },
   created() {
@@ -302,6 +352,44 @@ export default {
         this.addFormDialog = false
       }
     },
+    //  指定关系
+    appointBtn(row){
+      this.appintForm.buyerUserId = row.buyerUserId
+      this.appointDialog = true
+    },
+    // 获取省数据
+    handleCascaderChange() {
+      const checkedNode = this.$refs.cascaderRef.getCheckedNodes()
+      const nodeData = checkedNode[0].data
+      this.appintForm.region = nodeData.id
+    },
+    //  指定关系取消
+    appintCan(){
+      this.appointDialog = false
+    },
+    //  指定关系确认
+    async appintDetermine(){
+      if(this.appintForm.region == null && this.appintForm.isType != '3'){
+        this.$message.error("请选择区域");
+        return
+      }
+      let res = await appointRelationship(this.appintForm);
+      if(res.code == ""){
+        this.$message.success("指定关系成功")
+        this.appointDialog = false
+      }
+      console.log(res);
+    },
+    //  弹窗关闭 把数据重置
+    appintClose(){
+      this.appintForm = {
+        buyerUserId:null,
+        region:null,
+        isType:'1'
+      }
+      this.$refs.cascaderRef.inputValue = ""
+      console.log(this.$refs.cascaderRef);
+    },
     // 加入黑名单
     addBlackList(row) {
       //  "ifBlack": "是否加入黑名单 1-是 0-否"