|
|
@@ -1,111 +1,106 @@
|
|
|
<template>
|
|
|
- <view class="app-workbench_box">
|
|
|
- <view class="nav-left">
|
|
|
- <view class="item-list"> 收银 </view>
|
|
|
- </view>
|
|
|
- <view class="itemList-box">
|
|
|
- <view class="title">商品列表</view>
|
|
|
- <view class="itemList-item_box">
|
|
|
- <view v-for="item in itemList" :key="item.id" @click="selectCurrentActive(item)" class="show-item_box">
|
|
|
- <view :class="[ 'item-body_box', selectCurrentActiveItem.id===item.id?'active':'not-active']">
|
|
|
- <view class="flower-name_box">
|
|
|
- <view class="name">
|
|
|
- {{item.name}}
|
|
|
+<view>
|
|
|
+ <view v-if="isLogin == false">
|
|
|
+ <loginComponent></loginComponent>
|
|
|
+ </view>
|
|
|
+ <view v-else>
|
|
|
+ <view class="app-workbench_box">
|
|
|
+ <view class="nav-left">
|
|
|
+ <view class="item-list"> 收银 </view>
|
|
|
+ </view>
|
|
|
+ <view class="itemList-box">
|
|
|
+ <view class="title">花材列表</view>
|
|
|
+ <view class="itemList-item_box">
|
|
|
+ <view v-for="item in itemList" :key="item.id" @click="selectCurrentActive(item)" class="show-item_box">
|
|
|
+ <view :class="[ 'item-body_box', selectCurrentActiveItem.id===item.id?'active':'not-active']">
|
|
|
+ <view class="flower-name_box">
|
|
|
+ <view class="current-item-title"><text class="name">{{item.name}}</text><text @click.stop="delSelectItem" class="del">删除</text></view>
|
|
|
+ </view>
|
|
|
+ <view class="item-price-num">
|
|
|
+ <view>{{parseFloat(item.currentUnitPrice)}}元/{{item.currentUnit}}</view>
|
|
|
+ <view>{{item.currentNum}} {{item.currentUnit}}</view>
|
|
|
+ <view>¥{{item.currentNum * item.currentUnitPrice}}</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <view>
|
|
|
- <view>{{parseFloat(item.currentUnitPrice)}}元/{{item.currentUnit}}</view>
|
|
|
- <view>{{item.currentNum}} {{item.currentUnit}}</view>
|
|
|
- <view>¥{{item.currentNum * item.currentUnitPrice}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <view class="itemList-footer_box">
|
|
|
- <view> 数量
|
|
|
- <text style="margin-left:5upx;">
|
|
|
- <text v-if="Number(totalShop.bigUnit)>0">{{totalShop.bigUnit}}扎</text>
|
|
|
- <text v-if="Number(totalShop.smallUnit)>0">{{totalShop.smallUnit}}支</text>
|
|
|
- </text>
|
|
|
+ <view class="itemList-footer_box">
|
|
|
+ <view> 数量
|
|
|
+ <text style="margin-left:5upx;">
|
|
|
+ <text v-if="Number(totalShop.bigUnit)>0">{{totalShop.bigUnit}}扎</text>
|
|
|
+ <text v-if="Number(totalShop.smallUnit)>0">{{totalShop.smallUnit}}支</text>
|
|
|
+ </text>
|
|
|
+ </view>
|
|
|
+ <view> 合计 <text style="margin-left:5upx;">¥{{totalShop.totalPrice}}</text> </view>
|
|
|
</view>
|
|
|
- <view> 合计 <text style="margin-left:5upx;">¥{{totalShop.totalPrice}}</text> </view>
|
|
|
</view>
|
|
|
+ <view class="open-box">
|
|
|
+ <view @click="logout"> 退出 </view>
|
|
|
+ <view @click="selectUser"> 客户 </view>
|
|
|
+ <view @click="clearItemFn"> 清空花材 </view>
|
|
|
+ <view>临时商品</view>
|
|
|
+ <view @click="breakage"> 报损 </view>
|
|
|
+ <view @click="settle"> 结算 </view>
|
|
|
+ </view>
|
|
|
+ <!-- 分类和花材展示区 -->
|
|
|
+ <view class="item-show-list">
|
|
|
+ <rightItemArea @kdSelectItem="kdSelectItem"> </rightItemArea>
|
|
|
+ </view>
|
|
|
+ <!-- 选客户 isShowUser -->
|
|
|
+ <uni-popup ref="selectUserRef" background-color="#fff" type="center" :animation="false">
|
|
|
+ <selectUser @selectUser="selectUserReturn" @cancelSelectUser="cancelSelectUser"> </selectUser>
|
|
|
+ </uni-popup>
|
|
|
+ <!-- 开单选花材输入数量和金额 -->
|
|
|
+ <uni-popup ref="kdSelectNumPriceRef" background-color="#fff" type="center" :animation="false">
|
|
|
+ <kdSelectNumPrice @enterNum="enterReturn" :selectItem.sync="selectItem"></kdSelectNumPrice>
|
|
|
+ </uni-popup>
|
|
|
+ <!-- 结算弹框 isShowSettle -->
|
|
|
+ <uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
|
|
|
+ <settlePop @settleReturn="settleReturn" ref="settlePop" :totalShop="totalShop"></settlePop>
|
|
|
+ </uni-popup>
|
|
|
+ <!-- 选择支付方式 isShowselectPayWay -->
|
|
|
+ <uni-popup ref="selectPayWayRef" background-color="#fff" type="center" :animation="false">
|
|
|
+ <selectPayWay @cancel="cancelPay()" @selectPayWayBack="selectPayWayBack"></selectPayWay>
|
|
|
+ </uni-popup>
|
|
|
+ <!-- 清空花材 -->
|
|
|
+ <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>
|
|
|
</view>
|
|
|
- <view class="open-box">
|
|
|
- <view @click="logout"> 退出 </view>
|
|
|
- <view @click="selectUser"> 客户 </view>
|
|
|
- <view @click="deleteShop"> 删除商品 </view>
|
|
|
- <view @click="clearShop"> 清空商品 </view>
|
|
|
- <view @click="breakage"> 报损 </view>
|
|
|
- <view @click="settle"> 结算 </view>
|
|
|
- </view>
|
|
|
- <!-- 分类和花材展示区 -->
|
|
|
- <view class="item-show-list">
|
|
|
- <rightItemArea @kdSelectItem="kdSelectItem"> </rightItemArea>
|
|
|
- </view>
|
|
|
- <!-- 选客户 -->
|
|
|
- <uniPopup :show.sync="isShowUser" type="top" maxHeight="90vh" >
|
|
|
- <selectUser @selectUser="selectUserReturn"> </selectUser>
|
|
|
- </uniPopup>
|
|
|
- <!-- 开单选商品输入数量和金额 -->
|
|
|
- <uniPopup :show.sync="isShowFllowNum" type="top" maxHeight="90vh">
|
|
|
- <kdSelectNumPrice @enterNum="enterReturn" :selectItem.sync="selectItem"></kdSelectNumPrice>
|
|
|
- </uniPopup>
|
|
|
- <!-- 结算弹框 -->
|
|
|
- <uniPopup :show.sync="isShowSettle" type="top" maxHeight="90vh" >
|
|
|
- <settlePop @settleReturn="settleReturn" ref="settlePop" :totalShop="totalShop"></settlePop>
|
|
|
- </uniPopup>
|
|
|
- <!-- 选择支付方式 -->
|
|
|
- <uniPopup :show.sync="isShowselectPayWay" type="top" maxHeight="90vh" >
|
|
|
- <selectPayWay @cancel="isShowselectPayWay=false" @selectPayWayBack="selectPayWayBack"></selectPayWay>
|
|
|
- </uniPopup>
|
|
|
- <NotLogin></NotLogin>
|
|
|
</view>
|
|
|
+</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapGetters,mapActions } from "vuex";
|
|
|
-import NotLogin from "@/components/not-login";
|
|
|
import productMins from "@/mixins/product";
|
|
|
import autoUpdateMixins from "@/mixins/autoUpdate";
|
|
|
-import uniPopup from '@/components/uni-popup'
|
|
|
import kdSelectNumPrice from '@/components/app-kd-select-num-price.vue'
|
|
|
import settlePop from './components/settle-pop.vue'
|
|
|
import selectUser from './components/select-user.vue'
|
|
|
import rightItemArea from './components/rightItemArea.vue'
|
|
|
import selectPayWay from '@/components/select-pay-way.vue'
|
|
|
+import loginComponent from './login.vue'
|
|
|
import { createCreateOrder, wastageCreateOrder } from '@/api/home/index'
|
|
|
export default {
|
|
|
name: "workbench",
|
|
|
- components: {
|
|
|
- NotLogin,
|
|
|
- uniPopup,
|
|
|
- selectUser,
|
|
|
- rightItemArea,
|
|
|
- kdSelectNumPrice,
|
|
|
- settlePop,
|
|
|
- selectPayWay
|
|
|
- },
|
|
|
+ components: { selectUser, rightItemArea, kdSelectNumPrice, settlePop, selectPayWay,loginComponent },
|
|
|
mixins: [productMins,autoUpdateMixins],
|
|
|
data() {
|
|
|
return {
|
|
|
- isShowFllowNum: false,
|
|
|
- isShowUser: false,
|
|
|
- isShowSettle: false,
|
|
|
- isShowselectPayWay: false,
|
|
|
itemList:[],
|
|
|
currenSelectShop:{},
|
|
|
selectItem: {},
|
|
|
selectCurrentActiveItem:{},
|
|
|
- totalShop:{
|
|
|
- bigUnit: 0,
|
|
|
- smallUnit:0,
|
|
|
- totalPrice: 0
|
|
|
- },
|
|
|
- selectItemUser:{}
|
|
|
+ totalShop:{ bigUnit: 0, smallUnit:0, totalPrice: 0 },
|
|
|
+ selectItemUser:{},
|
|
|
+ isLogin:false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters({ loginInfo: "getLoginInfo" }),
|
|
|
+ ...mapGetters(["getLoginInfo"]),
|
|
|
...mapGetters({ myShopInfo: "getMyShopInfo" }),
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
@@ -116,9 +111,19 @@ export default {
|
|
|
},
|
|
|
onShow() {
|
|
|
},
|
|
|
- mounted(){
|
|
|
+ mounted() {
|
|
|
+ if(this.$util.isEmpty(this.getLoginInfo.admin) || this.getLoginInfo.admin.currentShopId == 0){
|
|
|
+ this.isLogin = false
|
|
|
+ }
|
|
|
},
|
|
|
watch:{
|
|
|
+ getLoginInfo: {
|
|
|
+ handler(newValue) {
|
|
|
+ if(this.$util.isEmpty(newValue.admin) == false && newValue.admin.currentShopId > 0){
|
|
|
+ this.isLogin = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
itemList(){
|
|
|
if(this.$util.isEmpty(this.itemList)) {
|
|
|
this.totalShop = { bigUnit: 0, smallUnit:0, totalPrice: 0 }
|
|
|
@@ -152,13 +157,16 @@ export default {
|
|
|
sendCost: freight,
|
|
|
remark:''
|
|
|
})
|
|
|
- this.isShowSettle = false
|
|
|
- this.isShowselectPayWay = true
|
|
|
+ this.$refs.settlePopRef.close()
|
|
|
+ this.$refs.selectPayWayRef.open('center')
|
|
|
this.$msg('订单创建成功')
|
|
|
}catch(err) {
|
|
|
console.log(err)
|
|
|
}
|
|
|
},
|
|
|
+ cancelPay(){
|
|
|
+ this.$refs.selectPayWayRef.close()
|
|
|
+ },
|
|
|
async settleReturn(){
|
|
|
this.setCreateOrder()
|
|
|
},
|
|
|
@@ -167,16 +175,19 @@ export default {
|
|
|
},
|
|
|
selectUserReturn(val){
|
|
|
this.selectItemUser = val
|
|
|
- this.isShowUser = false
|
|
|
+ this.$refs.selectUserRef.close()
|
|
|
},
|
|
|
- init() {
|
|
|
+ cancelSelectUser(){
|
|
|
+ this.$refs.selectUserRef.close()
|
|
|
},
|
|
|
selectUser(){
|
|
|
- this.isShowUser = true
|
|
|
+ this.$refs.selectUserRef.open('center')
|
|
|
+ },
|
|
|
+ init() {
|
|
|
},
|
|
|
breakage(){
|
|
|
if(this.$util.isEmpty(this.itemList)) {
|
|
|
- this.$msg('请选择报损商品')
|
|
|
+ this.$msg('请选择报损花材')
|
|
|
return false
|
|
|
}
|
|
|
this.$util.confirmModal({content:'确定报损吗?'},
|
|
|
@@ -194,63 +205,37 @@ export default {
|
|
|
}catch(err) {
|
|
|
console.log(err)
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
},
|
|
|
settle(){
|
|
|
if(this.$util.isEmpty(this.itemList)) {
|
|
|
- this.$msg('请选择结算商品')
|
|
|
+ this.$msg('请选择结算花材')
|
|
|
return false
|
|
|
}
|
|
|
if(this.$util.isEmpty(this.selectItemUser)) {
|
|
|
this.$msg('请选择客户')
|
|
|
return false
|
|
|
}
|
|
|
- this.isShowSettle = true
|
|
|
+ this.$refs.settlePopRef.open('center')
|
|
|
+ },
|
|
|
+ //清空花材弹框
|
|
|
+ clearItemFn(){
|
|
|
+ this.$refs.clearItemRef.open()
|
|
|
+ },
|
|
|
+ //确认清空花材
|
|
|
+ confirmClearItem(){
|
|
|
|
|
|
},
|
|
|
- clearShop(){
|
|
|
- let self = this
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '确认清空?',
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- self.itemList = []
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ confirmLogout(){
|
|
|
+ uni.clearStorage()
|
|
|
+ this.$store.commit("setLoginInfo", {})
|
|
|
+ plus.runtime.restart()
|
|
|
},
|
|
|
logout(){
|
|
|
- let that = this
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '确认退出?',
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- uni.clearStorage()
|
|
|
- that.$store.commit("setLoginInfo", {})
|
|
|
- plus.runtime.restart()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ this.$refs.logoutRef.open()
|
|
|
},
|
|
|
- deleteShop(){
|
|
|
- if(this.$util.isEmpty(this.selectCurrentActiveItem)) {
|
|
|
- this.$msg('请选择要删除的商品')
|
|
|
- return false
|
|
|
- }
|
|
|
- let self = this
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '确认删除?',
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- let index = self.itemList.findIndex(i=>self.selectCurrentActiveItem.id === i.id)
|
|
|
- self.itemList = self.itemList.filter(i=>self.selectCurrentActiveItem.id !== i.id)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ delSelectItem(){
|
|
|
+
|
|
|
},
|
|
|
kdSelectItem(item){
|
|
|
let obj = this.itemList.find(i=>i.id===item.id)
|
|
|
@@ -265,13 +250,11 @@ export default {
|
|
|
}else{
|
|
|
this.selectItem = obj
|
|
|
}
|
|
|
- this.isShowFllowNum = true
|
|
|
+ this.$refs.kdSelectNumPriceRef.open('center')
|
|
|
},
|
|
|
enterReturn(item){
|
|
|
- this.isShowFllowNum = false
|
|
|
+ this.$refs.kdSelectNumPriceRef.close()
|
|
|
let index = this.itemList.findIndex(i=>i.id===item.id)
|
|
|
- console.log(1111,index)
|
|
|
- console.log(item)
|
|
|
if(index >= 0) {
|
|
|
this.itemList.splice(index,1,item)
|
|
|
}else{
|
|
|
@@ -347,22 +330,38 @@ export default {
|
|
|
flex: 1;
|
|
|
border: 1px solid #eee;
|
|
|
& .show-item_box {
|
|
|
- padding: 5upx;
|
|
|
+ padding: 2upx;
|
|
|
& .item-body_box {
|
|
|
- border-radius: 3upx;
|
|
|
- padding: 5upx;
|
|
|
+ border-radius: 2upx;
|
|
|
+ padding: 2upx;
|
|
|
font-size: 14upx;
|
|
|
+ color:#666666;
|
|
|
&.active {
|
|
|
- background-color: #b2b4b4;
|
|
|
+ background-color: #d4d6d6;
|
|
|
}
|
|
|
&.not-active {
|
|
|
- background-color: #e1e4e4;
|
|
|
+ background-color: #e7e9e9;
|
|
|
+ }
|
|
|
+ .item-price-num{
|
|
|
+ color:#afaeae;
|
|
|
+ font-size:10upx;
|
|
|
}
|
|
|
& .flower-name_box {
|
|
|
padding: 0 5upx;
|
|
|
- & .name {
|
|
|
- color: #333333;
|
|
|
- font-weight: bold;
|
|
|
+ .current-item-title {
|
|
|
+ .name{
|
|
|
+ color: #333333;
|
|
|
+ font-weight: bold;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow:ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ width:50upx;
|
|
|
+ }
|
|
|
+ .del{
|
|
|
+ color:orange;
|
|
|
+ font-size:12upx;
|
|
|
+ float:right;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
& > view:nth-child(2) {
|