zhangdan 3 年 前
コミット
26d06b9690
3 ファイル変更249 行追加21 行削除
  1. 2 1
      pages.json
  2. 91 20
      pages/sales/productPricing.vue
  3. 156 0
      pages/sales/search.vue

+ 2 - 1
pages.json

@@ -204,7 +204,8 @@
 			"path": "pages/sales/productPricing", // 产品报价
 			"style": {
 				"navigationBarTitleText": "产品报价",
-				"enablePullDownRefresh": false
+				"enablePullDownRefresh": false,
+				"navigationStyle":"custom"
 			}
 		}
     ],

+ 91 - 20
pages/sales/productPricing.vue

@@ -1,5 +1,11 @@
 <template>
 	<view class="productPricing-content">
+		<view class="top"></view>
+		<view class="status_bar flex justify_between align_center">
+			<u-icon name="arrow-left" color="#191919" size="32" @click="toPage('/pages/sales/index')"></u-icon>
+		    <view class="title">产品报价</view>
+			<view><u-icon name="search" color="#999" size="28" @click="search"></u-icon>查询</view>
+		</view>
 		<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>
@@ -30,22 +36,22 @@
 							</view>
 						</view>
 					</view>
-					<view class="price-all flex justify_between">
-						<view class="price-item">
+					<view class="price-all flex">
+						<view class="price-item" v-if="isCostPrice">
 							<u-count-to :end-val="item.offerCost ? item.offerCost : 0" separator="," font-size="26" :decimals="2"></u-count-to>
 							<view>成本价</view>
 						</view>
-						<view class="price-item">
-							<u-count-to :end-val="item.offerCost ? item.offerCost : 0" separator="," font-size="26" :decimals="2"></u-count-to>
-							<view>成本价</view>
+						<view class="price-item" v-if="isCityPrice">
+							<u-count-to :end-val="item.cityPrice ? item.cityPrice : 0" separator="," font-size="26" :decimals="2"></u-count-to>
+							<view>市级价</view>
 						</view>
-						<view class="price-item">
-							<u-count-to :end-val="item.offerCost ? item.offerCost : 0" separator="," font-size="26" :decimals="2"></u-count-to>
-							<view>成本价</view>
+						<view class="price-item" v-if="isSpecialPrice">
+							<u-count-to :end-val="item.specialPrice ? item.specialPrice : 0" separator="," font-size="26" :decimals="2"></u-count-to>
+							<view>特约价</view>
 						</view>
-						<view class="price-item">
-							<u-count-to :end-val="item.offerCost ? item.offerCost : 0" separator="," font-size="26" :decimals="2"></u-count-to>
-							<view>成本价</view>
+						<view class="price-item" v-if="isTerminalPrice">
+							<u-count-to :end-val="item.terminalPrice ? item.terminalPrice : 0" separator="," font-size="26" :decimals="2"></u-count-to>
+							<view>终端会员价</view>
 						</view>
 					</view>
 				</view>
@@ -54,34 +60,82 @@
 				</view>
 			</view>
 		</scroll-view>
+		<!-- 搜索弹窗 -->
+		<search :showModal="showModal"/>
 	</view>
 </template>
 
 <script>
 	import { dealerProductList } from '@/api/sales'
+	import search from './search.vue'
 	export default{
+		components:{search},
 		data(){
 			return{
 				listData:[],
 				totalNum:0,
-				priceList:[{name:'成本价',checked:false},{name:'市级价',checked:false},{name:'特约价',checked:false},{name:'市级终端价',checked:false}],
+				priceList:[{name:'成本价',checked:false},{name:'市级价',checked:false},{name:'特约价',checked:false},{name:'终端会员价',checked:false}],
 				pageNo:1,
 				pageSize:10,
 				noDataText: '暂无数据',
-				theme: ''
+				theme: '',
+				isCostPrice: false,
+				isCityPrice: false,
+				isSpecialPrice: false,
+				isTerminalPrice: false,
+				showModal:false,
+				params:{}
 			}
 		},
-		onLoad() {
+		onLoad(option) {
 			this.theme = getApp().globalData.theme
+			this.params = option.data ? JSON.parse(option.data) : {}
 			this.getList()
 		},
 		methods:{
+			toPage(url){
+				uni.switchTab({
+					url:url
+				})
+			},
+			// 搜索
+			search(){
+				this.showModal=true
+				console.log('点击的时间里看电视剧')
+			},
 			// 价格显示
-			checkboxChange(e){
-				console.log(e,'val ,change')
-				// if(val&&val.length>0){
-				// 	const a= val.find(item=>{item=='成本价'})
-				// }
+			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
+				}
 			},
 			// 列表
 			getList(pageNo){
@@ -89,7 +143,7 @@
 				if (pageNo) {
 					this.pageNo = pageNo
 				}
-				let params =  { pageNo: this.pageNo, pageSize: this.pageSize }
+				let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
 				dealerProductList(params).then(res => {
 					if (res.status == 200) {
 						if(this.pageNo>1){
@@ -120,6 +174,23 @@
 	.productPricing-content{
 		width:100%;
 		height: 100vh;
+		.top {
+				top: var(--status-bar-height);
+			}
+		.status_bar {
+			height: 44px;
+			padding: 7px 3px;
+			width: 100%;
+			background-color: #fff;
+			text-align: center;
+			.title{
+				font-weight: 700;
+				font-size: 16px;
+			}
+			// position: fixed;
+			// top: 0px;
+			// z-index: 999;
+		}
 		.checkbox-price{
 			background-color: #fff;
 			display: flex;

+ 156 - 0
pages/sales/search.vue

@@ -0,0 +1,156 @@
+<template>
+	<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-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.productName" placeholder="请输入产品名称" input-align="right" /></u-form-item>
+				<u-form-item label="产品品牌"><u-input v-model="brandName" @click="brandModal=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>
+			<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>
+			</view>
+		</u-popup>
+		<!-- 产品品牌 -->
+		<productBrand :openModal="brandModal" :itemSn="form.productBrandSn" @choose="brandChoose" @clean="brandClean" @close="brandModal=false" />
+		<!-- 产品分类 -->
+		<productType :openModal="showTypeModal" :nowData="nowData" @choose="typeChoose" @clean="typeClean" @close="showTypeModal=false" />
+	</view>
+</template>
+
+<script>
+	import productBrand from '@/pages/common/productBrand.vue'
+	import productType from '@/pages/common/productType.vue'
+	import { dealerProductTypeList } from '@/api/dealerProductType'
+	export default{
+		components: { productBrand, productType },
+		props:{
+			showModal:{
+				type: Boolean,
+				default: false
+			}
+			
+		},
+		computed: {
+			productTypeNameArr: function() {
+				let str = ''
+				this.nowData.data.map(item => {
+					str += item.productTypeName+' / '
+				})
+				return str ? str.substr(0, str.length-3) : ''
+			}
+		},
+		data(){
+			return{
+				form: {
+					productCode: '', //  产品编码
+					productName: '', //  产品名称
+					productOrigCode: '', //  原厂编码
+					productBrandSn: undefined, //  产品品牌
+					productTypeSn1: undefined, //  产品分类1
+					productTypeSn2: undefined, //  产品分类2
+					productTypeSn3: undefined, //  产品分类3
+				},
+				customBtnStyle: {  //  自定义按钮样式
+					borderColor: this.$config('primaryColor'),
+					backgroundColor: this.$config('primaryColor'),
+					color: '#fff'
+				},
+				customStyle:{
+					width:"100%",
+					padding:"10px",
+				},
+				nowData: {
+					data: [],
+					indArr: [],
+					nowInd: 0
+				},
+				brandName: '',
+				isShow:this.showModal,
+				showTypeModal: false,
+				brandModal:false
+			}
+		},
+		methods:{
+			// 表单清空
+			handleClean(){
+				this.form.productCode = ''
+				this.form.productName = ''
+				this.form.productOrigCode = ''
+				this.form.productBrandSn = undefined
+				this.form.productTypeSn1 = undefined
+				this.form.productTypeSn2 = undefined
+				this.form.productTypeSn3 = undefined
+				// this.handleSearch()
+			},
+			handleSearch(){
+				let params = JSON.parse(JSON.stringify(this.form))
+				console.log(params)
+				uni.navigateTo({ url: "/pages/sales/productPricing?data="+JSON.stringify(params) })
+			},
+			// 选择品牌
+			brandChoose(data){
+				this.brandName = data.brandName
+				this.form.productBrandSn = data.brandSn
+			},
+			// 清空品牌
+			brandClean(){
+				this.brandName = ''
+				this.form.productBrandSn = undefined
+			},
+			// 选择分类
+			typeChoose(obj){
+				this.nowData = {
+					data: obj.data,
+					indArr: obj.indArr,
+					nowInd: obj.nowInd
+				}
+				this.form.productTypeSn1 = this.nowData.data[0]&&this.nowData.data[0].productTypeSn ? this.nowData.data[0].productTypeSn : undefined
+				this.form.productTypeSn2 = this.nowData.data[0]&&this.nowData.data[1].productTypeSn ? this.nowData.data[1].productTypeSn : undefined
+				this.form.productTypeSn3 = this.nowData.data[0]&&this.nowData.data[2].productTypeSn ? this.nowData.data[2].productTypeSn : undefined
+			},
+			// 清空分类
+			typeClean(){
+				this.nowData = {
+					data: [],
+					indArr: [],
+					nowInd: 0
+				}
+				this.form.productTypeSn1 = undefined
+				this.form.productTypeSn2 = undefined
+				this.form.productTypeSn3 = undefined
+			}
+		},
+		watch:{
+			showModal(nVal,oVal){
+				this.isShow=nVal
+			},
+			isShow (newValue, oldValue) {
+			  if (!newValue) {
+			    this.$emit('close')
+			  }
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.modal-box{
+		width: 100%;
+		.u-form-item{
+			padding: 20upx 10upx;
+		}
+		.form-footer-btn{
+			margin: 60upx 30upx 30upx;
+			display: flex;
+			justify-content: space-between;
+		}
+		.form-footer-btn uni-button{
+			width: 40%;
+			margin: 0 auto;
+			font-size: 30upx;
+		}
+	}
+</style>