Ver Fonte

小单位支持

shish há 4 anos atrás
pai
commit
0246ea8a26

+ 1 - 1
ghsApp/src/mixins/product.js

@@ -505,7 +505,7 @@ export default {
 			}
 
 			//弹框时默认显示的单位
-			if(Number(info.smallCount>0)){
+			if(Number(info.smallCount)>0){
 				this.globalUnitType = 1
 			}else{
 				this.globalUnitType = 0

+ 11 - 2
hdApp/src/admin/billing/affirmGhs.vue

@@ -91,8 +91,10 @@
 				<view class="select-cmd_bx" v-if="customData">
 					<view class="kc"> </view>
 					<view class="num_bx">
-						<input v-model="customData.bigCount" :focus="isFocus" type="number" placeholder="扎数" />
-						<input v-if="customData.smallShow && customData.smallShow == 1" v-model="customData.smallCount" type="number" style="margin-left:20upx" placeholder="支数" />
+						<input v-if="globalUnitType == 0" v-model="customData.bigCount" :focus="isFocus" type="number" :placeholder="`${customData.bigUnit||'扎'}数`" />
+						<input v-if="globalUnitType == 1" v-model="customData.smallCount" :focus="isFocus" type="number" :placeholder="`${customData.smallUnit||'支'}数`" />
+						<image @click="switchGlobalUnitType" :src="`${constant.imgUrl}/icon/switch/switch128.png`" v-if="customData.smallShow && customData.smallShow==1"
+						style="width:86upx;height:86upx;position:absolute;top:136upx;right:55upx;" mode="widthFix"></image>
 					</view>
 				</view>
 			</template>
@@ -217,6 +219,13 @@ export default {
 				this.customData.smallCount = 	this.customData.smallCount==0?null:this.customData.smallCount;
 				this.customData.bigCount = 	this.customData.bigCount==0?null:this.customData.bigCount;
 				this.isFocus = true;
+
+				if(Number(info.smallCount)>0){
+					this.globalUnitType = 1
+				}else{
+					this.globalUnitType = 0
+				}
+
 			})
 		},
 		modalCancel() {

+ 25 - 6
hdApp/src/mixins/cgProduct.js

@@ -29,7 +29,8 @@ export default {
 			top_list:'',
 			timeFun:"",
 			filterProductInfo:'',
-
+			//当前页面默认使用的单位 0大单位 1小单位
+			globalUnitType:0
 		};
 	},
 	onLoad(options) {
@@ -224,6 +225,18 @@ export default {
 			}
 			this.resetSelectInfoByType(this.pageType);
 		},
+		//大小单位切换
+		switchGlobalUnitType(){
+			if(this.globalUnitType == 0){
+				this.globalUnitType = 1
+				this.customData.userPrice = parseFloat(this.customData.smallPrice)
+				this.customData.bigCount = null
+			}else{
+				this.globalUnitType = 0
+				this.customData.userPrice = parseFloat(this.customData.bigPrice)
+				this.customData.smallCount = null
+			}
+		},
 		//采购时请求供应商花材
 		async initGhsData(id,shopId) {
 			//extendInfo调用时的扩展参数,如shopId
@@ -564,6 +577,11 @@ export default {
 				const element = list[index];
 				if (element.id == item.id && element.classId == item.classId) {
 					has = true;
+					if(Number(element.smallCount) > 0){
+						this.isSmallCount = true
+					}else{
+						this.isSmallCount = false
+					}
 					if(this.offVerifyRepertory){//去除库存验证
 						if(this.isSmallCount){
 							list[index] = { ...element, smallCount: ++element.smallCount };
@@ -581,10 +599,7 @@ export default {
 							const {bigCount, smallCount} = list[index];
 							//超过库存时 设置为库存最大值
 							const ratio = Number(item.ratio);
-							if (
-								Number(bigCount) * ratio + Number(smallCount) >
-								Number(item.bigNum) * ratio + Number(item.smallNum)
-							) {
+							if ( Number(bigCount) * ratio + Number(smallCount) > Number(item.bigNum) * ratio + Number(item.smallNum) ) {
 								list[index].bigCount = Number(item.bigNum);
 								list[index].smallCount = Number(item.smallNum);
 								this.$msg("库存还剩"+item.bigNum);
@@ -670,13 +685,17 @@ export default {
 		},
 		//减去商品
 		delEvent(item) {
-
 			const list = copyObject(this.selectList);
 			let has = false;
 			for (let index = 0; index < list.length; index++) {
 				let element = list[index];
 				if (element.id == item.id && element.classId == item.classId) {
 					has = true;
+					if(Number(element.smallCount) > 0){
+						this.isSmallCount = true
+					}else{
+						this.isSmallCount = false
+					}
 					if (element.bigCount > 0) {
 						if (!this.isSmallCount) {
 							list[index] = {...element, bigCount: --element.bigCount};

+ 3 - 4
hdApp/src/pagesPurchase/components/item.vue

@@ -23,9 +23,8 @@
 					<view class="open-bx" >
 						<i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click.stop="delEvent(info.variety)" v-if="bigCount > 0 || smallCount > 0"></i>
 						<text class="num">
-							<text v-if="bigCount > 0 || smallCount > 0">{{ `${bigCount}` }}</text>
-							<text v-if="smallCount > 0">/</text>
-							<text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
+							<text v-if="bigCount > 0" style="font-size:24upx;font-weight:bold;color:#3385ff;">{{ `${bigCount}` }}</text>
+							<text v-if="smallCount > 0" style="font-size:24upx;">{{ `${smallCount}` }}</text>
 						</text>
 						<i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click.stop="addEvents(info.variety)"></i>
 					</view>
@@ -38,7 +37,7 @@
 <script>
 import { COMMODITY_TYPE } from "@/utils/declare";
 import AppImg from "@/components/app-img";
-import { autoPriceByIdApi, changePriceByIdApi } from '@/api/product/index'
+import { changePriceByIdApi } from '@/api/product/index'
 import animationMins from "@/mixins/animation";
 import allSelectInput from "@/components/module/allSelectInput";
 import allSelectInputMins from "@/mixins/allSelectInput";

+ 13 - 2
hdApp/src/pagesPurchase/ghsProduct.vue

@@ -96,8 +96,12 @@
 				<view class="select-cmd_bx" v-if="customData">
 					<view class="kc"> </view>
 					<view class="num_bx">
-						<input v-model="customData.bigCount" :focus="isFocus" type="number" placeholder="扎数" />
-						<input v-if="customData.smallShow && customData.smallShow == 1" v-model="customData.smallCount" type="number" style="margin-left:24upx" placeholder="支数" />
+						<input v-if="globalUnitType == 0" v-model="customData.bigCount" :focus="isFocus" type="number" :placeholder="`${customData.bigUnit||'扎'}数`" />
+						<input v-if="globalUnitType == 1" v-model="customData.smallCount" :focus="isFocus" type="number" :placeholder="`${customData.smallUnit||'支'}数`" />
+
+						<image @click="switchGlobalUnitType" :src="`${constant.imgUrl}/icon/switch/switch128.png`" v-if="customData.smallShow && customData.smallShow==1"
+						style="width:86upx;height:86upx;position:absolute;top:136upx;right:55upx;" mode="widthFix"></image>
+
 					</view>
 				</view>
 			</template>
@@ -515,6 +519,13 @@ export default {
 				this.customData.smallCount = 	this.customData.smallCount==0?null:this.customData.smallCount;
 				this.customData.bigCount = 	this.customData.bigCount==0?null:this.customData.bigCount;
 				this.isFocus = true;
+
+				if(Number(info.smallCount)>0){
+					this.globalUnitType = 1
+				}else{
+					this.globalUnitType = 0
+				}
+
 			})
 		},
 		goToCg() {