chenrong 1 рік тому
батько
коміт
5846b058dd

+ 18 - 1
api/knapsack.js

@@ -40,4 +40,21 @@ export function prizerRecoverApi(data) {
     method: 'post',
     data: data
   })
-}
+}
+
+// 取消订单
+export function cancelOrderApi(data) {
+  return request({
+    url: '/wx/bkm/package/prize/cancelOrder',
+    method: 'post',
+    data: data
+  })
+}
+// 继续支付
+export function reOrderApi(data) {
+  return request({
+    url: '/wx/bkm/package/prize/reOrder',
+    method: 'post',
+    data: data
+  })
+}

+ 110 - 6
pages/knapsack/knapsack.vue

@@ -81,7 +81,7 @@
 					</view>
 				</view>
 				<view class="right">
-					<view class="button button1" @click="cancelOrder">
+					<view class="button button1" @click="cancelCheck">
 						取消
 					</view>
 					<view class="button button2" v-if="checkType == 1" @click="toConfirmConfirm">
@@ -120,6 +120,9 @@
 						<view class="status2 type1" v-if="item.order.orderStatus == 101">
 							待付款
 						</view>
+						<view class="status2 type5" v-if="item.order.orderStatus == 103">
+							已取消
+						</view>
 						<view class="status2 type2" v-if="item.order.orderStatus == 201">
 							待发货
 						</view>
@@ -156,6 +159,14 @@
 							</span>
 						</span>
 					</view>
+					<view class="row cardButtons" v-if="item.order.orderStatus == 101">
+						<view class="button button1" @click="cancelOrder(item)">
+							取消订单
+						</view>
+						<view class="button button2" @click="reOrder(item)">
+							去支付
+						</view>
+					</view>
 				</view>
 				<noData v-if="list2.length == 0" />
 			</view>
@@ -168,7 +179,9 @@
 	import {
 		packagePrizeListApi,
 		packageOrderListApi,
-		prizerRecoverApi
+		prizerRecoverApi,
+		cancelOrderApi,
+		reOrderApi
 	} from "@/api/knapsack.js"
 	export default {
 		components: {
@@ -204,7 +217,7 @@
 		},
 		onShow() {
 			// 重置页面状态
-			this.cancelOrder()
+			this.cancelCheck()
 			this.selectIndex = []
 			this.showCheck = false
 			this.activeIndex = 1
@@ -279,8 +292,8 @@
 				getApp().globalData.selectAddrss = null
 				this.$navigateTo('/pages/orderConfirm/orderConfirm')
 			},
-			// 取消下单
-			cancelOrder() {
+			// 取消选择
+			cancelCheck() {
 				this.showCheck = false
 				this.selectIndex = []
 				for (var i = 0; i < this.list.length; i++) {
@@ -389,7 +402,72 @@
 					}
 				})
 				
-			}
+			},
+			// 取消订单
+			cancelOrder(item) {
+				console.log(item, 'item')
+				let _this = this
+				wx.showModal({
+					title: '取消订单',
+					content: '确认取消此订单?',
+					success(res) {
+						if(res.confirm) {
+							let params = {
+								orderId: item.order.id
+							}
+							cancelOrderApi(params).then(res => {
+								console.log(res, 'res')
+								_this.tabs2Click(_this.tab2Active)
+							})
+						}
+					}
+				})
+				
+			},
+			reOrder(item) {
+				console.log(item, 'item')
+				// let prizeList = item.prizeList
+				// let ids = []
+				// for (var i = 0; i < prizeList.length; i++) {
+				// 	ids.push(prizeList[i].id)
+				// }
+				// getApp().globalData.orderConfirmIds = ids
+				// getApp().globalData.selectAddrss = null
+				// this.$navigateTo('/pages/orderConfirm/orderConfirm')
+				let params = {
+					orderId: item.order.id
+				}
+				reOrderApi(params).then(res => {
+					console.log(res, 'res')
+					// _this.tabs2Click(_this.tab2Active)
+					this.wxPayment(res.data)
+				})
+			},
+			wxPayment(data) {
+				let _this = this
+				wx.requestPayment({
+					'timeStamp': data.timeStamp,
+					'nonceStr': data.nonceStr,
+					'package': data.packageValue,
+					'signType': data.signType,
+					'paySign': data.paySign,
+					'success': function(res) {
+						console.log(res, "支付过程成功");
+						wx.showToast({
+							title: '支付成功。',
+							icon: 'success',
+						})
+						_this.tabs2Click(_this.tab2Active)
+					},
+					'fail': function(res) {
+						console.log("支付过程失败");
+						// util.showErrorToast('支付失败');
+					},
+					'complete': function(res) {
+						console.log("支付过程结束")
+					}
+				});
+			},
 		}
 	}
 </script>
@@ -534,6 +612,10 @@
 						background: #DEF2E4;
 						color: #00BCC8;
 					}
+					.type5 {
+						background: #dedede;
+						color: #999;
+					}
 					.left {
 						display: flex;
 						align-items: center;
@@ -583,6 +665,28 @@
 						font-size: 12px;
 					}
 				}
+				.cardButtons {
+					padding-top: 10px;
+					border-top: solid 1px #eaeaea;
+					justify-content: flex-end;
+					
+					.button {
+						font-size: 12px;
+						margin-left: 10px;
+						padding: 4px 0;
+						width: 60px;
+						text-align: center;
+						border-radius: 5px;
+					}
+					.button1 {
+						color: #FF7D12;
+						border: solid 1px #FF7D12;
+					}
+					.button2 {
+						color: #fff;
+						background: linear-gradient(180deg, #FFAD3D 0%, #FF740A 100%);
+					}
+				}
 			}
 		}
 

+ 112 - 7
pages/knapsackTab/knapsack.vue

@@ -81,7 +81,7 @@
 					</view>
 				</view>
 				<view class="right">
-					<view class="button button1" @click="cancelOrder">
+					<view class="button button1" @click="cancelCheck">
 						取消
 					</view>
 					<view class="button button2" v-if="checkType == 1" @click="toConfirmConfirm">
@@ -120,6 +120,9 @@
 						<view class="status2 type1" v-if="item.order.orderStatus == 101">
 							待付款
 						</view>
+						<view class="status2 type5" v-if="item.order.orderStatus == 103">
+							已取消
+						</view>
 						<view class="status2 type2" v-if="item.order.orderStatus == 201">
 							待发货
 						</view>
@@ -156,6 +159,14 @@
 							</span>
 						</span>
 					</view>
+					<view class="row cardButtons" v-if="item.order.orderStatus == 101">
+						<view class="button button1" @click="cancelOrder(item)">
+							取消订单
+						</view>
+						<view class="button button2" @click="reOrder(item)">
+							去支付
+						</view>
+					</view>
 				</view>
 				<noData v-if="list2.length == 0" />
 			</view>
@@ -168,7 +179,9 @@
 	import {
 		packagePrizeListApi,
 		packageOrderListApi,
-		prizerRecoverApi
+		prizerRecoverApi,
+		cancelOrderApi,
+		reOrderApi
 	} from "@/api/knapsack.js"
 	export default {
 		components: {
@@ -204,7 +217,7 @@
 		},
 		onShow() {
 			// 重置页面状态
-			this.cancelOrder()
+			this.cancelCheck()
 			this.selectIndex = []
 			this.showCheck = false
 			this.activeIndex = 1
@@ -279,8 +292,8 @@
 				getApp().globalData.selectAddrss = null
 				this.$navigateTo('/pages/orderConfirm/orderConfirm')
 			},
-			// 取消下单
-			cancelOrder() {
+			// 取消选择
+			cancelCheck() {
 				this.showCheck = false
 				this.selectIndex = []
 				for (var i = 0; i < this.list.length; i++) {
@@ -389,7 +402,72 @@
 					}
 				})
 				
-			}
+			},
+			// 取消订单
+			cancelOrder(item) {
+				console.log(item, 'item')
+				let _this = this
+				wx.showModal({
+					title: '取消订单',
+					content: '确认取消此订单?',
+					success(res) {
+						if(res.confirm) {
+							let params = {
+								orderId: item.order.id
+							}
+							cancelOrderApi(params).then(res => {
+								console.log(res, 'res')
+								_this.tabs2Click(_this.tab2Active)
+							})
+						}
+					}
+				})
+				
+			},
+			reOrder(item) {
+				console.log(item, 'item')
+				// let prizeList = item.prizeList
+				// let ids = []
+				// for (var i = 0; i < prizeList.length; i++) {
+				// 	ids.push(prizeList[i].id)
+				// }
+				// getApp().globalData.orderConfirmIds = ids
+				// getApp().globalData.selectAddrss = null
+				// this.$navigateTo('/pages/orderConfirm/orderConfirm')
+				let params = {
+					orderId: item.order.id
+				}
+				reOrderApi(params).then(res => {
+					console.log(res, 'res')
+					// _this.tabs2Click(_this.tab2Active)
+					this.wxPayment(res.data)
+				})
+			},
+			wxPayment(data) {
+				let _this = this
+				wx.requestPayment({
+					'timeStamp': data.timeStamp,
+					'nonceStr': data.nonceStr,
+					'package': data.packageValue,
+					'signType': data.signType,
+					'paySign': data.paySign,
+					'success': function(res) {
+						console.log(res, "支付过程成功");
+						wx.showToast({
+							title: '支付成功。',
+							icon: 'success',
+						})
+						_this.tabs2Click(_this.tab2Active)
+					},
+					'fail': function(res) {
+						console.log("支付过程失败");
+						// util.showErrorToast('支付失败');
+					},
+					'complete': function(res) {
+						console.log("支付过程结束")
+					}
+				});
+			},
 		}
 	}
 </script>
@@ -534,6 +612,10 @@
 						background: #DEF2E4;
 						color: #00BCC8;
 					}
+					.type5 {
+						background: #dedede;
+						color: #999;
+					}
 					.left {
 						display: flex;
 						align-items: center;
@@ -583,6 +665,28 @@
 						font-size: 12px;
 					}
 				}
+				.cardButtons {
+					padding-top: 10px;
+					border-top: solid 1px #eaeaea;
+					justify-content: flex-end;
+					
+					.button {
+						font-size: 12px;
+						margin-left: 10px;
+						padding: 4px 0;
+						width: 60px;
+						text-align: center;
+						border-radius: 5px;
+					}
+					.button1 {
+						color: #FF7D12;
+						border: solid 1px #FF7D12;
+					}
+					.button2 {
+						color: #fff;
+						background: linear-gradient(180deg, #FFAD3D 0%, #FF740A 100%);
+					}
+				}
 			}
 		}
 
@@ -593,7 +697,8 @@
 			justify-content: space-around;
 			width: 100%;
 			padding: 10px 0;
-
+			margin-bottom: 30px;
+			
 			image {
 				height: 42px;
 			}

Різницю між файлами не показано, бо вона завелика
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/knapsack/knapsack.wxml


Деякі файли не було показано, через те що забагато файлів було змінено