Browse Source

2023-5-22

cmy 2 năm trước cách đây
mục cha
commit
9359243bdc
3 tập tin đã thay đổi với 41 bổ sung14 xóa
  1. 2 2
      api/water.js
  2. 0 4
      pages/home/order.vue
  3. 39 8
      pages/water/deposit.vue

+ 2 - 2
api/water.js

@@ -68,8 +68,8 @@ export function createPledge(data) {
 // 
 // 
 export function delPledge(data) {
 export function delPledge(data) {
 	return request({
 	return request({
-		url: '/api/order/storeday',
-		method: 'get',
+		url: '/api/pledge/refund',
+		method: 'post',
 		data
 		data
 	});
 	});
 }
 }

+ 0 - 4
pages/home/order.vue

@@ -51,10 +51,6 @@
 										class="row_title">{{ goodsItem.productInfo.attrInfo ? goodsItem.productInfo.attrInfo.suk : '' }}</text>
 										class="row_title">{{ goodsItem.productInfo.attrInfo ? goodsItem.productInfo.attrInfo.suk : '' }}</text>
 									<text class="attr-box"> x {{ goodsItem.cart_num }}</text>
 									<text class="attr-box"> x {{ goodsItem.cart_num }}</text>
 								</view>
 								</view>
-								<view class="row flex">
-									<text class="attr-box">( 服务费:{{goodsItem.day_deducted}}
-										服务天数:{{goodsItem.day}})</text>
-								</view>
 							</view>
 							</view>
 						</view>
 						</view>
 						<!-- <view class="price-box">
 						<!-- <view class="price-box">

+ 39 - 8
pages/water/deposit.vue

@@ -32,6 +32,7 @@
 
 
 				</view>
 				</view>
 			</view>
 			</view>
+			
 		</view>
 		</view>
 		<uni-load-more :status="navList[tabCurrentIndex].loadingType"></uni-load-more>
 		<uni-load-more :status="navList[tabCurrentIndex].loadingType"></uni-load-more>
 		<uni-popup ref="popup" type="bottom">
 		<uni-popup ref="popup" type="bottom">
@@ -72,8 +73,8 @@
 				}],
 				}],
 				// 保存当前选中的桶对象
 				// 保存当前选中的桶对象
 				actionItem: {},
 				actionItem: {},
-				total_pledge_money:0,//押金
-				total_count:0,//总数
+				total_pledge_money: 0, //押金
+				total_count: 0, //总数
 			};
 			};
 		},
 		},
 		onReachBottom() {
 		onReachBottom() {
@@ -94,15 +95,24 @@
 					confirmText: '押桶',
 					confirmText: '押桶',
 					success: res => {
 					success: res => {
 						if (res.confirm) {
 						if (res.confirm) {
+							if(res.content.search(/^\d*$/)<0){
+								uni.showModal({
+									title: '错误',
+									content: '请输入数字',
+									showCancel: false,
+								});
+								return
+							}
 							createPledge({
 							createPledge({
-								id:that.actionItem.id,
-								num:res.content,
-								pay_type:'yue'
+								id: that.actionItem.id,
+								num: res.content,
+								pay_type: 'yue'
 							}).then(() => {
 							}).then(() => {
 								that.$refs.popup.close();
 								that.$refs.popup.close();
 								uni.showToast({
 								uni.showToast({
 									title: '押桶成功'
 									title: '押桶成功'
 								})
 								})
+								that.reloadList();
 							}).catch(e => {
 							}).catch(e => {
 								console.log(e);
 								console.log(e);
 							});
 							});
@@ -112,6 +122,7 @@
 			},
 			},
 			// 退桶
 			// 退桶
 			delBarrel() {
 			delBarrel() {
+				const that = this;
 				uni.showModal({
 				uni.showModal({
 					title: '退桶',
 					title: '退桶',
 					placeholderText: '请输入退桶数量',
 					placeholderText: '请输入退桶数量',
@@ -120,12 +131,32 @@
 					confirmText: '退桶',
 					confirmText: '退桶',
 					success: res => {
 					success: res => {
 						if (res.confirm) {
 						if (res.confirm) {
-							certificate({
-
+							if(res.content.search(/^\d*$/)<0){
+								uni.showModal({
+									title: '错误',
+									content: '请输入数字',
+									showCancel: false,
+								});
+								return
+							}
+							console.log(that.actionItem.pledge_num,res.content);
+							if(that.actionItem.pledge_num<+res.content){
+								uni.showModal({
+									title: '错误',
+									content: '退桶数不可大于押桶数',
+									showCancel: false,
+								});
+								return
+							}
+							delPledge({
+								id: that.actionItem.id,
+								num: res.content,
 							}).then(() => {
 							}).then(() => {
+								that.$refs.popup.close();
 								uni.showToast({
 								uni.showToast({
 									title: '退桶成功'
 									title: '退桶成功'
 								})
 								})
+								that.reloadList();
 							}).catch(e => {
 							}).catch(e => {
 								console.log(e);
 								console.log(e);
 							});
 							});
@@ -183,7 +214,7 @@
 						let arr = data.data.map(e => {
 						let arr = data.data.map(e => {
 							return e;
 							return e;
 						});
 						});
-						
+
 						navItem.orderList = navItem.orderList.concat(arr);
 						navItem.orderList = navItem.orderList.concat(arr);
 						// console.log(navItem.orderList);
 						// console.log(navItem.orderList);
 						navItem.page++;
 						navItem.page++;