shish 2 лет назад
Родитель
Сommit
5219d66c9c

+ 16 - 4
ghsApp/src/pagesPurchase/add.vue

@@ -52,17 +52,25 @@
 						<view class="num_bx">
 							
 							<!-- #ifdef APP-PLUS -->
-							<input v-model="customData.bigCount" type="number" @focus="customData.bigCount = null" placeholder="扎数" />
+							<input v-model="customData.bigCount" type="number" v-if="globalUnitType == 0" @focus="customData.bigCount = null" placeholder="扎数" />
+							<input v-model="customData.smallCount" type="number" v-else @focus="customData.smallCount = null" placeholder="支数" />
 							<!-- #endif -->
 							<!-- #ifdef MP-WEIXIN -->							
-							<input v-model="customData.bigCount" type="number" @focus="customData.bigCount = null" :focus="isAddInputFocus" placeholder="扎数" />
+							<input v-model="customData.bigCount" type="number" v-if="globalUnitType == 0" @focus="customData.bigCount = null" :focus="isAddInputFocus" placeholder="扎数" />
+							<input v-model="customData.smallCount" type="number" v-else @focus="customData.smallCount = null" :focus="isAddInputFocus" placeholder="支数" />
 							<!-- #endif -->
 
 							<input v-model="customData.userPrice" @focus="customData.userPrice = null" type="digit" placeholder="单价" />
 
-							<text>¥{{customData.userPrice && customData.bigCount ? parseFloat((customData.userPrice*customData.bigCount).toFixed(2)):0}}</text>
+							<text v-if="Number(customData.bigCount)>0">¥{{customData.userPrice && customData.bigCount ? parseFloat((customData.userPrice*customData.bigCount).toFixed(2)):0}}</text>
+							<text v-else>¥{{customData.userPrice && customData.smallCount ? parseFloat((customData.userPrice*customData.smallCount).toFixed(2)):0}}</text>
+
 						</view>
 					</view>
+					
+					<image @click="switchGlobalUnitType" :src="`${constant.imgUrl}/icon/switch/switch128.png`" mode="widthFix" 
+					style="width:58upx;height:58upx;position:absolute;top:35upx;left:30upx;" ></image>
+					
 				</view>
 			</template>
 		</modal-module>
@@ -126,7 +134,11 @@ export default {
 			let price = 0;
 			if (this.selectList) {
 				for (const item of this.selectList) {
-					price += Number(item.userPrice)*Number(item.bigCount)
+					if(Number(item.bigCount)>0){
+						price += Number(item.userPrice)*Number(item.bigCount)
+					}else{
+						price += Number(item.userPrice)*Number(item.smallCount)
+					}
 				}
 			}
 			return Math.round(price * 100) / 100;

+ 1 - 2
ghsApp/src/pagesPurchase/components/CommodityPurchase.vue

@@ -22,8 +22,7 @@
             <view class="open-bx">
               <i class="iconfont iconjian" @click.stop="delItemFn" v-if="bigCount > 0 || smallCount > 0" ></i>
               <text class="num" @click.stop="showAddModelFn" >
-                <text v-if="bigCount > 0 || smallCount > 0">{{ `${bigCount}` }}</text>
-                <text v-if="smallCount > 0">/</text>
+                <text v-if="bigCount > 0" style="color:#3385FF;">{{ `${bigCount}` }}</text>
                 <text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
               </text>
               <i class="iconfont iconzeng" @click.stop="showAddModelFn" ></i>

+ 7 - 3
ghsApp/src/pagesPurchase/details.vue

@@ -12,13 +12,15 @@
 									<view class="info-line">
 										<text class="item-name">{{ item.name||'' }}</text>
 										<text class="item-price">
-											<text class="price">¥{{parseFloat((Number(item.bigCount)*Number(item.userPrice)).toFixed(2))}}</text>
+											<text class="price" v-if="Number(item.bigCount)>0">¥{{parseFloat((Number(item.bigCount)*Number(item.userPrice)).toFixed(2))}}</text>
+											<text class="price" v-if="Number(item.smallCount)>0">¥{{parseFloat((Number(item.smallCount)*Number(item.userPrice)).toFixed(2))}}</text>
 										</text>
 									</view>
 									<view class="info-line">
 										<text class="item-type"></text>
 										<text class="item-count">
-											<text>{{`${item.bigCount}`}}扎 × ¥{{item.userPrice}}</text>
+											<text v-if="Number(item.bigCount)>0">{{`${item.bigCount}`}}扎 × ¥{{item.userPrice}}</text>
+											<text v-if="Number(item.smallCount)>0">{{`${item.smallCount}`}}支 × ¥{{item.userPrice}}</text>
 										</text>
 									</view>
 								</view>
@@ -450,7 +452,9 @@ export default {
 					bigNum: ele.bigCount,
 					smallNum: ele.smallCount,
 					itemId:ele.itemId,
-					itemPrice: ele.userPrice
+					itemPrice: ele.userPrice,
+					ratio:ele.ratio,
+					ratioType:ele.ratioType
 				}
 			})
 			formData.itemInfo = JSON.stringify(itemInfo)