shish 4 лет назад
Родитель
Сommit
bf6e4089d4

+ 5 - 4
hdPad/src/api/goods/index.js

@@ -1,13 +1,14 @@
 import https from '@/plugins/luch-request_0.0.7/request'
 
-/** *
- * 商品详情 m
- */
+//商品详情
 export const getDetail = data => {
 	return https.get('/goods/detail', data)
 }
 
-// =====================  B 端 ========================
+//获取商品详情 ssh 20220505
+export const getBySn = data =>{
+	return https.get('/goods/get-by-sn', data)
+}
 
 /** *
  * 获取分类的商品 b

+ 3 - 1
hdPad/src/mixins/product.js

@@ -165,7 +165,9 @@ export default {
 
 			if(index == -1){
 				if(this.$util.isEmpty(item.unitPrice) || Number(item.unitPrice) == 0){
-					item.unitPrice = item.bigPrice
+					if(item.property && item.property == 1){
+						item.unitPrice = item.bigPrice
+					}
 				}
 				list.push(item)			
 			}else{

+ 30 - 7
hdPad/src/pages/home/components/console.vue

@@ -47,6 +47,7 @@ import { createOrder} from '@/api/order'
 import {goodsWastage} from '@/api/wastage'
 import productMins from "@/mixins/product"
 import { allProduct } from '@/api/product'
+import { getBySn } from '@/api/goods'
 import selectPrice from './selectPrice.vue'
 export default {
     name:'console',
@@ -135,16 +136,39 @@ export default {
 		calcFn(){
 			this.calc = this.calc == 'add' ? 'sub' : 'add'
 		},
-		takeItem(code){
-			let current = this.allProduct.find(function(val){
-				return val.itemId == code
-			})
-			if(current == undefined){
+		async takeItem(code){
+			if(this.$util.isEmpty(code)){
+				return false
+			}
+			let current = null
+			let unitPrice = 0
+			let unitName = ''
+			if(code.indexOf('1-') == 0){
+				//成品
+				const res = await getBySn({sn:code})
+				if(res.code == 1){
+					current = res.data
+					unitName = '份'
+					unitPrice = Number(res.data.price)
+				}
+			}else{
+				//花材
+				current = this.allProduct.find(function(val){
+					return val.itemId == code
+				})
+				if(current == undefined){
+					return false
+				}
+				unitName = current.bigUnit
+				unitPrice = current.bigPrice
+			}
+			if(this.$util.isEmpty(current)){
 				return false
 			}
 			this.$util.hitRemind()
 			let num = this.calc == 'add' ? 1 : -1
-			let params = {...current,unitName:current.bigUnit,unitPrice:current.bigPrice,currentNum:num}
+			let params = {...current,unitName:unitName,unitPrice:unitPrice,currentNum:num}
+			console.log(params)
 			this.replaceItemFn(params,1)
 		},
 		changeProperty(){
@@ -189,7 +213,6 @@ export default {
 		},
 		selectPayWayBack(price){
 			this.$util.hitRemind()
-			console.log(price)
 		},
 		toWastage(){
 			this.$util.hitRemind()

+ 2 - 1
hdPad/src/pages/home/components/nav.vue

@@ -39,7 +39,8 @@ export default {
       if(!this.$util.isEmpty(code) && code != 'Unidentified'){
         if(code != 'Enter'){
           uni.setStorageSync('hasScanCode', hasScanCode+code)
-        }else{
+        }
+        if(code == 'Enter'){
           uni.$emit('listenGetScanCode',{code:hasScanCode})
           uni.removeStorageSync('hasScanCode')
         }

+ 1 - 2
hdPad/src/pages/home/components/workInfo.vue

@@ -157,7 +157,6 @@ export default {
   },
   methods:{
     confirmGetBlue(){
-      console.log('aaaab')
       this.pageTo({url:'/pages/home/blue'})
     },
     printFn(info){
@@ -173,7 +172,7 @@ export default {
             return false
           }
           let data = []
-          let label = that.createLable(info.name,info.goodsId,currentNum)
+          let label = that.createLable(info.name,info.goodsSn,currentNum)
           data.push(label)
           //说明地址 https://ext.dcloud.net.cn/plugin?id=462
           plug.printer({"TSC":data,isArray:true},result=>{