Browse Source

采购之后改价

shish 3 years ago
parent
commit
35e8dc31a1

+ 1 - 1
ghsApp/src/admin/home/workbench.vue

@@ -190,8 +190,8 @@ export default {
 				{ name: "改价", img: 'ghs/home/gj.png', url: "/admin/changePrice/list" },
 				{ name: "花材", img: 'ghs/home/hcgl.png', url: "/admin/item/list" },
 				{ name: "采购", img: 'ghs/home/icon_caigou.png', url: "/pagesPurchase/order" },
+				{ name: "供货商", img: 'ghs/home/icon_ghs.png', url: "/pagesPurchase/supplier" },
 				{ name: "损耗", img: 'ghs/home/kcyjs.png', url: "/admin/breakage/list" },
-				{ name: "预售", img: 'ghs/home/kcyjs.png', url: "/admin/order/statBook" },
 				{ name: "调拨入库", img: 'ghs/home/dbrk.png', url: "/pagesStorehouse/allot/allotPut" },
 				{ name: "调拨出库", img: 'ghs/home/dbck.png', url: "/pagesStorehouse/allot/allotEx" },
 				{name : "结账记录", img : "ghs/home/kcyjs.png", url : "/admin/clear/customList"},

+ 1 - 1
ghsApp/src/api/purchase/index.js

@@ -23,7 +23,7 @@ export const printItem = data => {
 /** *
  * 采购订单详情
  */
-export const getPurchaseDetailApi = async orderSn => {
+export const getPurchaseDetailApi = orderSn => {
 	return https.get("/purchase-order/detail", { orderSn });
 };
 

+ 46 - 15
ghsApp/src/pagesPurchase/components/pageSuccess.vue

@@ -8,13 +8,10 @@
 
 				<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">
-							确认销售价:
-						</view>
-						<view class="flex title">
-							<text style="font-size:30upx;font-weight:bold;color:red;">
-								红色进货价,<text style="color:blue;">蓝色成本价</text>
-							</text>
+							<text style="font-size:30upx;font-weight:normal;"> 红色进货价,蓝色成本价 </text>
 						</view>
 						<checkbox-group @change="checkboxChange">
 							<view v-for="(res,i) in flowersList" :key="i">
@@ -30,10 +27,14 @@
 							</view>
 						</checkbox-group>
 					</view>
-					<button class="admin-button-com big blue" style="width:40vh;margin-top:50upx;" @click="commitChange">确认修改</button>
+					<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">确认入库</button>
+						<button v-if="info.status != 3" class="admin-button-com big blue" style="width:55vw;margin-top:50upx;" @click="commitChange">确认改价</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:40vh;margin-top:30upx;" @click="goBackFn">返回</button>
+				<button class="admin-button-com big default" style="width:55vw;margin-top:30upx;" @click="goBackFn">返回</button>
 
 			</view>
 		</view>
@@ -41,7 +42,7 @@
 </template>
 <script>
 import { getAllProductDataApi,batchChangePrice } from "@/api/product";
-import { getCgItemList } from "@/api/purchase";
+import { getCgItemList,getPurchaseDetailApi } from "@/api/purchase";
 export default {
     name: "pageSuccess",
 	data() {
@@ -50,7 +51,8 @@ export default {
 			flowersList:[],
 			productList:[],
 			itemPriceList:[],
-			status:0
+			status:0,
+			info:{}
 		};
 	},
 	onShow(){
@@ -58,6 +60,14 @@ export default {
 	},
 	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=>{
+			if(res.code == 1){
+				that.info = res.data
+			}
+		})
 	},
 	methods: {
 		priceFocus(i,res){
@@ -97,7 +107,7 @@ export default {
 							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})
+								that.productList.push({id:item.id,price:parseFloat(item.autoPrice),skPrice:parseFloat(item.autoSkPrice),skMore:item.skMore,name:item.name})
 							})
 						});
 
@@ -109,12 +119,13 @@ export default {
 			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}
+					return {id:id,price:price,skPrice:skPrice,skMore:skMore,name:name}
 				}
 				return ele
 			})
@@ -125,9 +136,10 @@ export default {
 			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}
+					return {id:id,price:price,skPrice:skPrice,skMore:skMore,name:name}
 				}
 				return ele
 			})
@@ -135,7 +147,26 @@ export default {
 		},
 		commitChange(){
 			let that = this
-			this.$util.confirmModal({content:'确认修改?'},() => {
+			let hasError = false
+			let errorHint = ''
+			this.productList.forEach(function(item){
+				if(that.$util.isMoney(item.price) == false){
+					let name = item.name
+					errorHint = '请填写'+name+'的花店价'
+					hasError = true
+				}
+				if(that.$util.isMoney(item.skPrice) == false){
+					let name = item.name
+					errorHint = '请填写'+name+'的个人价'
+					hasError = true
+				}
+			})
+			if(hasError){
+				this.$msg(errorHint)
+				return false
+			}
+
+			this.$util.confirmModal({content:'确认提交?'},() => {
 				that.commitModify()
 			})
 		},
@@ -144,7 +175,7 @@ export default {
 			let targetId = this.option.id ||0
 			batchChangePrice({data:JSON.stringify(this.productList),changeType:'cg',targetId:targetId}).then(res => {
 				if(res.code == 1){
-					that.$msg('修改成功')
+					that.$msg(res.msg)
 				}
 			})
 		},

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

@@ -126,8 +126,7 @@
 					¥ <text class="large">{{ modifyPrice }}</text>
 				</text>
 			</view>
-			<button class="admin-button-com blue big" @click="formSubmit(0)">保存草稿</button>
-			<button class="admin-button-com blue big" @click="formSubmit(1)">提交入库</button>
+			<button class="admin-button-com blue big" @click="formSubmit(0)">保存采购</button>
 		</view>
 	</view>
 </view>
@@ -331,7 +330,7 @@ export default {
 			let that = this;
 			let title = '确认直接入库?'
 			if(inType == 0){
-				title = '确认稍后入库?'
+				title = '确认保存采购?'
 			}
 			that.$util.confirmModal({content:title},() => {
 				that.confirmFn(inType);

+ 3 - 3
ghsApp/src/pagesPurchase/info.vue

@@ -197,9 +197,9 @@
 		</view>
 
 		<view class="app-footer open_btn">
-			<view @click="changePrice()" class="admin-button-com big blue">修改价格</view>
+			<view v-if="detailInfo.status != 3" @click="changePrice()" class="admin-button-com big blue">修改价格</view>
 			<view v-if="detailInfo.status == 3" @click="cancelIn()" class="admin-button-com big blue">取消入库</view>
-			<view v-if="detailInfo.status == 3" @click="confirmIn()" class="admin-button-com big blue">确认入库</view>
+			<view v-if="detailInfo.status == 3" @click="changePrice()" class="admin-button-com big blue">提交入库</view>
 		</view>
 
 	</view>
@@ -237,7 +237,7 @@ export default {
 		},
 		cancelIn(){
 			let that = this
-			that.$util.confirmModal({content:'确认取消此单?'},() => {
+			that.$util.confirmModal({content:'确认取消入库?'},() => {
 				uni.showLoading({mask:true})
 				cancelPutIn({id:that.detailInfo.id}).then(res=>{
 					uni.hideLoading()

+ 3 - 3
ghsApp/src/pagesPurchase/order.vue

@@ -13,7 +13,7 @@
 			</block>
 		</view>
 		<view class="app-footer open_btn">
-			<view @click="getGhsList" class="admin-button-com big blue" style="margin-right:90upx;">供货商列表</view>
+			<view @click="addGhs" class="admin-button-com big blue" style="margin-right:90upx;">新增供货商</view>
 			<view @click="addEvent" class="admin-button-com big blue">新增采购</view>
 		</view>
 	</view>
@@ -82,8 +82,8 @@ export default {
 		this.getCgList()
 	},
 	methods: {
-		getGhsList(){
-			this.$util.pageTo({ url: '/pagesPurchase/supplier',type: 2 })
+		addGhs(){
+			this.pageTo({url:'/pagesPurchase/suppAdd'})
 		},
 		getCgList() {
 			let ghsId = this.option.ghsId || 0

+ 0 - 6
ghsApp/src/pagesPurchase/supplier.vue

@@ -41,9 +41,6 @@
         </block>
       </block>
     </view>
-			<div class="app-footer">
-				<div class="admin-button-com big blue add-ghs" @click="add">新增供货商</div>
-			</div>
   </view>
 </view>
 </template>
@@ -93,9 +90,6 @@ export default {
 		},
     goToCg (item) {
       this.pageTo({url: '/pagesPurchase/add?ghsId='+item.id+'&ghsName='+item.name})
-    },
-    add() {
-      this.pageTo({url:'/pagesPurchase/suppAdd'})
     }
   }
 }