shish 3 سال پیش
والد
کامیت
a84330fa66
2فایلهای تغییر یافته به همراه59 افزوده شده و 3 حذف شده
  1. 4 0
      ghsApp/src/api/purchase/index.js
  2. 55 3
      ghsApp/src/pagesPurchase/components/pageSuccess.vue

+ 4 - 0
ghsApp/src/api/purchase/index.js

@@ -1,5 +1,9 @@
 import https from "@/plugins/luch-request_0.0.7/request";
 
+export const saveCgPrice = data => {
+	return https.post("/purchase-order-item/save-cg-price", data);
+};
+
 export const printBill = data => {
 	return https.get("/purchase-order/print-bill", data);
 };

+ 55 - 3
ghsApp/src/pagesPurchase/components/pageSuccess.vue

@@ -7,6 +7,8 @@
 				<view class="result-title" v-if="info.status == 3">请继续以下完成入库</view>
 				<view class="result-title" v-else>提交成功</view>
 
+				<view class="pre-save-price" v-if="info.hasSavePrice && info.hasSavePrice == 1">预存价格已导入</view>
+
 				<template>
 					<view style="width:670upx;overflow:hidden;padding-left:50upx;">
 						<view class="flex title" v-if="info.status == 3"> 入库前请确认售价: </view>
@@ -40,11 +42,11 @@
 						<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>
+						<button v-if="info.status == 3" class="admin-button-com big default" style="width:55vw;margin-top:30upx;" @click="savePrice">保存价格,稍后改价入库</button>
 					</template>
 				</template>
 
-				<button class="admin-button-com big default" style="width:55vw;margin-top:30upx;" @click="goBackFn">返回</button>
+				<button class="admin-button-com big default" style="width:55vw;margin-top:30upx;" @click="goBackFn">稍后改价入库</button>
 
 			</view>
 		</view>
@@ -52,7 +54,7 @@
 </template>
 <script>
 import { getAllProductDataApi,batchChangePrice } from "@/api/product";
-import { getCgItemList,getPurchaseDetailApi,confirmPutIn } from "@/api/purchase";
+import { getCgItemList,getPurchaseDetailApi,confirmPutIn,saveCgPrice } from "@/api/purchase";
 export default {
     name: "pageSuccess",
 	data() {
@@ -143,6 +145,49 @@ export default {
 				}
 			})
 		},
+		savePrice(){
+			let that = this
+			let hasError = false
+			let errorHint = ''
+			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.suggestSkPrice) == false){
+					let name = item.name
+					errorHint = '请填写 '+name+' 零售价'
+					hasError = true
+				}
+				if(that.$util.isMoney(item.suggestHjPrice) == false){
+					let name = item.name
+					errorHint = '请填写 '+name+' 会员价'
+					hasError = true
+				}
+			})
+			if(hasError){
+				this.$msg(errorHint)
+				return false
+			}
+			let hint = '确认保存?'
+			this.$util.confirmModal({content:hint},() => {
+				let targetId = this.option.id ? this.option.id : 0
+				let newProduct = this.flowersList.map((ele) => {
+					return {id:ele.id,savePrice:ele.suggestPrice,saveSkPrice:ele.suggestSkPrice,saveHjPrice:ele.suggestHjPrice}
+				})
+				uni.showLoading({mask:true})
+				saveCgPrice({data:JSON.stringify(newProduct),cgId:targetId}).then(res => {
+					uni.hideLoading()
+					if(res.code == 1){
+						that.$msg(res.msg)
+						setTimeout(function(){
+							uni.navigateBack()
+						},1300)
+					}
+				})
+			})
+		},
 		commitChange(type){
 			let that = this
 			let hasError = false
@@ -298,6 +343,13 @@ export default {
 		background: #ffffff;
 		border-radius: 20upx;
 		z-index: 1;
+		.pre-save-price{
+			font-size:36upx;
+			color:green;
+			text-align: center;
+			font-weight:bold;
+			margin-bottom:25upx;
+		}
 		.iconchenggong {
 			font-size: 120upx;
 			color: $mainColor1;