瀏覽代碼

添加客户

shish 2 年之前
父節點
當前提交
472b931692
共有 2 個文件被更改,包括 73 次插入3 次删除
  1. 8 0
      ghs/src/service/custom/index.js
  2. 65 3
      ghs/src/views/member/list.vue

+ 8 - 0
ghs/src/service/custom/index.js

@@ -3,6 +3,14 @@ import { BaseService, Service } from '@/cool';
 @Service('custom')
 export class CustomService extends BaseService {
 
+	createCustomers(data) {
+		return this.request({
+			url: '/create-customers',
+			method: 'POST',
+			data: data
+		});
+	}
+
 	recharge(data) {
 		return this.request({
 			url: '/recharge',

+ 65 - 3
ghs/src/views/member/list.vue

@@ -69,8 +69,9 @@
 			</template>
 			
 			<template #slot-billing>
-				<el-button type="primary" size="mini" style="margin-left:50px;" @click="billing()">开单 Ctrl+,</el-button>
-				<el-button type="primary" size="mini" style="margin-left:50px;" @click="newCg()">新增采购 Ctrl+.</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="add()">添加客户</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="billing()">开单</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="newCg()">采购</el-button>
 			</template>
 
 			<template #table-column-name="{scope}">
@@ -117,6 +118,32 @@
 			</div>
     	</el-dialog>
 
+		<el-dialog title="添加客户" :visible.sync="addPop" width="600px" center :close-on-click-modal="false">
+			<div>
+				<div class="accounts-list">
+					客户名称
+					<el-input style="width: 80%" v-model="name1" clearable></el-input>
+				</div>
+
+				<div class="accounts-list">
+					客户手机
+					<el-input style="width: 80%" v-model="mobile1" clearable></el-input>
+				</div>
+
+				<div class="accounts-list">
+					确认手机
+					<el-input style="width: 80%" v-model="confirmMobile1" clearable></el-input>
+				</div>
+				<div class="accounts-list" style="margin-top:20px;">
+					<span></span>
+					<div class="accounts-center">
+						<el-button @click="resetAdd()">取消</el-button>
+						<el-button type="primary" @click="confirmAdd()" style="margin-left:80px;">确认</el-button>
+					</div>
+				</div>
+			</div>
+    	</el-dialog>
+
 	</div>
 </template>
 
@@ -151,7 +178,11 @@ export default {
 			rechargePayWay:-1,
 			rechargePop:false,
 			rechargeTitle:'充值',
-			rechargeCustom:{}
+			rechargeCustom:{},
+			name1:'',
+			mobile1:'',
+			confirmMobile1:'',
+			addPop:false
 		};
 	},
 	computed: {
@@ -179,6 +210,37 @@ export default {
 			let query = {}
 			this.$router.push({path:'/in/add',query})
 		},
+		add(){
+			this.addPop = true
+		},
+		resetAdd(){
+			this.name1 = ''
+			this.mobile1 = ''
+			this.addPop = false
+			this.confirmMobile1 = ''
+		},
+		confirmAdd(){
+			if(this.mobile1 != this.confirmMobile1){
+				this.$message({message: '二次手机号不一致',type: 'warning'})
+				return false
+			}
+			if(this.mobile1.length != 11){
+				this.$message({message: '手机号错误',type: 'warning'})
+				return false
+			}
+			if(this.$util.isEmpty(this.name1)){
+				this.$message({message: '请填写名称',type: 'warning'})
+				return false
+			}
+
+			this.$confirm('确认添加?', '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
+				this.$service.custom.createCustomers({ name1:this.name1,mobile1:this.mobile1,confirmMobile1:this.confirmMobile1}).then(data => {
+					this.resetAdd()
+					this.$notify({ title: '添加成功,15秒后生效', message: 'success', type: 'success'})
+					this.app.refresh({ type: this.tabIndex })
+				})
+			})
+		},
 		billing(){
 			let query = {}
 			this.$router.push({path:'/order/add',query})