Browse Source

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
下单修改

1004749546@qq.com 4 years ago
parent
commit
2463209cd1
1 changed files with 15 additions and 9 deletions
  1. 15 9
      pages/getOrder/getOrder.vue

+ 15 - 9
pages/getOrder/getOrder.vue

@@ -31,8 +31,8 @@
 					</view>
 					<view class="list">
 						<view :class="['item', serverIndex==index ?'avtive':'']" @click="chooseItem(index)" v-for="(item,index) in itemList" :key="index">
-							<text>{{item.name}}</text>
-							<text class="price">¥{{item.price}}</text>
+							<text>{{item.itemName}}</text>
+							<text class="price">¥{{item.currentPrice}}</text>
 						</view>
 					</view>
 				</view>
@@ -70,7 +70,7 @@
 					<text>合计:</text>
 					<text class="amount">¥{{finalAmount}}</text>
 					<view class="">
-						<button @click="toPay" type="warn">去付款</button>
+						<button :disabled="isRead!='read'" @click="toPay" type="warn">去付款</button>
 					</view>
 				</view>
 			</view>
@@ -193,7 +193,10 @@
 				getStoreItems({storeId:100000}).then(res =>{
 					if (res.status == 200) {
 						this.itemList = res.data 
+						this.serverIndex = 0
+						this.getFinalAmount()
 					} else {
+						this.itemList = []
 						this.toashMsg(res.message)
 					}
 				})
@@ -201,7 +204,6 @@
 			// 选择服务项目
 			chooseItem(index) {
 				this.serverIndex = index
-				this.amount = this.itemList[index].price
 				this.getFinalAmount()
 			},
 			// 下一步
@@ -250,8 +252,9 @@
 			},
 			// 计算合计
 			getFinalAmount () {
-			  let ret = this.amount - this.couponAmount 
-			  this.finalAmount = ret.toFixed(2)
+				this.amount = this.itemList[this.serverIndex].currentPrice
+			    let ret = this.amount - this.couponAmount 
+			    this.finalAmount = ret.toFixed(2)
 			},
 			// 选择优惠券
 			intoChooseCoupon () {
@@ -271,13 +274,14 @@
 					title: '请求中...',
 					mask: true
 				})
+				let item = this.itemList[this.serverIndex]
 				let params = {
-					"itemId": 100000, // 服务id
+					"itemId": item.itemId, // 服务id
 					"storeId": 100000, // 门店id
 					"deviceId": 100000, // 设备id
 					"orderTime": this.$u.timeFormat(Date.now(), 'yyyy-mm-dd hh:MM:ss'), 
-					"payableAmount": 4, // 应付金额 即优惠前金额
-					"paymentAmount": 4 // 实收金额 即优惠后金额
+					"payableAmount": this.amount, // 应付金额 即优惠前金额
+					"paymentAmount": this.finalAmount // 实收金额 即优惠后金额
 				}
 				saveOrder(params).then(res =>{
 					uni.hideLoading()
@@ -287,6 +291,8 @@
 							url:"/pages/work/index/index"
 						})
 					} else {
+						// 刷新服务项
+						this.getServerList()
 						this.toashMsg(res.message)
 					}
 				})