shish 3 лет назад
Родитель
Сommit
79cf996b26

+ 1 - 1
ghsApp/src/admin/changePrice/components/Item.vue

@@ -103,7 +103,7 @@ export default {
 	height:230upx;
 	.level-price{
 		display:flex;
-		color:rgb(124, 121, 121);
+		color:#CCCCCC;
 		text-align: right;
 		font-size:24upx;
 		justify-content:space-around;

+ 1 - 0
ghsApp/src/admin/changePrice/list.vue

@@ -260,6 +260,7 @@ export default {
 		overflow: hidden;
 	}
 	.tab-view {
+		padding-bottom:100upx;
 		height: calc(100vh - 140upx);
 		width: 170upx;
 		flex-shrink: 0;

+ 38 - 112
ghsApp/src/pagesPurchase/components/pageSuccess.vue

@@ -6,37 +6,36 @@
 				<view class="iconfont iconchenggong"></view>
 				<view class="result-title" v-if="info.status == 3">保存成功</view>
 				<view class="result-title" v-else>提交成功</view>
+<template>
+	<view style="width:670upx;overflow:hidden;padding-left:50upx;">
+		<view class="flex title" v-if="info.status == 3"> 入库前请确认售价: </view>
+		<view class="flex title" v-else> 确认售价: </view>
+		<view class="flex title">
+			<text style="font-size:30upx;font-weight:normal;"> 红色进货价,蓝色成本价 </text>
+		</view>
 
-				<template>
-					<view style="margin-left:150upx;">
-						<view class="flex title" v-if="info.status == 3"> 入库前请确认售价: </view>
-						<view class="flex title" v-else> 确认售价: </view>
-						<view class="flex title">
-							<text style="font-size:30upx;font-weight:normal;"> 红色进货价,蓝色成本价 </text>
-						</view>
-						<checkbox-group @change="checkboxChange">
-							<view v-for="(res,i) in flowersList" :key="i">
-								<view class="product-area">
-									<view class="first-area">
-										<text class="name">{{res.name}}</text>
-										<text class="cg-cost">¥{{itemPriceList[res.id].cgPrice?parseFloat(itemPriceList[res.id].cgPrice):0}}</text>
-										<text class="cost-price">¥{{itemPriceList[res.id].cost?parseFloat(itemPriceList[res.id].cost):0}}</text>
-										<input type="digit" v-model="res.autoPrice" placeholder="花店价" @focus="priceFocus(i,res)" @input="modifyPrice(i,res)" />
-										<input type="digit" v-model="res.autoSkPrice" placeholder="个人价" @focus="skPriceFocus(i,res)" @input="modifySkPrice(res)" />
-									</view>
-								</view>
-							</view>
-						</checkbox-group>
-					</view>
-					<template v-if="!$util.isEmpty(info)">
-						<button v-if="info.status == 3" class="admin-button-com big blue" style="width:55vw;margin-top:50upx;" @click="commitChange(1)">改价并入库</button>
-						<button v-if="info.status == 3" class="admin-button-com big blue" style="width:55vw;margin-top:50upx;" @click="confirmIn">仅入库不改价</button>
-						<button v-if="info.status != 3" class="admin-button-com big blue" style="width:55vw;margin-top:50upx;" @click="commitChange(2)">确认改价</button>
-						<button v-if="info.status == 3" class="admin-button-com big default" style="width:55vw;margin-top:30upx;" @click="goBackFn">稍后改价入库</button>
-					</template>
-				</template>
+<view v-for="(res,i) in flowersList" :key="i">
+<view class="product-area">
+	<view class="first-area">
+		<text class="name">{{res.name}}</text>
+		<text class="cg-cost">¥{{res.bigPrice?parseFloat(res.bigPrice):0}}</text>
+		<text class="cost-price">¥{{res.cost?parseFloat(res.cost):0}}</text>
+		<input type="digit" v-model="res.suggestPrice" placeholder="花店价" />
+		<input type="digit" v-model="res.suggestSkPrice" placeholder="个人价" />
+	</view>
+</view>
+</view>
 
-				<button class="admin-button-com big default" style="width:55vw;margin-top:30upx;" @click="goBackFn">返回</button>
+	</view>
+	<template v-if="!$util.isEmpty(info)">
+		<button v-if="info.status == 3" class="admin-button-com big blue" style="width:55vw;margin-top:50upx;" @click="commitChange(1)">改价并入库</button>
+		<button v-if="info.status == 3" class="admin-button-com big blue" style="width:55vw;margin-top:50upx;" @click="confirmIn">仅入库不改价</button>
+		<button v-if="info.status != 3" class="admin-button-com big blue" style="width:55vw;margin-top:50upx;" @click="commitChange(2)">确认改价</button>
+		<button v-if="info.status == 3" class="admin-button-com big default" style="width:55vw;margin-top:30upx;" @click="goBackFn">稍后改价入库</button>
+	</template>
+</template>
+
+<button class="admin-button-com big default" style="width:55vw;margin-top:30upx;" @click="goBackFn">返回</button>
 
 			</view>
 		</view>
@@ -49,20 +48,11 @@ export default {
     name: "pageSuccess",
 	data() {
 		return {
-			cgItemList:[],
 			flowersList:[],
-			productList:[],
-			itemPriceList:[],
-			status:0,
 			info:{}
 		};
 	},
-	onShow(){
-		this.getList();
-	},
 	onLoad(){
-		this.status = this.option.status ? Number(this.option.status) : 0
-
 		let that = this
 		let orderSn = this.option.orderSn ? this.option.orderSn : ''
 		getPurchaseDetailApi(orderSn).then(res=>{
@@ -73,7 +63,7 @@ export default {
 	},
 	methods: {
 		init(){
-
+			this.getList()
 		},
 		confirmIn(){
 			let that = this
@@ -92,92 +82,25 @@ export default {
 				})
 			})
 		},
-		priceFocus(i,res){
-			this.flowersList[i].autoPrice = ''
-			if(!this.$util.isEmpty(this.productList)){
-				this.productList.forEach((item,idx,arr) => {
-					if(item.id == res.id){
-						arr[idx].price = ''
-					}
-				})
-			}
-		},
-		skPriceFocus(i,res){
-			this.flowersList[i].autoSkPrice = ''
-			if(!this.$util.isEmpty(this.productList)){
-				this.productList.forEach((item,idx,arr) => {
-					if(item.id == res.id){
-						arr[idx].skPrice = ''
-					}
-				})
-			}
-		},
 		getList(){
-			let productIdArr = '';
 			let that = this
 			getCgItemList({id:this.option.id}).then(res=>{
 				if(res.code == 1){
-					let list = res.data.list
-					if(!this.$util.isEmpty(list)){
-
-						list.forEach((ele)=>{
-							productIdArr += ele.productId+','
-							that.itemPriceList[ele.productId] = {cgPrice:ele.bigPrice,cost:ele.cost}
-						})
-
-						getAllProductDataApi({ids : productIdArr.substring(0, productIdArr.lastIndexOf(',')),}).then((res)=>{
-							that.flowersList = res.data.list;
-							that.productList = [];
-							that.flowersList.forEach(function(item){
-								that.productList.push({id:item.id,price:parseFloat(item.autoPrice),skPrice:parseFloat(item.autoSkPrice),skMore:item.skMore,name:item.name})
-							})
-						});
-
-					}
+					that.flowersList = res.data.list
 				}
 			})
 		},
-		modifyPrice(i,res){
-			let id = res.id
-			let price = res.autoPrice
-			let skMore = res.skMore
-			let name = res.name
-			let skPrice = Number(res.autoPrice)+Number(skMore)
-			skPrice = parseFloat(skPrice.toFixed(2))
-			this.flowersList[i].autoSkPrice = skPrice
-			let arr = this.productList.map((ele)=>{
-				if(ele.id == id){
-					return {id:id,price:price,skPrice:skPrice,skMore:skMore,name:name}
-				}
-				return ele
-			})
-			this.productList = arr
-		},
-		modifySkPrice(res){
-			let id = res.id
-			let price = res.autoPrice
-			let skPrice = res.autoSkPrice
-			let skMore = res.skMore
-			let name = res.name
-			let arr = this.productList.map((ele)=>{
-				if(ele.id == id){
-					return {id:id,price:price,skPrice:skPrice,skMore:skMore,name:name}
-				}
-				return ele
-			})
-			this.productList = arr
-		},
 		commitChange(type){
 			let that = this
 			let hasError = false
 			let errorHint = ''
-			this.productList.forEach(function(item){
-				if(that.$util.isMoney(item.price) == false){
+			this.flowersList.forEach(function(item){
+				if(that.$util.isMoney(item.suggestPrice) == false){
 					let name = item.name
 					errorHint = '请填写 '+name+' 花店价'
 					hasError = true
 				}
-				if(that.$util.isMoney(item.skPrice) == false){
+				if(that.$util.isMoney(item.suggestSkPrice) == false){
 					let name = item.name
 					errorHint = '请填写 '+name+' 个人价'
 					hasError = true
@@ -201,8 +124,11 @@ export default {
 		commitModify(){
 			let that = this
 			let targetId = this.option.id ||0
+			let newProduct = this.flowersList.map((ele) => {
+				return {id:ele.productId,price:ele.suggestPrice,skPrice:ele.suggestSkPrice}
+			})
 			uni.showLoading({mask:true})
-			batchChangePrice({data:JSON.stringify(this.productList),changeType:'cg',targetId:targetId}).then(res => {
+			batchChangePrice({data:JSON.stringify(newProduct),changeType:'cg',targetId:targetId}).then(res => {
 				uni.hideLoading()
 				if(res.code == 1){
 					that.$msg(res.msg)
@@ -234,7 +160,7 @@ export default {
 	font-size:30upx;
 }
 .product-area{
-	width:750upx;
+	width:700upx;
 	height:90upx;
 	display:flex;
 	align-items:center;