Browse Source

采购优化

shish 3 years ago
parent
commit
b9eae917a1

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

@@ -1,5 +1,9 @@
 import https from "@/plugins/luch-request_0.0.7/request";
 
+export const getCgItemList = data => {
+	return https.get("/purchase-order-item/get-item-list", data);
+};
+
 export const cancelPutIn = data => {
 	return https.get("/purchase-order/cancel", data);
 };

+ 28 - 21
ghsApp/src/pagesPurchase/components/pageSuccess.vue

@@ -21,8 +21,8 @@
 								<view class="product-area">
 									<view class="first-area">
 										<text class="name">{{res.name}}</text>
-										<text class="cost">¥{{costList[res.id]?parseFloat(costList[res.id]):0}}</text>
-										<text class="cgPrice">¥{{res.cost?parseFloat(res.cost):0}}</text>
+										<text class="cg-cost">¥{{cgPriceList[res.id]?parseFloat(cgPriceList[res.id]):0}}</text>
+										<text class="cost-price">¥{{res.cost?parseFloat(res.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>
@@ -40,28 +40,25 @@
 	</view>
 </template>
 <script>
-import { getAllProductDataApi,batchChangePrice } from "@/api/product/index";
+import { getAllProductDataApi,batchChangePrice } from "@/api/product";
+import { getCgItemList } from "@/api/purchase";
 export default {
     name: "pageSuccess",
 	data() {
 		return {
-			flowersItemInfo:'',
+			cgItemList:[],
 			flowersList:[],
 			productList:[],
-			costList:[],
+			cgPriceList:[],
 			status:0
 		};
 	},
 	onShow(){
-  		this.flowersItemInfo  = uni.getStorageSync('flowersItemInfo');
 		this.getList();
 	},
 	onLoad(){
 		this.status = this.option.status ? Number(this.option.status) : 0
 	},
-	onUnload(){
-		uni.removeStorageSync('flowersItemInfo');
-	},
 	methods: {
 		priceFocus(i,res){
 			this.flowersList[i].autoPrice = ''
@@ -86,17 +83,27 @@ export default {
 		getList(){
 			let productIdArr = '';
 			let that = this
-			this.flowersItemInfo.forEach((ele)=>{
-				productIdArr += ele.productId+','
-				this.costList[ele.productId] = ele.itemPrice
+			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.cgPriceList[ele.productId] = ele.bigPrice
+						})
+
+						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})
+							})
+						});
+
+					}
+				}
 			})
-			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})
-				})
-			});
 		},
 		modifyPrice(i,res){
 			let id = res.id
@@ -174,7 +181,7 @@ export default {
 			font-weight:bold;
 			font-size:28upx;
 		}
-		.cost{
+		.cg-cost{
 			font-weight:bold;
 			font-size:28upx;
 			color:red;
@@ -182,7 +189,7 @@ export default {
 			left:505upx;
 			top:5upx;
 		}
-		.cgPrice{
+		.cost-price{
 			font-weight:bold;
 			font-size:28upx;
 			color:blue;

+ 0 - 1
ghsApp/src/pagesPurchase/details.vue

@@ -363,7 +363,6 @@ export default {
 			createPurchaseOrderApi(params).then(res=>{
 				uni.hideLoading()
 				if(res.code == 1 && res.data.orderSn){
-					uni.setStorageSync('flowersItemInfo', itemInfo)
 					that.removeFromSaveDirect()
 					that.$util.pageTo({url: "/pagesPurchase/components/pageSuccess?orderSn="+res.data.orderSn+"&id="+res.data.id+"&status="+res.data.status,type:2})
 				}

+ 0 - 13
ghsApp/src/pagesPurchase/info.vue

@@ -309,19 +309,6 @@ export default {
 			}
 			const { data } = await getPurchaseDetailApi(orderSn);
 			this.detailInfo = data;
-			if (this.detailInfo.itemInfo && !this.$util.isEmpty(this.detailInfo.itemInfo)){
-				const itemInfo = this.detailInfo.itemInfo.map(ele => {
-					return {
-						classId: 0,
-						productId: ele.productId,
-						bigNum: ele.itemNum,
-						smallNum: 0,
-						itemId:ele.itemId,
-						itemPrice: ele.cost
-					}
-				})
-				uni.setStorageSync('flowersItemInfo', itemInfo)
-			}
 		}
 	}
 };

+ 4 - 0
ghsApp/src/pagesPurchase/order.vue

@@ -73,6 +73,10 @@ export default {
 		uni.stopPullDownRefresh();
 		}
 	},
+	onShow(){
+		this.resetList()
+		this.getCgList()
+	},
 	methods: {
 		async init() {
 			this.getCgList();