shish 2 лет назад
Родитель
Сommit
b7b85f0bea
3 измененных файлов с 34 добавлено и 51 удалено
  1. 8 0
      ghs/src/service/ghs/index.js
  2. 21 2
      ghs/src/views/in/add.vue
  3. 5 49
      ghs/src/views/in/ghs.vue

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

@@ -2,5 +2,13 @@ import { BaseService, Service } from '@/cool';
 @Service('ghs')
 export class CustomService extends BaseService {
 
+    add(data) {
+		return this.request({
+			url: '/add',
+			method: 'POST',
+			data: data
+		});
+	}
+
 }
 export default new CustomService();

+ 21 - 2
ghs/src/views/in/add.vue

@@ -1,10 +1,14 @@
 <template>
-  <div v-if="form.ghsId == 0" style="text-align:center;margin-top:60px;">
+  <div v-if="form.ghsId == 0" style="text-align:left;margin-top:10vh;margin-left:10vw;">
     <span style="font-size:20px;">供货商</span>
-    <el-select @change="selectGhsFn" v-model="selectGhsName" filterable remote reserve-keyword placeholder="输入拼音首字母,光标插入 Ctrl + C" clearable ref="ghsRef"
+    <el-select @change="selectGhsFn" v-model="selectGhsName" filterable remote reserve-keyword placeholder="输入拼音首字母,光标插入 Ctrl + C" clearable ref="ghsRef" @blur="getGhsBlur"
 				:remote-method="selectGhsInfo" :loading="loading" style="width:300px;margin-left:20px;" size="big">
     				<el-option v-for="item in customInfoList" :key="item.id" :label="`${item.name}`" :value="item"></el-option>
   				</el-select>
+
+          <el-button :type="location == 0?'primary':''" @click="location=0" size="medium" style="margin-left:50px;" round>上游</el-button>
+					<el-button :type="location == 1?'primary':''" @click="location=1" size="medium" round>本地</el-button>
+          <el-button type="primary" @click="addGhs()" style="margin-left:20px;" size="medium">添加</el-button>
   </div>
   <div class="app-list-content" v-else>
     <div class="left_box">
@@ -483,6 +487,21 @@ export default {
 
   },
   methods: {
+    getGhsBlur(){
+      this.selectGhsName = this.$refs.ghsRef.selectedLabel
+    },
+    addGhs(){
+      if(this.$util.isEmpty(this.selectGhsName)){
+        this.$message({message: '请填写名称',type: 'warning'});
+        return false
+      }
+      this.$confirm('确认添加?', '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
+        this.$service.ghs.add({name:this.selectGhsName,location:this.location,mobile:''}).then(data=>{
+          this.$notify({ title: '成功', message: '添加成功', type: 'success'})
+          this.$refs.ghsRef.focus()
+        })
+      })
+    },
 		inputFn(e) {
 			let price = Number(this.selectAllPrice);
 			//打包费

+ 5 - 49
ghs/src/views/in/ghs.vue

@@ -62,7 +62,7 @@
 			</template>
 			
 			<template #slot-billing>
-				<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="addGhs()">添加供货商</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>
@@ -115,22 +115,6 @@
 			</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" 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>
 
@@ -168,8 +152,7 @@ export default {
 			rechargeCustom:{},
 			name1:'',
 			mobile1:'',
-			confirmMobile1:'',
-			addPop:false
+			confirmMobile1:''
 		};
 	},
 	computed: {
@@ -203,36 +186,9 @@ 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 })
-				})
-			})
+		addGhs(){
+			let query = {}
+			this.$router.push({path:'/in/add',query})			
 		},
 		billing(){
 			let query = {}