zhengxin 5 лет назад
Родитель
Сommit
5859e07141

+ 22 - 22
ghs/src/admin/billing/affirm.vue

@@ -198,35 +198,35 @@ export default {
 			try {
 				// 表单规则
 				let rules = [
-					{
-						name: "customId",
-						rule: ["required"],
-						msg: ["请选择客户"]
-					},
 					{
 						name: "sendTime",
 						rule: ["required"],
-						msg: ["请输入送货时间"]
-					},
-
-					{
-						name: "receiveProvince",
-						rule: ["required"],
-						msg: ["请选择地址"]
-					},
-					{
-						name: "receiveAddress",
-						rule: ["required"],
-						msg: ["请填写详细地址"]
-					},
-					{
-						name: "receiveFloor",
-						rule: ["required"],
-						msg: ["请输入门牌号"]
+						msg: ["请输入具体时间"]
 					}
 				];
 				// 进行表单检查
 				let formData = this.form;
+				if (formData.sendType == "1") {
+				} else {
+					let temp = [
+						{
+							name: "receiveProvince",
+							rule: ["required"],
+							msg: ["请选择地址"]
+						},
+						{
+							name: "receiveAddress",
+							rule: ["required"],
+							msg: ["请填写详细地址"]
+						},
+						{
+							name: "receiveFloor",
+							rule: ["required"],
+							msg: ["请输入门牌号"]
+						}
+					];
+					rules = rules.concat(temp);
+				}
 
 				const product = this.selectList.map(ele => {
 					return { productId: ele.id, num: ele.bigCount, smallNum: ele.smallCount };

+ 420 - 0
ghs/src/admin/billing/customerAffirm.vue

@@ -0,0 +1,420 @@
+<template>
+	<view class="affirm-page">
+		<view class="affirm-view overscroll">
+			<!-- 门店信息 -->
+			<form>
+				<view class="module-com">
+					<view class="commodity-view">
+						<view class="commodity-list">
+							<view
+								class="commodity-item"
+								v-for="(item, index) in selectList"
+								:key="index"
+							>
+								<image class="item-icon" :src="item.cover" alt="商品图" />
+
+								<view class="item-info">
+									<view class="info-line">
+										<text class="item-name">{{ item.itemName }}</text>
+										<text class="item-price">
+											<text class="unit">¥</text>
+
+											<text class="price">
+												{{ getSelectItemPrice(item) }}
+											</text>
+										</text>
+									</view>
+									<view class="info-line">
+										<text class="item-type">{{ item.rank }}级</text>
+										<text class="item-count">
+											<text v-if="item.bigCount > 0 || item.smallCount > 0">{{
+												`${item.bigCount}`
+											}}</text>
+											<text v-if="item.smallCount > 0">/</text>
+											<text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
+										</text>
+									</view>
+								</view>
+							</view>
+						</view>
+						<view class="summary-bar">
+							<view class="operate-view" @click="gobackEvent">
+								<text class="iconfont icongouwuche"></text>
+								重选花材
+							</view>
+							<view class="describe-view">
+								共{{ allCount }}种,
+								<!-- 共16扎9支, -->
+								合计 ¥<text class="price">{{ allPrice }}</text>
+							</view>
+						</view>
+					</view>
+				</view>
+				<!-- 登录信息 -->
+				<view class="module-com input-line-wrap">
+					<!-- <tui-list-cell class="line-cell" :hover="false" :arrow="true">
+						<view class="tui-title ">客户</view>
+						<view class="tui-input" v-if="form.customId">
+							{{ form.customName }}
+						</view>
+						<view class="tui-placeholder" v-else @click="showCustomer = true"
+							>请选择客户</view
+						>
+					</tui-list-cell> -->
+					<appBindInfo :nameTetx="'昵称'" @bindInfo="bindInfoEvent"></appBindInfo>
+					<appFormSend :form.sync="form"> </appFormSend>
+				</view>
+			</form>
+		</view>
+		<view class="under-bar">
+			<view class="price-view">
+				<text class="price-title">收款</text>
+				<text class="price-number">
+					¥ <text class="large">{{ allPrice }}</text>
+				</text>
+			</view>
+			<button class="admin-button-com blue middle" @click="formSubmit">
+				下单
+			</button>
+		</view>
+	</view>
+</template>
+
+<script>
+import TuiListCell from "@/components/plugin/list-cell";
+import AppAvatarModule from "@/components/module/app-avatar";
+import SimpleAddress from "@/components/plugin/simple-address";
+import AppAreaSel from "@/components/app-area-sel";
+import productMins from "@/mixins/product";
+import appFormRadioBtn from "@/components/app-formRadio-btn";
+import appAddressGroup from "@/components/app-address-group";
+import appSendTime from "@/components/app-send-time";
+import appBindInfo from "@/components/app-bind-info";
+import appFormSend from "@/components/app-form-send";
+const formUtil = require("@/utils/formValidation.js");
+import { createOrder } from "@/api/order/index";
+import { mapActions, mapGetters } from "vuex";
+
+export default {
+	name: "BillingAffirm", // 开单确认
+	components: {
+		TuiListCell,
+		AppAvatarModule,
+		SimpleAddress,
+		AppAreaSel,
+		appFormRadioBtn,
+		appAddressGroup,
+		appSendTime,
+		appFormSend,
+		appBindInfo
+	},
+	mixins: [productMins],
+	data() {
+		return {
+			pageType: "customer",
+			autoLoad: false,
+			form: {
+				shopId: "",
+				shopName: "",
+				receiveProvince: "",
+				receiveCity: "",
+				receiveFloor: "",
+				receiveAddress: "",
+				receiveLong: "",
+				receiveLat: "",
+				sendType: "3",
+				sendSide: "2",
+				sendDate: "",
+				sendTime: "",
+				sendCost: "",
+				customId: "",
+				product: "",
+				nickname: "",
+				mobile: ""
+			},
+
+			// 详细地址
+			// showRegion: false,
+			showCustomer: false
+		};
+	},
+	onLoad(options) {
+		const { shopId } = options;
+		if (shopId) {
+			this.shopId = shopId;
+		}
+	},
+	computed: {
+		...mapGetters(["getLoginInfo"])
+	},
+	methods: {
+		init() {
+			this._getDet();
+		},
+		// api
+		_getDet() {
+			let data = uni.getStorageSync("modifyShopB");
+			if (this.$util.isEmpty(data)) return;
+			Object.keys(this.form).forEach((i, index) => {
+				// if (i != 'password') {
+				this.form[i] = data[i];
+				// }
+			});
+		},
+
+		changeCustomerFn(info) {
+			console.log("changeCustomerFn", info);
+			this.form.customId = info.id;
+			this.form.customName = info.name;
+		},
+		confirmFn(options) {
+			createOrder(options).then(res => {
+				// this.$msg("下单成功");
+				this.resetSelectInfoByType(this.pageType);
+				const {
+					data: { orderId, orderSn }
+				} = res;
+				// 如果是客户跳转到客户成功页pagesClient/official/clientApply   供货员工下单到 /admin/billing/result
+				let url =
+					this.getLoginInfo.identity == "1"
+						? "pagesClient/official/clientApply"
+						: `/admin/billing/result?orderId=${orderId}&orderSn=${orderSn}`;
+				uni.redirectTo({
+					url: url,
+					success: result => {},
+					fail: () => {},
+					complete: () => {}
+				});
+			});
+		},
+		bindInfoEvent(info) {
+			this.form.nickname = info.nickName;
+			this.form.mobile = info.mobile;
+		},
+		// 表单验证
+		async formSubmit(e) {
+			try {
+				// 表单规则
+				let rules = [
+					{
+						name: "nickname",
+						rule: ["required"],
+						msg: ["请输入昵称"]
+					},
+					{
+						name: "mobile",
+						rule: ["required"],
+						msg: ["请输入手机号"]
+					},
+					{
+						name: "sendTime",
+						rule: ["required"],
+						msg: ["请输入具体时间"]
+					}
+				];
+				// 进行表单检查
+				let formData = this.form;
+
+				if (formData.sendType == "1") {
+				} else {
+					let temp = [
+						{
+							name: "receiveProvince",
+							rule: ["required"],
+							msg: ["请选择地址"]
+						},
+						{
+							name: "receiveAddress",
+							rule: ["required"],
+							msg: ["请填写详细地址"]
+						},
+						{
+							name: "receiveFloor",
+							rule: ["required"],
+							msg: ["请输入门牌号"]
+						}
+					];
+					rules = rules.concat(temp);
+				}
+
+				const product = this.selectList.map(ele => {
+					return { productId: ele.id, num: ele.bigCount, smallNum: ele.smallCount };
+				});
+				formData.product = JSON.stringify(product);
+
+				formData.shopId = this.shopId;
+				formData.customId = this.getLoginInfo.id;
+				if (this.waySele == 1) {
+					formData.sendCost = "免运费";
+				}
+				console.log(9999, formData);
+				let checkRes = formUtil.validation(formData, rules);
+				// 验证通过!
+				if (!checkRes) {
+					this.confirmFn(formData);
+				} else {
+					this.$msg(checkRes);
+				}
+			} catch (error) {
+				console.log(999999, error);
+			}
+		},
+		gobackEvent() {
+			uni.navigateBack({
+				delta: 1
+			});
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.affirm-page {
+	position: relative;
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+
+	.affirm-view {
+		flex: 1;
+		padding: 20px;
+		background-color: #f0f2f6;
+
+		.commodity-view {
+			display: flex;
+			flex-direction: column;
+			.commodity-list {
+				padding: 20px;
+				.commodity-item {
+					display: flex;
+					margin-bottom: 20px;
+					.item-icon {
+						flex-shrink: 0;
+						width: 140px;
+						height: 140px;
+					}
+					.item-info {
+						display: flex;
+						flex-direction: column;
+						justify-content: center;
+						flex: 1;
+						margin-left: 20px;
+						.info-line {
+							margin-bottom: 20px;
+							display: flex;
+							justify-content: space-between;
+							align-items: flex-end;
+							.item-name {
+								color: #666;
+								font-size: 28px;
+							}
+							.item-price {
+								color: #333;
+								font-size: 22px;
+								.price {
+									font-size: 32px;
+									font-weight: bold;
+								}
+							}
+							.item-type {
+								color: #999;
+								font-size: 24px;
+							}
+							.item-count {
+								color: #666;
+								font-size: 24px;
+							}
+						}
+					}
+				}
+			}
+			.summary-bar {
+				padding: 0 20px;
+				height: 90px;
+				display: flex;
+
+				align-items: center;
+				justify-content: space-between;
+				border-top: 1px solid #eeeeee;
+				.operate-view {
+					display: flex;
+
+					align-items: center;
+					color: #3385ff;
+					font-size: 26px;
+					.iconfont {
+						margin-right: 20px;
+						font-size: 40px;
+					}
+				}
+				.describe-view {
+					display: flex;
+
+					align-items: center;
+					color: #333;
+					font-size: 24px;
+					.price {
+						font-weight: bold;
+						font-size: 36px;
+					}
+				}
+			}
+		}
+
+		.module-com {
+			background-color: #fff;
+			margin-bottom: 20px;
+
+			border-radius: 10px;
+			overflow: hidden;
+			.member-wrap {
+				.member-det {
+					font-size: 24px;
+					margin-left: 20px;
+				}
+			}
+			.remark-wrap {
+				align-items: flex-start;
+				.remark {
+					height: 240px;
+				}
+			}
+			// .tui-placeholder,
+			// .tui-input {
+			// 	padding-right: 30px;
+			// 	width: 100%;
+			// 	text-align: right;
+			// }
+		}
+	}
+	.under-bar {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		padding: 0 20px;
+		width: 100%;
+		height: 100px;
+		background-color: #fff;
+
+		box-shadow: 0px -1px 6px 0px rgba(4, 0, 0, 0.06);
+		.price-view {
+			display: flex;
+			align-items: center;
+			font-size: 24px;
+			.price-title {
+				color: #333;
+			}
+			.price-number {
+				margin: 0 20px;
+				color: #ff2842;
+				.large {
+					font-size: 40px;
+				}
+			}
+		}
+		.admin-button-com {
+			width: 200px;
+		}
+	}
+}
+</style>

+ 399 - 0
ghs/src/admin/billing/customerPlace.vue

@@ -0,0 +1,399 @@
+<template>
+	<view class="billing_box_bg">
+		<app-tabs
+			:tabs="tabs"
+			:currentTab="tabIndex"
+			@change="change"
+			itemWidth="50%"
+		/>
+		<view class="input-wrap">
+			<app-search-module
+				v-model="py"
+				placeholder="请输入关键词,支持拼音首字母搜索"
+				@search="searchFn"
+			/>
+		</view>
+		<view class="scroll-middle_bx">
+			<scroll-view
+				scroll-y
+				scroll-with-animation
+				class="tab-view"
+				:scroll-top="scrollTop"
+			>
+				<div
+					v-for="(item, index) in filterProductInfo"
+					:key="index"
+					class="tab-bar-item"
+					:class="[classIndex == index ? 'active' : '']"
+					:data-current="index"
+					@tap.stop="swichClass"
+				>
+					<text>{{ item.className || "" }}</text>
+					<text
+						class="tag"
+						v-if="
+							getSelectClassById(item.classId).bigCount > 0 ||
+								getSelectClassById(item.classId).smallCount > 0
+						"
+					>
+						<text
+							v-if="
+								getSelectClassById(item.classId).bigCount > 0 ||
+									getSelectClassById(item.classId).smallCount > 0
+							"
+						>
+							{{ `${getSelectClassById(item.classId).bigCount}` }}
+						</text>
+						<text v-if="getSelectClassById(item.classId).smallCount > 0">
+							/
+						</text>
+						<text v-if="getSelectClassById(item.classId).smallCount > 0">{{
+							getSelectClassById(item.classId).smallCount
+						}}</text>
+					</text>
+				</div>
+			</scroll-view>
+
+			<scroll-view
+				scroll-y
+				class="right-box"
+				v-if="tabIndex == 0"
+				:scroll-into-view="scrollClassId"
+			>
+				<!--内容部分 start -->
+				<block v-if="!$util.isEmpty(filterProductInfo)">
+					<view
+						class="item_list_bx"
+						v-for="(classItem, classIndex) in filterProductInfo"
+						:key="classIndex"
+						:id="`class_${classItem.classId}`"
+					>
+						<view class="item_list_title">
+							{{ classItem.className }}
+						</view>
+						<template v-for="(productItem, productIndex) in classItem.child">
+							<view
+								:id="`class_${classItem.classId}_${productItem.id}`"
+								:key="productIndex"
+							>
+								<Commondity
+									:info="productItem"
+									:bigCount="
+										getSelectItemById(productItem.id, classItem.classId).bigCount
+									"
+									:smallCount="
+										getSelectItemById(productItem.id, classItem.classId).smallCount
+									"
+									@customNum="customNum"
+									@add="addEvent"
+									@del="delEvent"
+								></Commondity>
+							</view>
+							<!-- <Commondity
+							:type="COMMODITY_TYPE.CHANGE"
+							@customNum="customNum"
+						></Commondity> -->
+						</template>
+					</view>
+				</block>
+				<block v-else>
+					<app-wrapper-empty
+						title="暂无数据"
+						:is-empty="$util.isEmpty(filterProductInfo)"
+					/>
+				</block>
+				<!--内容部分 end -->
+			</scroll-view>
+			<block v-else>
+				<view style="width:100%">
+					<AppWrapperEmpty title="敬请期待" :is-empty="true" />
+				</view>
+			</block>
+		</view>
+		<!-- :maskClosable="false" -->
+		<modal-module
+			:show="isModel"
+			@cancel="modalCancel"
+			@click="affirm"
+			:title="customData.itemName"
+			color="#333"
+			:size="32"
+			padding="30rpx 30rpx"
+		>
+			<template slot="customContent">
+				<view class="select-cmd_bx" v-if="customData">
+					<view class="kc"> 库存{{ customData.stock }} </view>
+					<view class="num_bx">
+						<input v-model="customData.bigCount" type="number" focus />扎
+						<input
+							v-model="customData.smallCount"
+							type="number"
+							style="margin-left:24upx"
+						/>支
+					</view>
+				</view>
+			</template>
+		</modal-module>
+		<modal-module
+			:show="showSubmitModel"
+			@cancel="cancelEvent"
+			@click="submitEvent"
+			:title="confirmContent"
+			color="#333"
+			:size="32"
+			padding="30rpx 30rpx"
+		>
+		</modal-module>
+		<FooterCart
+			:price="allPrice"
+			:count="allCount"
+			@confirm="confirmSelectEvent"
+		></FooterCart>
+	</view>
+</template>
+
+<script>
+import AppSearchModule from "@/components/module/app-search";
+import AppTabs from "@/components/plugin/tabs";
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import Commondity from "@/components/module/app-commodity";
+import FooterCart from "@/components/module/app-footer-cart";
+import ModalModule from "@/components/plugin/modal";
+
+import { COMMODITY_TYPE } from "@/utils/declare";
+import productMins from "@/mixins/product";
+export default {
+	name: "Billing", // 开单
+	components: {
+		AppTabs,
+		AppSearchModule,
+		AppWrapperEmpty,
+		Commondity,
+		ModalModule,
+		FooterCart
+	},
+	mixins: [productMins],
+	data() {
+		return {
+			COMMODITY_TYPE,
+			pageType: "customer",
+			autoLoad: false,
+			tabIndex: 0,
+			shopId: null,
+			tabs: [
+				{
+					name: "花材"
+				},
+				{
+					name: "成品"
+				}
+				// {
+				//     name: '课程'
+				// },
+			],
+			isModel: false,
+			customData: {
+				bigCount: 0,
+				smallCount: 0
+			},
+			showSubmitModel: false
+		};
+	},
+	computed: {
+		confirmContent() {
+			let content = "确认下一步?";
+			if (this.hasNoStock) {
+				content = "有花材库存不足,确认下一步?";
+			}
+			return content;
+		}
+	},
+	onLoad(options) {
+		const { shopId } = options;
+		if (shopId) {
+			this.shopId = shopId;
+		}
+
+		this.initData({ shopId: this.shopId });
+	},
+	onUnload() {
+		this.resetSelectInfoByType(this.pageType);
+	},
+
+	methods: {
+		//自定义数量
+		customNum(info) {
+			this.isModel = true;
+			this.customData = info;
+		},
+		modalCancel() {
+			this.isModel = false;
+			this.customData = {};
+		}, // 取消 确认
+		affirm(val) {
+			if (val.index === 0) {
+				this.modalCancel();
+			} else {
+				const {
+					bigCount,
+					smallCount,
+					bigNum,
+					bigUnit,
+					smallNum,
+					smallUnit,
+					ratio
+				} = this.customData;
+				const ratioNum = Number(ratio);
+
+				//超过库存时 设置为库存最大值
+				if (
+					Number(bigCount) * ratioNum + Number(smallCount) >
+					Number(bigNum) * ratioNum + Number(smallNum)
+				) {
+					uni.showToast({
+						title: `库存只有${bigNum}${bigUnit}${smallNum}${smallUnit}`,
+						icon: "none"
+					});
+					this.customData.bigCount = bigNum;
+					this.customData.smallCount = smallNum;
+				} else {
+					this.updateItemEvent(this.customData);
+					this.modalCancel();
+				}
+			}
+		},
+		cancelEvent() {
+			this.showSubmitModel = false;
+		},
+		submitEvent(val) {
+			if (val.index === 0) {
+				this.cancelEvent();
+			} else {
+				console.log(444, this.selectList);
+				uni.navigateTo({
+					url: `/admin/billing/customerAffirm?shopId=${this.shopId}`
+				});
+				this.cancelEvent();
+			}
+		},
+		confirmSelectEvent() {
+			if (this.selectList.length > 0) {
+				uni.navigateTo({
+					url: `/admin/billing/customerAffirm?shopId=${this.shopId}`
+				});
+			} else {
+				this.$msg("请选择花材");
+			}
+		},
+		change(e) {
+			if (this.tabIndex == e.index) {
+				return false;
+			} else {
+				this.tabIndex = e.index;
+			}
+		},
+		scrollTop() {}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.billing_box_bg {
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+	.input-wrap {
+		padding: 22px 20px 22px 30px;
+	}
+	.scroll-middle_bx {
+		flex: 1;
+		display: flex;
+		width: 100%;
+		height: 100%;
+		overflow: hidden;
+	}
+	.tab-view {
+		height: 100%;
+		width: 170upx;
+		flex-shrink: 0;
+		background-color: #f0f2f6;
+		.tab-bar-item {
+			position: relative;
+			width: 170upx;
+			height: 90upx;
+			box-sizing: border-box;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			font-size: 26upx;
+			color: #444;
+			font-weight: 400;
+			.tag {
+				display: flex;
+				padding: 0 20px;
+				align-items: center;
+				position: absolute;
+				right: 0;
+				top: 0;
+				height: 32px;
+				background: #ff2842;
+				border-radius: 16px;
+				color: #fff;
+				font-size: 20px;
+			}
+		}
+
+		.active {
+			position: relative;
+			color: $mainColor;
+			font-size: 26px;
+			background: #fff;
+		}
+
+		.active::before {
+			content: "";
+			position: absolute;
+			border-left: 8upx solid $mainColor;
+			height: 100%;
+			left: 0;
+		}
+	}
+	.right-box {
+		height: 100%;
+		flex: 1;
+		box-sizing: border-box;
+	}
+	.item_list_bx {
+		padding: 40px 16px;
+	}
+	.item_list_title {
+		margin-bottom: 20px;
+		font-size: 24px;
+		font-weight: 600;
+		color: #666666;
+	}
+	.select-cmd_bx {
+		& .kc {
+			color: #999999;
+			font-size: 28px;
+			font-weight: 400;
+			margin-bottom: 60px;
+			text-align: center;
+			margin-top: 10px;
+		}
+		& .num_bx {
+			display: flex;
+			align-items: center;
+			margin-bottom: 80px;
+			& > input {
+				width: 212px;
+				height: 80px;
+				border: 1px solid #dddddd;
+				border-radius: 4px;
+				text-align: center;
+				margin-right: 24px;
+			}
+		}
+	}
+}
+</style>

+ 1 - 0
ghs/src/admin/billing/index.vue

@@ -205,6 +205,7 @@ export default {
 			return content;
 		}
 	},
+
 	onUnload() {
 		this.resetSelectInfoByType(this.pageType);
 	},

+ 12 - 0
ghs/src/pages.json

@@ -413,6 +413,12 @@
 						"navigationBarTitleText": "开单"
 					}
 				},
+				{
+					"path": "customerPlace",
+					"style": {
+						"navigationBarTitleText": "开单"
+					}
+				},
 				{
 					"path": "priceChange",
 					"style": {
@@ -431,6 +437,12 @@
 						"navigationBarTitleText": "确认下单"
 					}
 				},
+				{
+					"path": "customerAffirm",
+					"style": {
+						"navigationBarTitleText": "确认下单"
+					}
+				},
 				{
 					"path": "confirm",
 					"style": {