zhengxin 5 лет назад
Родитель
Сommit
e07cd8d4f0
2 измененных файлов с 124 добавлено и 34 удалено
  1. 1 1
      ghs/src/pagesPurchase/details.vue
  2. 123 33
      ghs/src/pagesStorehouse/allot/addExDetails.vue

+ 1 - 1
ghs/src/pagesPurchase/details.vue

@@ -148,7 +148,7 @@
 							:dateVal="form.entryTime"
 							:placeholder="'请选择日期'"
 						/>
-						<view v-else>{{ form.entryTime || "" }}</view>
+						<view v-else>{{ form.entryTime || "请选择日期" }}</view>
 					</tui-list-cell>
 
 					<tui-list-cell class="line-cell remark-wrap" :hover="false">

+ 123 - 33
ghs/src/pagesStorehouse/allot/addExDetails.vue

@@ -4,41 +4,25 @@
 			<view class="space-view ex-info">
 				<form>
 					<view class="module-com input-line-wrap">
-						<TuiListCell
-							class="line-cell"
-							:hover="false"
-							:arrow="true"
-							@click="openAddres"
-						>
+						<TuiListCell class="line-cell" :hover="false" :arrow="true">
 							<view class="tui-title ">收货仓库</view>
-							<view class="tui-input" v-if="form.province || form.city">
-								{{ form.province + "-" + form.city }}
+							<view class="tui-input">
+								<DorpdownSelect
+									:menuObj.sync="menuObj"
+									top="0"
+									:selectItemId.sync="form.inShopId"
+									@selectSussess="selectSussess"
+								></DorpdownSelect>
 							</view>
-							<view class="tui-placeholder" v-else>请选择</view>
-							<input v-model="form.province" name="province" hidden />
 						</TuiListCell>
-						<TuiListCell
-							class="line-cell"
-							:hover="false"
-							:arrow="true"
-							@click="openAddres"
-						>
+						<TuiListCell class="line-cell" :hover="false" :arrow="true">
 							<view class="tui-title ">日期</view>
-							<view class="tui-input" v-if="form.province || form.city">
-								{{ form.province + "-" + form.city }}
-							</view>
-							<view class="tui-placeholder" v-else>留空默认今天</view>
-							<input v-model="form.province" name="province" hidden />
+							<AppDatePicker :dateVal.sync="form.date" :placeholder="'请选择日期'" />
 						</TuiListCell>
-						<TuiListCell
-							class="line-cell"
-							:hover="false"
-							:arrow="false"
-							@click="openAddres"
-						>
+						<TuiListCell class="line-cell" :hover="false" :arrow="false">
 							<view class="tui-title ">备注</view>
 							<input
-								v-model="form.openTime"
+								v-model="form.remark"
 								placeholder-class="phcolor"
 								class="tui-input"
 								placeholder="请输入"
@@ -96,10 +80,10 @@
 		</view>
 		<view class="bar-view">
 			<view class="btn-view">
-				<button class="admin-button-com middle" @click="">
+				<button class="admin-button-com middle" @click="createStockOutOrder">
 					直接出库
 				</button>
-				<button class="admin-button-com middle" @click="">
+				<button class="admin-button-com middle" @click="confirmStockOutOrder">
 					确认
 				</button>
 			</view>
@@ -107,18 +91,29 @@
 	</view>
 </template>
 <script>
+import { getMainProfile } from "@/api/statistics";
+
 import TuiListCell from "@/components/plugin/list-cell";
 import productMins from "@/mixins/product";
+import AppDatePicker from "@/components/app-date-picker";
+import DorpdownSelect from "@/components/module/dorpdownSelect";
+import { selectShop } from "@/mixins";
+import { createStockOutOrderApi } from "@/api/storehouse/stock";
+const formUtil = require("@/utils/formValidation.js");
 
 export default {
-	components: { TuiListCell },
-	mixins: [productMins],
+	components: { TuiListCell, AppDatePicker, DorpdownSelect },
+	mixins: [productMins, selectShop],
 
 	data() {
 		return {
 			pageType: "allotEx",
 			autoLoad: false,
-			form: {},
+			form: {
+				date: "",
+				remark: "",
+				inShopId: ""
+			},
 			columns: [
 				{
 					name: "花材名称",
@@ -145,6 +140,9 @@ export default {
 		console.log(6666, this.selectList);
 	},
 	methods: {
+		async init() {
+			this.form.inShopId = this.userInfo.id;
+		},
 		gotoSelectPage() {
 			uni.navigateTo({
 				url: `/pagesStorehouse/allot/exSelect`,
@@ -152,6 +150,98 @@ export default {
 				fail: () => {},
 				complete: () => {}
 			});
+		},
+
+		selectSussess(val) {
+			this.form.inShopId = val.selectItem.id;
+		},
+		async createStockOutOrder() {
+			try {
+				let rules = [
+					{
+						name: "date",
+						rule: ["required"],
+						msg: ["请选择日期"]
+					},
+					{
+						name: "inShopId",
+						rule: ["required"],
+						msg: ["请选择门店"]
+					},
+					{
+						name: "remark",
+						rule: ["required"],
+						msg: ["请输入说明"]
+					}
+				];
+				let formData = this.form;
+				const itemInfo = this.selectList.map(ele => {
+					return {
+						productId: ele.id,
+						bigNum: ele.bigCount,
+						smallNum: ele.smallCount
+					};
+				});
+				formData.itemInfo = JSON.stringify(itemInfo);
+
+				formData.action = "confirm";
+
+				let checkRes = formUtil.validation(formData, rules);
+				// 验证通过!
+				if (!checkRes) {
+					await createStockOutOrderApi(formData);
+					this.$msg("出库成功");
+					uni.navigateBack({
+						delta: 1
+					});
+				} else {
+					this.$msg(checkRes);
+				}
+			} catch (error) {}
+		},
+		async confirmStockOutOrder() {
+			try {
+				let rules = [
+					{
+						name: "date",
+						rule: ["required"],
+						msg: ["请选择日期"]
+					},
+					{
+						name: "inShopId",
+						rule: ["required"],
+						msg: ["请选择门店"]
+					},
+					{
+						name: "remark",
+						rule: ["required"],
+						msg: ["请输入说明"]
+					}
+				];
+				let formData = this.form;
+				const itemInfo = this.selectList.map(ele => {
+					return {
+						productId: ele.id,
+						bigNum: ele.bigCount,
+						smallNum: ele.smallCount
+					};
+				});
+				formData.itemInfo = JSON.stringify(itemInfo);
+
+				formData.action = "wait";
+
+				let checkRes = formUtil.validation(formData, rules);
+				// 验证通过!
+				if (!checkRes) {
+					await createStockOutOrderApi(formData);
+					this.$msg("确认成功");
+					uni.navigateBack({
+						delta: 1
+					});
+				} else {
+					this.$msg(checkRes);
+				}
+			} catch (error) {}
 		}
 	}
 };