Przeglądaj źródła

产品报价修改

zhangdan 3 lat temu
rodzic
commit
bac3ac73ef
2 zmienionych plików z 68 dodań i 78 usunięć
  1. 30 57
      pages/sales/productPricing.vue
  2. 38 21
      pages/sales/search.vue

+ 30 - 57
pages/sales/productPricing.vue

@@ -1,13 +1,13 @@
 <template>
 <template>
 	<view class="productPricing-content">
 	<view class="productPricing-content">
-		<u-navbar leftText="返回" title="产品报价" :safeAreaInsetTop="false" :border-bottom="false" @leftClick="toPage('/pages/sales/index')">
-			<view class="u-nav-slot" slot="right" style="padding-right: 20rpx;">
-				<u-icon name="search" color="#999" size="28" @click="search"></u-icon>查询
+		<u-navbar  title="产品报价" :safeAreaInsetTop="false" :border-bottom="false" @leftClick="toPage('/pages/sales/index')">
+			<view class="u-nav-slot" slot="right" style="padding-right: 40rpx;" @click="showModal=true">
+				<u-icon name="search" color="#999" size="28"></u-icon>查询
 			</view>
 			</view>
 		</u-navbar>
 		</u-navbar>
 		<view class="checkbox-price">
 		<view class="checkbox-price">
-			<u-checkbox-group  placement="row"  @change="checkboxChange">
-				<u-checkbox v-model="item.checked" activeColor="rgb(4, 133, 246)" v-for="(item,index) in priceList" :key="index" :name="item.name" :label="item.name">{{item.name}}</u-checkbox>
+			<u-checkbox-group  placement="row">
+				<u-checkbox v-model="item.checked" activeColor="rgb(4, 133, 246)" v-for="(item,index) in priceList" :key="index" :name="item.val">{{item.name}}</u-checkbox>
 			</u-checkbox-group>
 			</u-checkbox-group>
 		</view>
 		</view>
 		<scroll-view class="product-list" scroll-y @scrolltolower="onreachBottom">
 		<scroll-view class="product-list" scroll-y @scrolltolower="onreachBottom">
@@ -34,31 +34,32 @@
 						</view>
 						</view>
 					</view>
 					</view>
 					<view class="price-all flex">
 					<view class="price-all flex">
-						<view class="price-item" v-if="isCostPrice">
+						<view class="price-item" v-if="priceList[0].checked">
 							<text>{{toThousands(item.offerCost|| 0,2)}} </text>
 							<text>{{toThousands(item.offerCost|| 0,2)}} </text>
 							<view>成本价</view>
 							<view>成本价</view>
 						</view>
 						</view>
-						<view class="price-item" v-if="isCityPrice">
+						<view class="price-item" v-if="priceList[1].checked">
 							<text>{{toThousands(item.cityPrice|| 0,2)}} </text>
 							<text>{{toThousands(item.cityPrice|| 0,2)}} </text>
 							<view>市级价</view>
 							<view>市级价</view>
 						</view>
 						</view>
-						<view class="price-item" v-if="isSpecialPrice">
+						<view class="price-item" v-if="priceList[2].checked">
 							<text>{{toThousands(item.specialPrice|| 0,2)}} </text>
 							<text>{{toThousands(item.specialPrice|| 0,2)}} </text>
 							<view>特约价</view>
 							<view>特约价</view>
 						</view>
 						</view>
-						<view class="price-item" v-if="isTerminalPrice">
+						<view class="price-item" v-if="priceList[3].checked">
 							<text>{{toThousands(item.terminalPrice|| 0,2)}} </text>
 							<text>{{toThousands(item.terminalPrice|| 0,2)}} </text>
 							<view>终端会员价</view>
 							<view>终端会员价</view>
 						</view>
 						</view>
 					</view>
 					</view>
 				</view>
 				</view>
-				<view v-if="listData && listData.length == 0">
-					<u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
+					<u-empty v-if="listData.length == 0 &&status!='loading'" :text="noDataText" mode="list" ></u-empty>
+					<view style="padding-bottom: 20upx;">
+					<u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
 				</view>
 				</view>
 			</view>
 			</view>
 		</scroll-view>
 		</scroll-view>
 		<!-- 搜索弹窗 -->
 		<!-- 搜索弹窗 -->
-		<search :showModal="showModal"/>
+		<search :showModal="showModal" @refresh="refreshList" @close="showModal=false"/>
 	</view>
 	</view>
 </template>
 </template>
 
 
@@ -73,22 +74,23 @@
 				toThousands,
 				toThousands,
 				listData:[],
 				listData:[],
 				totalNum:0,
 				totalNum:0,
-				priceList:[{name:'成本价',checked:false},{name:'市级价',checked:false},{name:'特约价',checked:false},{name:'终端会员价',checked:false}],
+				priceList:[
+					{ name: '成本价', checked: false, val: 'offerCost' },
+					{ name: '市级价', checked: false, val: 'cityPrice' },
+					{ name: '特约价', checked: false, val: 'specialPrice' },
+					{ name: '终端会员价', checked: false, val: 'terminalPrice' },
+				],
 				pageNo:1,
 				pageNo:1,
-				pageSize:10,
+				pageSize:6,
 				noDataText: '暂无数据',
 				noDataText: '暂无数据',
 				theme: '',
 				theme: '',
-				isCostPrice: false,
-				isCityPrice: false,
-				isSpecialPrice: false,
-				isTerminalPrice: false,
+				status: 'loadmore',
 				showModal:false,
 				showModal:false,
 				params:{}
 				params:{}
 			}
 			}
 		},
 		},
 		onLoad(option) {
 		onLoad(option) {
 			this.theme = getApp().globalData.theme
 			this.theme = getApp().globalData.theme
-			this.params = option.data ? JSON.parse(option.data) : {}
 			this.getList()
 			this.getList()
 		},
 		},
 		methods:{
 		methods:{
@@ -97,44 +99,13 @@
 					url:url
 					url:url
 				})
 				})
 			},
 			},
-			// 搜索
-			search(){
-				this.showModal=true
-				console.log('点击的时间里看电视剧')
-			},
-			// 价格显示
-			checkboxChange(val){
-				if(val&&val.length>0){
-					const a= val.filter(item=>{return item=='成本价'})
-					const b= val.filter(item=>{return item=='市级价'})
-					const c= val.filter(item=>{return item=='特约价'})
-					const d= val.filter(item=>{return item=='终端会员价'})
-					if(a&&a.length>0){
-						this.isCostPrice=true
-					}else{
-						this.isCostPrice=false
-					}
-					if(b&&b.length>0){
-						this.isCityPrice=true
-					}else{
-						this.isCityPrice=false
-					}
-					if(c&&c.length>0){
-						this.isSpecialPrice=true
-					}else{
-						this.isSpecialPrice=false
-					}
-					if(d&&d.length>0){
-						this.isTerminalPrice=true
-					}else{
-						this.isTerminalPrice=false
-					}
-				}else{
-					this.isCostPrice=false
-					this.isCityPrice=false
-					this.isSpecialPrice=false
-					this.isTerminalPrice=false
-				}
+			// 刷新列表
+			refreshList(val){
+				this.params =val ? val : {},
+				this.$nextTick(function(){
+					this.getList(1)
+				})
+				
 			},
 			},
 			// 列表
 			// 列表
 			getList(pageNo){
 			getList(pageNo){
@@ -143,6 +114,7 @@
 					this.pageNo = pageNo
 					this.pageNo = pageNo
 				}
 				}
 				let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
 				let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
+				this.status = "loading"
 				dealerProductList(params).then(res => {
 				dealerProductList(params).then(res => {
 					if (res.status == 200) {
 					if (res.status == 200) {
 						if(this.pageNo>1){
 						if(this.pageNo>1){
@@ -156,6 +128,7 @@
 						this.totalNum = 0
 						this.totalNum = 0
 						this.noDataText = res.message
 						this.noDataText = res.message
 					}
 					}
+					this.status = "loadmore"
 				})
 				})
 			},
 			},
 			// scroll-view到底部加载更多
 			// scroll-view到底部加载更多

+ 38 - 21
pages/sales/search.vue

@@ -1,7 +1,8 @@
 <template>
 <template>
 	<view class="modal-box">
 	<view class="modal-box">
-		<u-popup v-model="isShow" :customStyle="customStyle" @close="isShow=false" mode="right" >
-			<u-form :model="form" ref="uForm" label-width="180">
+		<u-popup v-model="isShow"  @close="isShow=false" mode="right" length="85%" >
+			<view class="search-title">查询</view>
+			<u-form :model="form" ref="uForm" label-width="180" class="form-content">
 				<u-form-item label="产品编码"><u-input v-model.trim="form.productCode" placeholder="请输入产品编码" input-align="right" /></u-form-item>
 				<u-form-item label="产品编码"><u-input v-model.trim="form.productCode" placeholder="请输入产品编码" input-align="right" /></u-form-item>
 				<u-form-item label="原厂编码"><u-input v-model.trim="form.productOrigCode" placeholder="请输入原厂编码" input-align="right" /></u-form-item>
 				<u-form-item label="原厂编码"><u-input v-model.trim="form.productOrigCode" placeholder="请输入原厂编码" input-align="right" /></u-form-item>
 				<u-form-item label="产品名称"><u-input v-model.trim="form.productName" placeholder="请输入产品名称" input-align="right" /></u-form-item>
 				<u-form-item label="产品名称"><u-input v-model.trim="form.productName" placeholder="请输入产品名称" input-align="right" /></u-form-item>
@@ -9,8 +10,8 @@
 				<u-form-item label="产品分类"><u-input v-model="productTypeNameArr" @click="showTypeModal=true" disabled placeholder="请选择产品分类" input-align="right" /></u-form-item>
 				<u-form-item label="产品分类"><u-input v-model="productTypeNameArr" @click="showTypeModal=true" disabled placeholder="请选择产品分类" input-align="right" /></u-form-item>
 			</u-form>
 			</u-form>
 			<view class="form-footer-btn">
 			<view class="form-footer-btn">
-				<u-button size="medium" hover-class="none" @click="handleClean">清空</u-button>
-				<u-button size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
+				<u-button class="handle-btn" size="medium" hover-class="none" @click="handleClean">清空</u-button>
+				<u-button class="handle-btn" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
 			</view>
 			</view>
 		</u-popup>
 		</u-popup>
 		<!-- 产品品牌 -->
 		<!-- 产品品牌 -->
@@ -58,10 +59,6 @@
 					backgroundColor: this.$config('primaryColor'),
 					backgroundColor: this.$config('primaryColor'),
 					color: '#fff'
 					color: '#fff'
 				},
 				},
-				customStyle:{
-					width:"100%",
-					padding:"10px",
-				},
 				nowData: {
 				nowData: {
 					data: [],
 					data: [],
 					indArr: [],
 					indArr: [],
@@ -83,12 +80,13 @@
 				this.form.productTypeSn1 = undefined
 				this.form.productTypeSn1 = undefined
 				this.form.productTypeSn2 = undefined
 				this.form.productTypeSn2 = undefined
 				this.form.productTypeSn3 = undefined
 				this.form.productTypeSn3 = undefined
-				// this.handleSearch()
+				this.handleSearch()
 			},
 			},
 			handleSearch(){
 			handleSearch(){
-				let params = JSON.parse(JSON.stringify(this.form))
-				console.log(params)
-				uni.navigateTo({ url: "/pages/sales/productPricing?data="+JSON.stringify(params) })
+				let data = JSON.parse(JSON.stringify(this.form))
+				console.log(data)
+				this.$emit('refresh', data)
+				this.isShow=false
 			},
 			},
 			// 选择品牌
 			// 选择品牌
 			brandChoose(data){
 			brandChoose(data){
@@ -124,13 +122,15 @@
 			}
 			}
 		},
 		},
 		watch:{
 		watch:{
-			showModal(nVal,oVal){
-				this.isShow=nVal
+			//  父页面传过来的弹框状态
+			showModal (newValue, oldValue) {
+				this.isShow = newValue
 			},
 			},
+			//  重定义的弹框状态
 			isShow (newValue, oldValue) {
 			isShow (newValue, oldValue) {
-			  if (!newValue) {
-			    this.$emit('close')
-			  }
+				if (!newValue) {
+					this.$emit('close')
+				}
 			}
 			}
 		}
 		}
 	}
 	}
@@ -139,6 +139,17 @@
 <style lang="scss">
 <style lang="scss">
 	.modal-box{
 	.modal-box{
 		width: 100%;
 		width: 100%;
+		.search-title {
+			text-align: center;
+			padding: 30upx 22upx;
+			color: #333;
+			border-bottom: 1px solid #eee;
+		}
+		.form-content{
+			display: block;
+			padding: 0 20upx;
+			box-sizing: content-box;
+		}
 		.u-form-item{
 		.u-form-item{
 			padding: 20upx 10upx;
 			padding: 20upx 10upx;
 		}
 		}
@@ -147,10 +158,16 @@
 			display: flex;
 			display: flex;
 			justify-content: space-between;
 			justify-content: space-between;
 		}
 		}
-		.form-footer-btn uni-button{
-			width: 40%;
-			margin: 0 auto;
-			font-size: 30upx;
+		.form-footer-btn {
+			display: flex;
+			padding: 20upx;
+			margin-top: 200upx;
+			.handle-btn {
+				font-size: 28upx;
+				margin: 0 30upx;
+				width: 100%;
+				flex: 1;
+			}
 		}
 		}
 	}
 	}
 </style>
 </style>