|
|
@@ -1,390 +0,0 @@
|
|
|
-<template>
|
|
|
-<view class="button-area">
|
|
|
- <view class="active" @click="openBox">开箱</view>
|
|
|
- <view class="active"
|
|
|
- style="background-color:orange;color:white;border-color:orange;position:fixed;left:135upx;bottom:13upx;width:84upx;height:50upx;line-height:30upx;font-size:16upx;"
|
|
|
- @click="goSettleCommit">结算</view>
|
|
|
- <view class="active"
|
|
|
- style="position:fixed;left:36upx;bottom:13upx;width:84upx;height:50upx;line-height:30upx;font-size:15upx;"
|
|
|
- @click="gatheringFn()">收款</view>
|
|
|
- <view class="active" @click="toWastage">报损</view>
|
|
|
- <view class="active" @click="selectCustom()">选客</view>
|
|
|
- <view class="active" @click="clearItemFn">清空</view>
|
|
|
- <view class="active" @click="logoutFn">退出</view>
|
|
|
- <view class="active" @click="closeFn">关闭</view>
|
|
|
-
|
|
|
- <view v-if="Number(customId)>0" style="position:fixed;left:32upx;bottom:66upx;width:189upx;height:20upx;line-height:5upx;font-size:13upx;background-color:white;color:#3385FF;font-weight:bold;border:none;">{{customName}}</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>
|
|
|
-
|
|
|
- <uni-popup ref="wastageRef" type="dialog">
|
|
|
- <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认报损?" @confirm="confirmWastage"></uni-popup-dialog>
|
|
|
- </uni-popup>
|
|
|
-
|
|
|
- <!-- 结算弹框 -->
|
|
|
- <uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
|
|
|
- <settlePop @settleCommit="settleCommit" @cancelSettle="cancelSettle" ref="settlePop" :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" :price.sync="price"></toPayWay>
|
|
|
- </uni-popup>
|
|
|
-
|
|
|
- <!-- 临时收款 -->
|
|
|
- <uni-popup ref="gatheringRef" background-color="#fff" type="center" :animation="false">
|
|
|
- <selectPrice @confirmSelectPrice="confirmSelectPrice" @cancelSelectPrice="cancelSelectPrice"></selectPrice>
|
|
|
- </uni-popup>
|
|
|
-
|
|
|
- <!-- 开单选花材输入数量和金额 -->
|
|
|
- <uni-popup ref="selectNumPriceRef" background-color="#fff" type="center" :animation="false">
|
|
|
- <selectNumPrice @confirmAddItemModel="confirmAddItemModel" :customData.sync="customData"
|
|
|
- @addToClear="addToClear" @cancelKdSelectNumPrice="addItemModelHidden"></selectNumPrice>
|
|
|
- </uni-popup>
|
|
|
-
|
|
|
-</view>
|
|
|
-</template>
|
|
|
-<script>
|
|
|
-import settlePop from './settlePop'
|
|
|
-import toPayWay from './toPay'
|
|
|
-import { wastageCreateOrder } from '@/api/home/index'
|
|
|
-import { createOrder} from '@/api/order'
|
|
|
-import {goodsWastage} from '@/api/wastage'
|
|
|
-import productMins from "@/mixins/product"
|
|
|
-import selectPrice from './selectPrice'
|
|
|
-import selectNumPrice from './selectNumPrice'
|
|
|
-// #ifdef APP-PLUS
|
|
|
-let sunmiCashboxPlugin = uni.requireNativePlugin('Tellsea-SunmiCashboxPlugin')
|
|
|
-// #endif
|
|
|
-export default {
|
|
|
- name:'console',
|
|
|
- mixins: [productMins],
|
|
|
- components:{ settlePop,toPayWay,selectPrice,selectNumPrice},
|
|
|
- props: {
|
|
|
- customId: {
|
|
|
- type: Number,
|
|
|
- default: 0
|
|
|
- },
|
|
|
- customName:{
|
|
|
- type:String,
|
|
|
- default:''
|
|
|
- },
|
|
|
- changeCurrentJobType:{
|
|
|
- type:String,
|
|
|
- default:'bill'
|
|
|
- },
|
|
|
- changeCurrentJobId:{
|
|
|
- type:Number,
|
|
|
- default:0
|
|
|
- }
|
|
|
- },
|
|
|
- data(){
|
|
|
- return {
|
|
|
- totalShop:{ bigUnit: 0, smallUnit:0, totalPrice: 0 },
|
|
|
- orderId:0,
|
|
|
- currentJobType:'bill',
|
|
|
- currentJobId:0,
|
|
|
- calc:'add',
|
|
|
- settleOpenStatus:0,
|
|
|
- price:0
|
|
|
- }
|
|
|
- },
|
|
|
- watch:{
|
|
|
- changeCurrentJobType:{
|
|
|
- handler(str){
|
|
|
- this.currentJobType = str
|
|
|
- },
|
|
|
- immediate:true
|
|
|
- },
|
|
|
- changeCurrentJobId:{
|
|
|
- handler(id){
|
|
|
- this.currentJobId = Number(id)
|
|
|
- },
|
|
|
- immediate:true
|
|
|
- }
|
|
|
- },
|
|
|
- created(){
|
|
|
- this.listenScanItem()
|
|
|
- },
|
|
|
- destroyed(){
|
|
|
- // #ifdef APP-PLUS
|
|
|
- //避免重复,每次进来先移除全局自定义事件监听器
|
|
|
- uni.$off('listenGetScanCode')
|
|
|
- // #endif
|
|
|
- },
|
|
|
- methods:{
|
|
|
- selectCustom(){
|
|
|
- this.$util.hitVoice()
|
|
|
- this.$util.pageTo({url:'/pages/home/selectCustom'})
|
|
|
- },
|
|
|
- closeFn(){
|
|
|
- // #ifdef APP-PLUS
|
|
|
- let that = this
|
|
|
- let type = uni.getSystemInfoSync().platform
|
|
|
- switch(type){
|
|
|
- case 'android':
|
|
|
- plus.runtime.quit()
|
|
|
- break;
|
|
|
- case 'ios':
|
|
|
- that.$msg('IOS暂不支持关闭')
|
|
|
- break;
|
|
|
- default:
|
|
|
- }
|
|
|
- // #endif
|
|
|
- },
|
|
|
- addToClear(){
|
|
|
- let params = {
|
|
|
- hasPay: 0,
|
|
|
- payWay:0,
|
|
|
- needPrint:2,
|
|
|
- freight: '',
|
|
|
- groupName:'',
|
|
|
- remark:'',
|
|
|
- sendCost:0,
|
|
|
- modifyPrice:0,
|
|
|
- getStaffName:''
|
|
|
- }
|
|
|
- if(this.$util.isEmpty(this.selectList)){
|
|
|
- this.$msg('请选择商品')
|
|
|
- return false
|
|
|
- }
|
|
|
- let price = 0
|
|
|
- for (const ele of this.selectList) {
|
|
|
- let currentPrice = Number(ele.currentNum) * Number(ele.unitPrice)
|
|
|
- currentPrice = currentPrice.toFixed(2)
|
|
|
- price = Number(currentPrice) + Number(price)
|
|
|
- price = price.toFixed(2)
|
|
|
- }
|
|
|
- params.modifyPrice = price
|
|
|
- this.settleCommit(params)
|
|
|
- },
|
|
|
- cancelSelectPrice(){
|
|
|
- this.$refs.gatheringRef.close()
|
|
|
- },
|
|
|
- confirmSelectPrice(params){
|
|
|
- uni.showLoading({mask:true})
|
|
|
- //isCashier=1时收银台播放 总金额139元,请扫码付款
|
|
|
- createOrder({orderName:params.name,lsGoodsPrice:params.price,modifyPrice:params.price,isCashier:1,cash:params.cash}).then(res=>{
|
|
|
- uni.hideLoading()
|
|
|
- if(res.code == 1){
|
|
|
- if(res.data.status == 1){
|
|
|
- this.$refs.toPayRef.open('center')
|
|
|
- this.$refs.gatheringRef.close()
|
|
|
- this.orderId = res.data.id
|
|
|
- this.price = res.data.mainPay ? Number(res.data.mainPay) : 0
|
|
|
- }else{
|
|
|
- this.$refs.gatheringRef.close()
|
|
|
- uni.showToast({title: '操作成功' })
|
|
|
- }
|
|
|
- if(params.cash && parseFloat(params.cash)>0){
|
|
|
- this.openBox()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- gatheringFn(){
|
|
|
- this.$util.hitVoice()
|
|
|
- this.$refs.gatheringRef.open('center')
|
|
|
- },
|
|
|
- payFinish(){
|
|
|
- this.$util.hitVoice()
|
|
|
- this.$refs.toPayRef.close()
|
|
|
- this.removeFromSaveDirect()
|
|
|
- this.customId =0
|
|
|
- this.customName=''
|
|
|
- //继续监听花材扫码
|
|
|
- this.listenScanItem()
|
|
|
- //开单完成之后更新花材库存
|
|
|
- this.$emit('rightItemRefresh')
|
|
|
- },
|
|
|
- calcFn(){
|
|
|
- this.calc = this.calc == 'add' ? 'sub' : 'add'
|
|
|
- },
|
|
|
- changeProperty(num){
|
|
|
- this.$emit('changeProperty',num)
|
|
|
- },
|
|
|
- settleCommit(params){
|
|
|
- if(this.$util.isEmpty(this.selectList)) {
|
|
|
- this.$msg('请选择商品')
|
|
|
- return false
|
|
|
- }
|
|
|
- uni.showLoading({mask:true})
|
|
|
- let product = this.selectList.map(i=>({ productId:i.id, unitType: i.unitType||0, num: i.currentNum, property: i.property, unitPrice: i.unitPrice }))
|
|
|
- //isCashier=1时收银台播放 总金额139元,请扫码付款
|
|
|
- createOrder({...params,product:JSON.stringify(product),isCashier:1,customId:this.customId}).then(res=>{
|
|
|
- uni.hideLoading()
|
|
|
- if(res.code == 1){
|
|
|
- if(res.data.status == 1){
|
|
|
- this.orderId = res.data.id
|
|
|
- this.price = res.data.mainPay ? Number(res.data.mainPay) : 0
|
|
|
- this.$refs.toPayRef.open('center')
|
|
|
- }else{
|
|
|
- this.removeFromSaveDirect()
|
|
|
- this.$emit('clearAll')
|
|
|
- //开单完成之后更新花材库存
|
|
|
- this.$emit('rightItemRefresh')
|
|
|
- uni.showToast({ title: '操作成功', duration: 1000 })
|
|
|
- }
|
|
|
- this.settleOpenStatus = 0
|
|
|
- this.$refs.settlePopRef.close()
|
|
|
- if(params.cash && parseFloat(params.cash)>0){
|
|
|
- this.openBox()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- cancelPay(){
|
|
|
- this.$util.hitVoice()
|
|
|
- this.$refs.toPayRef.close()
|
|
|
- this.listenScanItem()
|
|
|
- },
|
|
|
- cancelSettle(){
|
|
|
- this.$util.hitVoice()
|
|
|
- this.settleOpenStatus = 0
|
|
|
- this.$refs.settlePopRef.close()
|
|
|
- },
|
|
|
- async settleReturn(){
|
|
|
- this.$util.hitVoice()
|
|
|
- this.setCreateOrder()
|
|
|
- },
|
|
|
- selectPayWayBack(price){
|
|
|
- this.$util.hitVoice()
|
|
|
- },
|
|
|
- toWastage(){
|
|
|
- this.$util.hitVoice()
|
|
|
- if(this.$util.isEmpty(this.selectList)) {
|
|
|
- this.$msg('请选择报损花材')
|
|
|
- return false
|
|
|
- }
|
|
|
- this.$refs.wastageRef.open('center')
|
|
|
- },
|
|
|
- confirmWastage(){
|
|
|
- this.$util.hitVoice()
|
|
|
- if(this.$util.isEmpty(this.selectList)) {
|
|
|
- this.$msg('请选择报损花材')
|
|
|
- return false
|
|
|
- }
|
|
|
- let hasGoods = this.selectList.some((item) => {
|
|
|
- return item.property == 0
|
|
|
- })
|
|
|
- let hasItem = this.selectList.some((item) => {
|
|
|
- return item.property == 1
|
|
|
- })
|
|
|
- if(hasGoods == true && hasItem == true){
|
|
|
- this.$msg('商品和花材要分别进行报损')
|
|
|
- return false
|
|
|
- }
|
|
|
- if(hasItem == true){
|
|
|
- let product = this.selectList.map(i=>({
|
|
|
- productId:i.id, unitType: i.unitType||0, num: i.currentNum, property: i.property, unitPrice: i.unitPrice,
|
|
|
- }))
|
|
|
- wastageCreateOrder({ product: JSON.stringify(product) }).then(res=>{
|
|
|
- if(res.code == 1){
|
|
|
- this.removeFromSaveDirect()
|
|
|
- this.$refs.wastageRef.close()
|
|
|
- this.$msg("报损成功!")
|
|
|
- }
|
|
|
- })
|
|
|
- }else{
|
|
|
- let goodsList = this.selectList.map(i=>({
|
|
|
- goodsId:i.id, num: i.currentNum, property: i.property, unitPrice: i.unitPrice,name:i.name,cover:i.shortCover
|
|
|
- }))
|
|
|
- goodsWastage({ goodsList: JSON.stringify(goodsList) }).then(res=>{
|
|
|
- if(res.code == 1){
|
|
|
- this.removeFromSaveDirect()
|
|
|
- this.$refs.wastageRef.close()
|
|
|
- this.$msg("报损成功!")
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- goSettleCommit(){
|
|
|
- this.$util.hitVoice()
|
|
|
- if(this.$util.isEmpty(this.selectList)) {
|
|
|
- this.$msg('请选择结算花材')
|
|
|
- return false
|
|
|
- }
|
|
|
- if(this.$util.isEmpty(this.customId)) {
|
|
|
- this.$msg('请选择客户')
|
|
|
- return false
|
|
|
- }
|
|
|
- this.settleOpenStatus = 1
|
|
|
- this.$refs.settlePopRef.open('center')
|
|
|
- },
|
|
|
- //清空花材弹框
|
|
|
- clearItemFn(){
|
|
|
- this.$util.hitVoice()
|
|
|
- this.$refs.clearItemRef.open()
|
|
|
- },
|
|
|
- openBox(){
|
|
|
- // #ifdef APP-PLUS
|
|
|
- sunmiCashboxPlugin.connect((e) => {
|
|
|
- let res = JSON.parse(e)
|
|
|
- if (res.code == 200) {
|
|
|
- sunmiCashboxPlugin.openDrawer((e) => {
|
|
|
- let res = JSON.parse(e)
|
|
|
- if (res.code == 200) {
|
|
|
- //that.$msg(res.msg)
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- // #endif
|
|
|
- },
|
|
|
- //确认清空花材
|
|
|
- confirmClearItem(){
|
|
|
- this.$util.hitVoice()
|
|
|
- this.removeFromSaveDirect()
|
|
|
- this.$emit('clearAll')
|
|
|
- },
|
|
|
- confirmLogout(){
|
|
|
- this.$util.hitVoice()
|
|
|
- uni.clearStorage()
|
|
|
- this.$store.commit("setLoginInfo", {})
|
|
|
- // #ifdef APP-PLUS
|
|
|
- plus.runtime.restart()
|
|
|
- // #endif
|
|
|
- },
|
|
|
- logoutFn(){
|
|
|
- this.$util.hitVoice()
|
|
|
- this.$refs.logoutRef.open()
|
|
|
- },
|
|
|
- delSelectItem(){
|
|
|
- this.$util.hitVoice()
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-<style lang="scss" scoped>
|
|
|
-.button-area {
|
|
|
- height: 100vh;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- justify-content: space-around;
|
|
|
- padding: 5upx;
|
|
|
- padding-top: 12upx;
|
|
|
- & > view {
|
|
|
- border: 1upx solid #CCCCCC;
|
|
|
- border-radius: 5upx;
|
|
|
- text-align: center;
|
|
|
- padding: 10upx 0;
|
|
|
- color: #666666;
|
|
|
- margin-bottom: 12upx;
|
|
|
- font-size: 10upx;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- & .active {
|
|
|
- color: #3385FF;
|
|
|
- border-color: #3385FF;
|
|
|
- font-size: 10upx;
|
|
|
- font-weight:bold;
|
|
|
- }
|
|
|
-}
|
|
|
-</style>
|