Browse Source

Merge branch 'master' of http://git.aseanbusiness.cn/qzyReal/market-app-ui

mym 1 year ago
parent
commit
47185ff952

+ 1 - 0
common/style.scss

@@ -494,6 +494,7 @@
 .address {
 .address {
 	background-color: white;
 	background-color: white;
 	padding: 15px;
 	padding: 15px;
+	overflow: hidden;
 	.con {
 	.con {
 		float: left;
 		float: left;
 		width: 85%;
 		width: 85%;

+ 20 - 2
pages.json

@@ -119,7 +119,7 @@
 		}, {
 		}, {
 			"path": "pages/market/two/purchaser/buy/add",
 			"path": "pages/market/two/purchaser/buy/add",
 			"style": {
 			"style": {
-				"navigationBarTitleText": "新增采购商品",
+				"navigationBarTitleText": "新增求购信息",
 				"enablePullDownRefresh": false
 				"enablePullDownRefresh": false
 			}
 			}
 
 
@@ -296,7 +296,25 @@
 			}
 			}
 
 
 		}
 		}
-	],
+	    ,{
+            "path" : "pages/market/one/merchant/goods/selects",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "选择商品",
+                "enablePullDownRefresh": true
+            }
+            
+        }
+        ,{
+            "path" : "pages/market/one/merchant/goods/area",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "选择互市区",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+    ],
 	"tabBar": {
 	"tabBar": {
 		"color": "#7A7E83",
 		"color": "#7A7E83",
 		"selectedColor": "#4581fb",
 		"selectedColor": "#4581fb",

+ 72 - 89
pages/market/one/merchant/goods/add.vue

@@ -1,20 +1,19 @@
 <template>
 <template>
 	<view>
 	<view>
-		<view class="cmain">
+		<view class="cmain animated fadeInDown">
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable re">贸易区域</view>
 				<view class="lable re">贸易区域</view>
-				<picker :range="tradeAreaList" @change="pickerTradeArea($event)" range-key="name">
+				<picker @click="selectArea()" :disabled="true">
 					<input placeholder="请选择" v-model="item.tradeAreaName" :disabled="true" />
 					<input placeholder="请选择" v-model="item.tradeAreaName" :disabled="true" />
 					<view class="icon more">&#xe8f2;</view>
 					<view class="icon more">&#xe8f2;</view>
 				</picker>
 				</picker>
 			</view>
 			</view>
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable re">商品名称</view>
 				<view class="lable re">商品名称</view>
-				<picker v-if="flag === '新增商品'" :range="goodsList" @change="pickerGoods($event)" range-key="name">
+				<picker @click="selectGoods()" :disabled="true">
 					<input placeholder="请选择" v-model="item.goodsName" :disabled="true" />
 					<input placeholder="请选择" v-model="item.goodsName" :disabled="true" />
 					<view class="icon more">&#xe8f2;</view>
 					<view class="icon more">&#xe8f2;</view>
 				</picker>
 				</picker>
-				<input v-else placeholder="请选择" v-model="item.goodsName" :disabled="true" disabled="true"/>
 			</view>
 			</view>
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable re">商品价格</view>
 				<view class="lable re">商品价格</view>
@@ -25,7 +24,6 @@
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable re">商品数量</view>
 				<view class="lable re">商品数量</view>
 				<input type="number" placeholder="请输入" v-model="item.stock" />
 				<input type="number" placeholder="请输入" v-model="item.stock" />
-				
 			</view>
 			</view>
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable re">净重</view>
 				<view class="lable re">净重</view>
@@ -39,12 +37,15 @@
 				<view class="ops" v-if="flag === '编辑商品'">{{ item.goodsUnits }}</view>
 				<view class="ops" v-if="flag === '编辑商品'">{{ item.goodsUnits }}</view>
 				<view class="ops" v-else>{{ item.unit }}</view>
 				<view class="ops" v-else>{{ item.unit }}</view>
 			</view>
 			</view>
-			<view class="form_group">
-				<view class="lable re">商品状态</view>
-				<picker :range="dict.goodsStatus" @change="picker($event, 'goodsStatus')">
-					<input placeholder="请选择" :value="item.goodsStatus" :disabled="true" />
-					<view class="icon more">&#xe8f2;</view>
-				</picker>
+		</view>
+		<view class="mfooter">
+			<view class="flex">
+				<view class="f">
+					<button class="save btn" @click="save(0)">下架</button>
+				</view>
+				<view class="f">
+					<button class="btn" @click="save(1)">一键发售</button>
+				</view>
 			</view>
 			</view>
 		</view>
 		</view>
 	</view>
 	</view>
@@ -55,106 +56,88 @@ export default {
 	data() {
 	data() {
 		return {
 		return {
 			flag: '新增商品',
 			flag: '新增商品',
-			item: {tradeAreaName:''},
-			dict: {
-				goodsType: ['水果', '药品', '茶叶'],
-				goodsUnits: ['吨', '个', '柜'],
-				goodsStatus: ['在售', '下架']
-			},
-			goodsList: [],
-			tradeAreaList: []
+			item: {}
 		};
 		};
 	},
 	},
 	onLoad(e) {
 	onLoad(e) {
 		if (e.id) {
 		if (e.id) {
-			this.flag = '编辑商品'
+			this.flag = '编辑商品';
 			this.http.request({
 			this.http.request({
 				url: '/level-one-server/app/TbGoodsTransit/getById?id=' + e.id,
 				url: '/level-one-server/app/TbGoodsTransit/getById?id=' + e.id,
 				success: res => {
 				success: res => {
 					this.item = res.data.data;
 					this.item = res.data.data;
-					this.item.goodsStatus = this.item.goodsStatus == 1 ? '在售' : '下架';
-					uni.setNavigationBarTitle({ title: '编辑商品' });
+					uni.setNavigationBarTitle({ title: this.item.goodsStatus == 1 ? '编辑商品(在售)' : '编辑商品(下架)' });
 				}
 				}
 			});
 			});
-		};
-		this.getGoodsList();
-		this.getTradeAreaList();
-	},
-	methods: {
-		picker(e, tag) {
-			this.item[tag] = this.dict[tag][e.detail.value];
-			this.$forceUpdate();
-		},
-		pickerGoods(e) {
-			this.item['goodsName'] = this.goodsList[e.detail.value].name;
-			this.item['unit'] = this.goodsList[e.detail.value].unit;
+		}
+		//选择互市回显
+		uni.$on('area', res => {
+			this.item.tradeAreaName = res.name;
+			this.item.tradeAreaId = res.id;
 			this.$forceUpdate();
 			this.$forceUpdate();
-			if(this.flag == '新增商品') {
-				this.item.id = this.goodsList[e.detail.value].id;
-
+		});
+		//选择商品回显
+		uni.$on('selects', res => {
+			this.item.goodsName = res.name;
+			this.item.unit = res.unit;
+			if (this.flag == '新增商品') {
+				this.item.id = res.id;
 			}
 			}
-		},
-		pickerTradeArea(e) {
-			this.item['tradeAreaName'] = this.tradeAreaList[e.detail.value].name;
 			this.$forceUpdate();
 			this.$forceUpdate();
-			this.item.tradeAreaId = this.tradeAreaList[e.detail.value].id;
+		});
+	},
+	methods: {
+		//选择互市区
+		selectArea() {
+			uni.navigateTo({ url: '/pages/market/one/merchant/goods/area' });
 		},
 		},
-		// 获取监管商品列表
-		getGoodsList() {
-			this.http.request({
-				url: '/level-one-server/app/TbGoods/getList',
-				method: 'POST',
-				success: res => {
-					this.goodsList = res.data.data;
-					console.log("监管商品列表",this.goodsList);
-				}
-			});
+		//选择商品
+		selectGoods() {
+			if (this.item.tradeAreaId) {
+				uni.navigateTo({ url: '/pages/market/one/merchant/goods/selects?tradeAreaId=' + this.item.tradeAreaId + '&tradeAreaName=' + this.item.tradeAreaName });
+			} else {
+				uni.showModal({ content: '请先选择互市区', showCancel: false });
+				return;
+			}
 		},
 		},
-		// 获取贸易区域列表
-		getTradeAreaList() {
+		save(goodsStatus) {
+			let rule = [
+				{ name: 'tradeAreaName', checkType: 'notnull', errorMsg: '请选择互市区' },
+				{ name: 'goodsName', checkType: 'notnull', errorMsg: '请选择商品' },
+				{ name: 'price', checkType: 'notnull', errorMsg: '请输入商品价格' },
+				{ name: 'stock', checkType: 'notnull', errorMsg: '请输入商品数量' },
+				{ name: 'netWeight', checkType: 'notnull', errorMsg: '请输入净重' },
+				{ name: 'grossWeight', checkType: 'notnull', errorMsg: '请输入毛重' }
+			];
+			if (!this.verify.check(this.item, rule)) {
+				uni.showModal({ content: this.verify.error, showCancel: false });
+				return false;
+			}
+			let action = this.flag == '新增商品' ? 'add' : 'update';
+			this.item.goodsStatus = goodsStatus;
+			delete this.item.createTime;
+			delete this.item.createBy;
+			delete this.item.createName;
 			this.http.request({
 			this.http.request({
-				url: '/level-one-server/app/TbTradeArea/getList',
+				url: '/level-one-server/app/TbGoodsTransit/' + action,
 				method: 'POST',
 				method: 'POST',
+				data: this.item,
 				success: res => {
 				success: res => {
-					this.tradeAreaList = res.data.data;
-					console.log("贸易区域列表",this.tradeAreaList);
+					uni.showToast({ title: '操作成功' });
+					setTimeout(() => {
+						uni.$emit('goodsHandle');
+						uni.navigateBack();
+					}, 1000);
 				}
 				}
 			});
 			});
 		}
 		}
-	},
-	onNavigationBarButtonTap() {
-		let rule = [
-			{ name: 'goodsName', checkType: 'notnull', errorMsg: '请输入商品名称' },
-			{ name: 'goodsStatus', checkType: 'notnull', errorMsg: '请选择状态' }
-		];
-		if (!this.verify.check(this.item, rule)) {
-			uni.showModal({ content: this.verify.error, showCancel: false });
-			return false;
-		}
-		this.item.goodsStatus = this.item.goodsStatus == '在售' ? 1 : 0;
-		let url = '';
-		if(this.flag == '新增商品') {
-			url = '/level-one-server/app/TbGoodsTransit/transactionGoods';
-		} else {
-			url = '/level-one-server/app/TbGoodsTransit/update';
-		}
-		delete this.item.createTime;
-		delete this.item.createBy;
-		delete this.item.createName;
-		this.http.request({
-			url: url,
-			method: 'POST',
-			data: this.item,
-			success: res => {
-				uni.showToast({ title: '操作成功' });
-				setTimeout(() => {
-					uni.$emit('goodsHandle');
-					uni.navigateBack();
-				}, 1000);
-			}
-		});
 	}
 	}
 };
 };
 </script>
 </script>
 
 
-<style lang="scss"></style>
+<style lang="scss">
+.btn {
+	width: 100%;
+	border-radius: 5px;
+}
+</style>

+ 95 - 0
pages/market/one/merchant/goods/area.vue

@@ -0,0 +1,95 @@
+<template>
+	<view>
+		<view class="list">
+			<view class="search">
+				<u-search placeholder="搜索互市" v-model="param.name" bgColor="white" @search="refresh()" :animation="true" actionText="取消" @clear="refresh()"></u-search>
+			</view>
+			<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
+				<view class="title omit">{{ item.name }}</view>
+				<view class="desc">{{ item.address }}</view>
+			</view>
+			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
+			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			param: { pageNo: 1, pageSize: 20 },
+			list: [],
+			loadMore: true
+		};
+	},
+	onLoad(e) {
+		this.getData();
+	},
+	methods: {
+		getData() {
+			this.http.request({
+				url: '/level-one-server/app/TbTradeArea/getList',
+				loading: 'false',
+				data: this.param,
+				success: res => {
+					this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
+					this.list.push(...res.data.data);
+					uni.setNavigationBarTitle({ title: '互市选择(' + res.data.dataCount + ')' });
+				}
+			});
+		},
+		detail(item) {
+			uni.$emit('area', item);
+			uni.navigateBack();
+		},
+		//刷新数据
+		refresh() {
+			this.loadMore = true;
+			this.param.pageNo = 1;
+			this.list = [];
+			this.getData();
+		}
+	},
+	//下拉刷新
+	onPullDownRefresh() {
+		setTimeout(() => {
+			this.refresh();
+			uni.stopPullDownRefresh();
+		}, 1000);
+	},
+	//上拉加载
+	onReachBottom() {
+		if (this.loadMore) {
+			this.param.pageNo++;
+			this.getData();
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+page {
+	background-color: $pg;
+}
+.list {
+	padding: 12px;
+	.search {
+		padding-top: 0px;
+	}
+	.item {
+		padding: 13px;
+		background-color: white;
+		margin-bottom: 10px;
+		border-radius: 5px;
+		.title {
+			font-weight: bold;
+		}
+		.desc {
+			padding-top: 5px;
+			font-size: 14px;
+			color: #7a7a7a;
+		}
+	}
+}
+</style>

+ 0 - 41
pages/market/one/merchant/goods/list.vue

@@ -55,18 +55,6 @@
 			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
 			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
 			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
 			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
 		</view>
 		</view>
-		<view class="mfooter">
-			<view class="order">
-				<view class="f bage">
-					<text class="icon">&#xe830;</text>
-					<text>你有新的订单待处理</text>
-				</view>
-				<view class="f op" @click="order()">
-					<text class="icon">&#xe67b;</text>
-					<text>查看订单</text>
-				</view>
-			</view>
-		</view>
 	</view>
 	</view>
 </template>
 </template>
 
 
@@ -129,9 +117,6 @@ export default {
 		edit(id) {
 		edit(id) {
 			uni.navigateTo({ url: '/pages/market/one/merchant/goods/add?id=' + id });
 			uni.navigateTo({ url: '/pages/market/one/merchant/goods/add?id=' + id });
 		},
 		},
-		order() {
-			uni.navigateTo({ url:'/pages/market/one/merchant/order/list' });
-		},
 		//刷新数据
 		//刷新数据
 		refresh() {
 		refresh() {
 			this.loadMore = true;
 			this.loadMore = true;
@@ -164,30 +149,4 @@ export default {
 page {
 page {
 	background-color: $pg;
 	background-color: $pg;
 }
 }
-.goodsManageList {
-	padding-bottom: 55px;
-}
-.mfooter {
-	.order {
-		display: flex;
-		.f {
-			flex: 1;
-			padding: 16px;
-		}
-		.bage {
-			color: #f44336;
-			text-align: left;
-			font-size: 14px;
-		}
-		.op {
-			background-color: $main-color;
-			color: white;
-			flex: 0.5;
-		}
-		.icon {
-			padding-right: 5px;
-		}
-	}
-}
 </style>
 </style>
-s

+ 110 - 0
pages/market/one/merchant/goods/selects.vue

@@ -0,0 +1,110 @@
+<template>
+	<view>
+		<view class="list">
+			<view class="search">
+				<u-search :placeholder="'搜索'+param.tradeAreaName+'商品'" v-model="param.name" bgColor="white" @search="refresh()" :animation="true" actionText="取消" @clear="refresh()"></u-search>
+			</view>
+			<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
+				<view class="title omit">{{ item.name }}</view>
+				<view class="desc">
+					<text>{{ item.typeNames }}</text>
+					<text>{{ item.unit }}</text>
+					<text>{{ item.source }}</text>
+				</view>
+			</view>
+			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
+			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			param: { pageNo: 1, pageSize: 20 },
+			list: [],
+			loadMore: true
+		};
+	},
+	onLoad(e) {
+		//商品要和互市区对应
+		if (e.tradeAreaId) {
+			this.param.tradeAreaId = e.tradeAreaId;
+			this.param.tradeAreaName = e.tradeAreaName;
+		}
+		this.getData();
+	},
+	methods: {
+		getData() {
+			this.http.request({
+				url: '/level-one-server/app/TbGoods/getList',
+				loading: 'false',
+				data: this.param,
+				success: res => {
+					this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
+					this.list.push(...res.data.data);
+					uni.setNavigationBarTitle({ title: '商品选择(' + res.data.dataCount + ')' });
+				}
+			});
+		},
+		detail(item) {
+			uni.$emit('selects', item);
+			uni.navigateBack();
+		},
+		//刷新数据
+		refresh() {
+			this.loadMore = true;
+			this.param.pageNo = 1;
+			this.list = [];
+			this.getData();
+		}
+	},
+	//下拉刷新
+	onPullDownRefresh() {
+		setTimeout(() => {
+			this.refresh();
+			uni.stopPullDownRefresh();
+		}, 1000);
+	},
+	//上拉加载
+	onReachBottom() {
+		if (this.loadMore) {
+			this.param.pageNo++;
+			this.getData();
+		}
+	},
+	onNavigationBarButtonTap() {
+		uni.navigateTo({ url: '/pages/market/one/merchant/goods/add' });
+	}
+};
+</script>
+
+<style lang="scss">
+page {
+	background-color: $pg;
+}
+.list {
+	padding: 12px;
+	.search {
+		padding-top: 0px;
+	}
+	.item {
+		padding: 13px;
+		background-color: white;
+		margin-bottom: 10px;
+		border-radius: 5px;
+		.title {
+			font-weight: bold;
+		}
+		.desc {
+			padding-top: 5px;
+			font-size: 14px;
+			color: #7a7a7a;
+			text {
+				padding-right: 15px;
+			}
+		}
+	}
+}
+</style>

+ 2 - 2
pages/market/two/purchaser/address/list.vue

@@ -5,8 +5,8 @@
 				<view class="con">
 				<view class="con">
 					<view class="title omit">{{item.province}} {{item.city}} {{item.area}} {{item.street}}</view>
 					<view class="title omit">{{item.province}} {{item.city}} {{item.area}} {{item.street}}</view>
 					<view class="desc">
 					<view class="desc">
-						<text>陈晓东</text>
-						<text>13481076556</text>
+						<text>{{item.name}}</text>
+						<text>{{item.phone}}</text>
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="icon">&#xe8f2;</view>
 				<view class="icon">&#xe8f2;</view>

+ 78 - 36
pages/market/two/purchaser/buy/add.vue

@@ -1,50 +1,52 @@
 <template>
 <template>
 	<view>
 	<view>
 		<view class="address" @click="address()">
 		<view class="address" @click="address()">
-			<view class="con">
-				<view class="title omit">云南省普洱市思茅区普洱路云南省普洱市思茅区普洱路36号云南省普洱市思茅区普洱路云南省普洱市思茅区普洱路</view>
+			<view class="con" v-if="item.addressName">
+				<view class="title omit">{{ item.addressName }}</view>
 				<view class="desc">
 				<view class="desc">
-					<text>陈晓东</text>
-					<text>13481076556</text>
+					<text>{{ item.name }}</text>
+					<text>{{ item.phone }}</text>
+				</view>
+			</view>
+			<view class="con" v-else>
+				<view class="title omit">你还没添加收货地址</view>
+				<view class="desc">
+					<text>点击添加地址</text>
 				</view>
 				</view>
 			</view>
 			</view>
 			<view class="icon">&#xe8f2;</view>
 			<view class="icon">&#xe8f2;</view>
-			<view class="clear"></view>
 		</view>
 		</view>
 		<view class="forms">
 		<view class="forms">
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable re">互市区</view>
 				<view class="lable re">互市区</view>
-				<picker :range="dict.city" @change="picker($event, 'city')">
-					<input placeholder="请选择" v-model="item.city" :disabled="true" />
+				<picker :range="tradeAreaList" @change="picker($event, 'tradeAreaName')" range-key="name">
+					<input placeholder="请选择" v-model="item.tradeAreaName" :disabled="true" />
 					<view class="icon more">&#xe8f2;</view>
 					<view class="icon more">&#xe8f2;</view>
 				</picker>
 				</picker>
 			</view>
 			</view>
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable re">收购商品</view>
 				<view class="lable re">收购商品</view>
-				<picker :range="dict.city" @change="picker($event, 'city')">
-					<input placeholder="请选择" v-model="item.city" :disabled="true" />
+				<picker @click="selectGoods()" :disabled="true">
+					<input placeholder="请选择" v-model="item.goodsName" :disabled="true" />
 					<view class="icon more">&#xe8f2;</view>
 					<view class="icon more">&#xe8f2;</view>
 				</picker>
 				</picker>
 			</view>
 			</view>
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable">商品编号</view>
 				<view class="lable">商品编号</view>
-				<input placeholder="请输入" v-model="item.typeCode" />
+				<input placeholder="请输入" v-model="item.goodsNo" />
 			</view>
 			</view>
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable re">计价单位</view>
 				<view class="lable re">计价单位</view>
-				<picker :range="dict.city" @change="picker($event, 'city')">
-					<input placeholder="请选择" v-model="item.city" :disabled="true" />
-					<view class="icon more">&#xe8f2;</view>
-				</picker>
+				<input placeholder="请输入" v-model="item.goodsUnit" :disabled="true" />
 			</view>
 			</view>
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable re">数量</view>
 				<view class="lable re">数量</view>
-				<input placeholder="请输入" v-model="item.typeCode" />
+				<input type="number" placeholder="请输入" v-model="item.goodsQuantity" />
 			</view>
 			</view>
 			<view class="form_group">
 			<view class="form_group">
 				<view class="lable re">到货日期</view>
 				<view class="lable re">到货日期</view>
-				<picker mode="date" @change="picker($event, 'date')">
-					<input placeholder="请选择" v-model="item.date" :disabled="true" />
+				<picker mode="date" @change="picker($event, 'arrivalTime')">
+					<input placeholder="请选择" v-model="item.arrivalTime" :disabled="true" />
 					<view class="icon more">&#xe8f2;</view>
 					<view class="icon more">&#xe8f2;</view>
 				</picker>
 				</picker>
 			</view>
 			</view>
@@ -52,63 +54,103 @@
 		<view class="mfooter">
 		<view class="mfooter">
 			<view class="flex">
 			<view class="flex">
 				<view class="f">
 				<view class="f">
-					<button class="save btn" @click="save()">保存</button>
+					<button class="save btn" @click="save(0)">保存</button>
 				</view>
 				</view>
 				<view class="f">
 				<view class="f">
-					<button class="btn" @click="save()">一键发布</button>
+					<button class="btn" @click="save(1)">一键发布</button>
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
 	</view>
 	</view>
 </template>
 </template>
-
 <script>
 <script>
 export default {
 export default {
 	data() {
 	data() {
 		return {
 		return {
 			item: {},
 			item: {},
-			dict: {
-				city: ['东兴市', '贵港市']
-			}
+			tradeAreaList: []
 		};
 		};
 	},
 	},
 	onLoad(e) {
 	onLoad(e) {
 		if (e.id) {
 		if (e.id) {
 			this.http.request({
 			this.http.request({
-				url: '/level-one-server/app/TbPortNews/getPortNewsDetails',
-				data: { id: e.id },
+				url: '/level-two-server/app/TbGoodsDemand/getById?id=' + e.id,
 				success: res => {
 				success: res => {
 					this.item = res.data.data;
 					this.item = res.data.data;
+					uni.setNavigationBarTitle({ title: '编辑求购信息' });
 				}
 				}
 			});
 			});
 		}
 		}
-		uni.$on('selectAddress', res => {});
+		this.getTradeAreaList();
+		//选择地址回显
+		uni.$on('selectAddress', res => {
+			this.item.addressName = res.province + ' ' + res.city + ' ' + res.area + ' ' + res.street;
+			this.item.name = res.name;
+			this.item.phone = res.phone;
+			this.$forceUpdate();
+		});
+		//选择商品回显
+		uni.$on('selects', res => {
+			this.item.goodsName = res.name;
+			this.item.levelOneGoodsId = res.id;
+			this.item.goodsImg = res.avatar;
+			this.item.goodsNo = res.code;
+			this.item.goodsUnit = res.unit;
+			this.$forceUpdate();
+		});
 	},
 	},
 	methods: {
 	methods: {
+		// 获取贸易区域列表
+		getTradeAreaList() {
+			this.http.request({
+				url: '/level-one-server/app/TbTradeArea/getList',
+				success: res => {
+					this.tradeAreaList = res.data.data;
+				}
+			});
+		},
 		//选择地址
 		//选择地址
 		address() {
 		address() {
 			uni.navigateTo({ url: '/pages/market/two/purchaser/address/list?select=true' });
 			uni.navigateTo({ url: '/pages/market/two/purchaser/address/list?select=true' });
 		},
 		},
+		//选择商品
+		selectGoods() {
+			if (this.item.tradeAreaId) {
+				uni.navigateTo({ url: '/pages/market/one/merchant/goods/selects?tradeAreaId=' + this.item.tradeAreaId + '&tradeAreaName=' + this.item.tradeAreaName });
+			} else {
+				uni.showModal({ content: '请先选择互市区', showCancel: false });
+				return;
+			}
+		},
 		picker(e, tag) {
 		picker(e, tag) {
-			if (tag == 'date') {
+			if (tag == 'arrivalTime') {
 				this.item[tag] = e.detail.value;
 				this.item[tag] = e.detail.value;
-			} else {
-				this.item[tag] = this.dict[tag][e.detail.value];
+			}
+			if (tag == 'tradeAreaName') {
+				this.item.tradeAreaName = this.tradeAreaList[e.detail.value].name;
+				this.item.tradeAreaId = this.tradeAreaList[e.detail.value].id;
 			}
 			}
 			this.$forceUpdate();
 			this.$forceUpdate();
 		},
 		},
-		save() {
-			/* let rule = [
-				{ name: 'typeCode', checkType: 'notnull', errorMsg: '请输入编码' },
-				{ name: 'typeName', checkType: 'notnull', errorMsg: '请输入名称' },
-				{ name: 'status', checkType: 'notnull', errorMsg: '请选择状态' }
+		//保存或发布
+		save(isRelease) {
+			let rule = [
+				{ name: 'tradeAreaName', checkType: 'notnull', errorMsg: '请选择互市区' },
+				{ name: 'goodsName', checkType: 'notnull', errorMsg: '请选择商品' },
+				{ name: 'addressName', checkType: 'notnull', errorMsg: '请选择地址' },
+				{ name: 'goodsQuantity', checkType: 'notnull', errorMsg: '请输入数量' },
+				{ name: 'arrivalTime', checkType: 'notnull', errorMsg: '请选择到货日期' }
 			];
 			];
 			if (!this.verify.check(this.item, rule)) {
 			if (!this.verify.check(this.item, rule)) {
 				uni.showModal({ content: this.verify.error, showCancel: false });
 				uni.showModal({ content: this.verify.error, showCancel: false });
 				return false;
 				return false;
 			}
 			}
+			this.item.isRelease = isRelease;
+			delete this.item.createTime;
+			delete this.item.updateTime;
+			let action = this.item.id ? 'update' : 'add';
 			this.http.request({
 			this.http.request({
-				url: '/project/projectType',
+				url: '/level-two-server/app/TbGoodsDemand/' + action,
 				method: 'POST',
 				method: 'POST',
 				data: this.item,
 				data: this.item,
 				success: res => {
 				success: res => {
@@ -118,7 +160,7 @@ export default {
 						uni.navigateBack();
 						uni.navigateBack();
 					}, 1000);
 					}, 1000);
 				}
 				}
-			}); */
+			});
 		}
 		}
 	}
 	}
 };
 };

+ 24 - 30
pages/market/two/purchaser/buy/detail.vue

@@ -4,56 +4,48 @@
 			<view class="box order_detail" style="margin-top: 0px">
 			<view class="box order_detail" style="margin-top: 0px">
 				<view class="item">
 				<view class="item">
 					<text class="label">收购状态</text>
 					<text class="label">收购状态</text>
-					<text class="desc">
+					<text class="desc" v-if="item.isOrders == 0">
 						<text class="icon">&#xe830;</text>
 						<text class="icon">&#xe830;</text>
-						<text>未接单</text>
+						<text >未接单</text>
+					</text>
+					<text class="desc" v-else>
+						<text class="icon" style="color: #13ce66">&#xe830;</text>
+						<text >已接单</text>
 					</text>
 					</text>
 				</view>
 				</view>
 			</view>
 			</view>
 			<view class="box order_detail">
 			<view class="box order_detail">
 				<view class="item">
 				<view class="item">
 					<text class="label">收购商品</text>
 					<text class="label">收购商品</text>
-					<text class="desc">越南榴莲</text>
-				</view>
-				<view class="item">
-					<text class="label">商品编号</text>
-					<text class="desc">xxx093</text>
-				</view>
-				<view class="item">
-					<text class="label">商品名称</text>
-					<text class="desc">胡椒粉</text>
-				</view>
-				<view class="item">
-					<text class="label">计价单位</text>
-					<text class="desc">吨</text>
+					<text class="desc">{{ item.goodsName }}</text>
 				</view>
 				</view>
 				<view class="item">
 				<view class="item">
 					<text class="label">数量</text>
 					<text class="label">数量</text>
-					<text class="desc">34吨</text>
+					<text class="desc">{{ item.goodsQuantity }}</text>
 				</view>
 				</view>
 				<view class="item">
 				<view class="item">
-					<text class="label">到货日期</text>
-					<text class="desc">2023-07-20</text>
+					<text class="label">发布时间</text>
+					<text class="desc">{{ item.goodsDemandTime }}</text>
 				</view>
 				</view>
 				<view class="item">
 				<view class="item">
-					<text class="label">创建时间</text>
-					<text class="desc">2023-07-20 11:38</text>
+					<text class="label">接单组名</text>
+					<text class="desc">{{ item.groupName }}</text>
 				</view>
 				</view>
 				<view class="item">
 				<view class="item">
-					<text class="label">发布时间</text>
-					<text class="desc">2023-07-20 11:38</text>
+					<text class="label">接单组长</text>
+					<text class="desc">{{ item.createName }}</text>
 				</view>
 				</view>
 				<view class="item">
 				<view class="item">
-					<text class="label">接单人</text>
-					<text class="desc">貔貅</text>
+					<text class="label">组长备注</text>
+					<text class="desc">{{ item.remark }}</text>
 				</view>
 				</view>
 				<view class="item">
 				<view class="item">
 					<text class="label">出价金额</text>
 					<text class="label">出价金额</text>
-					<text class="desc">350000元</text>
+					<text class="desc">{{ item.quotation }}</text>
 				</view>
 				</view>
 				<view class="item">
 				<view class="item">
-					<text class="label">接单时间</text>
-					<text class="desc">2023-07-20 11:38</text>
+					<text class="label">报价时间</text>
+					<text class="desc">{{ item.createTime }}</text>
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
@@ -69,12 +61,14 @@ export default {
 	},
 	},
 	onLoad(e) {
 	onLoad(e) {
 		if (e.id) {
 		if (e.id) {
-			/* 			this.http.request({
-				url: '/level-one-server/app/TbPortNews/getPortNewsDetails?id=' + e.id,
+			this.http.request({
+				url: '/level-one-server/app/TbPortNews/goodsDemandDetail',
+				data: {id: e.id},
+				loading: 'false',
 				success: res => {
 				success: res => {
 					this.item = res.data.data;
 					this.item = res.data.data;
 				}
 				}
-			}); */
+			});
 		}
 		}
 	},
 	},
 	methods: {}
 	methods: {}