gjy 2 năm trước cách đây
mục cha
commit
d75bf05a39

+ 19 - 3
components/mehaotian-search-revision.vue

@@ -12,10 +12,10 @@
 				<!-- HM修改 @click换成@click.stop阻止冒泡 -->
 				<text v-if="isDelShow" class="icon icon-del" @click.stop="clear"></text>
 			</view>
-			<view v-show="(active&&show&&button === 'inside')||(isDelShow && button === 'inside')" class="serachBtn"
+			<!-- <view v-show="(active&&show&&button === 'inside')||(isDelShow && button === 'inside')" class="serachBtn"
 				@click="search">
 				搜索
-			</view>
+			</view> -->
 		</view>
 		<view v-if="button === 'outside'" class="button" :class="{'active':show||active}" @click="search">
 			<view class="button-item">{{!show?searchName:'搜索'}}</view>
@@ -35,6 +35,10 @@
 				value: String,
 				default: '请输入搜索内容'
 			},
+			oldsearch:{
+				type: String,
+				default: ''
+			},
 			value: {
 				type: String,
 				default: false
@@ -61,6 +65,18 @@
 				isFocus: false
 			};
 		},
+		watch: {
+			oldsearch:{
+				handler(oldValue, newValue) {
+					console.log(oldValue, newValue,22222)
+					// if (val != '') {
+					// 	this.place = val
+					// }
+				},
+				deep:true,
+				immediate:true,
+			}
+		},
 		methods: {
 			//HM修改 触发组件confirm事件
 			triggerConfirm() {
@@ -166,7 +182,7 @@
 					padding: 0 15upx;
 
 					&.icon-del {
-						font-size: 38upx;
+						font-size: 30upx;
 
 						&:before {
 							content: "\e644";

+ 35 - 4
components/search.vue

@@ -3,7 +3,7 @@
 		<view class="search-box">
 			<!-- mSearch组件 如果使用原样式,删除组件元素-->
 			<mSearch class="mSearch-input-box" :mode="2" button="inside" :placeholder="defaultKeyword"
-				@search="doSearch(false)" @input="inputChange" @confirm="doSearch(false)" v-model="keyword"></mSearch>
+				@search="doSearch(false)" @input="inputChange" @confirm="doSearch(false)" :oldsearch='keyword2' v-model="keyword"></mSearch>
 			<view class="cancel" @click="cancel">
 				取消
 			</view>
@@ -70,10 +70,17 @@
 	import mSearch from '@/components/mehaotian-search-revision.vue';
 	export default {
 		name: "search",
+		props: {
+			searchcontent: {
+				type: String,
+				default: ''
+			}
+		},
 		data() {
 			return {
 				defaultKeyword: "请输入作物名称或用户名称",
 				keyword: "",
+				keyword2: "",
 				oldKeywordList: [],
 				hotKeywordList: [],
 				keywordList: [],
@@ -88,6 +95,29 @@
 		mounted() {
 			this.init();
 		},
+		watch: {
+			searchcontent:{
+				handler(oldValue, newValue) {
+					this.keyword=oldValue
+					// if (val != '') {
+					// 	this.place = val
+					// }
+				},
+				deep:true,
+				immediate:true,
+			},
+			keyword:{
+				handler(oldValue, newValue) {
+					this.keyword2=oldValue
+					console.log(oldValue, newValue,11111111)
+					// if (val != '') {
+					// 	this.place = val
+					// }
+				},
+				deep:true,
+				immediate:true,
+			},
+		},
 		methods: {
 			cancel() {
 				this.$emit('searchVal', '')
@@ -367,17 +397,18 @@
 	}
 
 	.keyword-box .keyword-block .keyword-list-header {
-		width: 94%;
+		width: 100%;
 		padding: 10upx 3%;
 		font-size: 27upx;
 		color: #333;
 		display: flex;
 		justify-content: space-between;
+		align-items: center;
 	}
 
 	.keyword-box .keyword-block .keyword-list-header image {
-		width: 40upx;
-		height: 40upx;
+		width: 32upx;
+		height: 32upx;
 	}
 
 	.keyword-box .keyword-block .keyword {

+ 6 - 26
components/selectAddress.vue

@@ -1,11 +1,12 @@
 <template>
 	<view>
-		<picker class="pickerClass" ref='picker' :disabled="disabled" @change="bindPickerChange" :value="multiIndex" :range="multiArray" range-key='label'
+		<picker :class="disabled?'pickerClass':''" ref='picker' @change="bindPickerChange" :value="multiIndex" :range="multiArray" range-key='label'
 			mode="multiSelector" @columnchange='columnchange'>
 			<view class="text" :style="textStyleEmpty" v-if="place=='选择地区'">
 				{{place}}
 			</view>
 			<view class="text" :style="textStyle" v-else>{{edit?text:place}}</view>
+			<slot name="icon"></slot>
 		</picker>
 	</view>
 </template>
@@ -42,22 +43,7 @@
 			}
 		},
 		watch: {
-			disabled(oldValue, newValue) {
-				console.log(123)
-				console.log(oldValue, newValue)
-				if(newValue){
-					
-				}else{
-					// this.$refs.picker.change()
-					// console.log(this.$refs.picker)
-					this.bindPickerChange(this.$refs.picker.value)
-					
-					// this.bindPickerChange()
-				}
-				// if (val != '') {
-				// 	this.place = val
-				// }
-			}
+			
 			// searchPlace(oldValue, newValue) {
 			// 	console.log(123)
 			// 	console.log(oldValue, newValue)
@@ -162,14 +148,8 @@
 	}
 </script>
 
-<style lang="scss">
-	.pickerClass{
-		width: 80%;
-		position: absolute;
-		right:11px;
-		padding:0 20px;
-		top:50%;
-		transform: translateY(-50%);
-		z-index:2
+<style lang="scss" scoped>
+	.text{
+		display:inline-block;
 	}
 </style>

+ 2 - 2
components/text-over-flow.vue

@@ -17,9 +17,9 @@
 				</text>
 			</view>
 			<view class="fold-hint" v-if="foldHint">
-				<view @tap="isHide = true">
+				<text @tap="isHide = true">
 					{{ foldHint }}
-				</view>
+				</text>
 			</view>
 		</view>
 		<view>

+ 1 - 1
pages.json

@@ -16,7 +16,7 @@
 				"text": "资讯"
 			},
 			{
-				"pagePath": "pages/business/business",
+				"pagePath": "pages/business/businessNew",
 				"iconPath": "static/img/jiaoyi.png",
 				"selectedIconPath": "static/img/jiaoyi_check.png",
 				"text": "交易"

+ 55 - 18
pages/business/businessNew.vue

@@ -4,12 +4,14 @@
 			<view class="top-warp">
 				<view class="search">
 					<view class="place">
-						<selectAddress @selectAddress='selectAddress' :searchPlace='searchPlace'></selectAddress>
+						<selectAddress @selectAddress='selectAddress' :searchPlace='searchPlace'>
+							<u-icon :slot="'icon'" name="arrow-down" color="#333333" size="17" bold style='margin-left: 6rpx;'></u-icon>
+						</selectAddress>
 						<!-- 					<picker @change="bindPickerChange" :value="multiIndex" :range="multiArray" range-key='label'
 							mode="multiSelector" @columnchange='columnchange'>
 							<view class="text">{{searchPlace}}</view>
 						</picker> -->
-						<u-icon name="arrow-down" color="#333333" size="17" bold style='margin-left: 6rpx;'></u-icon>
+						
 					</view>
 					<u-search placeholder="请输入作物名称或用户名称" v-model="keyword" :input-style='inputStyle'
 						:show-action="false" disabled @click='toSearch'>
@@ -38,10 +40,10 @@
 									</view>
 								</view>
 							</view>
-							<view class="right" v-if="item.followed==1" @click="follow(item,1)">
+							<view class="right" v-if="item.followed==1&&item.commonUser&&item.commonUser.userName!=userInfo.userName" @click="follow(item,1)">
 								<text class="case" style="color:#878C9C;">已关注</text>
 							</view>
-							<view class="right" v-else @click="follow(item,2)">
+							<view class="right" v-else-if='item.followed!=1&&item.commonUser&&item.commonUser.userName!=userInfo.userName' @click="follow(item,2)">
 								<u-icon name="plus" color="#333333" size="17" bold></u-icon><text class="case">关注</text>
 							</view>
 
@@ -50,8 +52,10 @@
 							<mote-lines-divide :dt="item.publishingContent" :line="3" expandText="展开" foldHint="收起" />
 						</view>
 						<view class="row3">
-							<image :src="item1" mode="aspectFill" v-for="(item1,index) in item.imgList" class="img">
+							<image :src="item1" mode="aspectFill" v-for="(item1,index) in item.imgList"  @tap="previewImage(item,index)" class="img">
 							</image>
+							<image v-if='item.imgList.length%3==1||item.imgList.length%3==2' class="img" style='background:#fff;'></image>
+							<image v-if='item.imgList.length%3==1' class="img" style='background:#fff;'></image>
 							<!-- 	<u-row justify="space-between" gutter="10">
 								<u-col span="4">
 									<view class="demo-layout bg-purple">
@@ -78,6 +82,7 @@
 							<text class="text">{{item.placeDelivery}}</text>
 						</view>
 					</view>
+					
 				</view>
 
 				<!-- <good-list :list="goods"></good-list> -->
@@ -89,7 +94,7 @@
 				:content-style="contentStyle" showCancelButton='true' @confirm="cancelFollow" @cancel="show=false">
 			</u-modal>
 		</view>
-		<search v-if="isShowSearch" @searchVal='searchVal'></search>
+		<search :searchcontent='keyword1' v-if="isShowSearch" @searchVal='searchVal'></search>
 		<u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
 			:content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='提示'
 			showCancelButton='false' content="尚未登录,是否立即登录" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
@@ -136,6 +141,7 @@
 				selectItem: {},
 				show: false,
 				keyword: '',
+				keyword1:'',
 				inputStyle: {
 					// "padding-left": '30rpx'
 				},
@@ -147,7 +153,7 @@
 					// },
 					noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
 					empty: {
-						icon: '/static/empty.png',
+						// icon: '/static/empty.png',
 						tip: '暂无内容', // 提示
 						// btnText: '去看看'
 					},
@@ -246,6 +252,15 @@
 		},
 
 		methods: {
+			previewImage(item,index){
+				console.log(111111111)
+			        var i = item.imgList; //获取当前页面的轮播图数据
+			        //uniapp预览轮播图
+			        uni.previewImage({
+			            current:index, //预览图片的下标
+			            urls:i //预览图片的地址,必须要数组形式,如果不是数组形式就转换成数组形式就可以
+			        })
+			},
 			releaseAlertbtn() {
 				getApp().globalData.userRelease = false
 				this.isSHowReleaseAlert = false
@@ -284,7 +299,10 @@
 				this.keyword = e
 			},
 			toSearch() {
+				this.keyword1=this.keyword
 				this.isShowSearch = true
+			
+				console.log(this.keyword1)
 			},
 			follow(val, type) {
 				// 2关注
@@ -344,7 +362,7 @@
 			downCallback() {
 				this.mescroll.resetUpScroll();
 			},
-			upCallback(page) {
+			async upCallback(page) {
 				uni.showLoading({
 					title: '数据加载中',
 					mask: true
@@ -354,6 +372,7 @@
 				let _obj = {
 
 				}
+				console.log(this.selectType)
 				if (this.selectType == '关注') {
 					_obj = {
 						pageSize: page.size,
@@ -375,9 +394,9 @@
 						pcphone: 'mobile'
 					}
 				}
-				this.$api.doRequest('get', '/transactionExchangeInfo/selectTransactionExchangeInfo', _obj).then(res => {
-					console.log(res.data.data.records)
+				await this.$api.doRequest('get', '/transactionExchangeInfo/selectTransactionExchangeInfo', _obj).then(res => {
 					if (res.data.code == 200) {
+						console.log(res.data.data.records,page.num)
 						let curPageData = res.data.data.records;
 						let curPageLen = curPageData.length;
 						let totalPage = res.data.data.total;
@@ -385,12 +404,28 @@
 						this.goods = this.goods.concat(curPageData);
 						console.log(curPageLen, totalPage)
 						this.mescroll.endByPage(curPageLen, totalPage);
-						for (let i = 0; i < this.goods.length; i++) {
-							this.goods[i].imgList = this.goods[i].urlImg.split(',')
-						}
 					}
-					uni.hideLoading()
 				})
+				
+				if(this.goods.length>0){
+					for (let i = 0; i < this.goods.length; i++) {
+					await this.$api.doRequest('get', 'appendix/query/getFileList', {
+							appendixIds: this.goods[i].urlImg
+						}).then(res1 => {
+							if(i==this.goods.length-1){
+								uni.hideLoading()
+							}
+							var arr=[]
+							for (let q = 0; q < res1.data.data.length; q++) {
+								arr.push(res1.data.data[q].appendixPath)
+							}
+							this.goods[i].imgList = arr
+							this.$forceUpdate()
+						})
+						
+					}
+				}
+				
 			},
 			//点击空布局按钮的回调
 			emptyClick() {
@@ -420,7 +455,9 @@
 	.content {
 		background: #F5F6FA;
 	}
-
+	/deep/.button-show{
+		width:80rpx;
+	}
 	.flex {
 		display: flex;
 	}
@@ -535,7 +572,7 @@
 				margin-top: 18rpx;
 				display: flex;
 				align-items: center;
-				/* justify-content: space-between; */
+				justify-content: space-between;
 				flex-wrap: wrap;
 				/* background: #bbb; */
 
@@ -543,8 +580,8 @@
 				.img {
 					display: flex;
 					align-items: center;
-					justify-content: center;
-					width: 214rpx;
+					/* justify-content: space-between; */
+					width: 31.6333%;
 					height: 214rpx;
 					margin-bottom: 20rpx;
 					background: lightblue;

+ 134 - 5
pages/business/release.vue

@@ -18,10 +18,26 @@
 				</view> -->
 			</view>
 			<view style="padding-left: 10rpx;">
-				<upload :file-list='businesslicense' class="upload" ref="upload" :action="action" :max-size="maxSize"
+				<view style='flex-wrap:wrap;' class='flex'>
+					<view v-for='(item,index) in imgList2' v-if="imgList2 && imgList2.length > 0"
+					style="position: relative;margin-left: 20rpx;">
+					<view class="delete_img" @click="deleteImg(index)">
+						<u-icon size='4' name="close"></u-icon>
+					</view>
+					<image :src="item.appendixPath" mode="" style="width: 100px;height: 100px;border:1px solid #ccc;border-radius: 5rpx;"></image>
+					</view>
+					<view class="biankuang" @click="uploadClick" v-if="imgList2.length < 9">
+						<view class="tubiao">
+							<image class="upload" src="../../static/img/jiaoyi/tianjiazhaopian.png" mode="">
+							</image>
+						</view>
+					</view>
+				</view>
+				
+			<!-- 	<upload :file-list='businesslicense' class="upload" ref="upload" :action="action" :max-size="maxSize"
 					delIconSize='30' delBgColor='rgba(0,0,0,0.4)' delIcon="trash" :max-count="9"
 					:size-type="['compressed']" @on-success="getImgUrl" @on-remove="onRemove"
-					:before-upload="filterFileType"></upload>
+					:before-upload="filterFileType"></upload> -->
 			</view>
 		</view>
 		<view class="content2">
@@ -35,7 +51,7 @@
 					</u-radio-group>
 				</u-cell-item>
 				<u-cell-item :title="placeTitle" :title-style="titleStyle">
-					<selectAddress @selectAddress='selectAddress' series='3' :textStyle='textStyle'
+					<selectAddress :disabled="true" @selectAddress='selectAddress' series='3' :textStyle='textStyle'
 						:searchPlace='searchPlaceHolder'>
 					</selectAddress>
 
@@ -64,6 +80,7 @@
 </template>
 
 <script>
+		import * as config from '../../config'
 	import upload from '@/components/upload_small.vue';
 	import selectAddress from "@/components/selectAddress.vue"
 	import {
@@ -79,6 +96,7 @@
 				searchPlaceHolder: '选择地区',
 				placeTitle: '交货地',
 				imgList: [],
+				imgList2:[],
 				disabled:false,
 				showNickname: false,
 				dataObj: {
@@ -98,7 +116,7 @@
 					"font-size": "32rpx",
 					// "font-weight": 700,
 					"color": "#333333",
-					"margin-right": '27rpx'
+					"margin-right": '16rpx'
 				},
 				list: [{
 						name: '采购',
@@ -139,8 +157,81 @@
 		computed: {
 			...mapState(['hasLogin', 'userInfo', 'clientId']),
 		},
-
+		watch: {
+			imgList: {
+				handler: function() {
+					this.$api.doRequest('get', 'appendix/query/getFileList', {
+						appendixIds: this.imgList.toString()
+					}).then(res => {
+						this.imgList2 = res.data.data
+					})
+				},
+				deep: true
+			}
+		},
 		methods: {
+			deleteImg(index) {
+				this.imglist.splice(index, 1)
+			},
+			async uploadClick() {
+				let baseUrlNew = config.def().baseUrlNew
+				let pcUserInfo = uni.getStorageSync('pcUserInfo')
+				console.log('baseUrlNew',baseUrlNew)
+				if(!pcUserInfo){
+					uni.showToast({
+						title:"登录已失效,请重新登录"
+					})
+					return 
+				}
+				uni.chooseImage({
+					count:10,
+					success: (chooseImageRes) => {
+						console.log('chooseImageRes',chooseImageRes)
+						let files = []
+						for (let item of chooseImageRes.tempFiles) {
+							files.push({
+								name: 'fileName',
+								url : item.path
+							});
+						}
+						console.log(files)
+						for (let i = 0; i < files.length; i++) {
+							uni.uploadFile({
+							url: baseUrlNew + 'appendix/api/uploadFiles',
+							// url: baseUrlNew+'appendix/api/uploadFiles', //仅为示例,非真实的接口地址
+							// files: files[i],
+							filePath:files[i].url,
+							name:files[i].name,
+							formData: {
+								// fileName: chooseImageRes.tempFiles[0],
+								companyId: pcUserInfo.compId,
+								modelId: '',
+								vesselId: '',
+							},
+							success: (uploadFileRes) => {
+								console.log(JSON.parse(uploadFileRes.data))
+								var data = JSON.parse(uploadFileRes.data).data
+								data.compId = pcUserInfo.compId
+								this.$api.doRequest('post', '/appendix/api/saveFilesApp', {
+									newAppendixs: [data],
+									oldAppendixIds: ""
+								}).then(res => {
+									console.log(res.data.data)
+									this.imgList.push(res.data.data[0])
+									
+								})
+								console.log(uploadFileRes.data);
+							},
+							fail(res) {
+								
+								console.log(res);
+							}
+						});
+						}
+						
+					}
+				});
+			},
 			clear() {
 				this.dataObj.publishingContent = ''
 			},
@@ -474,4 +565,42 @@
 		bottom: 30rpx;
 		width: 90%;
 	}
+	.biankuang {
+		// border: 1px dashed #AFB3BF;
+		border-radius: 10rpx;
+		width: 200rpx;
+		height: 200rpx;
+		margin-left: 20rpx;
+		text-align:center;
+		line-height: 220rpx;
+		background:#F5F6FA;
+		.upload {
+			width: 46rpx;
+			height: 46rpx;
+		}
+	}
+	.delete_img {
+		position: absolute;
+		z-index: 100;
+		right: 0px;
+		border-radius:0 5rpx 0 10px;
+		color: #ffffff;
+		font-size: 28rpx;
+		
+		border: 1px;
+		// border-radius: 5rpx;
+		width: 40rpx;
+		height: 38rpx;
+		background-color: rgba(17, 26, 52, 0.50);
+		text-align: center;
+	}
+	/deep/.pickerClass{
+		width: 80%;
+		position: absolute;
+		right:11px;
+		padding:0 30px 0 0;
+		top:50%;
+		transform: translateY(-50%);
+		z-index:2
+	}
 </style>