shish 4 yıl önce
ebeveyn
işleme
1d93c7c1e7

+ 136 - 0
ghsPad/src/admin/home/components/middleButton.vue

@@ -0,0 +1,136 @@
+<template>
+<view class="middle-area">
+
+    <view @click="logout"> 退出 </view>
+    <view @click="selectUser"> 客户 </view>
+    <view @click="clearItemFn"> 清空花材 </view>
+    <view>临时商品</view>
+    <view @click="breakage"> 报损 </view>
+    <view @click="settle">结算 </view>
+
+    <!-- 清空花材 -->
+    <uni-popup ref="clearItemRef" type="dialog">
+        <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认清空?" @confirm="confirmClearItem"></uni-popup-dialog>
+    </uni-popup>
+
+    <uni-popup ref="logoutRef" type="dialog">
+        <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认退出?" @confirm="confirmLogout"></uni-popup-dialog>
+    </uni-popup>
+
+    <!-- 选客户 isShowUser -->
+    <uni-popup ref="selectUserRef" background-color="#fff" type="center" :animation="false">
+        <selectUser @selectUser="selectUserReturn" @cancelSelectUser="cancelSelectUser"> </selectUser>
+    </uni-popup>
+    <!-- 结算弹框 isShowSettle -->
+    <uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
+        <settlePop @settleReturn="settleReturn" ref="settlePop" :totalShop="totalShop"></settlePop>
+    </uni-popup>
+    <!-- 选择支付方式 isShowselectPayWay -->
+    <uni-popup ref="selectPayWayRef" background-color="#fff" type="center" :animation="false">
+        <selectPayWay @cancel="cancelPay()" @selectPayWayBack="selectPayWayBack"></selectPayWay>
+    </uni-popup>
+
+</view>
+</template>
+<script>
+import settlePop from './settle-pop.vue'
+import selectUser from './select-user.vue'
+import selectPayWay from '@/components/select-pay-way.vue'
+import productMins from "@/mixins/product";
+export default {
+    name:'middleButton',
+    mixins:{productMins},
+    components:{ settlePop,selectUser,selectPayWay },
+	props: {
+    },
+    data(){
+        return {
+            totalShop:{ bigUnit: 0, smallUnit:0, totalPrice: 0 }
+        }
+    },
+    created(){
+
+    },
+	watch:{
+
+	},
+    methods:{
+		breakage(){
+			if(this.$util.isEmpty(this.itemList)) {
+				this.$msg('请选择报损花材')
+				return false
+			}
+			this.$util.confirmModal({content:'确定报损吗?'},
+			async() => {
+				try {
+					let arr = this.itemList.map(i=>({
+						productId:i.id,
+						unitType: i.unitType,
+						num: i.currentNum
+					}))
+					await wastageCreateOrder({
+						product: JSON.stringify(arr)
+					})
+					this.$msg("报损成功!");
+				}catch(err) {
+					console.log(err)
+				}
+			})
+		},
+		settle(){
+			if(this.$util.isEmpty(this.itemList)) {
+				this.$msg('请选择结算花材')
+				return false
+			}
+			if(this.$util.isEmpty(this.selectItemUser)) {
+				this.$msg('请选择客户')
+				return false
+			}
+			this.$refs.settlePopRef.open('center')
+		},
+		//清空花材弹框
+		clearItemFn(){
+			this.$refs.clearItemRef.open()
+		},
+		//确认清空花材
+		confirmClearItem(){
+
+		},
+		confirmLogout(){
+			uni.clearStorage()
+			this.$store.commit("setLoginInfo", {})
+			plus.runtime.restart()
+		},
+		logout(){
+			this.$refs.logoutRef.open()
+		},
+		delSelectItem(){
+
+		}
+    }
+}
+</script>
+<style lang="scss" scoped>
+.middle-area {
+    height: 100vh;
+    display: flex;
+    flex-direction: column;
+    padding: 5upx;
+    padding-top: 12upx;
+    & > view {
+        border: 1upx solid #CCCCCC;
+        border-radius: 5upx;
+        text-align: center;
+        padding: 10upx 0;
+        color: #666666;
+        margin-bottom: 10upx;
+        font-size: 10upx;
+        text-align: center;
+        &.active {
+            color: #008000;
+            border-color: #008000;
+            border-radius: 2upx;
+        }
+    }
+}
+</style>

+ 6 - 103
ghsPad/src/admin/home/workbench.vue

@@ -34,55 +34,29 @@
 					<view> 合计 <text style="margin-left:5upx;">¥{{totalShop.totalPrice}}</text> </view>
 				</view>
 			</view>
+			<!-- 按钮操作 -->
 			<view class="open-box">
-				<view @click="logout"> 退出 </view>
-				<view @click="selectUser"> 客户 </view>
-				<view @click="clearItemFn"> 清空花材 </view>
-				<view>临时商品</view>
-				<view @click="breakage"> 报损 </view>
-				<view @click="settle">结算 </view>
+				<middleButton></middleButton>
 			</view>
-			<!-- 分类和花材展示区 -->
+			<!-- 分类和花材图片 -->
 			<view class="all-item-area">
 				<rightItemArea @showAddModelFn="showAddModelFn"> </rightItemArea>
 			</view>
-			<!-- 选客户 isShowUser -->
-			<uni-popup ref="selectUserRef" background-color="#fff" type="center" :animation="false">
-				<selectUser @selectUser="selectUserReturn" @cancelSelectUser="cancelSelectUser"> </selectUser>
-			</uni-popup>
-			<!-- 结算弹框 isShowSettle -->
-			<uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
-				<settlePop @settleReturn="settleReturn" ref="settlePop" :totalShop="totalShop"></settlePop>
-			</uni-popup>
-			<!-- 选择支付方式 isShowselectPayWay -->
-			<uni-popup ref="selectPayWayRef" background-color="#fff" type="center" :animation="false">
-				<selectPayWay @cancel="cancelPay()" @selectPayWayBack="selectPayWayBack"></selectPayWay>
-			</uni-popup>
-			<!-- 清空花材 -->
-			<uni-popup ref="clearItemRef" type="dialog">
-				<uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认清空?" @confirm="confirmClearItem"></uni-popup-dialog>
-			</uni-popup>
-			<uni-popup ref="logoutRef" type="dialog">
-				<uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认退出?" @confirm="confirmLogout"></uni-popup-dialog>
-			</uni-popup>
 		</view>
 	</view>
 </view>
 </template>
 <script>
 import { mapGetters,mapActions } from "vuex";
-import productMins from "@/mixins/product";
 import autoUpdateMixins from "@/mixins/autoUpdate";
-import settlePop from './components/settle-pop.vue'
-import selectUser from './components/select-user.vue'
 import rightItemArea from './components/rightItemArea.vue'
-import selectPayWay from '@/components/select-pay-way.vue'
+import middleButton from './components/middleButton.vue'
 import loginComponent from './login.vue'
 import { createCreateOrder, wastageCreateOrder } from '@/api/home/index'
 export default {
 	name: "workbench",
-	components: { selectUser, rightItemArea,  settlePop, selectPayWay,loginComponent },
-	mixins: [productMins,autoUpdateMixins],
+	components: { rightItemArea,middleButton,  loginComponent },
+	mixins: [autoUpdateMixins],
 	data() {
 		return {
 			itemList:[],
@@ -179,58 +153,6 @@ export default {
 			this.$refs.selectUserRef.open('center')
 		},
 		init() {
-		},
-		breakage(){
-			if(this.$util.isEmpty(this.itemList)) {
-				this.$msg('请选择报损花材')
-				return false
-			}
-			this.$util.confirmModal({content:'确定报损吗?'},
-			async() => {
-				try {
-					let arr = this.itemList.map(i=>({
-						productId:i.id,
-						unitType: i.unitType,
-						num: i.currentNum
-					}))
-					await wastageCreateOrder({
-						product: JSON.stringify(arr)
-					})
-					this.$msg("报损成功!");
-				}catch(err) {
-					console.log(err)
-				}
-			})
-		},
-		settle(){
-			if(this.$util.isEmpty(this.itemList)) {
-				this.$msg('请选择结算花材')
-				return false
-			}
-			if(this.$util.isEmpty(this.selectItemUser)) {
-				this.$msg('请选择客户')
-				return false
-			}
-			this.$refs.settlePopRef.open('center')
-		},
-		//清空花材弹框
-		clearItemFn(){
-			this.$refs.clearItemRef.open()
-		},
-		//确认清空花材
-		confirmClearItem(){
-
-		},
-		confirmLogout(){
-			uni.clearStorage()
-			this.$store.commit("setLoginInfo", {})
-			plus.runtime.restart()
-		},
-		logout(){
-			this.$refs.logoutRef.open()
-		},
-		delSelectItem(){
-
 		},
 		selectPayWayBack(price){
 			console.log(price)
@@ -330,25 +252,6 @@ export default {
 	& .open-box {
 		flex: 8;
 		height: 100vh;
-		display: flex;
-		flex-direction: column;
-		padding: 5upx;
-		padding-top: 12upx;
-		& > view {
-			border: 1upx solid #CCCCCC;
-			border-radius: 5upx;
-			text-align: center;
-			padding: 10upx 0;
-			color: #666666;
-			margin-bottom: 10upx;
-			font-size: 10upx;
-			text-align: center;
-			&.active {
-				color: #008000;
-				border-color: #008000;
-				border-radius: 2upx;
-			}
-		}
 	}
 }
 </style>