|
|
@@ -1,69 +1,35 @@
|
|
|
<template>
|
|
|
<view class="app-workbench_box">
|
|
|
<view class="nav-left">
|
|
|
- <view class="item-list">
|
|
|
- 收银
|
|
|
- </view>
|
|
|
+ <view class="item-list"> 收银 </view>
|
|
|
</view>
|
|
|
<view class="shopList-box">
|
|
|
<view class="title">商品列表</view>
|
|
|
<view class="shopList-item_box">
|
|
|
- <view
|
|
|
- v-for="item in shopList"
|
|
|
- :key="item.id"
|
|
|
- @click="selectCurrentActive(item)"
|
|
|
- class="shop-item_box">
|
|
|
- <view :class="[
|
|
|
- 'shop-body_box',
|
|
|
- selectCurrentActiveItem.id===item.id?'active':'']">
|
|
|
+ <view v-for="item in shopList" :key="item.id" @click="selectCurrentActive(item)" class="shop-item_box">
|
|
|
+ <view :class="[ 'shop-body_box', selectCurrentActiveItem.id===item.id?'active':'not-active']">
|
|
|
<view class="flower-name_box">
|
|
|
<view class="name">
|
|
|
{{item.name}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <view>{{item.currentUnitPrice}}元/{{item.currentUnit}}</view>
|
|
|
+ <view>{{parseFloat(item.currentUnitPrice)}}元/{{item.currentUnit}}</view>
|
|
|
<view>{{item.currentNum}} {{item.currentUnit}}</view>
|
|
|
<view>¥{{item.currentNum * item.currentUnitPrice}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- <view class="shop-item_box">
|
|
|
- <view class="shop-body_box">
|
|
|
- <view class="flower-name_box">
|
|
|
- <view class="name">
|
|
|
- 小菊
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view>
|
|
|
- <view>25元/支</view>
|
|
|
- <view>5支</view>
|
|
|
- <view>¥108</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view> -->
|
|
|
</view>
|
|
|
<view class="shopList-footer_box">
|
|
|
- <view>
|
|
|
- 数量:
|
|
|
- <text style="fontWeight:bold">
|
|
|
- <!-- 8扎5支 -->
|
|
|
- {{totalShop.bigUnit}}扎 {{totalShop.smallUnit}}支
|
|
|
- </text>
|
|
|
- </view>
|
|
|
- <view>
|
|
|
- 合计:
|
|
|
- <text style="color:red">¥{{totalShop.totalPrice}}</text>
|
|
|
- </view>
|
|
|
+ <view> 数量: <text style="fontWeight:bold"> {{totalShop.bigUnit}}扎 {{totalShop.smallUnit}}支 </text> </view>
|
|
|
+ <view> 合计: <text style="color:red">¥{{totalShop.totalPrice}}</text> </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="open-box">
|
|
|
<view @click="selectUser">
|
|
|
客户
|
|
|
</view>
|
|
|
- <!-- <view class="active">
|
|
|
- 扎
|
|
|
- </view> -->
|
|
|
<view @click="deleteShop">
|
|
|
删除商品
|
|
|
</view>
|
|
|
@@ -77,47 +43,23 @@
|
|
|
<view class="shop-list">
|
|
|
<shopTypeSelect @selectItemChange="selectItemChange">
|
|
|
<view slot="footer" class="shop-footer_box">
|
|
|
- <view
|
|
|
- @tap="breakage"
|
|
|
- class="btn-breakage">
|
|
|
- 报损
|
|
|
- </view>
|
|
|
- <view
|
|
|
- @click="settle"
|
|
|
- class="btn-account">
|
|
|
- 结算
|
|
|
- </view>
|
|
|
+ <view @tap="breakage" class="btn-breakage"> 报损 </view>
|
|
|
+ <view @click="settle" class="btn-account"> 结算 </view>
|
|
|
</view>
|
|
|
</shopTypeSelect>
|
|
|
</view>
|
|
|
- <uniPopup
|
|
|
- :show.sync="isShowUser"
|
|
|
- type="top"
|
|
|
- maxHeight="90vh"
|
|
|
- >
|
|
|
+ <uniPopup :show.sync="isShowUser" type="top" maxHeight="90vh" >
|
|
|
<selectUser @selectUser="selectUserReturn">
|
|
|
</selectUser>
|
|
|
</uniPopup>
|
|
|
- <uniPopup
|
|
|
- :show.sync="isShowFllowNum"
|
|
|
- type="top"
|
|
|
- maxHeight="90vh">
|
|
|
+ <uniPopup :show.sync="isShowFllowNum" type="top" maxHeight="90vh">
|
|
|
<keyboardSetFlower @enterNum="enterReturn" :selectItem.sync="selectItem"></keyboardSetFlower>
|
|
|
</uniPopup>
|
|
|
- <uniPopup
|
|
|
- :show.sync="isShowSettle"
|
|
|
- type="top"
|
|
|
- maxHeight="90vh"
|
|
|
- >
|
|
|
+ <uniPopup :show.sync="isShowSettle" type="top" maxHeight="90vh" >
|
|
|
<selectSettle @settleReturn="settleReturn" ref="selectSettle" :totalShop="totalShop"></selectSettle>
|
|
|
</uniPopup>
|
|
|
- <uniPopup
|
|
|
- :show.sync="isShowCollectMoney"
|
|
|
- type="top"
|
|
|
- maxHeight="90vh"
|
|
|
- >
|
|
|
+ <uniPopup :show.sync="isShowCollectMoney" type="top" maxHeight="90vh" >
|
|
|
<collectMoney @cancel="isShowCollectMoney=false" @collectMoneyBack="collectMoneyBack"></collectMoney>
|
|
|
- <!-- <selectSettle @settleReturn="settleReturn" ref="selectSettle" :totalShop="totalShop"></selectSettle> -->
|
|
|
</uniPopup>
|
|
|
<NotLogin></NotLogin>
|
|
|
</view>
|
|
|
@@ -180,40 +122,25 @@ export default {
|
|
|
},
|
|
|
watch:{
|
|
|
shopList(){
|
|
|
- if(this.$util.isEmpty(this.shopList)) {
|
|
|
- this.totalShop = {
|
|
|
- bigUnit: 0,
|
|
|
- smallUnit:0,
|
|
|
- totalPrice: 0
|
|
|
- }
|
|
|
- }
|
|
|
+ if(this.$util.isEmpty(this.shopList)) {
|
|
|
+ this.totalShop = { bigUnit: 0, smallUnit:0, totalPrice: 0 }
|
|
|
+ }
|
|
|
this.totalShop = this.shopList.reduce((total,val)=>{
|
|
|
- // 0 大单位 1小单位
|
|
|
- if(val.unitType === 0) {
|
|
|
- total.bigUnit = total.bigUnit + (val.currentNum *1)
|
|
|
- }else {
|
|
|
- total.smallUnit = total.smallUnit +(1*val.currentNum)
|
|
|
- }
|
|
|
- total.totalPrice = total.totalPrice + (1*val.currentNum) * (val.currentUnitPrice*1)
|
|
|
- return total
|
|
|
- },{
|
|
|
- bigUnit: 0,
|
|
|
- smallUnit:0,
|
|
|
- totalPrice: 0
|
|
|
- })
|
|
|
+ if(val.unitType === 0) {
|
|
|
+ total.bigUnit = total.bigUnit + (val.currentNum *1)
|
|
|
+ }else {
|
|
|
+ total.smallUnit = total.smallUnit +(1*val.currentNum)
|
|
|
+ }
|
|
|
+ total.totalPrice = total.totalPrice + (1*val.currentNum) * (val.currentUnitPrice*1)
|
|
|
+ return total
|
|
|
+ },{ bigUnit: 0, smallUnit:0, totalPrice: 0 })
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 结算创建订单
|
|
|
+ //结算创建订单
|
|
|
async setCreateOrder(){
|
|
|
try {
|
|
|
- let arr = this.shopList.map(i=>({
|
|
|
- productId:i.id,
|
|
|
- unitType: i.unitType,
|
|
|
- num: i.currentNum,
|
|
|
- property: i.property,
|
|
|
- unitPrice: i.currentUnitPrice
|
|
|
- }))
|
|
|
+ let arr = this.shopList.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.selectSettle
|
|
|
await createCreateOrder({
|
|
|
customId: this.selectItemUser.id,
|
|
|
@@ -302,11 +229,11 @@ export default {
|
|
|
title: '提示',
|
|
|
content: '确认退出?',
|
|
|
success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- uni.clearStorage()
|
|
|
- that.$store.commit("setLoginInfo", {})
|
|
|
- plus.runtime.restart()
|
|
|
- }
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.clearStorage()
|
|
|
+ that.$store.commit("setLoginInfo", {})
|
|
|
+ plus.runtime.restart()
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -320,41 +247,39 @@ export default {
|
|
|
title: '提示',
|
|
|
content: '确认删除?',
|
|
|
success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- let index = self.shopList.findIndex(i=>self.selectCurrentActiveItem.id === i.id)
|
|
|
- self.shopList = self.shopList.filter(i=>self.selectCurrentActiveItem.id !== i.id)
|
|
|
- }
|
|
|
+ if (res.confirm) {
|
|
|
+ let index = self.shopList.findIndex(i=>self.selectCurrentActiveItem.id === i.id)
|
|
|
+ self.shopList = self.shopList.filter(i=>self.selectCurrentActiveItem.id !== i.id)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
|
|
|
},
|
|
|
selectItemChange(item){
|
|
|
-
|
|
|
- let obj = this.shopList.find(i=>i.id===item.id)
|
|
|
- if(this.$util.isEmpty(obj)) {
|
|
|
- this.selectItem = {
|
|
|
- ...item,
|
|
|
- currentUnit:item.bigUnit,
|
|
|
- currentUnitPrice:item.property==1?item.bigPrice:item.price,
|
|
|
- currentNum: 1,
|
|
|
- unitType: 0
|
|
|
- }
|
|
|
- }else{
|
|
|
- this.selectItem = obj
|
|
|
- }
|
|
|
+ let obj = this.shopList.find(i=>i.id===item.id)
|
|
|
+ if(this.$util.isEmpty(obj)) {
|
|
|
+ this.selectItem = {
|
|
|
+ ...item,
|
|
|
+ currentUnit:item.bigUnit,
|
|
|
+ currentUnitPrice:item.property==1?item.bigPrice:item.price,
|
|
|
+ currentNum: 1,
|
|
|
+ unitType: 0
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.selectItem = obj
|
|
|
+ }
|
|
|
this.isShowFllowNum = true
|
|
|
},
|
|
|
enterReturn(item){
|
|
|
this.isShowFllowNum = false
|
|
|
- let index = this.shopList.findIndex(i=>i.id===item.id)
|
|
|
+ let index = this.shopList.findIndex(i=>i.id===item.id)
|
|
|
console.log(1111,index)
|
|
|
console.log(item)
|
|
|
if(index >= 0) {
|
|
|
- this.shopList.splice(index,1,item)
|
|
|
+ this.shopList.splice(index,1,item)
|
|
|
}else{
|
|
|
this.shopList.push(item)
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
collectMoneyBack(price){
|
|
|
console.log(price)
|
|
|
@@ -363,120 +288,123 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
- .app-workbench_box {
|
|
|
- display: flex;
|
|
|
- height: 100vh;
|
|
|
- & .shop-list {
|
|
|
- flex: 63;
|
|
|
- height: 100%;
|
|
|
- & .shop-footer_box {
|
|
|
+.app-workbench_box {
|
|
|
+ display: flex;
|
|
|
+ height: 100vh;
|
|
|
+ & .shop-list {
|
|
|
+ flex: 63;
|
|
|
+ height: 100%;
|
|
|
+ & .shop-footer_box {
|
|
|
+ height: 40rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ & > view {
|
|
|
height: 40rpx;
|
|
|
+ padding: 5rpx 25rpx;
|
|
|
+ border-radius: 5rpx;
|
|
|
+ font-size: 14rpx;
|
|
|
+ margin: 0 10rpx;
|
|
|
+ vertical-align: middle;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- justify-content: flex-end;
|
|
|
- & > view {
|
|
|
- height: 40rpx;
|
|
|
- padding: 5rpx 25rpx;
|
|
|
- border-radius: 5rpx;
|
|
|
- font-size: 14rpx;
|
|
|
- margin: 0 10rpx;
|
|
|
- vertical-align: middle;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- &.btn-breakage {
|
|
|
- background-color: #da9f5a;
|
|
|
- color: #ffffff;
|
|
|
- }
|
|
|
- &.btn-account {
|
|
|
- background-color: #009966;
|
|
|
- color: #ffffff;
|
|
|
- }
|
|
|
+ &.btn-breakage {
|
|
|
+ background-color: #da9f5a;
|
|
|
+ color: #ffffff;
|
|
|
+ }
|
|
|
+ &.btn-account {
|
|
|
+ background-color: #009966;
|
|
|
+ color: #ffffff;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- & .nav-left {
|
|
|
- height: 100%;
|
|
|
- // width: 50rpx;
|
|
|
- flex: 5;
|
|
|
+ }
|
|
|
+ & .nav-left {
|
|
|
+ height: 100%;
|
|
|
+ // width: 50rpx;
|
|
|
+ flex: 5;
|
|
|
+ background-color: rgba(72, 91, 107, 1);
|
|
|
+ // #599981
|
|
|
+ & .item-list {
|
|
|
+ margin-top: 50rpx;
|
|
|
+ font-size: 16rpx;
|
|
|
+ text-align: center;
|
|
|
+ padding: 15rpx 0;
|
|
|
+ background-color: #599981;
|
|
|
+ color: #FFFFFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ & .shopList-box {
|
|
|
+ flex: 25;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ & .title {
|
|
|
+ padding: 3rpx;
|
|
|
+ font-size: 12rpx;
|
|
|
background-color: rgba(72, 91, 107, 1);
|
|
|
- // #599981
|
|
|
- & .item-list {
|
|
|
- margin-top: 50rpx;
|
|
|
- font-size: 16rpx;
|
|
|
- text-align: center;
|
|
|
- padding: 15rpx 0;
|
|
|
- background-color: #599981;
|
|
|
- color: #FFFFFF;
|
|
|
- }
|
|
|
+ color: #FFFFFF;
|
|
|
}
|
|
|
- & .shopList-box {
|
|
|
- flex: 25;
|
|
|
- height: 100%;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- & .title {
|
|
|
- padding: 3rpx;
|
|
|
- font-size: 12rpx;
|
|
|
- background-color: rgba(72, 91, 107, 1);
|
|
|
- color: #FFFFFF;
|
|
|
- }
|
|
|
- & .shopList-item_box {
|
|
|
- flex: 1;
|
|
|
- border: 1px solid #eee;
|
|
|
- & .shop-item_box {
|
|
|
+ & .shopList-item_box {
|
|
|
+ flex: 1;
|
|
|
+ border: 1px solid #eee;
|
|
|
+ & .shop-item_box {
|
|
|
+ padding: 5rpx;
|
|
|
+ & .shop-body_box {
|
|
|
padding: 5rpx;
|
|
|
- & .shop-body_box {
|
|
|
- padding: 5rpx;
|
|
|
- font-size: 14rpx;
|
|
|
- &.active {
|
|
|
- background-color: #f2f8f8;
|
|
|
- }
|
|
|
- & .flower-name_box {
|
|
|
- padding: 0 5rpx;
|
|
|
- & .name {
|
|
|
- color: #333333;
|
|
|
- font-weight: bold;
|
|
|
- }
|
|
|
- }
|
|
|
- & > view:nth-child(2) {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- padding-top: 15rpx;
|
|
|
+ font-size: 14rpx;
|
|
|
+ &.active {
|
|
|
+ background-color: #b2b4b4;
|
|
|
+ }
|
|
|
+ &.not-active {
|
|
|
+ background-color: #e1e4e4;
|
|
|
+ }
|
|
|
+ & .flower-name_box {
|
|
|
+ padding: 0 5rpx;
|
|
|
+ & .name {
|
|
|
+ color: #333333;
|
|
|
+ font-weight: bold;
|
|
|
}
|
|
|
}
|
|
|
+ & > view:nth-child(2) {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding-top: 15rpx;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- & .shopList-footer_box {
|
|
|
- height: 50rpx;
|
|
|
- border: 1px solid #eee;
|
|
|
- font-size: 12rpx;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-around;
|
|
|
- }
|
|
|
}
|
|
|
- & .open-box {
|
|
|
- flex: 8;
|
|
|
- height: 100vh;
|
|
|
+ & .shopList-footer_box {
|
|
|
+ height: 50rpx;
|
|
|
+ border: 1px solid #eee;
|
|
|
+ font-size: 12rpx;
|
|
|
display: flex;
|
|
|
- flex-direction: column;
|
|
|
- padding: 5rpx;
|
|
|
- padding-top: 10rpx;
|
|
|
- & > view {
|
|
|
- border: 1px solid #eee;
|
|
|
- text-align: center;
|
|
|
- padding: 10rpx 0;
|
|
|
- color: #333333;
|
|
|
- margin-bottom: 15rpx;
|
|
|
- font-size: 14rpx;
|
|
|
- text-align: center;
|
|
|
- &.active {
|
|
|
- color: #008000;
|
|
|
- border-color: #008000;
|
|
|
- border-radius: 2rpx;
|
|
|
- }
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-around;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ & .open-box {
|
|
|
+ flex: 8;
|
|
|
+ height: 100vh;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ padding: 5rpx;
|
|
|
+ padding-top: 10rpx;
|
|
|
+ & > view {
|
|
|
+ border: 1px solid #eee;
|
|
|
+ text-align: center;
|
|
|
+ padding: 10rpx 0;
|
|
|
+ color: #333333;
|
|
|
+ margin-bottom: 15rpx;
|
|
|
+ font-size: 14rpx;
|
|
|
+ text-align: center;
|
|
|
+ &.active {
|
|
|
+ color: #008000;
|
|
|
+ border-color: #008000;
|
|
|
+ border-radius: 2rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+}
|
|
|
+</style>
|