فهرست منبع

商品列表开始

shish 4 سال پیش
والد
کامیت
1a5bcc859c

+ 14 - 7
hdPad/src/admin/home/components/middleButton.vue

@@ -1,6 +1,7 @@
 <template>
 <view class="middle-area">
-
+	<view @click="changeProperty(1)">花材</view>
+	<view @click="changeProperty(0)">成品</view>
     <view @click="logout">退出</view>
     <view @click="resetCustomer">选客户</view>
     <view @click="clearItemFn">清空花材</view>
@@ -17,11 +18,12 @@
     </uni-popup>
 
     <!-- 结算弹框 -->
-    <uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
-        <settlePop @settleCommit="settleCommit" ref="settlePop"></settlePop>
+    <uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false" :is-mask-click="false">
+        <settlePop @settleCommit="settleCommit" @cancelSettle="cancelSettle" ref="settlePop"></settlePop>
     </uni-popup>
-    <!-- 选择支付方式 -->
-    <uni-popup ref="toPayRef" background-color="#fff" type="center" :animation="false">
+
+    <!-- 扫码付款 -->
+    <uni-popup ref="toPayRef" background-color="#fff" type="center" :animation="false" :is-mask-click="false">
         <toPayWay @cancelPay="cancelPay()" @selectPayWayBack="selectPayWayBack"></toPayWay>
     </uni-popup>
 
@@ -54,6 +56,9 @@ export default {
 
 	},
     methods:{
+		changeProperty(property){
+			this.$emit('changeProperty',property)
+		},
 		resetCustomer(){
 			this.$util.hitRemind()
 			this.$emit('resetCustomer')
@@ -75,6 +80,10 @@ export default {
 			this.$util.hitRemind()
 			this.$refs.toPayRef.close()
 		},
+		cancelSettle(){
+			this.$util.hitRemind()
+			this.$refs.settlePopRef.close()
+		},
 		async settleReturn(){
 			this.$util.hitRemind()
 			this.setCreateOrder()
@@ -107,8 +116,6 @@ export default {
 			})
 		},
 		gosettleCommit(){
-			this.$refs.toPayRef.open('center')
-			return
 			this.$util.hitRemind()
 			if(this.$util.isEmpty(this.selectList)) {
 				this.$msg('请选择结算花材')

+ 190 - 0
hdPad/src/admin/home/components/rightGoodsArea.vue

@@ -0,0 +1,190 @@
+<template>
+    <view class="shop-listType_box">
+        <view class="shop-type_box">
+            <view v-for="item in categoryData" :key="item.id" :class="[categoryId===item.id?'active':'']" @click="changeCategory(item)" > {{item.categoryName}} </view>
+        </view>
+        <view class="shop-show_box">
+            <view v-for="item in goodsInfoList" :key="item.id" class="show-shop_box">
+                <view class="item-detail" @click="popAddModelFn(item)">
+                    <image class="img" :src="item.cover" mode="scaleToFill" ></image>
+                    <view class="shop-info_price">
+                        <view>
+                            <view>{{item.name}}</view>
+                            <view>¥{{parseFloat(item.price)}}</view>
+                        </view>
+                    </view>
+                </view>
+            </view>
+        </view>
+        <slot name="footer"></slot>
+
+        <!-- 开单选花材输入数量和金额 -->
+        <uni-popup ref="kdSelectNumPriceRef" background-color="#fff" type="center" :animation="false">
+            <kdSelectNumPrice @confirmAddItemModel="confirmAddItemModel" :customData.sync="customData" @cancelKdSelectNumPrice="addItemModelHidden"></kdSelectNumPrice>
+        </uni-popup>
+
+    </view>
+</template>
+<script>
+import settlePop from './settle-pop.vue'
+import { getClass } from '@/api/category/index'
+import { getGoodsList } from '@/api/goods/index'
+import productMins from "@/mixins/product";
+import kdSelectNumPrice from '@/components/app-kd-select-num-price.vue'
+export default {
+    name:'rightItemArea',
+    components:{ settlePop,kdSelectNumPrice },
+	mixins: [productMins],
+    data(){
+        return {
+            categoryData:[],
+            categoryId: '',
+            goodsInfoList:[],
+            selectJobType:'bill',
+            selectJobId:0
+        }
+    },
+	props: {
+		customId: {
+			type: Number,
+			default: 0
+		}
+    },
+    created(){
+        this.init()
+    },
+    watch:{
+        customId:{
+            handler(newCustomId){
+                this.selectJobId = newCustomId
+            },
+            immediate:true
+        }
+    },
+    methods:{
+		popAddModelFn(info) {
+            this.$util.hitRemind()
+			this.showAddModelFn({ ...info, buyNum: 1, unitPrice: info.price,unitType:0})
+		},
+        init(){
+            getClass().then(res=>{
+                if(res.code == 1){
+                    this.categoryData = res.data
+                    this.categoryId = this.categoryData[0].id
+                    this.getGoodsData()
+                    //this.initStorageData()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                }
+            })
+        },
+        getGoodsData(){
+            getGoodsList({cId:this.categoryId}).then(res=>{
+                if(res.code == 1){
+                    this.goodsInfoList = res.data
+                }
+            })
+        },
+        changeCategory(item){
+            this.$util.hitRemind()
+            if(item.id === this.categoryId){
+                return false
+            }
+            this.categoryId = item.id
+        }
+    }
+}
+</script>
+<style lang="scss" scoped>
+.shop-listType_box {
+    height: 100%;
+    border: 1px solid #eee;
+    display: flex;
+    flex-direction: column;
+    box-sizing: border-box;
+    & .shop-show_box{
+        & .show-shop_box{
+            & .item-detail{
+                position: relative;
+                margin-right: 9upx;
+                margin-bottom: 6upx;
+                width: 82upx;
+                height: 82upx;
+                & .img {
+                    width: 82upx;
+                    height: 82upx;
+                }
+                .shop-info_price {
+                    position: absolute;
+                    background-color: rgba(0, 0, 0, 0.5);
+                    bottom: 0;
+                    width: 100%;
+                    font-size: 12upx;
+                    color: #ffffff;
+                    height:25upx;
+                    & > view {
+                        font-size: 10upx;
+                        & > view:nth-child(1) {
+                            overflow: hidden;
+                            text-overflow:ellipsis;
+                            white-space: nowrap;
+                            width:90%;
+                        }
+                        & > view:nth-child(2) {
+                            font-size:8upx;
+                        }
+                    }
+                }
+            }
+        }
+    }
+    & .shop-type_box {
+        max-height: 300upx;
+        display: flex;
+        align-items: center;
+        flex-wrap: wrap;
+        overflow-y: scroll;
+        & > view {
+            border:1px solid #e4e4e4;
+            padding: 12upx 0upx;
+            font-size: 15px;
+            min-width: 75upx;
+            text-align: center;
+            &.active {
+                background-color: #428369;
+                color: #ffffff;
+            }
+        }
+    }
+    & .shop-show_box {
+        flex: 1;
+        padding: 2upx;
+        display: flex;
+        flex-wrap: wrap;
+        overflow-y: scroll;
+        overflow-x: hidden;
+    }
+    & .shop-footer_box {
+        height: 40upx;
+        display: flex;
+        align-items: center;
+        justify-content: flex-end;
+        & > view {
+            height: 40upx;
+            padding: 5upx 25upx;
+            border-radius: 5upx;
+            font-size: 14upx;
+            margin: 0 10upx;
+            vertical-align: middle;
+            display: flex;
+            align-items: center;
+            &.btn-breakage {
+                background-color: #da9f5a;
+                color: #ffffff;
+            }
+            &.btn-account {
+                background-color: #009966;
+                color: #ffffff;
+            }
+        }
+    }
+}
+</style>

+ 9 - 13
hdPad/src/admin/home/components/rightItemArea.vue

@@ -1,10 +1,10 @@
 <template>
     <view class="shop-listType_box">
         <view class="shop-type_box">
-            <view v-for="item in shopListType" :key="item.id" :class="[categoryId===item.id?'active':'']" @click="changeCategory(item)" > {{item.name}} </view>
+            <view v-for="item in classData" :key="item.id" :class="[categoryId===item.id?'active':'']" @click="changeCategory(item)" > {{item.name}} </view>
         </view>
         <view class="shop-show_box">
-            <view v-for="item in currenTypeShopList" :key="item.id" class="show-shop_box">
+            <view v-for="item in itemInfoList" :key="item.id" class="show-shop_box">
                 <view class="item-detail" @click="popAddModelFn(item)">
                     <image class="img" :src="item.cover" mode="scaleToFill" ></image>
                     <view class="shop-info_price">
@@ -37,11 +37,10 @@ export default {
 	mixins: [productMins],
     data(){
         return {
-            shopListType:[],
+            classData:[],
             categoryId: '',
-            arrShop:[],
-            currenTypeShopList:[],
-            isShowSettle: false,
+            totalItemData:[],
+            itemInfoList:[],
             selectJobType:'bill',
             selectJobId:0
         }
@@ -70,19 +69,19 @@ export default {
 		},
         async init(){
             let { data } =  await showClass()
-            this.shopListType = data
-            this.categoryId = this.shopListType[0].id
+            this.classData = data
+            this.categoryId = this.classData[0].id
             this.getShowList()
 
             this.initStorageData()
         },
         async getShowList(){
             let { data:{list} } =  await showList({})
-            this.arrShop = list
+            this.totalItemData = list
             this.updateCurrentShop()
         },
         updateCurrentShop(){
-            this.currenTypeShopList = this.arrShop[this.categoryId]
+            this.itemInfoList = this.totalItemData[this.categoryId]
         },
         changeCategory(item){
             this.$util.hitRemind()
@@ -91,9 +90,6 @@ export default {
             }
             this.categoryId = item.id
             this.updateCurrentShop()
-        },
-        settle(){
-            this.isShowSettle = true
         }
     }
 }

+ 4 - 1
hdPad/src/admin/home/components/settle-pop.vue

@@ -59,7 +59,7 @@
                 <text>¥<text :class="{selected:checkType == 0}">{{form.modifyPrice}}</text></text>
             </view>
 
-            <view class="keyboard-body_box"> <VKeyboard ref="keyboard" :digital="true" :disorderly="false" @typing="typing" @enter="enter"> </VKeyboard> </view>
+            <view class="keyboard-body_box"> <VKeyboard ref="keyboard" :digital="true" :disorderly="false" @typing="typing" @enter="enter" @cancel="cancel"> </VKeyboard> </view>
 
         </view>
     </view>
@@ -177,6 +177,9 @@ export default {
         enter() {
             this.$emit('settleCommit',this.form)
         },
+        cancel(){
+            this.$emit('cancelSettle')
+        }
     }
 }
 </script>

+ 11 - 4
hdPad/src/admin/home/workbench.vue

@@ -20,11 +20,12 @@
 			</view>
 			<!-- 按钮操作 -->
 			<view class="open-box">
-				<middleButton @resetCustomer="resetCustomer" :customId.sync="customId"></middleButton>
+				<middleButton @resetCustomer="resetCustomer" :customId.sync="customId" @changeProperty="changeProperty"></middleButton>
 			</view>
 			<!-- 分类和花材图片 -->
 			<view class="all-item-area">
-				<rightItemArea :customId.sync="customId"> </rightItemArea>
+				<rightGoodsArea v-if="currentProperty == 0" :customId.sync="customId"> </rightGoodsArea>
+				<rightItemArea v-else :customId.sync="customId"> </rightItemArea>
 			</view>
 		</view>
 		</view>
@@ -35,6 +36,7 @@
 import { mapGetters } from "vuex";
 import autoUpdateApp from "@/mixins/autoUpdate";
 import rightItemArea from './components/rightItemArea.vue'
+import rightGoodsArea from './components/rightGoodsArea.vue'
 import middleButton from './components/middleButton.vue'
 import customerList from './components/customer-list.vue'
 import leftItem from './components/leftItem.vue'
@@ -43,10 +45,12 @@ import loginComponent from './login.vue'
 import productMins from "@/mixins/product";
 export default {
 	name: "workbench",
-	components: { rightItemArea,middleButton,  loginComponent, leftItem,leftGroup, customerList },
+	components: { rightItemArea,middleButton,  loginComponent, leftItem,leftGroup, customerList, rightGoodsArea },
 	mixins: [autoUpdateApp,productMins],
 	data() {
 		return {
+			//0成品 1花材
+			currentProperty:0,
 			itemList:[],
 			currenSelectShop:{},
 			selectItem: {},
@@ -56,7 +60,7 @@ export default {
             selectJobType:'bill',
             selectJobId:0,
 			chooseCustomer:false
-		};
+		}
 	},
 	computed: {
 		...mapGetters(["getLoginInfo"])
@@ -82,6 +86,9 @@ export default {
 		}
 	},
 	methods: {
+		changeProperty(property){
+			this.currentProperty = property
+		},
 		resetCustomer(){
 			this.chooseCustomer = true
 		},

+ 6 - 3
hdPad/src/api/goods/index.js

@@ -16,13 +16,16 @@ export const getCategoryGoodsB = data => {
 	return https.get('/category/goods-list', data)
 }
 
-/** *
- * 商品-列表 b
- */
+//商品列表
 export const getListB = data => {
 	return https.get('/goods/list', data)
 }
 
+//商品列表
+export const getGoodsList = data => {
+	return https.get('/goods/list', data)
+}
+
 /** *
  * 商品-查看 b
  */