|
|
@@ -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')
|
|
|
},
|
|
|
//清空花材弹框
|