瀏覽代碼

前端小程序 sdy

zhongtianhaoyuan 3 年之前
父節點
當前提交
6b67e79abd
共有 3 個文件被更改,包括 286 次插入127 次删除
  1. 258 110
      pageD/myRelease/buyGrain.vue
  2. 27 16
      pages/release/release.vue
  3. 1 1
      pages/user/user.vue

+ 258 - 110
pageD/myRelease/buyGrain.vue

@@ -3,187 +3,169 @@
 		<view class="c-row b-b">
 			<text class="tit">名头</text>
 			<view class="con-list">
-				<input placeholder="请填写名头" name="input" @input="addressInput"></input>
+				<input placeholder="请填写名头" name="input" v-model="deptList.procurementPlanNo"></input>
 			</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">标题</text>
 			<view class="con-list">
-				<input placeholder="请填写标题,2-16个子" name="input" @input="addressInput"></input>
+				<input placeholder="请填写标题,2-16个字" name="input" v-model="deptList.title"></input>
 			</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">货名</text>
 			<view class="con-list">
-				<input placeholder="请填写货名" name="input" @input="addressInput"></input>
+				<input placeholder="请填写货名" name="input" v-model="deptList.goodsName"></input>
 			</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">采购量(吨)</text>
 			<view class="con-list">
-				<input placeholder="请填写出售重量" name="input" @input="addressInput"></input>
+				<input placeholder="请填写采购重量" name="input" v-model="deptList.plannedPurchaseVolume"></input>
 			</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">最小成交量(吨)</text>
 			<view class="con-list">
-				<input placeholder="请填写最小成交量" name="input" @input="addressInput"></input>
+				<input placeholder="请填写最小成交量" name="input" v-model="deptList.minimumVolume"></input>
 			</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">类型</text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="picker">
+			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list"
+				>
+				<view class="picker" v-model="deptList.procurementPlanType">
 					{{typesIndex>-1?typesType[typesIndex]:'请选择类型'}}
 				</view>
 			</picker>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">价格类型</text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
 				<view class="con-list">
-					<input placeholder="请填写价格类型" name="input" @input="addressInput"></input>
+					<!-- <input placeholder="请填写价格类型" name="input"  v-model="deptList.priceType"></input> -->
+					{{deptList.priceType}}
 				</view>
-			</picker>
 		</view>
-		<view class="c-row b-b">
+		<view class="c-row b-b" v-if="this.typesIndex != 1">
 			<text class="tit">单价(元/吨)</text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写单价(元/吨)" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+			<view class="con-list">
+				<input placeholder="请填写单价(元/吨)" name="input" v-model="deptList.unitPrice"></input>
+			</view>
+		</view>
+		<view class="c-row b-b" v-if="this.typesIndex == 1">
+			<text class="tit">基差(元/吨)</text>
+			<view class="con-list">
+				<input placeholder="请填写单价(元/吨)" name="input" v-model="deptList.basisPrice"></input>
+			</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">收货地区</text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写发货地区" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+			<view class="con-list">
+				<input placeholder="请填写收货地区" name="input" v-model="deptList.receiveArea"></input>
+			</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">买方手机号</text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写卖方手机号" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+			<view class="con-list">
+				<input placeholder="请填写卖方手机号" name="input" v-model="deptList.buyerPhone"></input>
+			</view>
 		</view>
 		<view class="c-row b-b">
 			<button type="default">获取验证码</button>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写6位短信验证码" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+			<view class="con-list">
+				<input placeholder="请填写6位短信验证码" name="input" v-model="deptList.title1"></input>
+			</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">水分(%)<= </text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写水分占比" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+					<view class="con-list">
+						<input placeholder="请填写水分占比" name="input" v-model="deptList.waterContent"></input>
+					</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">容重(g/L)<= </text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写容重" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+					<view class="con-list">
+						<input placeholder="请填写容重" name="input" v-model="deptList.bulkDensity"></input>
+					</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">热损伤(%)<= </text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写热损伤占比" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+					<view class="con-list">
+						<input placeholder="请填写热损伤占比" name="input" v-model="deptList.jiaorenli"></input>
+					</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">杂质(%)<= </text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写杂质占比" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+					<view class="con-list">
+						<input placeholder="请填写杂质占比" name="input" v-model="deptList.impurity"></input>
+					</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">霉变粒(%)<= </text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写霉变粒占比" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+					<view class="con-list">
+						<input placeholder="请填写霉变粒占比" name="input" v-model="deptList.mildewGrain"></input>
+					</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">不完整粒(%)<= </text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写不完整粒占比" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+					<view class="con-list">
+						<input placeholder="请填写不完整粒占比" name="input" v-model="deptList.imperfectGrain"></input>
+					</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">蛋白(%)<= </text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
-				<view class="con-list">
-					<input placeholder="请填写蛋白占比" name="input" @input="addressInput"></input>
-				</view>
-			</picker>
+					<view class="con-list">
+						<input placeholder="请填写蛋白占比" name="input" v-model="deptList.protein"></input>
+					</view>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">粒型 </text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
+			<picker @change="liChange" :value="liIndex" :range="liType" class="con-list" v-model="deptList.grain">
 				<view class="con-list">
-					<input placeholder="请填写粒型" name="input" @input="addressInput"></input>
+					{{liIndex>-1?liType[liIndex]:'请选择粒型'}}
 				</view>
 			</picker>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">品级 </text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
+			<picker @change="pinChange" :value="pinIndex" :range="pinType" class="con-list">
 				<view class="con-list">
-					<input placeholder="请填写品级" name="input" @input="addressInput"></input>
+					{{pinIndex>-1?pinType[pinIndex]:'请选择品级'}}
 				</view>
 			</picker>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">产出年份</text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
+			<picker @change="nianChange" :value="nianIndex" :range="nianType" class="con-list">
 				<view class="con-list">
-					<input placeholder="请填写产出年份" name="input" @input="addressInput"></input>
+					{{nianIndex>-1?nianType[nianIndex]:'请选择产出年份'}}
 				</view>
 			</picker>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">包装方式</text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
+			<picker @change="baoChange" :value="baoIndex" :range="baoType" class="con-list">
 				<view class="con-list">
-					<input placeholder="请填写包装方式" name="input" @input="addressInput"></input>
+					{{baoIndex>-1?baoType[baoIndex]:'请选择包装方式'}}
 				</view>
 			</picker>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">袋装备注</text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
 				<view class="con-list">
-					<input placeholder="请填写包装方式" name="input" @input="addressInput"></input>
+					<input placeholder="请填写袋装备注" name="input" v-model="deptList.baggingNotes"></input>
 				</view>
-			</picker>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">运费承担方</text>
-			<picker @change="typeChange" :value="typesIndex" :range="typesType" class="con-list">
+			<picker @change="chengChange" :value="chengIndex" :range="chengType" class="con-list">
 				<view class="con-list">
-					<input placeholder="请填写包装方式" name="input" @input="addressInput"></input>
+					{{chengIndex>-1?chengType[chengIndex]:'请选择运费承担方'}}
 				</view>
 			</picker>
 		</view>
-		
-		<button type="default">发布</button>
+
+		<button @click="commit()">发布</button>
 	</view>
 </template>
 
@@ -191,51 +173,217 @@
 	export default {
 		data() {
 			return {
-				types:'',
-				typesType:["现货","期货"],
-		
+				types: '',
+				typesType: ["现货", "期货"],
+				typesIndex: 0,
+				deptList: {
+					priceType: "定价采购",
+					procurementPlanType:"现货",
+					grain:"塔粮",
+					grade:"不限(默认)",
+					outputYear:"2020",
+					packingType:"不限(默认)",
+					freightPayer:"",
+				},
+				insertProcurementPlanInfo: {},
+				liIndex: 0,
+				liType: ['塔粮', '筛粮', '中粒', '大粒'],
+				pinIndex: 0,
+				pinType: ['不限(默认)', '一等品', '二等品', '三等品', '等外'],
+				nianIndex: 3,
+				nianType: ['2023', '2022', '2021', '2020', '2019', '2018', '2017', '2016', '2015', '2014', '2013', '2012',
+					'2011'
+				],
+				baoIndex: 0,
+				baoType: ['不限(默认)', '散装', '大袋', '小袋'],
+				chengIndex: -1,
+				chengType: ['可议', '买方承担', '卖方承担']
 			}
 		},
 		methods: {
-			typeChange(e){
+			typeChange(e) {
 				this.typesIndex = e.detail.value
 				this.types = this.typesType[this.typesIndex];
+				this.deptList.procurementPlanType = this.typesType[this.typesIndex];
+				if (this.typesIndex == 0) {
+					this.deptList.priceType = '定价采购'
+				} else {
+					this.deptList.priceType = '期货盘面价+基差'
+				}
+
+			},
+			commit() {
+				this.insertProcurementPlanInfo = this.deptList
+				// if (!this.deptList.goodsName) {
+				// 	this.$api.msg('货名1不能为空')
+				// 	return
+				// }
+			// 	if (!this.deptList.title) {
+			// 		this.$api.msg('标题不能为空')
+			// 		return
+			// 	}
+				if (!this.deptList.goodsName) {
+					this.$api.msg('货名不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.plannedPurchaseVolume) {
+					this.$api.msg('采购量不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.minimumVolume) {
+					this.$api.msg('最小成交量不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.procurementPlanType) {
+					this.$api.msg('类型不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.priceType) {
+					this.$api.msg('价格类型不能为空')
+					return
+				}
+				if(this.insertProcurementPlanInfo.procurementPlanType == '现货'){
+					if (!this.insertProcurementPlanInfo.unitPrice) {
+						this.$api.msg('单价不能为空')
+						return
+					}
+				}else if(this.insertProcurementPlanInfo.procurementPlanType == '期货'){
+					if (!this.insertProcurementPlanInfo.basisPrice) {
+						this.$api.msg('基差(元/吨)不能为空')
+						return
+					}
+				}
+			
+				if (!this.insertProcurementPlanInfo.buyerPhone) {
+					this.$api.msg('买方手机号不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.waterContent) {
+					this.$api.msg('水分不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.bulkDensity) {
+					this.$api.msg('容重不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.jiaorenli) {
+					this.$api.msg('热损伤不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.impurity) {
+					this.$api.msg('杂质不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.mildewGrain) {
+					this.$api.msg('霉变粒不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.imperfectGrain) {
+					this.$api.msg('不完整粒不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.bulkDensity) {
+					this.$api.msg('蛋白不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.grain) {
+					this.$api.msg('粒型不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.grade) {
+					this.$api.msg('品级不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.outputYear) {
+					this.$api.msg('产出年份不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.packingType) {
+					this.$api.msg('包装方式不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.baggingNotes) {
+					this.$api.msg('装袋备注不能为空')
+					return
+				}
+				if (!this.insertProcurementPlanInfo.freightPayer) {
+					this.$api.msg('运费承担方不能为空')
+					return
+				}
+				this.$api.doRequest('post', '/procurementPlanInfo/api/insertProcurementPlanInfo', this
+						.insertProcurementPlanInfo).then(res => {
+						console.log("添加成功")
+						this.procurementPlanInfos = res.data.data
+					})
+					.catch(res => {
+						uni.showToast({
+							title: res.errmsg,
+							icon: 'none',
+							duration: 2000
+						})
+					});
+			},
+			liChange(e) {
+				this.liIndex = e.detail.value
+				this.litypes = this.typesType[this.liIndex];
+				this.deptList.grain = this.typesType[this.liIndex]
+			},
+			pinChange(e) {
+				this.pinIndex = e.detail.value
+				this.pintypes = this.pinType[this.pinIndex];
+				this.deptList.grade = this.pinType[this.pinIndex]
+			},
+			nianChange(e) {
+				this.nianIndex = e.detail.value
+				this.niantypes = this.nianType[this.nianIndex];
+				this.deptList.outputYear = this.baoType[this.baoIndex]
+			},
+
+			baoChange(e) {
+				this.baoIndex = e.detail.value
+				this.baotypes = this.baoType[this.baoIndex];
+				this.deptList.packingType =his.chengType[this.chengIndex];
+			},
+			chengChange(e) {
+				this.chengIndex = e.detail.value
+				this.chengtypes = this.chengType[this.chengIndex];
+					this.deptList.freightPayer = this.chengType[this.chengIndex];
 			}
 		}
 	}
 </script>
 
 <style>
-	.center{
+	.center {
 		padding: 10px 20px;
 	}
+
 	.c-row {
-	    display: -webkit-box;
-	    display: -webkit-flex;
-	    display: flex;
-	    -webkit-box-align: center;
-	    -webkit-align-items: center;
-	    align-items: center;
-	    padding: 20rpx 30rpx;
-	    position: relative;
+		display: -webkit-box;
+		display: -webkit-flex;
+		display: flex;
+		-webkit-box-align: center;
+		-webkit-align-items: center;
+		align-items: center;
+		padding: 20rpx 30rpx;
+		position: relative;
 	}
+
 	.con-list {
-	    -webkit-box-flex: 1;
-	    -webkit-flex: 1;
-	    flex: 1;
-	    display: -webkit-box;
-	    display: -webkit-flex;
-	    display: flex;
-	    -webkit-box-orient: vertical;
-	    -webkit-box-direction: normal;
-	    -webkit-flex-direction: column;
-	    flex-direction: column;
-	    color: #303133;
-	    line-height: 40rpx;
-	    text-align: right;
-	    padding-right: 20rpx;
+		-webkit-box-flex: 1;
+		-webkit-flex: 1;
+		flex: 1;
+		display: -webkit-box;
+		display: -webkit-flex;
+		display: flex;
+		-webkit-box-orient: vertical;
+		-webkit-box-direction: normal;
+		-webkit-flex-direction: column;
+		flex-direction: column;
+		color: #303133;
+		line-height: 40rpx;
+		text-align: right;
+		padding-right: 20rpx;
 		font-size: 14px;
 	}
-
-
 </style>

+ 27 - 16
pages/release/release.vue

@@ -11,20 +11,25 @@
 			</view>
 		</view>
 		<!-- <button type="default" class="fabuBut" @change="releaseChange">发布 -->
-		<view class="c-row b-b">
+		<!-- <view class="c-row b-b">
 			<text class="tit" >发布</text>
-			<!-- <view class="con-list"> -->
+
 			<picker @change="releaseChange" :value="releaseIndex" :range="releaseType" class="con-list">
 				<view class="picker " >
 					{{releaseIndex>-1?releaseType[releaseIndex]:'请选择发布内容'}}
 				</view>
 			</picker>
-			<!-- </view> -->
-		</view>
+	
+		</view> -->
 		<!-- </button> -->
 		<view class="page-bottom">
 			<view class="action-btn-group">
-				<button  type="primary" class=" action-btn no-border add-cart-btn" @click="tradeNow">发布</button>
+				<picker style='display:inline-block;' @change="releaseChange" :value="releases" :range="releaseType">
+					<button  type="primary" class=" action-btn no-border add-cart-btn" >发布</button>
+					<view class="picker">
+						{{releases>-1?releaseType[releases]:''}}
+					</view>
+				</picker>
 			</view>
 		</view>
 	</view>
@@ -36,6 +41,8 @@
 			return {
 				releaseType:["我要卖粮","我要买粮"],
 				release:'',
+				releases:'',
+				receivePrivate:'',
 				procurementPlanInfo:{
 					pageSize:10,
 					currentPage:1
@@ -44,6 +51,7 @@
 				pageSize:10,
 				currentPage:1,
 				procurementPlanInfos:[],
+				
 
 
 			}
@@ -53,17 +61,20 @@
 		},
 		methods: {
 			releaseChange(e){
-					this.releaseIndex = e.detail.value
-					this.release = this.releaseType[this.releaseIndex];
-						if(this.release == "我要卖粮"){
-							uni.navigateTo({
-								url: `/pageD/myRelease/sellGrain`
-							})
-						}else if(this.release == "我要买粮"){
-							uni.navigateTo({
-								url: `/pageD/myRelease/buyGrain`
-							})
-						}
+				this.receivePrivate = e.detail.value
+				this.release = this.releaseType[this.receivePrivate];
+				this.pageSize = 1
+
+				if(this.release == "我要卖粮"){
+					uni.navigateTo({
+						url: `/pageD/myRelease/sellGrain`
+					})
+				}else if(this.release == "我要买粮"){
+					uni.navigateTo({
+						url: `/pageD/myRelease/buyGrain`
+					})
+				}
+			
 			},
 			details(item){
 				uni.navigateTo({

+ 1 - 1
pages/user/user.vue

@@ -202,7 +202,7 @@
 							name: '我的发布',
 							icon:'cuIcon-news',
 							tips: 0,
-							url:'pages/release/release',
+							url:`pages/release/release`,
 							show:true
 						},
 						{