Jelajahi Sumber

确认收货

shish 2 tahun lalu
induk
melakukan
4b1802f631

+ 335 - 0
hdApp/src/pagesPurchase/confirmTake.vue

@@ -0,0 +1,335 @@
+<template>
+	<view class="app-content">
+		<view class="billing_box_bg">
+			<view class="top-view"> </view>
+			<view class="result-view">
+				<view class="result-title">请确认售价并入库</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>
+						<view class="flex title" v-else> 确认售价: </view>
+						<view class="flex title">
+							<text style="font-size:22upx;font-weight:normal;color:green;">花材名称 / 进货价 / 旧批发价 / 入库数 </text>
+						</view>
+
+						<view v-for="(res,i) in flowersList" :key="i">
+							<view class="product-area">
+								<view class="first-area">
+									<view style="margin-bottom:6upx;">
+										<text class="name" @click="pageTo({url:'/admin/item/detail?id='+ res.productId})">
+											{{res.name?res.name.substr(0,11):''}}
+											<text style="color:red;margin-left:20upx;font-weight:normal;">¥{{res.xhUnitPrice?parseFloat(res.xhUnitPrice):0}}</text>
+											<text style="color:#CCCCCC;margin-left:20upx;font-weight:normal;">旧¥{{res.beforeModifyPrice?parseFloat(res.beforeModifyPrice):0}}</text>
+											<text style="color:#CCCCCC;margin-left:20upx;font-weight:normal;">{{res.xhNum?parseFloat(res.xhNum):0}}{{res.xhPreUnitName}}</text>
+											<text style="color:green;margin-left:20upx;font-weight:normal;">...</text>
+										</text>
+									</view>
+									<view>
+										<input type="digit" v-model="res.suggestHjPrice" @focus="clearHjPrice(i)" placeholder="大客价" />
+										<input type="digit" v-model="res.suggestPrice" @focus="clearPrice(i)" @input="linkChange(i)" placeholder="批发价" style="border:1upx solid #3385FF;color:#3385FF;" />
+										<input type="digit" v-model="res.suggestSkPrice" @focus="clearSkPrice(i)" placeholder="零售价" />
+									</view>
+								</view>
+							</view>
+						</view>
+
+					</view>
+					<template v-if="!$util.isEmpty(info)">
+						<button v-if="info.status == 3 || info.status == 2" class="admin-button-com big blue" style="width:55vw;margin-top:50upx;" @click="commitChange(0)">改价并入库</button>
+						<button v-if="info.status == 3 || info.status == 2" class="admin-button-com big blue" style="width:55vw;margin-top:50upx;background-color: red;border:1upx solid red;" @click="commitChange(1)">仅入库不改价</button>
+						<button v-if="info.status == 4" class="admin-button-com big blue" style="width:55vw;margin-top:50upx;" @click="commitChange(2)">确认改价</button>
+						<button v-if="info.status == 3 || info.status == 2" 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>
+
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+import { getAllProductDataApi,batchChangePrice } from "@/api/product";
+import { getCgItemInfo,getDetail,confirmPutIn,saveCgPrice } from "@/api/purchase";
+export default {
+    name: "pageSuccess",
+	data() {
+		return {
+			flowersList:[],
+			info:{}
+		};
+	},
+	methods: {
+		linkChange(i){
+			if(this.flowersList[i].suggestPrice && Number(this.flowersList[i].suggestPrice)>0){
+				let skMore = this.flowersList[i].skMore ? Number(this.flowersList[i].skMore) : 0
+				let hjAddPrice = this.flowersList[i].hjAddPrice ? Number(this.flowersList[i].hjAddPrice) : 0
+				let addPrice = this.flowersList[i].addPrice ? Number(this.flowersList[i].addPrice) : 0
+
+				let skAddNum = Number(skMore) - Number(addPrice)
+				skAddNum = skAddNum.toFixed(2)
+				let skAmount = Number(skAddNum) + Number(this.flowersList[i].suggestPrice)
+				if(skAmount>0){
+					skAmount = skAmount.toFixed(2)
+					skAmount = parseFloat(skAmount)
+					this.flowersList[i].suggestSkPrice = skAmount
+				}else{
+					this.flowersList[i].suggestSkPrice = ''
+				}
+
+				let hjSubNum = Number(addPrice) - Number(hjAddPrice)
+				hjSubNum = hjSubNum.toFixed(2)
+				let hjAmount = Number(this.flowersList[i].suggestPrice) - Number(hjSubNum)
+				if(hjAmount > 0){
+					hjAmount = hjAmount.toFixed(2)
+					hjAmount = parseFloat(hjAmount)
+					this.flowersList[i].suggestHjPrice = hjAmount
+				}else{
+					this.flowersList[i].suggestHjPrice = ''	
+				}
+			}else{
+				this.flowersList[i].suggestSkPrice = ''
+				this.flowersList[i].suggestHjPrice = ''
+			}
+		},
+		clearPrice(i){
+			this.flowersList[i].suggestPrice =''
+			this.$forceUpdate()
+		},
+		clearSkPrice(i){
+			this.flowersList[i].suggestSkPrice =''
+			this.$forceUpdate()
+		},
+		clearHjPrice(i){
+			this.flowersList[i].suggestHjPrice =''
+			this.$forceUpdate()
+		},
+		init(){
+			let that = this
+			let id = this.option.id ? this.option.id : ''
+			getDetail({id:id}).then(res=>{
+				if(res.code == 1){
+					that.info = res.data
+				}
+			})
+			this.getItemList()
+		},
+		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(doType){
+			let that = this
+      if(doType != 1){
+        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 = '确认提交?'
+			if(doType == 1){
+				hint = '确认仅入库不改价?'
+			}
+			if(doType == 2){
+				hint = '确认修改价格?'
+			}
+			this.$util.confirmModal({content:hint},() => {
+				that.commitModify(doType)
+			})
+		},
+		commitModify(doType){
+			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,hjPrice:ele.suggestHjPrice}
+			})
+			uni.showLoading({mask:true})
+			batchChangePrice({data:JSON.stringify(newProduct),changeType:'cg',targetId:targetId,doType:doType}).then(res => {
+				uni.hideLoading()
+				if(res.code == 1){
+					that.$msg(res.msg)
+					setTimeout(function(){
+						uni.navigateBack()
+					},1300)
+				}
+			})
+		},
+		goBackFn() {
+			uni.navigateBack({})
+		}
+	}
+};
+</script>
+<style lang="scss" scoped>
+.go-back{
+	width: 80%;
+	height: 80upx;
+	color: #FFFFFF;
+	margin-top: 50upx;
+	background: #3385FF;
+	border-radius: 10upx;
+	font-size:30upx;
+}
+.title{
+	font-weight:700;
+	margin-bottom:30upx;
+	font-size:30upx;
+}
+.product-area{
+	width:700upx;
+	height:115upx;
+	display:flex;
+	align-items:center;
+	.first-area{
+		border-bottom:1upx solid #e4e2e2;
+		position:relative;
+		.name{
+			overflow: hidden;
+			white-space: nowrap;
+			display:inline-block;
+			font-weight:bold;
+			font-size:28upx;
+		}
+		.cg-cost{
+			font-weight:bold;
+			font-size:27upx;
+			color:red;
+			position:absolute;
+			left:450upx;
+			top:-10upx;
+		}
+		.cost-price{
+			font-weight:bold;
+			font-size:27upx;
+			color:blue;
+			position:absolute;
+			left:515upx;
+			top:-10upx;
+		}
+		input{
+			border:1upx solid #cccccc;
+			display:inline-block;
+			width:135upx;
+			margin-left:10upx;
+			margin-right:30upx;
+			text-align:center;
+			font-size:30upx;
+		}
+	}
+	.second-area{
+		float:left;
+		color:#646464;
+		margin-top:10upx;
+		.one{
+			color:red;
+		}
+		.two{
+			color:#CCCCCC;
+		}
+	}
+}
+.billing_box_bg {
+	position: relative;
+	padding: 60upx 30upx;
+	display: flex;
+	background: white;
+	flex-direction: column;
+    background-color: #f5f5f5;
+	.top-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		width: 100%;
+		height: 299upx;
+		background: #3385ff;
+		border-radius: 0upx 0upx 83upx 83upx;
+	}
+	.result-view {
+		position: relative;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		padding: 50upx 70upx 70upx 70upx;
+		width: 100%;
+		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;
+		}
+		.result-title {
+			margin: 20upx 0 30upx;
+			font-size: 32upx;
+		}
+	}
+}
+</style>

+ 23 - 6
hdApp/src/pagesPurchase/purDetails.vue

@@ -265,17 +265,19 @@
 
     </view>
     <view class="app-footer open_btn">
+      <button class="admin-button-com blue big" open-type="share" v-if="detailInfo.status!=5 && detailInfo.payStatus != 1" 
+      style="margin-right:50upx;padding-left:50upx;padding-right:50upx;">邀请付款</button>
 
-      <button class="admin-button-com blue big" open-type="share" v-if="detailInfo.status!=5 && detailInfo.payStatus != 1"
-      style="margin-right:80upx;padding-left:50upx;padding-right:50upx;">邀请付款</button>
+      <button class="admin-button-com blue big" v-if="detailInfo.status== 3 || detailInfo.status== 2" @click="confirmTake()" style="margin-right:50upx;padding-left:50upx;padding-right:50upx;">确认收货</button>
+      <button class="admin-button-com blue big" v-if="detailInfo.status== 4" @click="confirmTake()" style="margin-right:50upx;padding-left:50upx;padding-right:50upx;">修改价格</button>
 
       <block v-if="detailInfo.status == 1">
         <button class="admin-button-com blue big" @click="toPay">去付款</button>
       </block>
       <block v-else>
-      <block v-if="afterSale == 1">
-        <button class="admin-button-com default big" style="margin-right:60upx;" @click="refundOrder" v-if="detailInfo.payStatus == 1">申请售后</button>
-      </block>
+        <block v-if="afterSale == 1">
+          <button class="admin-button-com default big" style="margin-right:60upx;" @click="refundOrder" v-if="detailInfo.status == 4">申请售后</button>
+        </block>
         <button class="admin-button-com blue big" @click="clearOrder" v-if="detailInfo.debt == 1">付款结清</button>
       </block>
 
@@ -284,7 +286,7 @@
 </template>
 <script>
 import { mapGetters } from "vuex";
-import { purchaseDetail, purchaseDebtPay,purchaseClearCreateOrder } from "@/api/purchase";
+import { purchaseDetail, purchaseDebtPay,purchaseClearCreateOrder,confirmTake } from "@/api/purchase";
 import TuiListCell from "@/components/plugin/list-cell";
 import { getGhsDataApi } from "@/api/ghs";
 export default {
@@ -362,6 +364,21 @@ export default {
     this.beginInit()
   },
   methods: {
+    confirmTake(){
+      if(this.loginInfo.pfShopId && Number(this.loginInfo.pfShopId)>0){
+        //有开批发店
+        this.pageTo({url: '/pagesPurchase/confirmTake?id='+this.detailInfo.id})
+      }else{
+        //没有开批发店
+        this.$util.confirmModal({content:'确认已收货?'},() => {
+          confirmTake({id:this.detailInfo.id}).then(res=>{
+            if(res.code == 1){
+
+            }
+          })
+        })
+      }
+    },
 		copyWl(val){
 			const self = this;
 			uni.setClipboardData({