Browse Source

Merge branch 'master' of http://git.zthymaoyi.com/gdc/yiliangyiyun-app

gjy 3 years ago
parent
commit
cf82327dea
2 changed files with 70 additions and 14 deletions
  1. 32 4
      pageD/myRelease/buyGrain.vue
  2. 38 10
      pageD/myRelease/sellGrain.vue

+ 32 - 4
pageD/myRelease/buyGrain.vue

@@ -4,7 +4,7 @@
 			<view class="c-row b-b">
 				<text class="tit">名头</text>
 				<view class="con-list">
-					<text @click="navToDetailPage">{{deptList.procurementPlanNo}}</text>
+					<text @click="navToDetailPage">{{deptList.buyer}}</text>
 				</view>
 			</view>
 			<view class="c-row b-b">
@@ -243,7 +243,7 @@
 		},
 		onLoad(options) {
 			if (options.customerName) {
-				this.deptList.procurementPlanNo = options.customerName
+				this.deptList.buyer = options.customerName
 			}
 		},
 		onShow() {
@@ -253,9 +253,9 @@
 			}).then(res => {
 				if (res.data.code == 200) {
 					if (res.data.data.customerTypeFlag == 1) {
-						that.$set(this.deptList, 'procurementPlanNo', res.data.data.customerName)
+						that.$set(this.deptList, 'buyer', res.data.data.customerName)
 					} else {
-						that.$set(this.deptList, 'procurementPlanNo', res.data.data.compName)
+						that.$set(this.deptList, 'buyer', res.data.data.compName)
 					}
 					this.goods = res.data.data
 				}
@@ -464,6 +464,7 @@
 				this.insertProcurementPlanInfo = this.deptList
 				this.insertProcurementPlanInfo.basisPrice = -this.insertProcurementPlanInfo.basisPrice
 				this.insertProcurementPlanInfo.commonId = this.userInfo.id
+				this.insertProcurementPlanInfo.procurementPlanNo='CGJH'+this.getdate()+this.verifyinit()
 				this.insertProcurementPlanInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
 				this.$api.doRequest('post', '/procurementPlanInfo/api/insertProcurementPlanInfo', this
 						.insertProcurementPlanInfo).then(res => {
@@ -520,6 +521,33 @@
 				this.deptList.packingTypeKey = e.detail.value
 				this.deptList.packingType = this.baoType[this.baoIndex];
 			},
+			getdate() {
+			  var date = new Date()
+			  var year = date.getFullYear() //获取完整的年份(4位)
+			  var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
+			  var datetime = date.getDate() //获取当前日(1-31)
+			  if (mouth < 10) {
+				mouth = '0' + mouth
+			  }
+			  if (datetime < 10) {
+				datetime = '0' + datetime
+			  }
+			  return year + mouth + datetime
+			},
+			verifyinit() {
+			  var arr = []
+			  for (var i = 48; i < 123; i++) {
+				if (i > 57 && i < 65) continue
+				if (i > 90 && i < 97) continue
+				arr.push(String.fromCharCode(i))
+			  }
+			  arr.sort(function() {
+				return Math.random() - 0.5
+			  })
+			  arr.length = 4
+		
+			  return arr.join('')
+			},
 			chengChange(e) {
 				this.chengIndex = e.detail.value
 				this.chengtypes = this.chengType[this.chengIndex];

+ 38 - 10
pageD/myRelease/sellGrain.vue

@@ -4,7 +4,7 @@
 			<view class="c-row b-b">
 				<text class="tit">名头</text>
 				<view class="con-list">
-					<text @click="navToDetailPage">{{deptList.procurementPlanNo}}</text>
+					<text @click="navToDetailPage">{{deptList.seller}}</text>
 				</view>
 			</view>
 			<view class="c-row b-b">
@@ -224,7 +224,7 @@
 					city: true,
 				},
 				checked: true,
-				insertProcurementPlanInfo: {},
+				insertSalePlanInfo: {},
 				liIndex: 0,
 				liType: ['塔粮', '筛粮', '中粒', '大粒'],
 				pinIndex: 0,
@@ -248,7 +248,7 @@
 		},
 		onLoad(options) {
 			if (options.customerName) {
-				this.deptList.procurementPlanNo = options.customerName
+				this.deptList.seller = options.customerName
 			}
 		},
 		onShow() {
@@ -258,9 +258,9 @@
 			}).then(res => {
 				if (res.data.code == 200) {
 					if (res.data.data.customerTypeFlag == 1) {
-						that.$set(this.deptList, 'procurementPlanNo', res.data.data.customerName)
+						that.$set(this.deptList, 'seller', res.data.data.customerName)
 					} else {
-						that.$set(this.deptList, 'procurementPlanNo', res.data.data.compName)
+						that.$set(this.deptList, 'seller', res.data.data.compName)
 					}
 					this.goods = res.data.data
 				}
@@ -470,12 +470,13 @@
 						}
 					}
 				}
-				this.insertProcurementPlanInfo = this.deptList
-				this.insertProcurementPlanInfo.basisPrice = -this.insertProcurementPlanInfo.basisPrice
-				this.insertProcurementPlanInfo.commonId = this.userInfo.id
-				this.insertProcurementPlanInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
+				this.insertSalePlanInfo = this.deptList
+				this.insertSalePlanInfo.basisPrice = -this.insertSalePlanInfo.basisPrice
+				this.insertSalePlanInfo.commonId = this.userInfo.id
+				this.insertSalePlanInfo.salePlanNo='XSJH'+this.getdate()+this.verifyinit()
+				this.insertSalePlanInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
 				this.$api.doRequest('post', '/salePlanInfo/api/insertSalePlanInfo', this
-						.insertProcurementPlanInfo).then(res => {
+						.insertSalePlanInfo).then(res => {
 						if (res.data.code == 200) {
 							uni.showToast({
 								title: "发布成功",
@@ -529,6 +530,33 @@
 				this.deptList.packingTypeKey = e.detail.value
 				this.deptList.packingType = this.baoType[this.baoIndex];
 			},
+			getdate() {
+			  var date = new Date()
+			  var year = date.getFullYear() //获取完整的年份(4位)
+			  var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
+			  var datetime = date.getDate() //获取当前日(1-31)
+			  if (mouth < 10) {
+				mouth = '0' + mouth
+			  }
+			  if (datetime < 10) {
+				datetime = '0' + datetime
+			  }
+			  return year + mouth + datetime
+			},
+			verifyinit() {
+			  var arr = []
+			  for (var i = 48; i < 123; i++) {
+				if (i > 57 && i < 65) continue
+				if (i > 90 && i < 97) continue
+				arr.push(String.fromCharCode(i))
+			  }
+			  arr.sort(function() {
+				return Math.random() - 0.5
+			  })
+			  arr.length = 4
+					
+			  return arr.join('')
+			},
 			chengChange(e) {
 				this.chengIndex = e.detail.value
 				this.chengtypes = this.chengType[this.chengIndex];