Преглед изворни кода

组合开单 与 收款人

shish пре 4 година
родитељ
комит
ff46c92730

+ 3 - 3
hdApp/src/admin/goodsManage/detail.vue

@@ -53,12 +53,12 @@
           </radio-group>
         </tui-list-cell>
 
-        <tui-list-cell class="line-cell" :hover="false">
-          <view class="tui-title">库存不足时</view>
+        <tui-list-cell class="line-cell" :hover="false" v-if="form.flower == 1">
+          <view class="tui-title">没有库存</view>
           <radio-group class="tui-input" @change="stockSetChange">
             <label class="list" for="stockCouldOrder">
               <radio id="stockCouldOrder" value="1" :checked="form.stockSet == 1" style="transform: scale(0.8,0.8);" />
-              <span class="checkbox-text">可以下单</span>
+              <span class="checkbox-text">允许下单</span>
             </label>
             <label class="list" for="stockNotOrder">
               <radio id="stockNotOrder" value="0" :checked="form.stockSet == 0" style="transform: scale(0.8,0.8);" />

+ 1 - 1
hdApp/src/admin/home/me.vue

@@ -80,7 +80,7 @@
             </tui-list-cell>
 
             <tui-list-cell @click="pageTo({ url: '/admin/shop/print' })" class="line-cell" :hover="false" :arrow="true">
-              <view class="tui-title">打印</view>
+              <view class="tui-title">打印机设置</view>
             </tui-list-cell>
 
             <tui-list-cell @click="pageTo({ url: '/admin/jc/index' })" class="line-cell" :hover="false" :arrow="true">

+ 1 - 1
hdApp/src/admin/shop/print.vue

@@ -73,7 +73,7 @@ export default {
   },
   onShow() {
     uni.setNavigationBarTitle({
-      title: `打印`,
+      title: `打印机设置`,
     });
   },
   methods: {

+ 1 - 1
hdApp/src/pages.json

@@ -177,7 +177,7 @@
 				{"path": "list","style": {"navigationBarTitleText": "门店"}},
 				{"path": "downloadCode","style": {"navigationBarTitleText": "收款码"}},
 				{"path": "add","style": {"navigationBarTitleText": ""}},
-				{"path": "print","style": {"navigationBarTitleText": "打印"}},
+				{"path": "print","style": {"navigationBarTitleText": "打印机设置"}},
 				{"path": "password","style": {"navigationBarTitleText": "修改密码"}}
 			]
 		},

+ 4 - 0
hdPad/src/api/group/index.js

@@ -2,4 +2,8 @@ import https from '@/plugins/luch-request_0.0.7/request'
 
 export const getGroupList = data => {
 	return https.get('/group/list', data)
+}
+
+export const detail = data => {
+	return https.get('/group/detail', data)
 }

+ 4 - 0
hdPad/src/api/shop-admin/index.js

@@ -8,4 +8,8 @@ export const prepareBind = data => {
 //创建管理员
 export const generateAdmin = data => {
 	return https.post('/shop-admin/generate-admin', data)
+}
+
+export const getAllStaff = data => {
+	return https.get('/shop-admin/get-all-staff', data)
 }

+ 61 - 2
hdPad/src/mixins/product.js

@@ -1,5 +1,7 @@
 import { mapGetters, mapActions } from "vuex";
 import { copyObject } from "@/utils/util";
+import { getBySn } from '@/api/goods'
+import { allProduct } from '@/api/product'
 export default {
 	data() {
 		return {
@@ -16,7 +18,8 @@ export default {
 			kdType:'HIT',//点击和扫码开单,HIT SCAN
 			checkStock:true,// 考虑库存,盘点不需要考虑库存
 			customData: { currentNum: 0, unitPrice: 0,unitType:0, unitName:'扎',property:1},
-			globalItemList:[]
+			globalItemList:[],
+			globalAllProduct:[]
 		};
 	},
 	onLoad(options) {
@@ -231,6 +234,62 @@ export default {
 		addItemModelHidden() {
 			this.$refs.selectNumPriceRef.close()
 			this.customData = {};
-		}
+		},
+		async takeItem(code){
+			if(this.$util.isEmpty(code)){
+				return false
+			}
+			let current = null
+			let unitPrice = 0
+			let unitName = ''
+			if(code.indexOf('1-') == 0){
+				//成品
+				const res = await getBySn({sn:code})
+				if(res.code == 1){
+					current = res.data
+					if(this.$util.isEmpty(current)){
+						return false
+					}
+					unitName = '份'
+					unitPrice = Number(res.data.price)
+					this.customData = current
+					this.customData.currentNum = 1
+					this.customData.unitPrice = unitPrice
+					this.customData.property = 0
+					this.$refs.selectNumPriceRef.open('center')
+				}
+			}else{
+				//花材
+				current = this.globalAllProduct.find(function(val){
+					return val.itemId == code
+				})
+				if(current == undefined){
+					return false
+				}
+				if(this.$util.isEmpty(current)){
+					return false
+				}
+				unitName = current.bigUnit
+				unitPrice = current.bigPrice
+				this.$util.hitRemind()
+				let num = this.calc == 'add' ? 1 : -1
+				let params = {...current,unitName:unitName,unitPrice:unitPrice,currentNum:num}
+				this.replaceItemFn(params,1)
+			}
+		},
+		getNewItemAndListenScan(){
+			// #ifdef APP-PLUS
+			//避免重复,每次进来先移除全局自定义事件监听器
+			uni.$off('listenGetScanCode')
+			let that = this
+			uni.$on('listenGetScanCode',function(data){
+				that.takeItem(data.code)
+			})
+			allProduct().then(res=>{
+				this.allProduct = res.data.list
+				console.log('载入最新花材...')
+			})
+			// #endif
+		},
 	}
 }

+ 11 - 68
hdPad/src/pages/home/components/console.vue

@@ -1,7 +1,7 @@
 <template>
 <view class="button-area">
 	<view class="active" @click="changeProperty">{{property==1 ? '花材' : '成品'}}</view>
-	<view class="active" @click="gosettleCommit">结算 </view>
+	<view class="active" @click="goSettleCommit">结算 </view>
 	<view class="active" @click="gatheringFn()">收款</view>
 	<view class="active" @click="resetCustomer">选客</view>
 	<view class="active" @click="calcFn">{{calc == 'add' ? '+' : '-'}}</view>
@@ -24,7 +24,7 @@
 
     <!-- 结算弹框 -->
     <uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
-        <settlePop @settleCommit="settleCommit" @cancelSettle="cancelSettle" ref="settlePop"></settlePop>
+        <settlePop @settleCommit="settleCommit" @cancelSettle="cancelSettle" ref="settlePop" :settleOpenStatus.sync="settleOpenStatus"></settlePop>
     </uni-popup>
 
     <!-- 扫码付款 -->
@@ -51,8 +51,6 @@ import { wastageCreateOrder } from '@/api/home/index'
 import { createOrder} from '@/api/order'
 import {goodsWastage} from '@/api/wastage'
 import productMins from "@/mixins/product"
-import { allProduct } from '@/api/product'
-import { getBySn } from '@/api/goods'
 import selectPrice from './selectPrice'
 import selectNumPrice from './selectNumPrice'
 export default {
@@ -77,11 +75,11 @@ export default {
         return {
             totalShop:{ bigUnit: 0, smallUnit:0, totalPrice: 0 },
 			orderId:0,
-			allProduct:[],
             currentJobType:'bill',
             currentJobId:0,
 			calc:'add',
-			property:1
+			property:1,
+			settleOpenStatus:0
         }
     },
     watch:{
@@ -99,7 +97,7 @@ export default {
         }
     },
 	created(){
-		this.initData()
+		this.getNewItemAndListenScan()
 	},
 	destroyed(){
 		// #ifdef APP-PLUS
@@ -129,69 +127,11 @@ export default {
 		payFinish(){
 			this.$util.hitRemind()
 			this.$refs.toPayRef.close()
-			this.initData()
-		},
-		initData(){
-			// #ifdef APP-PLUS
-			//避免重复,每次进来先移除全局自定义事件监听器
-			uni.$off('listenGetScanCode')
-			let that = this
-			uni.$on('listenGetScanCode',function(data){
-				that.takeItem(data.code)
-			})
-			allProduct().then(res=>{
-				this.allProduct = res.data.list
-				console.log('载入最新花材...')
-			})
-			// #endif
+			this.getNewItemAndListenScan()
 		},
 		calcFn(){
 			this.calc = this.calc == 'add' ? 'sub' : 'add'
 		},
-		async takeItem(code){
-			console.log(code)
-			if(this.$util.isEmpty(code)){
-				return false
-			}
-			let current = null
-			let unitPrice = 0
-			let unitName = ''
-			if(code.indexOf('1-') == 0){
-				//成品
-				const res = await getBySn({sn:code})
-				if(res.code == 1){
-					current = res.data
-					if(this.$util.isEmpty(current)){
-						return false
-					}
-					unitName = '份'
-					unitPrice = Number(res.data.price)
-					this.customData = current
-					this.customData.currentNum = 1
-					this.customData.unitPrice = unitPrice
-					this.customData.property = 0
-					this.$refs.selectNumPriceRef.open('center')
-				}
-			}else{
-				//花材
-				current = this.allProduct.find(function(val){
-					return val.itemId == code
-				})
-				if(current == undefined){
-					return false
-				}
-				if(this.$util.isEmpty(current)){
-					return false
-				}
-				unitName = current.bigUnit
-				unitPrice = current.bigPrice
-				this.$util.hitRemind()
-				let num = this.calc == 'add' ? 1 : -1
-				let params = {...current,unitName:unitName,unitPrice:unitPrice,currentNum:num}
-				console.log(params)
-				this.replaceItemFn(params,1)
-			}
-		},
 		changeProperty(){
 			this.property = this.property == 1 ? 0 : 1
 			this.$emit('changeProperty',this.property)
@@ -214,6 +154,7 @@ export default {
 						this.orderId = res.data.id
 						this.$refs.toPayRef.open('center')
 					}
+					this.settleOpenStatus = 0
 					this.$refs.settlePopRef.close()
 					this.removeFromSaveDirect()
 				}
@@ -222,10 +163,11 @@ export default {
 		cancelPay(){
 			this.$util.hitRemind()
 			this.$refs.toPayRef.close()
-			this.initData()
+			this.getNewItemAndListenScan()
 		},
 		cancelSettle(){
 			this.$util.hitRemind()
+			this.settleOpenStatus = 0
 			this.$refs.settlePopRef.close()
 		},
 		async settleReturn(){
@@ -281,7 +223,7 @@ export default {
 				})
 			}
 		},
-		gosettleCommit(){
+		goSettleCommit(){
 			this.$util.hitRemind()
 			if(this.$util.isEmpty(this.selectList)) {
 				this.$msg('请选择结算花材')
@@ -291,6 +233,7 @@ export default {
 				this.$msg('请选择客户')
 				return false
 			}
+			this.settleOpenStatus = 1
 			this.$refs.settlePopRef.open('center')
 		},
 		//清空花材弹框

+ 63 - 9
hdPad/src/pages/home/components/leftGroup.vue

@@ -3,24 +3,39 @@
         <view class="title">列表</view>
         <scroll-view class="itemList-item_box" scroll-y="true" @scrolltolower="reachBottom" lower-threshold="50">
             <view v-for="item in list.data" :key="item.id" class="show-item_box">
-                <view class="item-body_box not-active">
+                <view class="item-body_box not-active" @click="getDetail(item)">
                     <view class="flower-name_box">
                         <view class="current-item-title"><text class="name">{{item.name}}</text></view>
                         <image class="flower-image" :src="item.cover"></image>
                     </view>
-                    <view class="item-price-num"> <view>¥{{parseFloat(item.price)}}</view> <view>{{item.num}}次</view> <view>开单</view> </view>
+                    <view class="item-price-num"> <view>¥{{parseFloat(item.price)}}</view> <view>{{item.num}}次</view> <view>组合开单</view> </view>
                 </view>
             </view>
         </scroll-view>
+
+        <!-- 结算弹框 -->
+        <uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
+            <settlePop @settleCommit="settleCommit" @cancelSettle="cancelSettle" ref="settlePop" :groupInfo.sync="groupInfo" :settleOpenStatus.sync="settleOpenStatus"></settlePop>
+        </uni-popup>
+
+        <!-- 扫码付款 -->
+        <uni-popup ref="toPayRef" background-color="#fff" type="center" :animation="false" :is-mask-click="false">
+            <toPayWay @cancelPay="cancelPay()" @payFinish="payFinish()" @selectPayWayBack="selectPayWayBack" :orderId.sync="orderId"></toPayWay>
+        </uni-popup>
+
     </view>
 </template>
 <script>
-import {getGroupList} from "@/api/group"
-import { list } from "@/mixins";
+import settlePop from './settlePop'
+import toPayWay from './toPay'
+import {getGroupList,detail} from "@/api/group"
+import { list } from "@/mixins"
+import { createOrder} from '@/api/order'
+import productMins from "@/mixins/product"
 export default {
     name:'leftItem',
-    components:{},
-	mixins: [list],
+    components:{settlePop,toPayWay},
+	mixins: [list,productMins],
 	props: {
 		customId: {
 			type: Number,
@@ -33,7 +48,9 @@ export default {
             itemList:[],
             currentJobType:'bill',
             currentJobId:0,
-            groupList:[]
+            groupList:[],
+            settleOpenStatus:0,
+            groupInfo:{}
         }
     },
     watch:{
@@ -48,6 +65,37 @@ export default {
         this.getGroupList()
     },
     methods:{
+        getDetail(item){
+            this.$util.hitRemind()
+            uni.showLoading({mask:true})
+            detail({id:item.id}).then(res=>{
+                uni.hideLoading()
+                if(res.code == 1){
+                    this.groupInfo = res.data.info || []
+                    this.settleOpenStatus = 1
+                    this.$refs.settlePopRef.open('center')
+                }
+            })
+        },
+		settleCommit(params){
+			uni.showLoading({mask:true})
+			createOrder({...params,groupId:this.groupInfo.id}).then(res=>{
+				uni.hideLoading()
+				if(res.code == 1){
+					if(res.data.status == 1){
+						this.orderId = res.data.id
+						this.$refs.toPayRef.open('center')
+					}
+					this.settleOpenStatus = 0
+					this.$refs.settlePopRef.close()
+				}
+			})
+		},
+		cancelPay(){
+			this.$util.hitRemind()
+			this.$refs.toPayRef.close()
+			this.getNewItemAndListenScan()
+		},
         reachBottom() {
             if (!this.list.finished) {
                 this.getGroupList().then((res) => {
@@ -63,7 +111,12 @@ export default {
                     this.completes(res);
                 }
             })
-        }
+        },
+		cancelSettle(){
+			this.$util.hitRemind()
+			this.settleOpenStatus = 0
+			this.$refs.settlePopRef.close()
+		},
     }
 }
 </script>
@@ -119,9 +172,10 @@ export default {
                     }
                 }
                 .item-price-num{
-                    color:#afaeae;
+                    color:#428369;
                     font-size:10upx;
                     display: flex;
+                    margin-top:5upx;
                     align-items: center;
                     justify-content: space-between;
                     padding: 15upx 2upx 0 2upx;

+ 2 - 0
hdPad/src/pages/home/components/selectPrice.vue

@@ -113,6 +113,8 @@ export default {
             width:150upx;
             margin:20upx auto 0 auto;
             height:30upx;
+            font-size:15upx;
+            text-align:center;
         }
     }
     & .flower-open_box {

+ 100 - 30
hdPad/src/pages/home/components/settlePop.vue

@@ -14,14 +14,21 @@
                     <view :key="item.id" @tap="changePayWay(item.id)" v-for="item in payWayList" :class="[form.payWay===item.id?'active':'']"> {{item.name}} </view>  
                 </view>
             </view>
-            
+          
+            <view class="select-item_box">
+                <view class="title">收款账号</view>
+                <view class="item-list_box">
+                    <view :key="item.id" @tap="changeGetStaff(item)" v-for="item in getStaffList" :class="[form.getStaffId===item.id?'active':'']"> {{item.name}} </view>  
+                </view>
+            </view>
+
             <view class="select-item_box">
                 <view class="title">打印小票</view>
                 <view class="item-list_box">
                     <view :key="item.id" @tap="changeNeedPrint(item.id)" v-for="item in needPrintList" :class="[form.needPrint===item.id?'active':'']"> {{item.name}} </view>     
                 </view>
             </view>
-            <view class="select-item_box">
+            <view class="select-item_box" v-if="$util.isEmpty(groupInfo)">
                 <view class="title">如需保存此组合,请输入名称:</view>
                 <view class="inpup_box">
                     <view><input type="text" v-model="form.groupName" name="groupName" /></view>     
@@ -62,36 +69,20 @@
             <view class="keyboard-body_box"> <VKeyboard ref="keyboard" :digital="true" :disorderly="false" @typing="typing" @enter="enter" @cancel="cancel"> </VKeyboard> </view>
 
         </view>
+
+        <uni-popup ref="remindSettleRef" type="dialog">
+            <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认提交?" @confirm="confirmToSettle"></uni-popup-dialog>
+        </uni-popup>
+
+
     </view>
 </template>
 <script>
 import VKeyboard from '@/components/vKeyboard/VKeyboard.vue'
 import productMins from "@/mixins/product";
+import { getAllStaff} from '@/api/shop-admin'
 export default {
     name:'selectCustomer',
-    props:{
-        totalShop:{
-            type:Object,
-            default:()=>{}
-        }
-    },
-    components:{ VKeyboard },
-	mixins: [productMins],
-    computed:{
-        totalPrice(){
-            let price = Number(this.allPrice)+Number(this.form.sendCost)
-            price = parseFloat(price.toFixed(2))
-
-            this.form.modifyPrice = price
-
-            return price
-        },
-        diffPrice(){
-            let price = Number(this.totalPrice) - Number(this.form.modifyPrice)
-            price = parseFloat(price.toFixed(2))
-            return price
-        }
-    },
     data() {
         return {
             //全选类型 0 实收金额全选 1 运费全选 2 没有任何全选
@@ -106,22 +97,94 @@ export default {
                 groupName:'',
                 remark:'',
                 sendCost:0,
-                modifyPrice:0
+                modifyPrice:0,
+                getStaffId:0,
+                getStaffName:''
             },
             proceeds: '0',
             hasPayList:[ { name:'待付款', id:0, }, { name:'已付款', id:1, }],
-            payWayList:[ { name:'微信', id:0 }, { name:'支付宝', id:1 }, { name:'现金', id:4 }, { name:'银行卡', id:5 } ],
+            payWayList:[ { name:'微信', id:0 }, { name:'支付宝', id:1 }, { name:'现金', id:4 }, { name:'银行卡', id:5 },{name:'其它',id:9} ],
             currentInputType:'proceeds',
             totalMoney: 0,
-            needPrintList:[ { name:'打印', id:1 }, { name:'不打印', id:2 } ]
+            needPrintList:[ { name:'打印', id:1 }, { name:'不打印', id:2 } ],
+            getStaffList:[]
         };
     },
-    mounted() {
-        this.activeKeyboard()
+    props:{
+        totalShop:{
+            type:Object,
+            default:()=>{}
+        },
+        groupInfo:{
+            type:Object,
+            default:()=>{}
+        },
+        settleOpenStatus:{
+            type:Number,
+            default:0
+        }
+    },
+    components:{ VKeyboard },
+	mixins: [productMins],
+    computed:{
+        totalPrice(){
+            let price = 0
+            if(!this.$util.isEmpty(this.groupInfo)){
+                price = this.groupInfo.price ? parseFloat(this.groupInfo.price) : 0
+            }else{
+                price = Number(this.allPrice)+Number(this.form.sendCost)
+                price = parseFloat(price.toFixed(2))
+            }
+            this.form.modifyPrice = price
+            return price
+        },
+        diffPrice(){
+            let price = Number(this.totalPrice) - Number(this.form.modifyPrice)
+            price = parseFloat(price.toFixed(2))
+            return price
+        }
     },
     watch:{
+        settleOpenStatus:{
+            handler(val){
+                if(Number(val) == 1){
+                    this.form.hasPay = 0
+                    this.form.payWay = 0
+                    this.form.needPrint = 1
+                    this.form.groupName = ''
+                    this.form.remark = ''
+                    this.form.sendCost = 0
+                }
+            },
+            immediate:true
+        },
+        groupInfo:{
+            handler(val){
+                if(!this.$util.isEmpty(val)){
+
+                }
+            },
+            immediate:true
+        }
+    },
+    mounted() {
+        this.activeKeyboard()
+
+        getAllStaff().then(res=>{
+            if(res.code == 1){
+                this.getStaffList = res.data.list
+                if(!this.$util.isEmpty(this.getStaffList)){
+                    this.form.getStaffId = this.getStaffList[0].id
+                    this.form.getStaffName = this.getStaffList[0].name
+                }
+            }
+        })
     },
     methods: {
+        changeGetStaff(item){
+            this.form.getStaffId = item.id
+            this.form.getStaffName = item.name
+        },
         changeNeedPrint(val){
             this.form.needPrint = val
         },
@@ -136,6 +199,10 @@ export default {
             this.fillType = val
         },
         typing(e) {
+            if(!this.$util.isEmpty(this.groupInfo)){
+                this.$msg('不可修改')
+                return false
+            }
             if (e.backspace) {
                 if(this.fillType == 0){
                     if(this.checkType == 0){
@@ -175,6 +242,9 @@ export default {
             this.$refs.keyboard.activate();
         },
         enter() {
+            this.$refs.remindSettleRef.open('center')
+        },
+        confirmToSettle(){
             this.$emit('settleCommit',this.form)
         },
         cancel(){