shish 4 лет назад
Родитель
Сommit
a83cc259be

+ 26 - 35
hdPad/src/admin/home/components/middleButton.vue

@@ -5,7 +5,7 @@
     <view @click="resetCustomer">选客户</view>
     <view @click="clearItemFn">清空花材</view>
     <view @click="breakage">报损</view>
-    <view @click="goToSettle">结算 </view>
+    <view @click="gosettleCommit">结算 </view>
 
     <!-- 清空花材 -->
     <uni-popup ref="clearItemRef" type="dialog">
@@ -16,26 +16,26 @@
         <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认退出?" @confirm="confirmLogout"></uni-popup-dialog>
     </uni-popup>
 
-    <!-- 结算弹框 isShowSettle -->
+    <!-- 结算弹框 -->
     <uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
-        <settlePop @settleReturn="settleReturn" ref="settlePop" :totalShop="totalShop"></settlePop>
+        <settlePop @settleCommit="settleCommit" ref="settlePop"></settlePop>
     </uni-popup>
-    <!-- 选择支付方式 isShowselectPayWay -->
-    <uni-popup ref="selectPayWayRef" background-color="#fff" type="center" :animation="false">
-        <selectPayWay @cancel="cancelPay()" @selectPayWayBack="selectPayWayBack"></selectPayWay>
+    <!-- 选择支付方式 -->
+    <uni-popup ref="toPayRef" background-color="#fff" type="center" :animation="false">
+        <toPayWay @cancelPay="cancelPay()" @selectPayWayBack="selectPayWayBack"></toPayWay>
     </uni-popup>
 
 </view>
 </template>
 <script>
 import settlePop from './settle-pop.vue'
-import selectPayWay from '@/components/select-pay-way.vue'
+import toPayWay from '@/components/to-pay-way.vue'
 import { createCreateOrder, wastageCreateOrder } from '@/api/home/index'
 import productMins from "@/mixins/product";
 export default {
     name:'middleButton',
 	mixins: [productMins],
-    components:{ settlePop,selectPayWay },
+    components:{ settlePop,toPayWay },
 	props: {
 		customId: {
 			type: Number,
@@ -48,7 +48,7 @@ export default {
         }
     },
     created(){
-
+		
     },
 	watch:{
 
@@ -58,33 +58,22 @@ export default {
 			this.$util.hitRemind()
 			this.$emit('resetCustomer')
 		},
-		async setCreateOrder(){
-			this.$util.hitRemind()
-			try {
-				let arr = this.itemList.map(i=>({ productId:i.id, unitType: i.unitType, num: i.currentNum, property: i.property, unitPrice: i.currentUnitPrice }))
-				const {settleId,payId,payUserId,isPrint,proceeds,freight} = this.$refs.settlePop
-				await createCreateOrder({
-					customId: this.customId,
-					product: JSON.stringify(arr),
-					modifyPrice: proceeds,
-					sendType: 1,
-					hasPay: settleId,
-					payWay: payId,
-					getUserId: payUserId,
-					needPrint: isPrint,
-					sendCost: freight,
-					remark:''
-				})
-				this.$refs.settlePopRef.close()
-				this.$refs.selectPayWayRef.open('center')
-				this.$msg('订单创建成功')
-			}catch(err) {
-				console.log(err)
+		settleCommit(params){
+			if(this.$util.isEmpty(this.selectList)) {
+				this.$msg('请选择商品')
+				return false
 			}
+			let product = this.selectList.map(i=>({ productId:i.id, unitType: i.unitType, num: i.buyNum, property: i.property, unitPrice: i.unitPrice }))
+			createCreateOrder({...params,product:JSON.stringify(product)}).then(res=>{
+				if(res.code == 1){
+					this.$refs.settlePopRef.close()
+					this.$refs.toPayRef.open('center')
+				}
+			})
 		},
 		cancelPay(){
 			this.$util.hitRemind()
-			this.$refs.selectPayWayRef.close()
+			this.$refs.toPayRef.close()
 		},
 		async settleReturn(){
 			this.$util.hitRemind()
@@ -108,7 +97,7 @@ export default {
 						unitType: i.unitType,
 						num: i.currentNum
 					}))
-					await wastageCreateOrder({
+					wastageCreateOrder({
 						product: JSON.stringify(arr)
 					})
 					this.$msg("报损成功!");
@@ -117,7 +106,9 @@ export default {
 				}
 			})
 		},
-		goToSettle(){
+		gosettleCommit(){
+			this.$refs.toPayRef.open('center')
+			return
 			this.$util.hitRemind()
 			if(this.$util.isEmpty(this.selectList)) {
 				this.$msg('请选择结算花材')
@@ -177,4 +168,4 @@ export default {
         }
     }
 }
-</style>
+</style>

+ 96 - 38
hdPad/src/admin/home/components/settle-pop.vue

@@ -4,21 +4,21 @@
             <view class="select-item_box">
                 <view class="title">结账方式</view>
                 <view class="item-list_box">
-                    <view :key="item.id" @tap="changeType('hasPay',item.id)" v-for="item in hasPayList" :class="[form.hasPay===item.id?'active':'']"> {{item.name}} </view>    
+                    <view :key="item.id" @tap="changeHasPay(item.id)" v-for="item in hasPayList" :class="[form.hasPay===item.id?'active':'']"> {{item.name}} </view>    
                 </view>
             </view>
-            <template v-if="hasPay!==3">
+            <template>
                 <view class="select-item_box">
                     <view class="title">收款方式</view>
                     <view class="item-list_box">
-                        <view :key="item.id" @tap="changeType('payWay',item.id)" v-for="item in payWayList" :class="[form.payWay===item.id?'active':'']"> {{item.name}} </view>  
+                        <view :key="item.id" @tap="changePayWay(item.id)" v-for="item in payWayList" :class="[form.payWay===item.id?'active':'']"> {{item.name}} </view>  
                     </view>
                 </view>
             </template>
             <view class="select-item_box">
                 <view class="title">打印小票</view>
                 <view class="item-list_box">
-                    <view :key="item.id" @tap="changeType('isPrint',item.id)" v-for="item in needPrintList" :class="[form.needPrint===item.id?'active':'']"> {{item.name}} </view>     
+                    <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">
@@ -37,33 +37,36 @@
         <view class="line"></view>
         <view class="select-right">
 
-            <view style="border-bottom: 1upx solid #ebedf0;height:35upx;font-size: 14upx;display:flex;align-items: center;justify-content:space-between;padding-right:10upx;">
+            <view class="input-list">
                 <text>商品金额</text>
-                <text>¥<text>50</text></text>
+                <text>¥<text>{{allPrice}}</text></text>
             </view>
 
-            <view style="border-bottom: 1upx solid #ebedf0;height:35upx;font-size: 14upx;display:flex;align-items: center;justify-content:space-between;padding-right:10upx;">
+            <view class="input-list" @click.stop="changeCheck(1)">
                 <text style="color:green;">运费</text>
-                <text>¥<text>50</text></text>
+                <text>¥<text :class="{selected:checkType == 1}">{{form.sendCost}}</text></text>
             </view>
 
-            <view style="border-bottom: 1upx solid #ebedf0;height:35upx;font-size: 14upx;display:flex;align-items: center;justify-content:space-between;padding-right:10upx;">
+            <view class="input-list">
                 <text>总金额</text>
-                <text>¥<text>50</text></text>
+                <text>¥<text>{{totalPrice}}</text></text>
             </view>
 
-            <view style="border-bottom: 1upx solid #ebedf0;height:35upx;font-size: 14upx;display:flex;align-items: center;justify-content:space-between;margin-bottom:10upx;padding-right:10upx;">
+            <view class="input-list input-bottom" @click.stop="changeCheck(0)">
                 <text style="color:green;">实收金额</text>
-                <text style="font-size: 10upx;color:green;">优惠¥<text>5</text></text>
-                <text>¥<text>50</text></text>
+                <text style="font-size: 10upx;color:green;" v-if="diffPrice > 0">优惠¥<text>{{diffPrice}}</text></text>
+                <text style="font-size: 10upx;color:green;" v-if="diffPrice < 0">人工包装费¥<text>{{Math.abs(diffPrice)}}</text></text>
+                <text>¥<text :class="{selected:checkType == 0}">{{form.modifyPrice}}</text></text>
             </view>
 
             <view class="keyboard-body_box"> <VKeyboard ref="keyboard" :digital="true" :disorderly="false" @typing="typing" @enter="enter"> </VKeyboard> </view>
+
         </view>
     </view>
 </template>
 <script>
 import VKeyboard from '@/components/plugin/vKeyboard/VKeyboard.vue'
+import productMins from "@/mixins/product";
 export default {
     name:'selectCustomer',
     props:{
@@ -73,17 +76,37 @@ export 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 没有任何全选
+            checkType:0,
+            //输入类型 0 实收金额 1 运费
+            fillType:0,
             form:{
                 hasPay: 0,
                 payWay:0,
                 needPrint:1,
                 freight: '',
                 groupName:'',
-                remark:''
+                remark:'',
+                sendCost:0,
+                modifyPrice:0
             },
             proceeds: '0',
             hasPayList:[ { name:'待付款', id:0, }, { name:'已付款', id:1, }],
@@ -94,46 +117,65 @@ export default {
         };
     },
     mounted() {
-        this.activeKeyboard();
-        this.updateTotal()
+        this.activeKeyboard()
     },
     watch:{
-        totalShop(){
-            this.updateTotal()
-        }
     },
     methods: {
-        updateTotal(){
-            this.proceeds = this.totalShop.totalPrice
-            this.totalMoney = (+this.totalShop.totalPrice) +  (this.$util.isEmpty(this.freight)?0: +this.freight)
+        changeNeedPrint(val){
+            this.form.needPrint = val
         },
-        changeEnterType(type){
-            this.currentInputType = type
+        changePayWay(val){
+            this.form.payWay = val
         },
-        changeType(key, id){
-            this[key] = id
+        changeHasPay(val){
+            this.form.hasPay = val
         },
-        activeKeyboard() {
-            this.$refs.keyboard.activate();
+        changeCheck(val){
+            this.checkType = val
+            this.fillType = val
         },
         typing(e) {
             if (e.backspace) {
-                if (this[this.currentInputType].length > 0) {
-                    this[this.currentInputType] = this[this.currentInputType].substring(0, this[this.currentInputType].length - 1);
+                if(this.fillType == 0){
+                    if(this.checkType == 0){
+                        this.form.modifyPrice = ''
+                    }else{
+                        if (this.form.modifyPrice.length > 0) {
+                            this.form.modifyPrice = this.form.modifyPrice.substring(0, this.form.modifyPrice.length - 1)   
+                        }
+                    }
+                }else{
+                    if(this.checkType == 1){
+                        this.form.sendCost = ''
+                    }else{
+                        if (this.form.sendCost.length > 0) {
+                            this.form.sendCost = this.form.sendCost.substring(0, this.form.sendCost.length - 1)   
+                        }
+                    }
                 }
             }else {
-                if(this[this.currentInputType]== 0 || this.$util.isEmpty(this[this.currentInputType])) {
-                    this[this.currentInputType] = e.char
-                }else {
-                    this[this.currentInputType] += e.char;
+                if(this.fillType == 0){
+                    if(this.$util.isEmpty(this.form.modifyPrice) || this.checkType == 0) {
+                        this.form.modifyPrice = e.char
+                    }else {
+                        this.form.modifyPrice += e.char;
+                    }
+                }else{
+                    if(this.$util.isEmpty(this.form.sendCost) || this.checkType == 1) {
+                        this.form.sendCost = e.char
+                    }else {
+                        this.form.sendCost += e.char
+                    }
                 }
             }
-            if(this[this.currentInputType] === 'freight') {
-                this.updateTotal()
-            }  
+            this.checkType = 2
+        },
+        activeKeyboard() {
+            this.$refs.keyboard.activate();
         },
         enter() {
-            this.$emit('settleReturn') 
+            this.$emit('settleCommit',this.form)
         },
     }
 }
@@ -205,6 +247,22 @@ export default {
         padding: 10upx;
         display: flex;
         flex-direction: column;
+        & .input-list{
+            border-bottom: 1upx solid #ebedf0;
+            height:35upx;
+            font-size: 14upx;
+            display:flex;
+            align-items: center;
+            justify-content:space-between;
+            padding-right:10upx;
+            .selected{
+                background:blue;
+                color:white;
+            }
+        }
+        & .input-bottom{
+            margin-bottom:10upx;
+        }
         & .shop-distoracn {
             text-align: right;
             font-size: 14upx;

+ 0 - 134
hdPad/src/components/select-pay-way.vue

@@ -1,134 +0,0 @@
-<template>
-    <view class="app-collect_money">
-        <template v-if="step===0">
-            <view class="price-box">
-                <view class="title">金额</view>
-                <input  disabled type="text" v-model="price">
-            </view>
-            <view class="keyboard-body_box">
-                <VKeyboard ref="keyboard" :digital="true" :disorderly="false" @typing="typing" @enter="enter"> </VKeyboard>
-            </view>
-        </template>
-        <template v-else>
-            <view class="collect-code_box">
-                <image class="img" src="../static/images/common/business-sale.png" mode="scaleToFill" />
-                <view class="btn-default result">查询结果</view>
-                <view @click="cancel" class="btn-default">取消</view>
-            </view>
-        </template>
-    </view>
-</template>
-<script>
-    import VKeyboard from '@/components/plugin/vKeyboard/VKeyboard.vue'
-    export default {
-        name:'collectMoney',
-        components:{
-            VKeyboard
-        },
-        props:{
-            step:{
-                type:Number,
-                default: 1
-            }
-        },
-        data(){
-            return {
-                price: 0,
-                
-            }
-        },
-        mounted(){
-            if(this.step === 0) {
-                this.activeKeyboard()
-            }   
-        },
-        methods:{
-            //键盘方法
-			activeKeyboard() {
-				this.$refs.keyboard.activate();
-			},
-            typing(e) {
-				if (e.backspace) {
-					if (this.price.length > 0) {
-						this.price = this.price.substring(0, this.price.length - 1);
-					}
-				}else {
-                    if(this.price == 0|| this.$util.isEmpty(this.price)) {
-                        this.price = e.char
-                    }else {
-                        this.price += e.char;
-                    }
-				}
-			},
-			enter() {
-                this.$emit('collectMoneyBack', this.price)
-			},
-            cancel(){
-                this.$emit('cancel')
-            }
-        },
-        watch:{
-           step(){
-                 if(this.step === 0) {
-                    this.activeKeyboard()
-                }  
-           } 
-        }
-    }
-</script>
-
-<style lang="scss" scoped>
-.app-collect_money {
-    background-color: #ffffff;
-    margin: 0 auto;
-    border-radius: 5upx;
-    padding: 10upx;
-    // overflow: hidden;
-    overflow-y: auto;
-    display: flex;
-    height: 90vh;
-    flex-direction: column;
-    box-sizing: border-box;
-    & .price-box {
-        min-height: 100upx;
-        & > .title {
-            text-align: center;
-            font-size: 14upx;
-            padding: 5upx 0;
-            
-        }
-        & > input {
-            text-align: center;
-            line-height: 40upx;
-            height: 40upx;
-            font-size: 14upx;
-        }
-    }
-    & .keyboard-body_box {
-        flex: 1;
-    }
-    & .collect-code_box {
-        height: 100%;
-        display: flex;
-        align-items: center;
-        justify-content: center;
-        flex-direction: column;
-        & > .img {
-            width: 100upx;
-            height: 100upx;
-        }
-        & .btn-default {
-            height: 40upx;
-            width: 100upx;
-            text-align: center;
-            line-height: 40upx;
-            border: 1px solid #eee;
-            font-size: 14upx;
-            color: #333333;
-        }
-        & > .result {
-            margin: 30upx 0;
-        }
-    }
-}
-</style>

+ 120 - 0
hdPad/src/components/to-pay-way.vue

@@ -0,0 +1,120 @@
+<template>
+    <view class="app-collect_money">
+        <view v-if="showSuccess == false">
+            <view class="collect-code_box">
+                <image class="img" :src="`${constant.imgUrl}/icon/scan/scan.png`" mode="scaleToFill" />
+                <view class="show-code">请出示付款码</view>
+                <view class="btn-default result">查询结果</view>
+                <view @click="cancelPay" class="btn-default result">取消</view>
+            </view>
+        </view>
+        <view v-else>
+
+			<view class="result-view">
+				<view class="iconfont iconchenggong"></view>
+				<view class="result-title">付款成功</view>
+				<button class="admin-button-com mini-btn default">返回</button>
+			</view>
+
+        </view>
+    </view>
+</template>
+<script>
+export default {
+    name:'toPayWay',
+    components:{
+    },
+    data(){
+        return {
+            showSuccess:false
+        }
+    },
+    methods:{
+        cancelPay(){
+            this.$emit('cancelPay')
+        }
+    },
+    watch:{
+    }
+}
+</script>
+<style lang="scss" scoped>
+.app-collect_money {
+    background-color: #ffffff;
+    margin: 0 auto;
+    border-radius: 5upx;
+    padding: 10upx;
+    overflow-y: auto;
+    display: flex;
+    height: 90vh;
+    flex-direction: column;
+    box-sizing: border-box;
+    width:50vw;
+    & .price-box {
+        min-height: 100upx;
+        & > .title {
+            text-align: center;
+            font-size: 14upx;
+            padding: 5upx 0;
+            
+        }
+        & > input {
+            text-align: center;
+            line-height: 40upx;
+            height: 40upx;
+            font-size: 14upx;
+        }
+    }
+    & .keyboard-body_box {
+        flex: 1;
+    }
+    & .collect-code_box {
+        height: 100%;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        flex-direction: column;
+        padding-top:38upx;
+        & > .img {
+            width: 100upx;
+            height: 100upx;
+        }
+        & .show-code{
+            font-size: 14upx;
+            margin: 20upx 0 0 0;            
+        }
+        & .btn-default {
+            height: 40upx;
+            width: 100upx;
+            text-align: center;
+            line-height: 40upx;
+            border: 1px solid #eee;
+            font-size: 14upx;
+            color: #333333;
+        }
+        & > .result {
+            margin: 20upx 0 0 0;
+        }
+    }
+	.result-view {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		background: #ffffff;
+		border-radius: 20upx;
+        padding-top:50upx;
+		.iconchenggong {
+			font-size: 50upx;
+			color: $mainColor1;
+		}
+		.result-title {
+			margin: 20upx 0 10upx;
+			font-size: 15upx;
+		}
+        button{
+            font-size:13upx;
+            margin-top:10upx;
+        }
+	}
+}
+</style>