shish 2 лет назад
Родитель
Сommit
5668c3d03b
2 измененных файлов с 17 добавлено и 11 удалено
  1. 13 11
      ghsApp/src/admin/item/loan.vue
  2. 4 0
      ghsApp/src/api/inventory/index.js

+ 13 - 11
ghsApp/src/admin/item/loan.vue

@@ -57,7 +57,7 @@ import { list } from "@/mixins";
 import { mapGetters} from "vuex";
 import AppSearchModule from "@/components/module/app-search";
 import ModalModule from "@/components/plugin/modal"
-import { addItem } from "@/api/order-item";
+import { loanFn } from "@/api/inventory";
 import productMins from "@/mixins/product";
 export default {
 	components: { SelectList, AppWrapperEmpty,AppSearchModule,ModalModule},
@@ -82,7 +82,9 @@ export default {
 			breakFocus:false,
 			breakShow:false,
 			checkStock:false,
-			T:null
+			T:null,
+			inId:0,
+			outId:0
 		};
 	},
 	onLoad() {
@@ -95,6 +97,8 @@ export default {
 		let prevPage = pages[ pages.length - 2 ];
 		prevPage.$vm.addSelectItem = 1
 
+		this.inId = this.option.itemId?this.option.itemId:0
+
 	},
 	onPullDownRefresh() {
 		this.resetList();
@@ -112,18 +116,16 @@ export default {
 	},
 	methods: {
 		loanItem(item){
-			let that = this
-			let id = this.option.id ? this.option.id : 0
-			let data = [{id:item.id,bigCount:item.bigCount}]
-			uni.showLoading({mask:true})
-			addItem({data:JSON.stringify(data),id:id}).then(res=>{
-				uni.hideLoading()
+			if(Number(item.bigCount)<=0){
+				this.$msg('请填写数量')
+				return false
+			}
+			loanFn({inId:this.inId,outId:item.id,num:bigCount}).then(res=>{
 				if(res.code == 1){
-					that.$msg('借用成功')
-					that.goBack()
+					this.$msg('操作成功')
+					this.goBack()
 				}
 			})
-			item.bigCount=''
 		},
 		goBack(){
 			let pages = getCurrentPages();

+ 4 - 0
ghsApp/src/api/inventory/index.js

@@ -1,5 +1,9 @@
 import https from "@/plugins/luch-request_0.0.7/request";
 
+export const loanFn = data => {
+	return https.get("/check-order/loan", data);
+};
+
 export const clearStock = data => {
 	return https.get("/check-order/clear-stock", data);
 };