|
@@ -8,21 +8,27 @@
|
|
|
<view class="shopList-box">
|
|
<view class="shopList-box">
|
|
|
<view class="title">商品列表</view>
|
|
<view class="title">商品列表</view>
|
|
|
<view class="shopList-item_box">
|
|
<view class="shopList-item_box">
|
|
|
- <view class="shop-item_box">
|
|
|
|
|
- <view class="shop-body_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 class="flower-name_box">
|
|
<view class="flower-name_box">
|
|
|
<view class="name">
|
|
<view class="name">
|
|
|
- 小菊
|
|
|
|
|
|
|
+ {{item.name}}
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view>
|
|
<view>
|
|
|
- <view>25元/支</view>
|
|
|
|
|
- <view>5支</view>
|
|
|
|
|
- <view>¥108</view>
|
|
|
|
|
|
|
+ <view>{{item.currentUnitPrice}}元/{{item.currentUnit}}</view>
|
|
|
|
|
+ <view>{{item.currentNum}} {{item.currentUnit}}</view>
|
|
|
|
|
+ <view>¥{{item.currentNum * item.currentUnitPrice}}</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="shop-item_box">
|
|
|
|
|
|
|
+ <!-- <view class="shop-item_box">
|
|
|
<view class="shop-body_box">
|
|
<view class="shop-body_box">
|
|
|
<view class="flower-name_box">
|
|
<view class="flower-name_box">
|
|
|
<view class="name">
|
|
<view class="name">
|
|
@@ -35,18 +41,19 @@
|
|
|
<view>¥108</view>
|
|
<view>¥108</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- </view>
|
|
|
|
|
|
|
+ </view> -->
|
|
|
</view>
|
|
</view>
|
|
|
<view class="shopList-footer_box">
|
|
<view class="shopList-footer_box">
|
|
|
<view>
|
|
<view>
|
|
|
数量:
|
|
数量:
|
|
|
<text style="fontWeight:bold">
|
|
<text style="fontWeight:bold">
|
|
|
- 8扎5支
|
|
|
|
|
|
|
+ <!-- 8扎5支 -->
|
|
|
|
|
+ {{totalShop.bigUnit}}扎 {{totalShop.smallUnit}}支
|
|
|
</text>
|
|
</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view>
|
|
<view>
|
|
|
合计:
|
|
合计:
|
|
|
- <text style="color:red">¥123</text>
|
|
|
|
|
|
|
+ <text style="color:red">¥{{totalShop.totalPrice}}</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -54,9 +61,9 @@
|
|
|
<view @click="selectUser">
|
|
<view @click="selectUser">
|
|
|
客户
|
|
客户
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="active">
|
|
|
|
|
|
|
+ <!-- <view class="active">
|
|
|
扎
|
|
扎
|
|
|
- </view>
|
|
|
|
|
|
|
+ </view> -->
|
|
|
<view @click="deleteShop">
|
|
<view @click="deleteShop">
|
|
|
删除商品
|
|
删除商品
|
|
|
</view>
|
|
</view>
|
|
@@ -65,14 +72,21 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="shop-list">
|
|
<view class="shop-list">
|
|
|
- <shopTypeSelect></shopTypeSelect>
|
|
|
|
|
|
|
+ <shopTypeSelect @selectItemChange="selectItemChange"></shopTypeSelect>
|
|
|
</view>
|
|
</view>
|
|
|
<uniPopup
|
|
<uniPopup
|
|
|
:show.sync="isShowUser"
|
|
:show.sync="isShowUser"
|
|
|
type="top"
|
|
type="top"
|
|
|
maxHeight="90vh"
|
|
maxHeight="90vh"
|
|
|
>
|
|
>
|
|
|
- <selectUser @selectUser="selectUserReturn"></selectUser>
|
|
|
|
|
|
|
+ <selectUser @selectUser="selectUserReturn">
|
|
|
|
|
+ </selectUser>
|
|
|
|
|
+ </uniPopup>
|
|
|
|
|
+ <uniPopup
|
|
|
|
|
+ :show.sync="isShowFllowNum"
|
|
|
|
|
+ type="top"
|
|
|
|
|
+ maxHeight="90vh">
|
|
|
|
|
+ <keyboardSetFlower @enterNum="enterReturn" :selectItem.sync="selectItem"></keyboardSetFlower>
|
|
|
</uniPopup>
|
|
</uniPopup>
|
|
|
<NotLogin></NotLogin>
|
|
<NotLogin></NotLogin>
|
|
|
</view>
|
|
</view>
|
|
@@ -83,13 +97,13 @@ import NotLogin from "@/components/not-login";
|
|
|
import productMins from "@/mixins/product";
|
|
import productMins from "@/mixins/product";
|
|
|
import autoUpdateMixins from "@/mixins/autoUpdate";
|
|
import autoUpdateMixins from "@/mixins/autoUpdate";
|
|
|
import uniPopup from '@/components/uni-popup'
|
|
import uniPopup from '@/components/uni-popup'
|
|
|
-// import keyboardSetFlower from '@/components/app-boardSet-flower.vue'
|
|
|
|
|
|
|
+import keyboardSetFlower from '@/components/app-boardSet-flower.vue'
|
|
|
// import selectSettle from './components/select-settle.vue'
|
|
// import selectSettle from './components/select-settle.vue'
|
|
|
import selectUser from './components/select-user.vue'
|
|
import selectUser from './components/select-user.vue'
|
|
|
import shopTypeSelect from './components/shopTypeSelect.vue'
|
|
import shopTypeSelect from './components/shopTypeSelect.vue'
|
|
|
export default {
|
|
export default {
|
|
|
name: "workbench",
|
|
name: "workbench",
|
|
|
- components: { NotLogin,uniPopup,selectUser,shopTypeSelect },
|
|
|
|
|
|
|
+ components: { NotLogin,uniPopup,selectUser,shopTypeSelect,keyboardSetFlower },
|
|
|
mixins: [productMins,autoUpdateMixins],
|
|
mixins: [productMins,autoUpdateMixins],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -97,7 +111,14 @@ export default {
|
|
|
isShowUser: false,
|
|
isShowUser: false,
|
|
|
isShowSettle: false,
|
|
isShowSettle: false,
|
|
|
shopList:[],
|
|
shopList:[],
|
|
|
- currenSelectShop:{}
|
|
|
|
|
|
|
+ currenSelectShop:{},
|
|
|
|
|
+ selectItem: {},
|
|
|
|
|
+ selectCurrentActiveItem:{},
|
|
|
|
|
+ totalShop:{
|
|
|
|
|
+ bigUnit: 0,
|
|
|
|
|
+ smallUnit:0,
|
|
|
|
|
+ totalPrice: 0
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -112,15 +133,43 @@ export default {
|
|
|
},
|
|
},
|
|
|
onShow() {
|
|
onShow() {
|
|
|
},
|
|
},
|
|
|
|
|
+ watch:{
|
|
|
|
|
+ shopList(){
|
|
|
|
|
+ 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
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ selectCurrentActive(item){
|
|
|
|
|
+ this.selectCurrentActiveItem = item
|
|
|
|
|
+ },
|
|
|
selectUserReturn(val){
|
|
selectUserReturn(val){
|
|
|
this.isShowUser = false
|
|
this.isShowUser = false
|
|
|
},
|
|
},
|
|
|
init() {
|
|
init() {
|
|
|
},
|
|
},
|
|
|
- selectItem(){
|
|
|
|
|
- this.isShowFllowNum = true
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // selectItem(){
|
|
|
|
|
+ // this.isShowFllowNum = true
|
|
|
|
|
+ // },
|
|
|
selectUser(){
|
|
selectUser(){
|
|
|
this.isShowUser = true
|
|
this.isShowUser = true
|
|
|
},
|
|
},
|
|
@@ -131,7 +180,26 @@ export default {
|
|
|
this.shopList = []
|
|
this.shopList = []
|
|
|
},
|
|
},
|
|
|
deleteShop(){
|
|
deleteShop(){
|
|
|
-
|
|
|
|
|
|
|
+ if(this.$util.isEmpty(this.selectCurrentActiveItem)) {
|
|
|
|
|
+ this.$msg('请选择要删除的商品')
|
|
|
|
|
+ }
|
|
|
|
|
+ let index = this.shopList.findIndex(i=>this.selectCurrentActiveItem.id === i.id)
|
|
|
|
|
+ this.shopList = this.shopList.filter(i=>this.selectCurrentActiveItem.id !== i.id)
|
|
|
|
|
+ // this.selectCurrentActiveItem
|
|
|
|
|
+ },
|
|
|
|
|
+ selectItemChange(item){
|
|
|
|
|
+ this.selectItem = {
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ currentUnit:item.bigUnit,
|
|
|
|
|
+ currentUnitPrice:item.property==1?item.bigPrice:item.price,
|
|
|
|
|
+ currentNum: 0,
|
|
|
|
|
+ unitType: 0
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isShowFllowNum = true
|
|
|
|
|
+ },
|
|
|
|
|
+ enterReturn(item){
|
|
|
|
|
+ this.isShowFllowNum = false
|
|
|
|
|
+ this.shopList.push(item)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -172,13 +240,15 @@ export default {
|
|
|
}
|
|
}
|
|
|
& .shopList-item_box {
|
|
& .shopList-item_box {
|
|
|
flex: 1;
|
|
flex: 1;
|
|
|
- border: 1px solid #eee;
|
|
|
|
|
|
|
+ border: 1px solid #eee;
|
|
|
& .shop-item_box {
|
|
& .shop-item_box {
|
|
|
padding: 5rpx;
|
|
padding: 5rpx;
|
|
|
& .shop-body_box {
|
|
& .shop-body_box {
|
|
|
- background-color: #f2f8f8;
|
|
|
|
|
padding: 5rpx;
|
|
padding: 5rpx;
|
|
|
font-size: 14rpx;
|
|
font-size: 14rpx;
|
|
|
|
|
+ &.active {
|
|
|
|
|
+ background-color: #f2f8f8;
|
|
|
|
|
+ }
|
|
|
& .flower-name_box {
|
|
& .flower-name_box {
|
|
|
padding: 0 5rpx;
|
|
padding: 0 5rpx;
|
|
|
& .name {
|
|
& .name {
|