소스 검색

前端gjy

gjy 3 년 전
부모
커밋
c938aa6f20
4개의 변경된 파일86개의 추가작업 그리고 40개의 파일을 삭제
  1. 0 17
      pageB/contract/contract.vue
  2. 79 22
      pageB/contract/enclosures.vue
  3. 3 0
      pages/grain_pulse/localtion/coordinate.nvue
  4. 4 1
      pages/grain_pulse/localtion/coordinate.vue

+ 0 - 17
pageB/contract/contract.vue

@@ -245,23 +245,6 @@
 			},
 			commit(item) {
 				console.log(item)
-				// var list = item.addressUrl.toString().split(',')
-				// if(list.length > 0){
-				// 	uni.downloadFile({
-				// 	  url: list[0],
-				// 	  success: function (res) {
-				// 	    var filePath = res.tempFilePath;
-				// 	    uni.openDocument({
-				// 	      filePath: filePath,
-				// 	      success: function (res) {
-				// 			  uni.hideLoading()
-				// 	        console.log('打开文档成功');
-				// 	      }
-				// 	    });
-				// 	  },
-				// 	})
-				// }
-				
 				uni.navigateTo({
 					url: `/pageB/contract/enclosures?addressUrl=${item.addressUrl}`
 				})

+ 79 - 22
pageB/contract/enclosures.vue

@@ -2,25 +2,18 @@
 	<view class="center">
 		<view class="c-list">
 			<view class="xinxiup">
-				<view class="c-row b-b">
-					<text class="tit">合同编号:</text>
-					<view class="con-list">
-						<text>{{goods.contractNo}}({{goods.goodsName}})</text>
+				<view>{{title}}</view>
+				<view v-for="item in list">
+					<view class="c-row b-b">
+						<text class="tit">{{item.appendixName}}</text>
 					</view>
-				</view>
-				<view class="c-row b-b">
-					<text class="tit">买方名称:</text>
-					<view class="con-list">
-						<text>{{goods.contracter}}</text>
+					<view class="c-row b-b">
+						<text class="tit">{{item.appendixSize}}</text>
 					</view>
-				</view>
-				<view class="c-row">
-					<text class="tit">累计收发:</text>
-					<view class="con-list">
-						<text style="font-size: 18px">{{sendout}}<text class="hair">发</text>{{collect}}<text
-								class="collect">收</text></text>
-						<!-- <text>{{goods.level}}收</text> -->
+					<view class="c-row b-b">
+						<text class="tit">{{item.appendixPath}}</text>
 					</view>
+					<u-button @click="download(item.appendixPath)">下载</u-button>
 				</view>
 			</view>
 		</view>
@@ -32,15 +25,79 @@
 			name: "trust",
 			data() {
 				return {
-					list:[]
+					list:[],
+					title:""
 				};
 			},
-			onLoad(addressUrl) {
-				if(addressUrl){
-					this.list = addressUrl.toString().split(',')
-					console.log(this.list)
-				}
+			onLoad(param) {
+				var that = this
+				this.$api.doRequest('get', '/appendix/query/getFileList', {appendixIds:param.addressUrl}).then(res => {
+					if (res.data.code == 200) {
+						that.list = res.data.data
+						that.title = "共"+that.list.length+"个附件"
+					} else {
+						uni.showToast({
+							title: res.data.message,
+							icon: 'none',
+							duration: 2000
+						})
+					}
+				})
+				.catch(res => {
+					if(res.errmsg){
+						uni.showToast({
+							title: res.errmsg,
+							icon: 'none',
+							duration: 2000
+						})
+					}
+					else{
+						uni.showToast({
+							title: "系统异常,请联系管理员",
+							icon: 'none',
+							duration: 2000
+						})
+					}
+				});
 			},
+			methods: {
+				download(path){
+					uni.downloadFile({
+					  url: path,
+					  success: function (res) {
+						var filePath = res.tempFilePath;
+						uni.saveFile({
+						      tempFilePath: filePath,
+						      success: function (res) {
+						        var savedFilePath = res.savedFilePath;
+								uni.showModal({
+									title: '提示',
+									content: '下载成功,是否打开文件?',
+									showCancel: true,
+									success: (e) => {
+										if (e.confirm) {
+											uni.openDocument({
+											  filePath: savedFilePath,
+											  success: function (res) {
+												uni.showToast({
+													title: "打开成功",
+													icon: 'none',
+													duration: 2000
+												})
+											  }
+											});
+										}
+									},
+									fail: () => {},
+									complete: () => {}
+								})
+								
+						      }
+						    });
+					},
+					})
+				}
+			}
 		}
 </script>
 

+ 3 - 0
pages/grain_pulse/localtion/coordinate.nvue

@@ -126,6 +126,9 @@
 
 			},
 			config() {
+				// console.log("this.position",this.position)
+					// this.position.selectLocation = this.position.longitude+","+this.position.latitude
+					// console.log("this.position",this.position)
 				uni.navigateTo({
 						url:"/pages/grain_pulse/enter?position="+JSON.stringify(this.position)
 				})

+ 4 - 1
pages/grain_pulse/localtion/coordinate.vue

@@ -125,7 +125,10 @@
 				this.covers = newmarker
 
 			},
-			config() {debugger
+			config() {
+				// console.log("this.position",this.position)
+					// this.position.selectLocation = this.position.longitude+","+this.position.latitude
+					// console.log("this.position",this.position)
 				uni.navigateTo({
 						url:"/pages/grain_pulse/enter?position="+JSON.stringify(this.position)
 				})