瀏覽代碼

对账单

chenrui 2 年之前
父節點
當前提交
bd2d894cc2

+ 219 - 78
pages/sales/bill.vue

@@ -5,9 +5,10 @@
 				<view class="list_l">
 					<u-icon name="clock" color="#00aaff" size="32"></u-icon>
 					<text>对账周期</text>
+					<u-icon name="question-circle-fill" @click="tipShow = true" :color="wordColor" size="32"></u-icon>
 				</view>
 				<view class="list_r u-flex">
-					<u-input v-model="brandName" @click="timeShow=true" disabled placeholder="请选择对账日期"  />
+					<u-input v-model="brandName" @click="showSearch=true" disabled placeholder="请选择对账日期"  />
 					<u-icon name="arrow-right" color="#999" size="30"></u-icon>
 				</view>
 			</view>
@@ -17,7 +18,7 @@
 					<text>客户名称</text>
 				</view>
 				<view class="list_r u-flex">
-					<u-input v-model="brandName" @click="customerShow=true" disabled placeholder="请选择客户名称"  />
+					<u-input v-model="brandName" @click="jumpPage('/pages/sales/chooseCustomerBill')" disabled placeholder="请选择客户名称"  />
 					<u-icon name="arrow-right" color="#999" size="30"></u-icon>
 				</view>
 			</view>
@@ -33,29 +34,7 @@
 			</view>
 		</view>
 		<view class="chooseCon">
-			<view class="chooseList u-flex">
-				<view class="checkbox">
-					<u-checkbox v-model="checked" :name="productSn" @change="checkChange" size="40" shape="circle"></u-checkbox>
-				</view>
-				<view class="choose_r">
-					<view class="u-flex u-row-between">
-						<view class="billInfo u-flex">
-							<text>2022-11-23</text>
-							<view>待出库</view>
-							<view>数字货架</view>
-						</view>
-						<view class="billOrder">
-							XS211230001
-						</view>
-					</view>
-					<view class="rigth_b u-flex u-row-between">
-						<view>应收:¥12.00</view>
-						<view>已收:¥12.00</view>
-						<view>待收:<text>¥12.00</text></view>
-					</view>
-				</view>
-			</view>
-			
+			<billList :showCheck="true"></billList>
 		</view>
 		<view class="footer u-flex">
 			<view class="f-left">
@@ -70,7 +49,7 @@
 					<view>
 						折让:<text>¥0.00</text>
 					</view>
-					<view class="costBtn">
+					<view class="costBtn" @click="costShow= true">
 						打折
 					</view>
 				</view>
@@ -79,14 +58,60 @@
 				<u-button size="medium" @click="submitOrder" :custom-style="customBtnStyle" shape="circle" type="primary" hover-class="none" >发送对账单</u-button>
 			</view>
 		</view>
-		<!-- 时间、客户选择弹窗 -->
-		<u-picker  mode="time" v-model="timeShow" :params="params"></u-picker>
-		<u-picker mode="selector" v-model="customerShow"  :default-selector="[0]"></u-picker>
+		<!-- 对账周期弹窗 -->
+		<u-popup v-model="showSearch" mode="right" width="70%">
+			<view class="tabBox">
+				<view class="tabs">
+					<view class="flex">
+						<view :class="item.val==curTab?'active':'all'" v-for="item in placeTab" :key="item.val" @click="tabChange(item)">{{item.name}}</view>
+					</view>
+				</view>
+				<view class="flex align_center form-item-inp" style="padding: 0 30rpx;" v-if="curTab == 6">
+					<u-input clearable v-model="dateArray" disabled placeholder="请选择时间段" @click="showDate=true" />
+					<u-icon name="arrow-down" color="#999"></u-icon>
+				</view>
+				<view class="form-footer-btn">
+					<u-button class="handle-btn" shape="circle" size="medium" hover-class="none" @click="handleClean">重置</u-button>
+					<u-button class="handle-btn" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
+				</view>
+			</view>
+		</u-popup>
+		<!-- 选择日期范围 -->
+		<u-calendar v-model="showDate" ref="rangeDate" @change="dateChange" mode="range"></u-calendar>
+		<!-- 打折弹窗 -->
+		<u-popup v-model="costShow" mode="center" :border-radius="20" closeable width="80%">
+			<view class="costPopup">
+				<view class="costPopupTit">
+					东莞市京步车证汽车服务中心
+				</view>
+				<view class="costPopupCon">
+					<view class="costList">
+						<text class="label">待收金额:</text>
+						<text>¥527.00</text>
+					</view>
+					<view class="costList u-flex">
+						<view class="label">折让金额:</view>
+						<u-input v-model="value" type="number" :border="true" :height="50"/>
+					</view>
+					<view class="costText">
+						折让后金额
+					</view>
+					<view class="costText">
+						¥500.00
+					</view>
+				</view>
+				<u-button type="primary" :custom-style="customStyle" shape="circle">确定</u-button>
+			</view>
+		</u-popup>
+		<!-- 对账周期弹窗 -->
+		<u-modal v-model="tipShow" :show-title="false" :content="tipContent" confirm-text="知道了"></u-modal>
 	</view>
 </template>
 
 <script>
+	import billList from './billListComponent.vue'
 	export default {
+		components: { billList },
 		data() {
 			return {
 				params:{//配置时间选项
@@ -97,6 +122,8 @@
 					minute: false,
 					second: false
 				},
+				checked:true,
+				brandName:'',
 				timeShow:false,
 				customerShow:false,
 				customBtnStyle: {  //  自定义按钮样式
@@ -105,18 +132,101 @@
 					color: '#fff',
 					width:'180rpx'
 				},
-				allChecked:false
+				wordColor:this.$config('infoColor'),
+				customStyle:{
+					borderColor: this.$config('primaryColor'),
+					backgroundColor: this.$config('primaryColor'),
+					color: '#fff',
+				},
+				allChecked:false,
+				tipShow:false,
+				value:'',
+				tipContent:`账单周期指销售单的创建时间`,
+				placeTab: [
+					{
+						name:'今日',
+						val: '0'
+					},
+					{
+						name:'昨日',
+						val: '1'
+					},
+					{
+						name:'本周',
+						val: '2'
+					},
+					
+					{
+						name:'上周',
+						val: '3'
+					},
+					{
+						name:'本月',
+						val: '4'
+					},
+					{
+						name:'上月',
+						val: '5'
+					},
+					{
+						name:'自定义',
+						val: '6'
+					}
+				],
+				curTab: '4',
+				showSearch:false,
+				showDate:false,
+				costShow:false
 			};
 		},
-		
 		onLoad() {
 			uni.setNavigationBarColor({
 				frontColor: '#ffffff',
 				backgroundColor: this.$config('primaryColor')
 			})
 		},
+		onNavigationBarButtonTap() {
+			// this.showSearch = true
+			uni.navigateTo({
+				url:'/pages/sales/billHistory'
+			})
+		},
+		onBackPress() {
+			if(this.showSearch){
+				this.showSearch = false
+				return true
+			}
+		},
 		methods:{
-			
+			// 时间  change
+			dateChange(date){
+				this.dateArray = date.startDate + ' ~ ' + date.endDate
+				this.queryPramas.beginDate = date.startDate + ' 00:00:00'
+				this.queryPramas.endDate = date.endDate + ' 23:59:59'
+				//#ifdef APP-PLUS
+				this.webView.setTitleNViewButtonStyle(0, {
+					"text":"\ue626 "+date.startDate.substr(5)+"至"+date.endDate.substr(5),
+					"color": "#00aaff",
+					"width": "130px"
+				});
+				//#endif
+			},
+			tabChange(data){
+				this.curTab = data.val
+				if(data.val != 6){
+					//#ifdef APP-PLUS
+					this.webView.setTitleNViewButtonStyle(0, {
+						"text":"\ue626 "+data.name,
+						"color": "#00aaff",
+						"width": "80px"
+					});
+					//#endif
+				}else{
+					this.dateArray = ''
+					this.queryPramas.beginDate = ''
+					this.queryPramas.endDate = ''
+				}
+			},
 		}
 	}
 </script>
@@ -136,15 +246,16 @@
 				border-top:1rpx solid #e4e7ed;	
 				}
 				.list_l{
-					width: 170rpx;
+					width:208rpx;
 					text{
 						font-size: 28rpx;
 						color: #666666;
 						margin-left: 10rpx;
+						margin-right: 10rpx;
 					}
 				}
 				.list_r{
-					width: calc(100% - 170rpx);
+					width: calc(100% - 208rpx);
 				}
 			}
 		}
@@ -168,50 +279,6 @@
 				flex-grow: 1;
 				overflow: auto;
 				background-color: #fff;
-				.chooseList{
-					padding:20rpx;
-					border-bottom:1rpx solid #e4e7ed;
-					&:last-child{
-						border-bottom:0rpx solid #e4e7ed;
-					}
-					.checkbox{
-						width: 74rpx;
-					}
-					.choose_r{
-						flex:1;
-						.billInfo{
-							text{
-								font-weight: 600;
-							}
-							view{
-								padding:4rpx 10rpx;
-								text-align: center;
-								border-radius: 30rpx;
-								border:1rpx solid #e4e7ed;
-								margin-left: 10rpx;
-								font-size: .7rem;
-								color: #666;
-							}
-						}
-						.billOrder{
-							font-size: .8rem;
-							color: #666;
-						}
-						.rigth_b{
-							color: #666;
-							font-size: 0.8rem;
-							margin-top: 10rpx;
-							view{
-								&:last-child{
-									color:#333;
-									text{
-										color:$uni-color-warning;
-									}
-								}
-							}
-						}
-					}
-				}
 			}
 		.footer{
 			background-color: #f8f8f8;
@@ -247,5 +314,79 @@
 				}
 			}
 		}
+		// 历史对账单弹窗
+		.tabBox{
+			height: 100vh;
+			.tabs{
+				flex-grow: 1;
+				overflow: auto;
+				padding: 20rpx;
+				> view{
+					flex-wrap: wrap;
+					justify-content: space-between;
+					> view{
+						width: 45%;
+						border: 1rpx solid #eee;
+						padding: 15rpx;
+						border-radius: 50rpx;
+						text-align: center;
+						margin-bottom: 15rpx;
+					}
+					.active{
+						border:0;
+						background-color: #0485F6;
+						color: #fff;
+					}
+				}
+			}
+			.form-item-inp{
+				border-bottom: 1rpx solid #eee;
+			}
+			.form-footer-btn{
+				margin: 30upx;
+				display: flex;
+				justify-content: space-between;
+			}
+			.form-footer-btn {
+				display: flex;
+				.handle-btn {
+					font-size: 28upx;
+					margin: 0 10upx;
+					flex: 1;
+				}
+			}
+		}
+		//打折弹窗
+		.costPopup{
+			padding:26rpx 20rpx 40rpx;
+			box-sizing: border-box;
+			.costPopupTit{
+				text-align: center;
+				font-weight: bold;
+			}
+			.costPopupCon{
+				margin-top:40rpx;
+				.costList{
+					margin-bottom:20rpx;
+					.label{
+						color: $uni-text-color-grey;
+					}
+				}
+				.costText{
+					text-align: center;
+					color: $uni-text-color-grey;
+					font-size: 22rpx;
+					margin-top:40rpx;
+					&:last-child{
+						font-weight: bold;
+						color:$uni-color-error;
+						font-size: 32rpx;
+						line-height: 60rpx;
+						margin-top:0rpx;
+						margin-bottom: 50rpx;
+					}
+				}
+			}
+		}
 	}
 </style>

+ 84 - 0
pages/sales/billHistory.vue

@@ -0,0 +1,84 @@
+<template>
+	<view class="content flex flex_column">
+		<view class="p-header" @click="jumpPage('/pages/statistics/chooseShelf')">
+			<text>{{ curCustomerName || '全部客户' }}</text>
+			<u-icon name="arrow-right"></u-icon>
+		</view>
+		<view class="p-content">
+			<view class="list" @click="jumpPage('/pages/sales/billHistoryDetail')">
+				<view class="list_t u-flex u-row-between">
+					<view class="u-line-1">东莞市寮步车正汽车服务中心东莞市寮步车正汽车服务中心</view>
+					<view>¥526.88</view>
+				</view>
+				<view class="list_b u-flex u-row-between">
+					<view>2022-11-29 14:32:32</view>
+					<view class="u-flex">
+						<view>已付款</view>
+						<u-icon name="yifukuan" custom-prefix="iscm-icon" size="40" :color="wordColor"></u-icon>
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data(){
+			return {
+				wordColor:this.$config('infoColor'),
+				curCustomerName:''
+			}
+		},
+		onLoad() {
+			
+		},
+		methods:{
+			jumpPage(url){
+				uni.navigateTo({
+					url
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+.content {
+	height: 100vh;
+	width: 100%;
+	.p-header {
+		background-color: #fff;
+		text-align: center;
+		padding-bottom: 20rpx;
+	}
+	.p-content{
+		flex-grow: 1;
+		padding:20rpx;
+		.list{
+			width: 100%;
+			background: #ffffff;
+			padding:30rpx 20rpx;
+			border-radius: 20rpx;
+			box-sizing: border-box;
+			margin-bottom: 20rpx;
+			.list_t{
+				margin-bottom: 20rpx;
+				view{
+					&:first-child{
+						width: calc(100% - 200rpx);
+					}
+					&:last-child{
+						color:$uni-color-warning;
+					}
+				}
+			}
+			.list_b{
+				color:$uni-text-color-grey;
+				font-size: $uni-font-size-sm;
+				font-weight: 500;
+			}
+		}
+	}
+}
+</style>

+ 130 - 0
pages/sales/billHistoryDetail.vue

@@ -0,0 +1,130 @@
+<template>
+	<view class="content flex flex_column">
+		<view class="b_head">
+			<view class="head_list">
+				<text>分享时间</text>
+				<text>2022-11-29 10:02:54</text>
+			</view>
+			<view class="head_list">
+				<text>客户名称</text>
+				<text>东莞市寮步车正汽车服务中心</text>
+			</view>
+			<view class="head_list">
+				<text>对账周期</text>
+				<text>2022年11月29日~2022年12月31日</text>
+			</view>
+			<view class="head_list">
+				<text>付款状态</text>
+				<text>已付款(支付宝)</text>
+			</view>
+		</view>
+		<view class="b_detail">
+			<view class="detail_list u-flex">
+				<view class="detail_box">
+					<text>总单数:</text>
+					<text>34</text>
+				</view>
+				<view class="detail_box">
+					<text>待收金额合计:</text>
+					<text>34.00</text>
+				</view>
+			</view>
+			<view class="detail_list u-flex">
+				<view class="detail_box">
+					<text>折让金额:</text>
+					<text>34</text>
+				</view>
+				<view class="detail_box">
+					<text>折让待收金额:</text>
+					<text>34.00</text>
+				</view>
+			</view>
+		</view>
+		<view class="detail_con">
+			<billList></billList>
+		</view>
+		<view class="footer">
+			<u-button type="primary" :custom-style="customStyle" shape="circle">再次发送对账单</u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import billList from './billListComponent.vue'
+export default {
+	components: { billList },
+	data() {
+		return {
+			customStyle:{
+				backgroundColor: this.$config('primaryColor'),
+				color: '#fff',
+			},
+		};
+	},
+	onReady() {
+		uni.setNavigationBarColor({
+			frontColor: '#ffffff',
+			backgroundColor: this.$config('primaryColor')
+		});
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.content {
+	height: 100vh;
+	width: 100%;
+	.b_head {
+		background-color: #fff;
+		.head_list {
+			padding:14rpx 20rpx;
+			border-bottom: 1rpx solid #f8f8f8;
+			text {
+				&:first-child {
+					color: $uni-text-color-grey;
+					display: inline-block;
+					width: 160rpx;
+				}
+			}
+		}
+	}
+	.b_detail{
+		margin:6rpx 0;
+		background-color: #fff;
+		padding:20rpx;
+		box-sizing: border-box;
+		.detail_list{
+			margin-bottom: 10rpx;
+			&:last-child{
+				margin-bottom: 0rpx;
+			}
+			.detail_box::after{
+				content:';';
+				color:$uni-text-color-grey;
+			}
+			.detail_box{
+				text{
+					&:first-child{
+						color:$uni-text-color-grey;
+					}
+					&:last-child{
+						color:$uni-color-warning;
+						font-weight: 600;
+					}
+				}
+				
+			}
+		}
+	}
+	.detail_con{
+		flex-grow: 1;
+		overflow: auto;
+		background-color: #fff;
+	}
+	.footer{
+		padding:10rpx 20rpx;
+		background:#fff;
+		margin-top:20rpx;
+	}
+}
+</style>

+ 103 - 0
pages/sales/billListComponent.vue

@@ -0,0 +1,103 @@
+<template>
+	<view class="bill-list-component">
+		<view class="chooseList u-flex" @click="jumpPage('/pages/sales/salesDetail')">
+			<view class="checkbox" v-show="showCheck"><u-checkbox v-model="checked" name="productSn" @change="checkChange" size="40" shape="circle"></u-checkbox></view>
+			<view class="choose_r">
+				<view class="u-flex u-row-between">
+					<view class="billInfo u-flex">
+						<text>2022-11-23</text>
+						<view>待出库</view>
+						<view>数字货架</view>
+					</view>
+					<view class="billOrder">XS211230001</view>
+				</view>
+				<view class="rigth_b u-flex u-row-between">
+					<view>应收:¥12.00</view>
+					<view>已收:¥12.00</view>
+					<view>
+						待收:
+						<text>¥12.00</text>
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	props: {
+		listData: {
+			type: Array,
+			default: () => {
+				return [];
+			}
+		},
+		showCheck:{
+			type: Boolean,
+			default:false
+		}
+	},
+	data() {
+		return {
+			checked:true
+		};
+	},
+	methods: {
+		jumpPage(url){
+			uni.navigateTo({
+				url
+			})
+		}
+	}
+};
+</script>
+
+<style lang="less">
+.bill-list-component {
+	.chooseList {
+		padding: 30rpx 20rpx;
+		border-bottom: 1rpx solid #e4e7ed;
+		&:last-child {
+			border-bottom: 0rpx solid #e4e7ed;
+		}
+		.checkbox {
+			width: 74rpx;
+		}
+		.choose_r {
+			flex: 1;
+			.billInfo {
+				text {
+					font-weight: 600;
+				}
+				view {
+					padding: 4rpx 10rpx;
+					text-align: center;
+					border-radius: 30rpx;
+					border: 1rpx solid #e4e7ed;
+					margin-left: 10rpx;
+					font-size: 0.7rem;
+					color: #666;
+				}
+			}
+			.billOrder {
+				font-size: 0.8rem;
+				color: #666;
+			}
+			.rigth_b {
+				color: #666;
+				font-size: 0.8rem;
+				margin-top: 20rpx;
+				view {
+					&:last-child {
+						color: #333;
+						text {
+							color: #f0ad4e;
+						}
+					}
+				}
+			}
+		}
+	}
+}
+</style>

+ 8 - 0
pages/sales/chooseCustomerBill.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

+ 1 - 1
pages/sales/listComponent.vue

@@ -250,7 +250,7 @@
 						}
 						>view{
 							&:last-child{
-								width: 150upx;
+								width: 160upx;
 								text-align: right;
 								color: #666;
 								font-size: 26upx;

+ 506 - 0
pages/sales/salesDetail.vue

@@ -0,0 +1,506 @@
+<template>
+	<view class="sales-edit-wrap flex flex_column">
+		<!-- 基础信息 -->
+		<view class="sales-info-con">
+			<u-section @click="infoModal=true" title="基础信息" sub-title="查看更多" :line-color="$config('primaryColor')"></u-section>
+			<view class="info-item-box">
+				<text class="info-item-tit color_6">销售单号</text>
+				<text>XS12454545454</text>
+			</view>
+			<view class="info-item-box">
+				<text class="info-item-tit color_6">客户名称</text>
+				<text>东莞市寮步车正汽车服务中心</text>
+			</view>
+		</view>
+		<!-- 产品列表 -->
+		<view class="sales-product-con">
+			<!-- 标题 -->
+			<view class="sales-product-header">
+				<u-tabs :show-bar="false" :active-item-style="activeItemStyle" :list="tabsList" :is-scroll="false" :current="current" @change="changeTabs"></u-tabs>
+			</view>
+			<view class="flex flex_column">
+			<!-- 合计 -->
+			<view ref="salesTotal" class="sales-total-box border-b font_13 flex justify_between">
+				<view class="sales-total-con flex_1" :style="{height: toggle ? 'auto' : '44upx'}">
+					<view>
+						总款数:<text class="sales-total-num" :style="{color: $config('warringColor')}">{{detailData && (detailData.totalCategory || detailData.totalCategory==0) ? toThousands(detailData.totalCategory) : '--'}}</text>;总数量:<text class="sales-total-num" :style="{color: $config('warringColor')}">{{detailData && (detailData.totalQty || detailData.totalQty==0) ? toThousands(detailData.totalQty) : '--'}}</text>;
+					</view>
+					<view>
+						总售价:<text class="sales-total-num" :style="{color: $config('warringColor')}">¥{{detailData && (detailData.discountAmount || detailData.discountAmount==0) ? toThousands(detailData.discountAmount, 2) : '--'}}</text>;折后总售价:<text class="sales-total-num" :style="{color: $config('warringColor')}">¥{{detailData && (detailData.discountedAmount || detailData.discountedAmount==0) ? toThousands(detailData.discountedAmount, 2) : '--'}}</text>;
+					</view>
+				</view>
+			</view>
+			<!-- 产品列表 -->
+			<view class="sales-list-box">
+				<scroll-view class="sales-list-con" :style="{height:scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
+					<view class="sales-list-item border-b flex align_center justify_between" v-for="(item, index) in listData" :key="item.id">
+						<view class="font_13 flex_1 flex justify_between">
+							<view class="pimgs">
+								<u-image :src="item.productMainImage?item.productMainImage:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+								<view v-if="item.oosFlag == 1" class="sign" :style="{backgroundColor: $config('errorColor')}">急</view>
+								<view v-if="item.price < item.cost" class="sign" :style="{backgroundColor: $config('errorColor')}">亏</view>
+								<view v-if="item.price == 0" class="sign" :style="{backgroundColor: $config('errorColor')}">赠</view>
+							</view>
+							<view class="sales-item-main flex_1">
+								<view class="sales-item-name">{{item.productName || '--'}}</view>
+								<view class="sales-item-txt">{{item.productCode || '--'}}</view>
+								<view class="sales-item-txt color_6" style="font-size: 24upx;" v-if="item.warehouseEntity&&item.warehouseEntity.name || item.warehouseLocationEntity&&item.warehouseLocationEntity.name">{{item.warehouseEntity&&item.warehouseEntity.name}} > {{item.warehouseLocationEntity&&item.warehouseLocationEntity.name}}</view>
+								<view class="sales-item-txt flex align_center justify_between">
+									<view class="sales-item-priceInfo">
+										<view :style="{color: $config('errorColor'), display: 'inline-block'}">¥<text style="font-size: 30upx;">{{toThousands(item.price||0, 2)}}</text></view>
+										<text style="display: inline-block;margin: 0 10upx;">X</text> 
+										<text style="font-size: 30upx;">{{toThousands(item.qty||0)}}</text>
+										{{item.productUnit}}
+									</view>
+									<view class="sales-item-price">¥{{toThousands(item.totalAmount||0, 2)}}</view>
+								</view>
+								<view class="sales-item-price" v-if="detailData&&detailData.discountAmount">折后:¥{{toThousands(item.discountedAmount||0, 2)}}</view>
+							</view>
+						</view>
+						<!-- <view class="btn-box" style="padding-right: 0;">
+							<u-button v-if="pageData.type=='edit'" @click="handleDel(item)" size="mini" :hair-line="false" shape="circle" plain type="error" hover-class="none">删除</u-button>
+						</view> -->
+					</view>
+					<view v-if="listData && listData.length == 0">
+						<u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" :text="noDataText" mode="list" :margin-top="50"></u-empty>
+					</view>
+					<view style="padding: 20upx;">
+						<u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
+					</view>
+				</scroll-view>
+			</view>
+			</view>
+		</view>
+		<!-- 操作按钮 -->
+		<!-- <view class="sales-btn-box" v-if="detailData&&detailData.billStatus!='FINISH'">
+			<view v-if="pageData.type=='edit'" class="flex align_center justify_between">
+				<u-button class="handle-btn" shape="circle" size="medium" hover-class="none" @click="handleDel()">整单删除</u-button>
+				<u-button class="handle-btn search-btn" shape="circle" @click="handleSubmit" size="medium" hover-class="none" :custom-style="customBtnStyle">提交</u-button>
+			</view>
+			<u-button v-if="pageData.type=='detail' && (detailData&&detailData.billStatus !== 'CANCEL' && detailData.billStatus !== 'FINISH' && detailData.billStatus != 'WAIT_OUT_WAREHOUSE')" class="edit-btn" shape="circle" @click="goPage" size="medium" hover-class="none" :custom-style="customBtnStyle">编辑</u-button>
+		</view> -->
+		<!-- 基础信息 -->
+		<orderInfoModal :openModal="infoModal" :infoData="detailData" @close="infoModal=false" />
+		<!-- 折扣 -->
+		<discountModal :openModal="discountModal" :infoData="detailData" :amount="detailData&&detailData.discountAmount" @confirm="discountConfirm" @close="discountModal=false" />
+		<!-- 删除产品/整单删除弹框 -->
+		<common-modal :openModal="commonModal" :content="modalText" @confirm="handleCommon" @cancel="handleCancel" @close="commonModal=false" />
+		<!-- 添加/编辑产品 -->
+		<productModal :openModal="openProductModal" :infoData="productInfo" @confirm="productConfirm" @close="openProductModal=false" />
+	</view>
+</template>
+
+<script>
+	import commonModal from '@/pages/common/commonModal.vue'
+	import OrderInfoModal from './orderInfoModal.vue'
+	import DiscountModal from './discountModal.vue'
+	import ProductModal from './productModal.vue'
+	import { toThousands } from '@/libs/tools'
+	import { stockByProductSn } from '@/api/stock'
+	import { salesDetailList, salesDetailDel, salesDel, salesDetailBySn, salesSubmit, salesDiscount, salesDetailUpdate } from '@/api/sales'
+	export default{
+		components: { OrderInfoModal, DiscountModal, commonModal, ProductModal },
+		data(){
+			return{
+				tabsList:[{
+					name:'产品列表'
+				},{
+					name:'收款记录'
+				}],
+				current:0,
+				activeItemStyle:{
+					color:this.$config('primaryColor'),
+					borderBottom:'4rpx solid '+this.$config('primaryColor')
+				},
+				pageData: {
+					type: 'edit',
+					data: null
+				},
+				toggle: true,
+				toThousands,
+				customBtnStyle: {  //  自定义按钮样式
+					borderColor: this.$config('primaryColor'),
+					backgroundColor: this.$config('primaryColor'),
+					color: '#fff'
+				},
+				listData: [],
+				pageNo: 1,
+				pageSize: 6,
+				totalNum: 0,
+				status: 'loadmore',
+				noDataText: '暂无数据',
+				theme: '',
+				scrollH: 916,
+				infoModal: false,
+				discountModal: false,
+				commonModal: false,
+				modalText: '确认要删除吗?',
+				detailData: null,  // 销售单详情
+				openProductModal: false,  // 编辑产品信息弹框是否显示
+				productData: null,  // 当前操作的产品信息
+				productInfo: null,  // 编辑产品需要的参数
+				editInfo: null,  // 添加/编辑 提交的值
+				commonType: 1,  // 公共弹框类型  1删除产品,2删除销售单,3编辑产品时库存不足
+			}
+		},
+		onLoad(opt) {
+			// this.theme = getApp().globalData.theme
+			// if(opt){
+			// 	this.pageData = {
+			// 		type: opt.pageType || 'edit',
+			// 		data: opt.data ? JSON.parse(opt.data) : null
+			// 	}
+			// }
+			// this.init()
+			// // 监听整改完成后刷新事件
+			// uni.$on('refreshEditBL', this.init)
+		},
+		onUnload() {
+			uni.$off('refreshEditBL')
+		},
+		methods: {
+			changeTabs(index){
+				this.current= index
+			},
+			init(){
+				this.getList(1)
+				this.getDetail()
+			},
+			// 列表
+			getList(pageNo){
+				const _this = this
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				let params = {
+					pageNo: this.pageNo,
+					pageSize: this.pageSize,
+					salesBillSn: this.pageData.data && this.pageData.data.salesBillSn
+				}
+				this.status = "loading"
+				salesDetailList(params).then(res => {
+					if (res.status == 200) {
+						if(res.data && res.data.list){
+							res.data.list.map(item => {
+								item.productName = item.productEntity && item.productEntity.name || item.dealerProductEntity && item.dealerProductEntity.name
+								item.productCode = item.productEntity && item.productEntity.code || item.dealerProductEntity && item.dealerProductEntity.code
+								item.productUnit = item.productEntity && item.productEntity.unit || item.dealerProductEntity && item.dealerProductEntity.unit
+							})
+							if(this.pageNo>1){
+								this.listData = this.listData.concat(res.data && res.data.list || [])
+							}else{
+								this.listData = res.data.list || []
+							}
+						}else{
+							this.listData = []
+						}
+						this.totalNum = res.data && res.data.count || 0
+					} else {
+						this.listData = []
+						this.totalNum = 0
+						this.noDataText = res.message
+					}
+					this.status = "loadmore"
+				})
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listData.length < this.totalNum){
+					this.pageNo += 1
+					this.getList()
+				}
+			},
+			// 折扣金额
+			discountConfirm(amount){
+				let params = {
+					discountAmount: amount,
+					salesBillSn: this.detailData.salesBillSn,
+					id: this.detailData.id
+				}
+				salesDiscount(params).then(res => {
+					if(res.status == 200){
+						this.init()
+						this.discountModal = false
+					}
+				})
+			},
+			// 提交
+			handleSubmit(){
+				salesSubmit({ id: this.detailData.id }).then(res => {
+					if(res.status == 200){
+						this.toashMsg(res.message)
+						uni.$emit('refreshSalesBL')
+						uni.navigateBack()
+					}
+				})
+			},
+			// 编辑
+			handleEdit(data){
+				this.productInfo = {
+					productName: data.productName,
+					productMainImage: data.productMainImage,
+					productCode: data.productCode,
+					productOrigCode: data.productOrigCode,
+					warehouseName: data.warehouseEntity && data.warehouseEntity.name,
+					warehouseLocationName: data.warehouseLocationEntity && data.warehouseLocationEntity.name,
+					price: data.price,
+					qty: data.qty
+				}
+				this.openProductModal = true
+				this.productData = data
+			},
+			// 确认产品信息
+			productConfirm(data){
+				this.editInfo = data
+				this.validateStock()  //验证  库存是否不足
+			},
+			// 库存不足
+			validateStock(){
+				//  校验库存
+				stockByProductSn({ productSn: this.productData.productSn }).then(res => {
+					if (res.status == 200) {
+						if (res.data && (!res.data.currentStockQty || this.editInfo.qty <= res.data.currentStockQty)) {
+							this.editProduct()
+						} else {  // 库存不足
+							this.commonType = 3
+							this.modalText = '库存不足,将产生急件,确认修改吗?'
+							this.commonModal = true
+						}
+					}
+				})
+			},
+			// 编辑产品
+			editProduct(){
+				let params = {
+					id: this.productData.id,
+					qty: this.editInfo.qty,
+					price: this.editInfo.price,
+					productSn: this.productData.productSn,
+					salesBillSn: this.detailData.salesBillSn,
+				}
+				salesDetailUpdate(params).then(res => {
+					if(res.status == 200){
+						this.toashMsg(res.message)
+						this.init()
+						this.commonModal = false
+						this.openProductModal = false
+					}
+				})
+			},
+			// 删除
+			handleDel(item){
+				if(item){  // 删除产品
+					this.commonType = 1
+					this.productData = item
+					this.modalText = '确认要删除吗?'
+					this.commonModal = true
+				}else{  // 整单删除
+					this.commonType = 2
+					this.productData = null
+					this.modalText = '确认删除该销售单吗?'
+					this.commonModal = true
+				}
+			},
+			// 公共弹框  确定
+			handleCommon(){
+				if(this.commonType == 1){  // 删除产品
+					this.delFun()
+				}else if(this.commonType == 2){  // 整单删除
+					this.delFun()
+				}else if(this.commonType == 3){  // 编辑产品时库存不足
+					this.editProduct()
+				}
+			},
+			// 公共弹框  取消
+			handleCancel(){
+				this.openProductModal = false
+			},
+			// 删除
+			delFun(){
+				let url = salesDetailDel
+				let params = {}
+				console.log(this.commonType)
+				if(this.commonType == 1){  // 删除产品
+					url = salesDetailDel
+					params = { id: this.productData.id }
+				}else if(this.commonType == 2){  // 整单删除
+					console.log('整单删除', this.detailData)
+					url = salesDel
+					params = { id: this.detailData && this.detailData.id }
+				}
+				url(params).then(res => {
+					if (res.status == 200) {
+						if(this.productData){  // 删除产品
+							this.toashMsg(res.message)
+							this.init()
+						}else{  // 整单删除
+							this.toashMsg(res.message)
+							uni.$emit('refreshSalesBL')
+							uni.navigateBack()
+						}
+						this.commonModal = false
+					} else {
+						this.commonModal = false
+					}
+				})
+			},
+			// 选择产品
+			handleProduct(){
+				uni.navigateTo({ url: '/pages/sales/chooseProduct?data='+JSON.stringify(this.detailData) })
+			},
+			// 编辑
+			goPage(){
+				uni.redirectTo({ url: '/pages/sales/edit?pageType=edit&data='+JSON.stringify(this.detailData) })
+			},
+			// 销售单详情
+			getDetail(){
+				salesDetailBySn({ salesBillSn: this.pageData.data.salesBillSn }).then(res => {
+					console.log(res.data)
+					if(res.status == 200){
+						this.detailData = res.data
+					}else{
+						this.detailData = null
+					}
+					this.toggle = false
+				})
+			},
+			changeScrollH(){
+				const _this = this
+				uni.getSystemInfo({
+					success: function (res) {
+						const winH = res.windowHeight * 2
+						let totalH = _this.$refs.salesTotal && _this.$refs.salesTotal.$el && _this.$refs.salesTotal.$el.offsetHeight || 0
+						if(_this.toggle){
+							_this.scrollH = winH - 656 - totalH
+						}else{
+							_this.scrollH = winH - 522 - totalH
+						}
+						// if(_this.detailData&&_this.detailData.billStatus=='FINISH'){
+							_this.scrollH = _this.scrollH + 100
+						// }
+					}
+				})
+			}
+		},
+		watch: {
+			toggle (newValue, oldValue) {
+				this.changeScrollH()
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.sales-edit-wrap{
+		width: 100%;
+		.color_6{
+			color: #666;
+		}
+		.font_13{
+			font-size: 26upx;
+		}
+		.border-b{
+			border-bottom: 1px solid #e4e7ed;
+		}
+		.sales-info-con{
+			background-color: #fff;
+			margin-bottom: 6upx;
+			>view{
+				padding: 14upx 20rpx;
+				border-bottom: 1px solid #e4e7ed;
+			}
+			>view:last-child{
+				border-bottom: none;
+			}
+			.info-item-box{
+				.info-item-tit{
+					display: inline-block;
+					width: 20%;
+				}
+			}
+		}
+		.sales-product-con{
+			background-color: #fff;
+			.sales-product-header{
+				/deep/.u-tab-item{
+					border-bottom:1rpx solid #e4e7ed;
+				}
+			}
+			.sales-total-box{
+				align-items: flex-end;
+				padding: 16upx 20rpx;
+				.sales-total-con{
+					color: #666;
+					overflow: hidden;
+					view{
+						padding: 4upx 0;
+						.sales-total-num{
+							font-size: 24upx;
+							color: rgb(48, 49, 51);
+						}
+					}
+				}
+				.sales-total-btn{
+					display: inline-block;
+					margin-bottom: 6upx;
+				}
+			}
+			.sales-list-box{
+				flex-grow: 1;
+				.sales-list-con{
+					.sales-list-item{
+						padding: 20upx 0;
+						.pimgs{
+							margin-right: 20upx;
+							position: relative;
+							.sign{
+								position: absolute;
+								right: -2upx;
+								top: -2upx;
+								color: #fff;
+								border-radius: 50%;
+								width: 40upx;
+								height: 40upx;
+								text-align: center;
+							}
+						}
+						.sales-item-main{
+							.sales-item-name{
+								font-size: 28upx;
+								color: rgb(48, 49, 51);
+								font-weight: bold;
+								overflow: hidden;
+								text-overflow: ellipsis;
+								display: -webkit-box;
+								-webkit-box-orient: vertical;
+								-webkit-line-clamp: 1;
+							}
+							.sales-item-txt{
+								margin: 8upx 0;
+							}
+							.sales-item-price{
+								text-align: right;
+							}
+						}
+						.btn-box{
+							padding: 30upx 30upx;
+						}
+					}
+					.sales-list-item:last-child{
+						border: none;
+					}
+				}
+			}
+		}
+		.sales-btn-box{
+			background-color: #fff;
+			padding: 12upx 50upx;
+			.handle-btn{
+				width: 47%;
+			}
+			.edit-btn{
+				width: 100%;
+			}
+		}
+	}
+</style>