Pārlūkot izejas kodu

自助采摘修改订单数量

zhaoxw 4 gadi atpakaļ
vecāks
revīzija
911f625f91

+ 5 - 2
components/CnumberBox.vue

@@ -20,6 +20,9 @@
 <script>
 	export default {
 		props: {
+			// number: {
+			// 	default: 1
+			// },
 			isDisabled: {
 				default: false
 			},
@@ -57,12 +60,12 @@
 				this.$emit('getNum',this.number);
 			},
 			numPlus() {
-			    this.number = Number(this.number) + Number(this.step)
+			    this.number = (Number(this.number) + Number(this.step))
 				this.$emit('getNum',this.number);
 			},
 			numReduce() {
 			    if ((Number(this.number) - Number(this.step)) >= Number(this.minNum)) {
-				    this.number = Number(this.number) - Number(this.step)
+				    this.number = (Number(this.number) - Number(this.step))
 			    }
 				this.$emit('getNum',this.number);
 			}

+ 5 - 3
config/api.js

@@ -1,7 +1,8 @@
-// const WX_API_BASE = 'https://www.qianjiadi.com/'
+const WX_API_BASE = 'https://www.qianjiadi.com/'
 // const WX_API_BASE = 'http://ch.jihengcc.cn:17080/'
 // const WX_API_BASE = 'https://test.jihengcc.cn/'
- const WX_API_BASE = 'https://www.qianjiadi.com/'
+ // const WX_API_BASE = 'https://www.qianjiadi.com/'
+ // const WX_API_BASE = 'http://172.18.1.79:8765/'
 
 module.exports = {
 	//  微信登录
@@ -92,7 +93,8 @@ module.exports = {
 	addMessage: WX_API_BASE + 'app/order/user/my/orderList/orderDetail/leaMsgList/addLeaMsg',
 	//  获取订单详情
 	getOrderDetail: WX_API_BASE + 'app/order/user/my/orderList/orderDetail',
-
+    //  编辑订单数量
+	editOrder: WX_API_BASE + 'app/order/user/editOrder',
 
 	//  查询优惠券列表
 	getCouponList: WX_API_BASE + 'app/merchants/merchantsCouponGrantPage',

+ 1 - 1
pagesGood/goodForm.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="container">
-		<u-form :model="goodInfo" ref="goodInfo" label-width="180">
+		<u-form :model="goodInfo" ref="goodInfo" label-width="240">
 			<u-form-item label="商品名称" prop="productName" required>
 				<u-input v-model="goodInfo.productName" type="text" placeholder="请输入商品名称" :disabled="ifEdit()"/>
 			</u-form-item>

+ 151 - 74
pagesMain/orderDetail.vue

@@ -36,14 +36,17 @@
 							<text class="goods-number">x{{item.buyNum}}</text>
 							<text class="plant-text" v-if="item.productType == 4">有效期:{{item.term}}天</text>
 						</view>
+						<view class="goods-editnumber">
+							<CnumberBox v-if="item.productType == 3 && isEdit" isDisabled @getNum="getStockNum($event,index)" minNum="1"></CnumberBox>
+						</view>
 					</view>
 				</view>
 			</view>
 			<view class="order-info">
 				<u-cell-group :border="false">
 					<u-cell-item title="商品金额" :value="'¥' + orderData.orderSum" :arrow="false" :border-bottom="false"></u-cell-item>
-					<u-cell-item title="积分抵扣" :value="'-¥' + orderData.integralAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1"></u-cell-item>
-					<u-cell-item title="优惠券" :value="'-¥' + orderData.couponDiscountAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1"></u-cell-item>
+					<u-cell-item title="积分抵扣" :value="'-¥' + orderData.integralAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1 || goodType == 3"></u-cell-item>
+					<u-cell-item title="优惠券" :value="'-¥' + orderData.couponDiscountAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1 || goodType == 3"></u-cell-item>
 					<u-cell-item title="备注" :value="orderData.notes" :arrow="false" :border-bottom="false"></u-cell-item>
 				</u-cell-group>
 			</view>
@@ -113,7 +116,7 @@
 			</view>
 		</view>
 		<uni-goods-nav :fill="true" :options="[]" @click="" @buttonClick="orderHandle" class="order-handle" :buttonGroup="buttonGroup"
-		 v-if="(orderData.orderStatus >= 2 && orderData.orderStatus <= 4) || (orderData.orderStatus == 5 && orderData.evaluateReplyStatus == 1)" />
+		 v-if="(orderData.orderStatus >= 1 && orderData.orderStatus <= 4) || (orderData.orderStatus == 5 && orderData.evaluateReplyStatus == 1)" />
 		<u-top-tips ref="uTips"></u-top-tips>
 		<view class="uni-popup-dialog" :hidden="show_qx">
 			<view class="uni-dialog-title">
@@ -137,7 +140,11 @@
 <script>
 	const NET = require('@/utils/request')
 	const API = require('@/config/api')
+	import CnumberBox from '@/components/CnumberBox.vue'
 	export default {
+		components: {
+			CnumberBox
+		},
 		data() {
 			return {
 				show_qx:true,
@@ -170,12 +177,7 @@
 					tenantCode: '',
 					evaluateReplyStatus: 1,
 				},
-				goodType: 1,
-				// buttonGroup: [{
-				// 	text: '',
-				// 	backgroundColor: '#52A63A',
-				// 	color: '#fff'
-				// }],
+				goodType: 1, // 1是普通商品类型;2是包含自助采摘+普通商品的类型;3是拍卖、共享种植
 				buttonGroup: [
 				    {
 				    	text: '',
@@ -183,78 +185,114 @@
 				    	color: '#fff'
 				    }	
 				],
-				noPick: true // 没有自助采摘的商品
+				noPick: true, // 没有自助采摘的商品
+				isEdit: false,
+				orderId: '',
+				orderStatus: 1,
+				isClick: false
 			}
 		},
 		onLoad(options) {
 			this.userData = uni.getStorageSync("userData")
-			NET.request(API.getOrderDetail, {
-				flag: 2,
-				orderId: options.orderId,
-				orderStatus: options.orderStatus,
-			}, 'GET').then(res => {
-				this.orderData = res.data
-				if (this.orderData.addOrderTime) {
-					let tempTime = new Date(this.orderData.addOrderTime).getTime()
-					let addTempTime = new Date(tempTime + 1000 * 60 * 60 * 24)
-					let addYear = addTempTime.getFullYear()
-					let addMonth = addTempTime.getMonth() + 1
-					let addDay = addTempTime.getDate()
-					let addHours = addTempTime.getHours()
-					let addMin = addTempTime.getMinutes()
-					let addSeconds = addTempTime.getSeconds()
-					this.orderData.overTime = addYear + '年' + addMonth + '月' + addDay + '日' + addHours + ':' + addMin + ':' +
-						addSeconds
-				}
-				if (this.orderData.merchantInfoResVO.products.length && this.orderData.merchantInfoResVO.products[0].productType !=
-					2 && this.orderData.merchantInfoResVO.products[0].productType != 4) {
-					this.goodType = 1
-				} else {
-					this.goodType = 2
-				}
-				if (this.orderData.orderStatus == 2) {
-					if (this.orderData.merchantInfoResVO.products.length) {
+			this.orderId = options.orderId
+			this.orderStatus = options.orderStatus
+			this.getDetail()
+		},
+		onShow() {},
+		methods: {
+			closeSetting:function(){
+				this.show_qx=true;
+			},
+			// 获取订单详情
+			getDetail() {
+				NET.request(API.getOrderDetail, {
+					flag: 2,
+					orderId: this.orderId,
+					orderStatus: this.orderStatus,
+				}, 'GET').then(res => {
+					this.orderData = res.data
+					if (this.orderData.addOrderTime) {
+						let tempTime = new Date(this.orderData.addOrderTime).getTime()
+						let addTempTime = new Date(tempTime + 1000 * 60 * 60 * 24)
+						let addYear = addTempTime.getFullYear()
+						let addMonth = addTempTime.getMonth() + 1
+						let addDay = addTempTime.getDate()
+						let addHours = addTempTime.getHours()
+						let addMin = addTempTime.getMinutes()
+						let addSeconds = addTempTime.getSeconds()
+						this.orderData.overTime = addYear + '年' + addMonth + '月' + addDay + '日' + addHours + ':' + addMin + ':' +
+							addSeconds
+					}
+					if (this.orderData.merchantInfoResVO.products.length && this.orderData.merchantInfoResVO.products[0].productType !=
+						2 && this.orderData.merchantInfoResVO.products[0].productType != 4) {
+						// this.goodType = 1
 						if (this.orderData.merchantInfoResVO.products.some(v => {return v.productType == 3})) {
-						    this.noPick = false
-							this.buttonGroup = [{
-								text: '发货',
-								backgroundColor: '#75BD60',
-								color: '#fff'
-							}, {
-								text: '自助采摘',
-								backgroundColor: '#52A63A',
-								color: '#fff'
-							}]
+							this.goodType = 3
 						} else {
-							this.buttonGroup = [{
-								text: '发货',
-								backgroundColor: '#75BD60',
-								color: '#fff'
-							}]
+							this.goodType = 1
 						}
+					} else {
+						this.goodType = 2
 					}
-					if (this.orderData.auctionStatus == 1) {
+					if (this.orderData.orderStatus == 1 && this.goodType == 3) {
+						this.buttonGroup = [{
+							text: '修改订单',
+							backgroundColor: '#75BD60',
+							color: '#fff'
+						}]
+					} else if (this.orderData.orderStatus == 2) {
+						if (this.orderData.merchantInfoResVO.products.length) {
+							if (this.orderData.merchantInfoResVO.products.some(v => {return v.productType == 3})) {
+							    this.noPick = false
+								this.buttonGroup = [{
+									text: '发货',
+									backgroundColor: '#75BD60',
+									color: '#fff'
+								}, {
+									text: '自助采摘',
+									backgroundColor: '#52A63A',
+									color: '#fff'
+								}]
+							} else {
+								this.buttonGroup = [{
+									text: '发货',
+									backgroundColor: '#75BD60',
+									color: '#fff'
+								}]
+							}
+						}
+						if (this.orderData.auctionStatus == 1) {
+							this.buttonGroup = []
+						}
+					} else if (this.orderData.orderStatus == 3 || this.orderData.orderStatus == 4) {
+						this.buttonGroup[0].text = '追踪物流'
+					} else if (this.orderData.evaluateReplyStatus == 1) {
+						this.buttonGroup[0].text = '回复'
+					} else {
 						this.buttonGroup = []
 					}
-				} else if (this.orderData.orderStatus == 3 || this.orderData.orderStatus == 4) {
-					this.buttonGroup[0].text = '追踪物流'
-				} else if (this.orderData.evaluateReplyStatus == 1) {
-					this.buttonGroup[0].text = '回复'
-				} else {
-					this.buttonGroup = []
-				}
-				this.getOrderType()
-			}).catch(error => {
-				this.$refs.uTips.show({
-					title: error.data.msg,
-					type: 'warning',
+					this.getOrderType()
+				}).catch(error => {
+					this.$refs.uTips.show({
+						title: error.data.msg,
+						type: 'warning',
+					})
 				})
-			})
-		},
-		onShow() {},
-		methods: {
-			closeSetting:function(){
-				this.show_qx=true;
+			},
+			// 获取子组件的库存数量/
+			getStockNum(num,index) {
+				this.isClick = true
+				debugger
+				this.orderData.merchantInfoResVO.products[index].buyNum = num
+				this.getEditSum()
+			},
+			// 计算实付额和订单总额
+			getEditSum() {
+				let price = this.orderData.merchantInfoResVO.products.reduce((total, site) => {
+					return total + site.bizPrice * site.buyNum
+				}, 0)
+				this.orderData.orderSum = price.toFixed(2)
+				this.orderData.paySum = (price - this.orderData.discountAmount).toFixed(2)
 			},
 			//  获取订单类型
 			getOrderType() {
@@ -298,7 +336,41 @@
 			},
 			//  操作
 			orderHandle(e) {
-				if (this.orderData.orderStatus == 2) {
+				if (this.orderData.orderStatus == 1) {
+					this.buttonGroup = [{
+						text: this.isEdit ? '修改订单' : '提交订单',
+						backgroundColor: this.isEdit ? '#52A63A' : '#75BD60',
+						color: '#fff'
+					}]
+					if (this.isEdit) {
+						if (!this.isClick) {
+							this.orderData.merchantInfoResVO.products.forEach(v => {
+								if (v.productType == 3) {
+									v.buyNum = 1
+								}
+							})
+							this.getEditSum()
+						}
+						NET.request(API.editOrder, {
+							orderId: this.orderData.orderId,
+							orderSum: this.orderData.orderSum,
+							paySum: this.orderData.paySum,
+							products: this.orderData.merchantInfoResVO.products
+						}, 'POST').then(res => {
+							this.$refs.uTips.show({
+								title: '修改成功',
+								type: 'success',
+							})
+							this.getDetail()
+						}).catch(error => {
+							this.$refs.uTips.show({
+								title: error.data.msg,
+								type: 'warning',
+							})
+						})
+					}
+					this.isEdit = !this.isEdit
+				} else if (this.orderData.orderStatus == 2) {
 					if (e.index == 0) {
 						//  发货
 						uni.navigateTo({
@@ -522,7 +594,7 @@
 
 				.goods-row {
 					width: 100%;
-					height: 90px;
+					height: 110px;
 					float: left;
 					display: flex;
 					margin-bottom: 10px;
@@ -578,10 +650,10 @@
 						}
 
 						.goods-price-number {
-							width: 100%;
+							width: 60%;
 							height: 20px;
 							float: left;
-							line-height: 20px;
+							line-height: 40px;
 							font-family: PingFang SC;
 							color: #333333;
 
@@ -598,6 +670,11 @@
 								font-size: 12px;
 							}
 						}
+                        
+						.goods-editnumber {
+							float: left;
+							width: 35%
+						}
 
 						.plant-text {
 							float: right;

+ 9 - 3
pagesMedia/liveOption.vue

@@ -22,8 +22,8 @@
 		<view class="form-handle">
 			<u-button type="success" shape="circle" :ripple="true" @click="submitData" :disabled="getPermit()" class="handle-custom">提交</u-button>
 		</view>
-		<u-picker mode="time" v-model="dateShow1" :start-year="startYear" :params="params" @confirm="setDate1"></u-picker>
-		<u-picker mode="time" v-model="dateShow2" :start-year="startYear" :params="params" @confirm="setDate2"></u-picker>
+		<u-picker mode="time" v-model="dateShow1" :start-year="startYear" :params="params1" @confirm="setDate1"></u-picker>
+		<u-picker mode="time" v-model="dateShow2" :start-year="startYear" :params="params2" @confirm="setDate2"></u-picker>
 		<u-top-tips ref="uTips"></u-top-tips>
 	</view>
 </template>
@@ -85,7 +85,7 @@
 				],
 				dateShow1: false,
 				dateShow2: false,
-				params: {
+				params1: {
 					// year: true,
 					// month: true,
 					// day: true,
@@ -93,6 +93,11 @@
 					minute: true,
 					second: true
 				},
+				params2: {
+					hour: true,
+					minute: true,
+					second: true
+				},
 				startYear: '',
 				uploadData: {
 					folderId: 0,
@@ -172,6 +177,7 @@
 			setDate2(data) {
 				// this.videoInfo.liveEndTime = data.year + '-' + data.month + '-' + data.day + ' ' + data.hour + ':' + data.minute +
 				// 	':' + data.second
+				console.log('时间:', data)
 				this.videoInfo.liveEndTime = data.hour + ':' + data.minute + ':' + data.second
 			},
 			//  检查必填项