Просмотр исходного кода

门店仓库》门店管理页面

zhengxin 5 лет назад
Родитель
Сommit
6a550c26c6
3 измененных файлов с 501 добавлено и 0 удалено
  1. 150 0
      ghs/src/admin/warehouse/shop/list.vue
  2. 333 0
      ghs/src/admin/warehouse/shop/update.vue
  3. 18 0
      ghs/src/pages.json

+ 150 - 0
ghs/src/admin/warehouse/shop/list.vue

@@ -0,0 +1,150 @@
+<template>
+	<view class="shop-page">
+		<scroll-view scroll-y class="shop-list">
+			<view class="shop-item" v-for="(item, index) in shopList" :key="index">
+				<image
+					class="avatar"
+					src="https://img.huaml.com/uploads/12358/202005/29/de74c55596d304b85e79154958e8bf57_small.jpeg"
+					alt="商品图"
+				/>
+				<view class="info">
+					<view class="info-name">{{ item.name }}</view>
+					<view class="info-address">
+						{{ item.dateTime }}
+					</view>
+				</view>
+				<view :class="['edit']">
+					<text class="iconfont iconxinrenlingquanshezhi"> </text>
+					<text class="iconfont iconbianji"> </text>
+					<text class="iconfont iconshanchu1"> </text>
+				</view>
+			</view>
+		</scroll-view>
+		<view class="under-bar">
+			<button :class="['admin-button-com', 'middle', 'blue']" @click="">
+				添加
+			</button>
+		</view>
+	</view>
+</template>
+<script>
+export default {
+	components: {},
+	data() {
+		return {
+			tabs: [
+				{
+					name: "全部",
+					key: ""
+				},
+				{
+					name: "草稿",
+					key: "01"
+				},
+				{
+					name: "已盘点",
+					key: "02"
+				}
+			],
+			shopList: [
+				{
+					orderNo: "PD20201217212800156",
+					name: "小许",
+					dateTime: "2020-7-10 21:50",
+					count: "101",
+					status: "02"
+				},
+				{
+					orderNo: "PD20201217212800156",
+					name: "小许",
+					dateTime: "2020-7-10 21:50",
+					count: "101",
+					status: "02"
+				},
+				{
+					orderNo: "PD20201217212800156",
+					name: "小许",
+					dateTime: "2020-7-10 21:50",
+					count: "101",
+					status: "01"
+				}
+			]
+		};
+	}
+};
+</script>
+<style lang="scss" scoped>
+.shop-page {
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+	background-color: #f9fbfc;
+	.under-bar {
+		padding: 0 20upx;
+		display: flex;
+
+		flex-shrink: 0;
+		justify-content: flex-end;
+		align-items: center;
+		width: 100%;
+		height: 100upx;
+		background-color: #fff;
+	}
+	.shop-list {
+		margin-top: 20upx;
+		flex: 1;
+		padding-bottom: 150upx;
+		.shop-item {
+			margin-bottom: 1px;
+			padding: 30upx;
+			display: flex;
+			align-items: center;
+			box-shadow: 0px 1px 0px 0px #eeeeee;
+			background-color: #fff;
+			.avatar {
+				width: 90upx;
+				height: 90upx;
+				border-radius: 50%;
+				image {
+					width: 100%;
+					height: 100%;
+				}
+			}
+			.info {
+				flex: 1;
+				margin: 0 20px;
+				.info-name {
+					font-size: 30upx;
+					font-weight: 600;
+					color: #333333;
+				}
+				.info-address {
+					margin-top: 15upx;
+					font-size: 24upx;
+					font-weight: 400;
+					color: #999999;
+				}
+			}
+			.edit {
+				display: flex;
+				align-items: center;
+				justify-content: space-around;
+				flex-shrink: 0;
+				.iconfont {
+					margin: 0 20upx;
+				}
+				.iconxinrenlingquanshezhi {
+					font-size: 46upx;
+					color: $mainColor;
+				}
+				.iconbianji {
+					font-size: 40upx;
+				}
+				.iconshanchu1 {
+					font-size: 40upx;
+				}
+			}
+		}
+	}
+}
+</style>

+ 333 - 0
ghs/src/admin/warehouse/shop/update.vue

@@ -0,0 +1,333 @@
+<template>
+	<div class="app-content">
+		<!-- 门店信息 -->
+		<form @submit="formSubmit" @reset="formReset">
+			<!-- <div class="prompt-text">注: 请先关注公众号,绑定后可以在移动端自动登录</div> -->
+			<!-- 登录信息 -->
+			<div class="module-com input-line-wrap">
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title required">门店名称</div>
+					<input
+						v-model="form.shopName"
+						placeholder-class="phcolor"
+						class="tui-input"
+						name="shopName"
+						placeholder="请输入名称"
+						maxlength="50"
+						type="text"
+					/>
+				</tui-list-cell>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title required">营业时间</div>
+					<input
+						v-model="form.openTime"
+						placeholder-class="phcolor"
+						class="tui-input"
+						name="openTime"
+						placeholder="请输入营业时间 例如:8:00 - 22:00"
+						maxlength="50"
+						type="text"
+					/>
+				</tui-list-cell>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title required">联系电话</div>
+					<input
+						v-model="form.telephone"
+						placeholder-class="phcolor"
+						class="tui-input"
+						name="telephone"
+						placeholder="请输入联系电话"
+						maxlength="50"
+						type="text"
+					/>
+				</tui-list-cell>
+				<tui-list-cell
+					class="line-cell"
+					:hover="false"
+					:arrow="true"
+					@click="openAddres"
+				>
+					<div class="tui-title required">所在城市</div>
+					<div class="tui-input" v-if="form.province || form.city">
+						{{ form.province + "-" + form.city }}
+					</div>
+					<div class="tui-placeholder" v-else>请选择</div>
+					<input v-model="form.province" name="province" hidden />
+				</tui-list-cell>
+				<tui-list-cell
+					class="line-cell"
+					:hover="false"
+					:arrow="true"
+					@click="selRegionFn"
+				>
+					<div class="tui-title required">地址</div>
+					<div class="tui-input" v-if="form.address">{{ form.address }}</div>
+					<div class="tui-placeholder" v-else>请填写详细地址</div>
+					<input v-model="form.address" name="address" hidden />
+				</tui-list-cell>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title required">门牌号</div>
+					<input
+						v-model="form.floor"
+						placeholder-class="phcolor"
+						class="tui-input"
+						name="floor"
+						placeholder="楼号门牌号(选填)"
+					/>
+				</tui-list-cell>
+				<tui-list-cell class="line-cell remark-wrap" :hover="false">
+					<div class="tui-title">状态</div>
+					<div class="tui-input">
+						<radio-group class="radio-group" @change="radioChange">
+							<label v-for="(item, index) in statusList" :key="item.value">
+								<radio
+									:value="item.value"
+									:checked="item.value === form.status"
+									:color="'#3385FF'"
+								/>
+								<text>{{ item.name }}</text>
+							</label>
+						</radio-group>
+					</div>
+				</tui-list-cell>
+			</div>
+			<!-- 提交 -->
+			<div class="confirm-btn">
+				<button class="admin-button-com big blue" formType="submit">确认</button>
+			</div>
+		</form>
+		<!-- 省市联动 -->
+		<simple-address
+			ref="simpleAddress"
+			:pickerValueDefault="cityPickerValueDefault"
+			@onConfirm="onCityConfirm"
+		></simple-address>
+		<!-- 选择地区 -->
+		<app-area-sel
+			:show.sync="showRegion"
+			:city="form.receiveCity"
+			@change="changeAreaFn"
+		/>
+	</div>
+</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";
+const form = require("@/utils/formValidation.js");
+// api
+import { updateShop as update, addShop as add } from "@/api/shop";
+export default {
+	name: "staff-add",
+	components: {
+		TuiListCell,
+		AppAvatarModule,
+		SimpleAddress,
+		AppAreaSel
+	},
+	data() {
+		return {
+			form: {
+				shopName: "",
+				province: "",
+				city: "",
+				address: "",
+				floor: "",
+				openTime: "8:00 - 22:00",
+				introduction: "",
+				telephone: "",
+				status: ""
+			},
+			// 详细地址
+			showRegion: false,
+			region: {
+				lat: 0,
+				long: 0
+			},
+			// 省市联动
+			regionData: [],
+			cityPickerValueDefault: [0, 0],
+			statusList: [
+				{
+					value: "01",
+					name: "正常"
+				},
+				{
+					value: "02",
+					name: "停用"
+				}
+			]
+		};
+	},
+	onLoad() {
+		// this.init()
+	},
+	onShow() {
+		if (this.option.id) {
+			uni.setNavigationBarTitle({
+				title: `修改门店`
+			});
+		} else {
+			uni.setNavigationBarTitle({
+				title: `添加门店`
+			});
+		}
+	},
+	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];
+				// }
+			});
+		},
+		// option
+		// 选择地址
+		selRegionFn() {
+			if (!this.form.city) {
+				this.$msg("请先选择城市!");
+				return false;
+			}
+			this.showRegion = true;
+		},
+		changeAreaFn(e) {
+			console.log("changeAreaFn", e);
+			this.form.address = e.address;
+			this.region.lat = e.location.lat;
+			this.region.long = e.location.lng;
+		},
+		// 省市联动
+		openAddres() {
+			this.$refs.simpleAddress.open();
+		},
+		onCityConfirm(e) {
+			// this.form.receiveAddress = e.label
+			this.form.province = e.provinceName;
+			this.form.city = e.cityName;
+			// this.pickerText = JSON.stringify(e)
+		},
+		radioChange: function(evt) {
+			for (let i = 0; i < this.statusList.length; i++) {
+				if (this.statusList[i].value === evt.target.value) {
+					this.form.status = evt.target.value;
+					break;
+				}
+			}
+		},
+		confirmFn() {
+			let hostFn = this.option.id ? update : add;
+			if (this.option.id) {
+				this.form.id = this.option.id;
+			}
+			hostFn(this.form).then(res => {
+				let promptText = this.option.id ? "修改成功!" : "添加成功!";
+				this.$msg(promptText);
+				uni.removeStorageSync("modifyShopB");
+				setTimeout(() => {
+					this.$util.pageTo("/admin/shop/list");
+				}, 1000);
+			});
+		},
+		// 表单验证
+		formSubmit(e) {
+			// 表单规则
+			let rules = [
+				{
+					name: "shopName",
+					rule: ["required"],
+					msg: ["请输入名称"]
+				},
+				{
+					name: "openTime",
+					rule: ["required"],
+					msg: ["请输入营业时间"]
+				},
+				{
+					name: "telephone",
+					rule: ["required"],
+					msg: ["请输入联系电话"]
+				},
+				{
+					name: "province",
+					rule: ["required"],
+					msg: ["请选择地址"]
+				},
+				{
+					name: "address",
+					rule: ["required"],
+					msg: ["请填写详细地址"]
+				},
+				{
+					name: "floor",
+					rule: ["required"],
+					msg: ["请输入门牌号"]
+				},
+				{
+					name: "status",
+					rule: ["required"],
+					msg: ["请选择状态"]
+				}
+			];
+			// 进行表单检查
+			let formData = e.detail.value;
+			let checkRes = form.validation(formData, rules);
+			// 验证通过!
+			if (!checkRes) {
+				this.confirmFn();
+			} else {
+				this.$msg(checkRes);
+			}
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.app-content {
+	min-height: calc(100vh - 20px);
+	padding-top: 20px;
+}
+.prompt-text {
+	color: $fontColor3;
+	padding-left: 30px;
+	margin-bottom: 30px;
+}
+// ---
+.module-com {
+	margin-bottom: 20px;
+	.member-wrap {
+		.member-det {
+			font-size: 24px;
+			margin-left: 20px;
+		}
+	}
+	.remark-wrap {
+		align-items: flex-start;
+		.remark {
+			height: 240px;
+		}
+	}
+}
+.radio-group {
+	display: flex;
+	label {
+		margin-right: 80upx;
+	}
+}
+// 按钮
+.confirm-btn {
+	width: calc(100% - 60px);
+	margin: 60px 30px 20px;
+	.admin-button-com {
+		width: 100%;
+	}
+}
+</style>

+ 18 - 0
ghs/src/pages.json

@@ -467,6 +467,24 @@
 					}
 				}
 			]
+		},
+		{
+			"root": "admin/warehouse/shop/",
+			"pages": [
+				{
+					"path": "list",
+					"style": {
+						"navigationBarTitleText": "盘点",
+						"enablePullDownRefresh": true
+					}
+				},
+				{
+					"path": "update",
+					"style": {
+						"navigationBarTitleText": "门店编辑"
+					}
+				}
+			]
 		}
 	],
 	"globalStyle": {