Procházet zdrojové kódy

零售开单、供货商改价

jiangfeng před 5 roky
rodič
revize
d45dbf1929

+ 1 - 0
ghsApp/package.json

@@ -39,6 +39,7 @@
     "jweixin-module": "^1.4.1",
     "lodash": "^4.17.20",
     "regenerator-runtime": "^0.12.1",
+    "text-encoding": "^0.7.0",
     "to-array-buffer": "^3.2.0",
     "vue": "^2.6.10",
     "vue-lazyload": "^1.3.3",

+ 1 - 1
ghsApp/src/components/module/app-commodity.vue

@@ -125,7 +125,7 @@ export default {
 		if(this.info.priceLabel == 2){
 			this.changeAutoPrice = this.info.price
 		}
-		this.showPrice = this.info.price
+		this.showPrice = this.info.priceLabel==1?null:this.info.price
 		this.oldPrice = (Number(this.info.cost) + Number(this.info.addPrice)).toFixed(2)
 	},
 	methods: {

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

@@ -180,11 +180,7 @@
 				<view class="module-com">
 					<view class="commodity-view">
 						<view class="commodity-list">
-							<view
-								class="commodity-item"
-								v-for="(item, index) in selectList"
-								:key="index"
-							>
+							<view class="commodity-item" v-for="(item, index) in list" :key="index">
 								<image class="item-icon" :src="item.cover" alt="商品图" />
 
 								<view class="item-info">
@@ -201,9 +197,7 @@
 									<view class="info-line">
 										<text class="item-type">{{ item.rank }}级</text>
 										<text class="item-count">
-											<text v-if="item.bigCount > 0 || item.smallCount > 0">{{
-												`${item.bigCount}`
-											}}</text>
+											<text v-if="item.bigCount > 0 || item.smallCount > 0">{{`${item.bigCount}`}}</text>
 											<text v-if="item.smallCount > 0">/</text>
 											<text v-if="item.smallCount > 0">{{ `${item.smallCount}` }}</text>
 										</text>
@@ -217,9 +211,9 @@
 								重选花材
 							</view>
 							<view class="describe-view">
-								共{{ allCount.bigLength }}/{{ allCount.smallLength }}种,
+								共{{ allCountFun.bigLength }}/{{ allCountFun.smallLength }}种,
 								<!-- 共16扎9支, -->
-								合计 ¥<text class="price">{{ allPrice }}</text>
+								合计 ¥<text class="price">{{ allPriceFun }}</text>
 							</view>
 						</view>
 					</view>
@@ -301,6 +295,7 @@ export default {
 	mixins: [productMins],
 	data() {
 		return {
+			list:[],
 			autoLoad: false,
 			ghsMsg:'',
 			sendTime:'',
@@ -347,6 +342,26 @@ export default {
 		this.getGhsData(e.id);
 	},
   onShow() {
+				console.log(this.selectList,'selectList')
+			let selectList = this.$util.copyObject(this.selectList);
+			let list = [];
+				for (let i=0;i<selectList.length;i++){
+					if(list==''){
+						list.push(selectList[i])
+					}else{
+						list.forEach(res=>{
+							if(res.id==selectList[i].id){
+								res.bigCount = (res.bigCount+selectList[i].bigCount)
+								res.smallCount = (res.smallCount+selectList[i].smallCount)
+							}
+						})
+					}
+				}
+			this.selectList.map(ele=>{
+
+			})
+			this.list = list;
+			console.log(list,'list')
     if(uni.getStorageSync('selectCouponInfo').couponSum) {
       this.couponSumText = uni.getStorageSync('selectCouponInfo').couponSum
       this.couponText = '-¥' + this.couponSumText
@@ -450,7 +465,7 @@ export default {
 			});
 		},
 		affirmFormSubmit(){
-			const product = this.selectList.map(ele => {
+			const product = this.list.map(ele => {
 				return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId };
 			});
 			let parameter = {

+ 18 - 3
hdApp/src/components/module/app-commodity.vue

@@ -8,8 +8,17 @@
 		</view>
 		<view class="cmd-info_bx">
 			<view class="tit" >{{ info.itemName || "" }}</view>
-			<view class="kc num-open_bx flex-end" v-if="type == COMMODITY_TYPE.COMMON">
-				<view class="price" v-if="!offPrice">¥{{ info.price }}</view>
+			<view class="kc num-open_bx flex-space" v-if="type == COMMODITY_TYPE.COMMON">
+				<view v-if="!offPrice">
+					<view class="flex-space" style="margin-bottom: 36rpx" v-if="isDiscounts&&Number(oldPrice)>Number(info.price)">
+						<view style="padding:0 10rpx;text-align: center;color: red;border: 1px solid red;margin-right: 20rpx">
+							{{((Number(info.price)/Number(oldPrice)).toFixed(2)*10).toFixed(1)+'折'}}
+						</view>
+						<text style="text-decoration:line-through; ">{{oldPrice}}</text>
+					</view>
+					<view class="price" >¥{{ info.price }}</view>
+				</view>
+
 				<view class="price" v-else></view>
 				<view style="text-align: right" >
 					<view class="open-bx" >
@@ -92,6 +101,10 @@ export default {
 			type: Boolean,
 			default: false
 		},
+		isDiscounts: {
+			type: Boolean,
+			default: false
+		},
 	},
 	data() {
 		return {
@@ -105,6 +118,7 @@ export default {
 			isShowSucceed:false,
 			changeAutoPrice:'',
 			showPrice:0.00,
+			oldPrice:0.00,
 			ifFocus:false
 		};
 	},
@@ -113,7 +127,8 @@ export default {
 		if(this.info.priceLabel == 2){
 			this.changeAutoPrice = this.info.price
 		}
-		this.showPrice = this.info.price
+		this.showPrice = this.info.price;
+		this.oldPrice = (Number(this.info.cost) + Number(this.info.addPrice)).toFixed(2)
 	},
 	methods: {
 		//input点击删除按键

+ 30 - 0
hdApp/src/mixins/product.js

@@ -90,6 +90,25 @@ export default {
 
 			return Math.round(price * 100) / 100;
 		},
+		allPriceFun() {
+			let price = 0;
+
+			if (this.list) {
+				for (const item of this.list) {
+					const itemInfo = this.getSelectItemById(item.id, item.classId);
+					if (
+						itemInfo &&
+						!this.$util.isEmpty(itemInfo.bigPrice) &&
+						!this.$util.isEmpty(itemInfo.smallPrice)
+					) {
+						price += item.bigCount * Number(itemInfo.bigPrice);
+						price += item.smallCount * Number(itemInfo.smallPrice);
+					}
+				}
+			}
+
+			return Math.round(price * 100) / 100;
+		},
 		//选择商品总数
 		allCount() {
 			let bigLength = 0;
@@ -102,6 +121,17 @@ export default {
 			}
 			return {bigLength:bigLength,smallLength:smallLength,};
 		},
+		allCountFun() {
+			let bigLength = 0;
+			let smallLength = 0;
+			if (this.list) {
+				for (const item of this.list) {
+					bigLength += item.bigCount
+					smallLength += item.smallCount
+				}
+			}
+			return {bigLength:bigLength,smallLength:smallLength,};
+		},
 		/**
 			* 描点-定位分类
 			* */

+ 5 - 4
hdApp/src/pagesPurchase/ghsProduct.vue

@@ -18,7 +18,9 @@
 		<view class="scroll-middle_bx">
 			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop" >
 				<div v-for="(item, index) in filterProductInfo" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass(index)">
-					<text>{{ item.className || "" }}</text>
+					<!--<text>{{ item.className || "" }}</text>-->
+					<text v-if="item.classId=='-1'" style="color: red">{{ item.className || "" }}</text>
+					<text v-else>{{ item.className }}</text>
 					<text class="tag" v-if=" getSelectClassById(item.classId).bigCount > 0 || getSelectClassById(item.classId).smallCount > 0">
 						<text v-if=" getSelectClassById(item.classId).bigCount > 0 || getSelectClassById(item.classId).smallCount > 0 ">
 							{{ `${getSelectClassById(item.classId).bigCount}` }}
@@ -38,14 +40,13 @@
 				<!--内容部分 start -->
 				<block v-if="!$util.isEmpty(filterProductInfo)">
 					<view class="item_list_bx selectAll" v-for="(classItem, classIndex) in filterProductInfo" :key="classIndex" :id="`class_${classIndex}`">
-						<view class="item_list_title">
-							{{ classItem.className }}
-						</view>
+						<view class="item_list_title">{{ classItem.className }}</view>
 						<template v-for="(productItem, productIndex) in classItem.child">
 							<view style="height: 160rpx" :id="`class_${classItem.classId}_${productItem.id}`" :key="productIndex">
 								<Commondity v-if="classItem.isActive"
 									:info="productItem"
 									:offVerifyRepertory="true"
+									:isDiscounts="true"
 									:bigCount="
 										getSelectItemById(productItem.id, classItem.classId).bigCount
 									"