فهرست منبع

订单可以修改功能开始

shish 5 سال پیش
والد
کامیت
ba26aa5d1a

+ 1 - 1
ghsApp/src/admin/home/workbench.vue

@@ -205,7 +205,7 @@ export default {
 					url: "/pagesPurchase/supplier"
 				},
 				{
-					name: "库存",
+					name: "库存预警",
 					img: `${this.$constant.imgUrl}/ghs/home/kcyjs.png`,
 					url: "/pagesStorehouse/stockWarn/manage"
 				},

+ 9 - 2
ghsApp/src/admin/item/detail.vue

@@ -47,7 +47,8 @@
           </tui-list-cell>
 							<tui-list-cell class="line-cell" :hover="false">
 								<div class="tui-title">库存</div>
-								<input v-model="form.stock" placeholder-class="phcolor" @focus="form.stock=''" @input="changeStock($event)" class="tui-input" name="stock" placeholder="请输入" maxlength="50" type="digit"/>
+								<input v-model="form.stock" style="width:340rpx;" placeholder-class="phcolor" @focus="form.stock=''" @input="changeStock($event)" class="tui-input" name="stock" placeholder="请输入" type="digit"/>
+                <button class="admin-button-com blue small" @click="goStockDetail(productInfo.id,productInfo.itemId)">查看明细</button>
 							</tui-list-cell>
         <tui-list-cell class="line-cell" :arrow="true">
           <div class="tui-title">大单位</div>
@@ -217,7 +218,8 @@ export default {
       unitData:[],
       smallUnitSelectedData:{},
       bigUnitSelectedData:{},
-      hasRequest:0
+      hasRequest:0,
+      productInfo:null
     };
   },
   computed: {
@@ -230,6 +232,9 @@ export default {
   watch:{
   },
   methods: {
+    goStockDetail(id,itemId){
+				this.$util.pageTo({url: "/pagesStorehouse/stockWarn/detailed?id="+itemId})
+		},
     statusChange(e){
       this.form.status = e.detail.value ? 1 : 2;
     },
@@ -295,6 +300,8 @@ export default {
           e => this.form.bigUnitId == e.id
         )[0];
 
+        this.productInfo = res.data
+
       });
     },
     init() {

+ 164 - 0
ghsApp/src/admin/ptItem/components/Item.vue

@@ -0,0 +1,164 @@
+<template>
+	<view class="item-cmd_bx" v-if="hidden==0">
+		<view class="img_bx" style="background:#eeeeee">
+			<image :src="info.cover" v-if="isImg"></image>
+		</view>
+		<view @click="goItem(info.id,info.itemId)" class="cmd-info_bx" :class="type == STOCK_TYPE.WARN?'':'active'">
+			<view class="tit">{{ info.name || "" }}</view>
+			<view class="kc"></view>
+			<view class="num-open_bx">
+				<view class="price" v-if="isPrice">¥{{ info.price }}</view>
+				<view class="open-bx warn">
+					单位 <text style="margin-left: 10rpx;">{{ info.bigUnit }}</text>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+import { STOCK_TYPE } from "@/utils/declare";
+import AppImg from "@/components/app-img";
+export default {
+	name: "item",
+	components: {
+		AppImg
+	},
+	props: {
+		type: {
+			type: String,
+			default: STOCK_TYPE.WARN
+		},
+		isPrice: {
+			type: Boolean,
+			default: true
+		},
+		isEdit: {
+			type: Boolean,
+			default: true
+		},
+		info: {
+			required: true
+		},
+		modifyStock:{
+			type:Object
+		}
+	},
+	data() {
+		return {
+			isImg:false,
+			currentStock:null,
+			hidden:0
+		};
+	},
+	mounted() {
+		setTimeout(()=>{
+			this.isImg = true;
+		},100)
+	},
+	watch: {
+		modifyStock:{
+			handler(){
+				if(this.modifyStock.id == this.info.id && this.modifyStock.stock != this.info.stock){
+					this.currentStock = this.modifyStock.stock
+					let that = this
+					setTimeout(function(){
+						that.hidden = that.modifyStock.hidden
+					},800)
+				}
+			},
+			deep:true
+		}
+	},
+	methods: {
+		goItem(id,itemId){
+			if(this.type == STOCK_TYPE.WARN){
+				this.$util.pageTo({url: "/admin/item/detail?id="+id})
+			}else{
+				this.$util.pageTo({url: "/pagesStorehouse/stockWarn/detailed?id="+itemId})
+			}
+		},
+		customNum() {
+			this.$emit("customNum");
+		},
+		addEvent() {
+			this.$emit("add");
+		},
+		subtractEvent() {
+			this.$emit("subtract");
+		},
+		delEvent() {
+			this.$emit("del");
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.item-cmd_bx {
+	position: relative;
+	margin-bottom: 20px;
+	.img_bx {
+		height: 160px;
+		width: 160px;
+		position: absolute;
+		left: 0px;
+		top: 0px;
+		image{
+			width: 100%;
+			height: 100%;
+		}
+	}
+	.cmd-info_bx {
+		position: relative;
+		padding-left: 177px;
+		&.active{
+			&:before{
+				content: ' ';
+				height: 22rpx;
+				width: 22rpx;
+				border-width: 2rpx 2rpx 0 0;
+				border-color: #b2b2b2;
+				border-style: solid;
+				-webkit-transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
+				transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
+				position: absolute;
+				top: 50%;
+				margin-top: -12rpx;
+				right: 30rpx;
+			}
+		}
+
+		& .tit {
+			font-size: 28px;
+			font-weight: 400;
+			color: #333333;
+			padding-top: 10px;
+		}
+		& .kc {
+			color: #999999;
+			font-size: 24px;
+			padding: 10px 0 24px;
+		}
+		& .num-open_bx {
+			display: flex;
+			align-items: center;
+			& .price {
+				font-size: 28px;
+				color: #999999;
+				flex: 1;
+			}
+			& .open-bx {
+				color: #333333;
+				text{
+					font-size: 24rpx;
+					font-weight: 700;
+				}
+				*.warn {
+					color: $redColor;
+				}
+			}
+		}
+	}
+}
+</style>

+ 236 - 0
ghsApp/src/admin/ptItem/itemList.vue

@@ -0,0 +1,236 @@
+<template>
+	<view class="billing_box_bg">
+    <view class="input-wrap">
+			<view class="search-bar">
+				<app-search-module v-model="py" placeholder="输入拼音首字母查询" @input="searchFnContrapose"/>
+			</view>
+		</view>
+		<view class="scroll-middle_bx">
+			<block v-if="!$util.isEmpty(filterProductInfoContrapose)">
+				<scroll-view scroll-y class="item_list_bx" @scrolltolower="loadMore" lower-threshold="100" style="width: 100%">
+					<template v-for="(productItem, productIndex) in filterProductInfoContrapose">
+						<view style="padding: 20rpx 0">
+						<ptItemInfo
+							:isPrice="false"
+							:type="STOCK_TYPE.WARN"
+							:key="productIndex"
+							:info="productItem"
+							:isEdit="true"
+							:modifyStock="modifyStock"
+						></ptItemInfo>
+						</view>
+					</template>
+				</scroll-view>
+			</block>
+			<block v-else>
+				<view style="width: 100%">
+					<app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(filterProductInfoContrapose)"/></view>
+			</block>
+		</view>
+	</view>
+</template>
+<script>
+import AppSearchModule from "@/components/module/app-search";
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import ptItemInfo from "./components/Item";
+import { STOCK_TYPE } from "@/utils/declare";
+import productMins from "@/mixins/product";
+import productContraposeMins from "@/mixins/ptProductContrapose";
+import { selectShop } from "@/mixins";
+import { mapGetters } from "vuex";
+import DorpdownSelect from "@/components/module/dorpdownSelect";
+export default {
+	name: "ptItemList",
+	components: {
+		AppSearchModule,
+		AppWrapperEmpty,
+		ptItemInfo,
+		DorpdownSelect
+	},
+	mixins: [productMins, selectShop,productContraposeMins],
+	data() {
+		return {
+			STOCK_TYPE,
+			autoLoad: false,
+			pageType: "getPtItem",
+			tabIndex: 0,
+			modifyStock:{},
+			tabs: [
+				{
+					name: "库存预警",
+					key: STOCK_TYPE.WARN
+				}
+			],
+		};
+	},
+	computed:{
+		...mapGetters(["getMyShopInfo","getLoginInfo"]),
+	},
+	onLoad() {
+		let type = "waring";
+		this.shopId = this.getMyShopInfo.id;
+		this.initDataContrapose({ type, shopId: this.shopId,status:0,delStatus:0});
+	},
+	onPullDownRefresh() {
+		this.page = 1
+		this.filterProductInfoContrapose = []
+		let type = "waring";
+		this.shopId = this.getMyShopInfo.id;
+		this.initDataContrapose({ type, shopId: this.shopId,status:0,delStatus:0});	
+	},
+	onShow(){
+	},
+	methods: {
+		affirm(val) {
+			if (val.index === 0) {
+				this.modalCancel();
+			}
+		},
+		change(e) {
+			if (this.tabIndex == e.index) {
+				return false;
+			} else {
+				uni.showLoading({
+					title: "加载中"
+				});
+				this.tabIndex = e.index;
+				this.filterProductInfoContrapose = this.allFilterProductInfoContrapose;
+				uni.hideLoading();
+			}
+		},
+		scrollTop() {},
+		initProductInfo() {
+			this.filterProductInfoContrapose = [];
+			this.page = 1;
+			this.isMore = true;
+			},
+		selectSussess(val) {
+			uni.showLoading({
+				title: "加载中"
+			});
+			this.initProductInfo();
+			let type = "waring";
+			this.shopId = val.selectItem.id;
+			this.initDataContrapose({ type, shopId: this.shopId,status:0,delStatus:0});
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.billing_box_bg {
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+	.input-wrap {
+		display: flex;
+		padding: 22px 20px 22px 30px;
+		.search-bar {
+			flex: 1;
+		}
+		.city-select {
+			display: flex;
+			flex-shrink: 0;
+			align-items: center;
+			margin-right: 15upx;
+			margin-left: 45px;
+			background-color: #ffff;
+			.iconfont {
+				margin-left: 20upx;
+				font-size: 30upx;
+			}
+		}
+	}
+	.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;
+			}
+			&:last-child{
+				margin-bottom: 110upx;
+			}
+		}
+		.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: 10px 40px;
+	}
+	.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>

+ 6 - 0
ghsApp/src/api/pt-item/index.js

@@ -0,0 +1,6 @@
+import https from "@/plugins/luch-request_0.0.7/request";
+
+//平台花材列表
+export const ptItemList = data => {
+	return https.get("/pt-item/list", data);
+};

+ 78 - 0
ghsApp/src/mixins/ptProductContrapose.js

@@ -0,0 +1,78 @@
+import { ptItemList } from "@/api/pt-item/index";
+import { STOCK_TYPE } from "@/utils/declare";
+import { mapGetters, mapActions } from "vuex";
+import { copyObject } from "@/utils/util";
+export default {
+	data() {
+		return {
+			pageType: "ptProductList", //选择商品页面类别  用于区分不同功能的数据
+			productInfo: [], //商品信息
+			classIndex: 0, //当前商品类别下标
+			py: "", //拼音搜索条件
+			type: "", //库存预警时,固定为waring,其他情况不传或者传空
+			autoLoad: true, //自动获取商品信息
+			isLimit: true, //选择数量不能大于库存限制
+			filterProductInfoContrapose:[],
+			allFilterProductInfoContrapose:[],
+			isMore:true,
+			page:1,
+		};
+	},
+	onLoad(options) {
+		const { pageType } = options;
+		if (pageType) {
+			this.pageType = pageType;
+		}
+		if (this.autoLoad) {
+			this.initDataContrapose();
+		}
+	},
+	onUnload() {},
+	computed: {
+		...mapGetters(["getSelectInfo","getMyShopInfo"]),
+	},
+	methods: {
+		...mapActions(["setSelectInfoByType", "resetSelectInfoByType"]),
+		/**
+		 * 请求商品数据
+		 */
+		loadMore(){
+			if(this.isMore){
+				this.page++;
+				this.initDataContrapose();
+			}
+		},
+		async initDataContrapose(extendInfo) {
+			let params = {
+				name: this.py,
+				page: this.page,
+			};
+			if (extendInfo) {
+				params = { ...params, ...extendInfo };
+			}
+			const { data } = await ptItemList(params);
+			data.list.forEach((ele)=>{
+				this.filterProductInfoContrapose.push(ele);
+			})
+			this.allFilterProductInfoContrapose = this.filterProductInfoContrapose;
+			if(this.filterProductInfoContrapose.length==data.totalNum){
+				this.isMore = false;
+			}
+			this.productInfo = data.list;
+			uni.stopPullDownRefresh();
+			uni.hideLoading();
+		},
+		/**
+		 * 搜索对应花材
+		 */
+		searchFnContrapose() {
+			if(!this.$util.isEmpty(this.py)){
+				this.page = 1
+				this.filterProductInfoContrapose = []
+				this.initDataContrapose({shopId: this.shopId});
+			}else{
+				this.filterProductInfoContrapose = this.allFilterProductInfoContrapose;
+			}
+		}
+	}
+};

+ 8 - 2
ghsApp/src/pages.json

@@ -14,6 +14,12 @@
 		{"path": "common/pageSuccess","style": {"navigationBarBackgroundColor": "#ffffff","navigationBarTextStyle": "black"}}
 	],
 	"subPackages": [
+		{
+			"root": "admin/ptItem",
+			"pages": [
+				{"path": "itemList","style": {"navigationBarTitleText": "平台花材"}}
+			]
+		},
 		{
 			"root": "admin/shopYeChange",
 			"pages": [
@@ -336,14 +342,14 @@
 				{
 					"path": "manage",
 					"style": {
-						"navigationBarTitleText": "库存",
+						"navigationBarTitleText": "库存预警",
 						"enablePullDownRefresh": true
 					}
 				},
 				{
 					"path": "detailed",
 					"style": {
-						"navigationBarTitleText": "明细",
+						"navigationBarTitleText": "库存明细",
 						"enablePullDownRefresh": true
 					}
 				}

+ 14 - 77
ghsApp/src/pagesStorehouse/stockWarn/manage.vue

@@ -1,21 +1,18 @@
 <template>
 	<view class="billing_box_bg">
-    <app-tabs :tabs="tabs" :currentTab="tabIndex" @change="change" itemWidth="50%"/>
     <view class="input-wrap">
 			<view class="search-bar">
-				<app-search-module v-if="tabs[tabIndex].key==STOCK_TYPE.WARN" v-model="py" placeholder="输入拼音首字母查询" @input="searchFnContrapose"/>
-				<app-search-module v-else v-model="py" placeholder="输入拼音首字母查询" @input="searchFn"/>
+				<app-search-module v-model="py" placeholder="输入拼音首字母查询" @input="searchFnContrapose"/>
 			</view>
 		</view>
-
-		<view v-if="tabs[tabIndex].name=='库存预警'" class="scroll-middle_bx">
+		<view class="scroll-middle_bx">
 			<block v-if="!$util.isEmpty(filterProductInfoContrapose)">
 				<scroll-view scroll-y class="item_list_bx" @scrolltolower="loadMore" lower-threshold="100" style="width: 100%">
 					<template v-for="(productItem, productIndex) in filterProductInfoContrapose">
 						<view style="padding: 20rpx 0">
 						<CommodityStock
 							:isPrice="false"
-							:type="tabs[tabIndex].key"
+							:type="STOCK_TYPE.WARN"
 							:key="productIndex"
 							:info="productItem"
 							:isEdit="true"
@@ -25,51 +22,15 @@
 					</template>
 				</scroll-view>
 			</block>
-
 			<block v-else>
 				<view style="width: 100%">
 					<app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(filterProductInfoContrapose)"/></view>
 			</block>
 		</view>
-
-		<view v-else 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(index)">
-					<text>{{ item.className || "" }}</text>
-				</div>
-			</scroll-view>
-				<scroll-view scroll-y class="right-box" :scroll-into-view="scroll_into_view" 
-				scroll-with-animation="true" @scroll="scroll_detail" lower-threshold="100" @scrolltolower="scroll_bottom">
-				<block v-if="!$util.isEmpty(filterProductInfo)">
-					<view class="item_list_bx selectAll" v-for="(classItem, classIndex) in filterProductInfo" :key="classIndex" :id="`class_${classIndex}`">
-						<view class="item_list_title" v-if="!$util.isEmpty(classItem.child)"> {{ classItem.className }}</view>
-						<text v-if="tabs[tabIndex].name=='库存预警'&&$util.isEmpty(classItem.child)">当前库存充足</text>
-						<template v-for="(productItem,productIndex) in classItem.child" >
-							<view style="height: 200rpx" :id="`class_${classIndex}`" :key="productIndex">
-								<CommodityStock v-if="classItem.isActive"
-								:isPrice="false"
-								:type="tabs[tabIndex].key"
-								:info="productItem"
-								:isEdit="true"
-							></CommodityStock>
-							</view>
-						</template>
-					</view>
-				</block>
-				<block v-else>
-					<view style="width: 100%">
-						<app-wrapper-empty  title="暂无数据" :is-empty="$util.isEmpty(filterProductInfo)"/>
-					</view>
-				</block>
-				<!--内容部分 end -->
-			</scroll-view>
-		</view>
 	</view>
 </template>
-
 <script>
 import AppSearchModule from "@/components/module/app-search";
-import AppTabs from "@/components/plugin/tabs";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import CommodityStock from "../components/CommodityStock";
 import { STOCK_TYPE } from "@/utils/declare";
@@ -79,9 +40,8 @@ import { selectShop } from "@/mixins";
 import { mapGetters } from "vuex";
 import DorpdownSelect from "@/components/module/dorpdownSelect";
 export default {
-	name: "stock_manage", // 开单
+	name: "stock_manage",
 	components: {
-		AppTabs,
 		AppSearchModule,
 		AppWrapperEmpty,
 		CommodityStock,
@@ -94,41 +54,29 @@ export default {
 			autoLoad: false, //不自动请求数据  自定义请求
 			pageType: "stock",
 			tabIndex: 0,
+			modifyStock:{},
 			tabs: [
 				{
 					name: "库存预警",
 					key: STOCK_TYPE.WARN
-				},
-				{
-					name: "库存明细",
-					key: STOCK_TYPE.MANAGE
 				}
 			],
-			modifyStock:{}
 		};
 	},
 	computed:{
 		...mapGetters(["getMyShopInfo","getLoginInfo"]),
 	},
 	onLoad() {
-		let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
+		let type = "waring";
 		this.shopId = this.getMyShopInfo.id;
-		if(type=="waring"){
-			this.initDataContrapose({ type, shopId: this.shopId,status:0,delStatus:0});
-		}else{
-			this.initData({ type, shopId: this.shopId,status:0});
-		}
+		this.initDataContrapose({ type, shopId: this.shopId,status:0,delStatus:0});
 	},
 	onPullDownRefresh() {
 		this.page = 1
 		this.filterProductInfoContrapose = []
-		let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
+		let type = "waring";
 		this.shopId = this.getMyShopInfo.id;
-		if(type=="waring"){
-			this.initDataContrapose({ type, shopId: this.shopId,status:0,delStatus:0});
-		}else{
-			this.initData({ type, shopId: this.shopId,status:0});
-		}
+		this.initDataContrapose({ type, shopId: this.shopId,status:0,delStatus:0});	
 	},
 	onShow(){
 	},
@@ -136,7 +84,6 @@ export default {
 		affirm(val) {
 			if (val.index === 0) {
 				this.modalCancel();
-			} else {
 			}
 		},
 		change(e) {
@@ -147,14 +94,8 @@ export default {
 					title: "加载中"
 				});
 				this.tabIndex = e.index;
-				this.tabs[this.tabIndex].key;
-				let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
-				if(type=="waring"){
-					this.filterProductInfoContrapose = this.allFilterProductInfoContrapose;
-					uni.hideLoading();
-				}else{
-					this.initData({ type, shopId: this.shopId,status:0});
-				}
+				this.filterProductInfoContrapose = this.allFilterProductInfoContrapose;
+				uni.hideLoading();
 			}
 		},
 		scrollTop() {},
@@ -168,13 +109,9 @@ export default {
 				title: "加载中"
 			});
 			this.initProductInfo();
-			let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
+			let type = "waring";
 			this.shopId = val.selectItem.id;
-			if(type=="waring"){
-				this.initDataContrapose({ type, shopId: this.shopId,status:0,delStatus:0});
-			}else{
-				this.initData({ type, shopId: this.shopId,status:0});
-			}
+			this.initDataContrapose({ type, shopId: this.shopId,status:0,delStatus:0});
 		}
 	}
 };
@@ -264,7 +201,7 @@ export default {
 		box-sizing: border-box;
 	}
 	.item_list_bx {
-		padding: 40px 16px;
+		padding: 10px 40px;
 	}
 	.item_list_title {
 		margin-bottom: 20px;