hmp 4 年 前
コミット
79c3c970a1
5 ファイル変更80 行追加24 行削除
  1. 10 1
      assets/http/api.js
  2. 7 6
      pages/bill/bill.vue
  3. 9 10
      pages/withdraw/select-bank.vue
  4. 37 7
      pages/withdraw/withdraw.vue
  5. 17 0
      utils/dialog.js

+ 10 - 1
assets/http/api.js

@@ -85,6 +85,14 @@ const webSocket={
 }
 
 
+//提现
+const withdraw={
+	//提交申请
+	submit:p => http.post('cyzh-ldt/withdrawrecord/withdraw',p),
+	yeeWithdraw:p => http.get('/payment/payOrder/YEE_PAY/USER_WITHDRAW',{params:p}),
+}
+
+
 export const api={
 	uploadFile,
 	dict,
@@ -95,5 +103,6 @@ export const api={
 	activity,
 	userBank,
 	accout,
-	webSocket
+	webSocket,
+	withdraw
 }

+ 7 - 6
pages/bill/bill.vue

@@ -15,10 +15,11 @@
 					</view>
 				</view>
 			</view>
+			
 			<view style="display: flex;justify-content: flex-start;">
 				<view class="value">
 					<text>余额</text>
-					<text class="text-price">{{$digital.floatSub(shopData.withdrawTotalPrice, shopData.totalPointValue)}}</text>
+					<text class="text-price">{{$digital.floatSub(shopData.withdrawTotalPrice,shopData.totalPointValue)}}</text>
 				</view>
 			</view>
 
@@ -84,11 +85,11 @@
 							<view class="item-padding">
 								<image style="width: 35rpx;height: 35rpx;margin-bottom: -5rpx;"
 									src="@/static/icon/points-value.png"></image>
-								<text style="font-size: 32rpx;margin-left: 10rpx;color: #F39248;">+{{item.point}}</text>
+								<text style="font-size: 32rpx;margin-left: 10rpx;color: #F39248;">+{{item.point  || 0}}</text>
 							</view>
 						</view>
 						<view class="area3 text-area ">
-							<view class="item-padding" style="font-size: 34rpx;color: #000;">¥{{item.pointValue}}</view>
+							<view class="item-padding" style="font-size: 34rpx;color: #000;">¥{{item.pointValue  || 0}}</view>
 						</view>
 					</block>
 					<block v-if="current==0">
@@ -111,7 +112,7 @@
 						<view class="area3 text-area u-p-r-20" style="width: 30%;">
 							<view class="item-padding"
 								style="flex:1;text-align: right;font-size: 34rpx;color: #F39248;">
-								+¥{{item.realPayAmount}}</view>
+								+¥{{item.realPayAmount || 0}}</view>
 						</view>
 					</block>
 				</view>
@@ -327,7 +328,7 @@
 
 		.area1 {
 			padding-left: 30rpx;
-			width: 55%;
+			width: 50%;
 
 			view:first-child {
 				display: flex;
@@ -358,7 +359,7 @@
 		}
 
 		.area2 {
-			width: 25%;
+			width: 30%;
 		}
 
 		.area3 {

+ 9 - 10
pages/withdraw/select-bank.vue

@@ -36,26 +36,25 @@
 				radio: ''
 			};
 		},
-		onLoad() {
+		onLoad(options) {
+			this.radio=options.id
 			this.fetchCardList()
 		},
 		methods: {
-			fetchCardList() {
+			async fetchCardList() {
 				let params = {
 					userId:this.vuex_shopId,
 					size: 10
 				}
-				this.$api.userBank.appList(params).then(res => {
-					if (!this.$isEmpty(res.data.records)) {
-						this.bankList = res.data.records
-						this.radio = this.bankList[0].id
-					}
-				})
+				let res=await this.$api.userBank.appList(params)
+				if (!this.$isEmpty(res.data.records)) {
+					this.bankList = res.data.records
+				}
 			},
 			confirm(){
-				let bank= this.bankList.filter(item=>item.id==this.radio)[0]
+				let bankList= this.bankList.filter(item=>item.id==this.radio)
 				let params={
-					bank
+					bank:bankList[0]
 				}
 				this.$util.backWithParams(params)
 			}

+ 37 - 7
pages/withdraw/withdraw.vue

@@ -9,7 +9,7 @@
 			</view>
 		</navigator>
 
-		<navigator url="select-bank" class="bank" v-else hover-class="none">
+		<navigator :url="'select-bank?id='+bank.id" class="bank" v-else hover-class="none">
 			<view class="left center">
 				<image :src="bank.bankType?'/static/bank/'+bank.bankType+'.png':''" mode=""></image>
 				<view class="content">
@@ -106,14 +106,15 @@
 			};
 		},
 		onLoad() {
-			this.fetchCardList()
 			this.fetchShopDetail()
 		},
 		onShow() {
-			if (this.canReset) {
-				this.bank = this.$util.getBackParams('bank')
+			let bank=this.$util.getBackParams('bank')
+			if (!this.$isEmpty(bank)) {
+				this.bank=bank
+			}else{
+				this.fetchCardList()
 			}
-			this.canReset = true
 		},
 		methods: {
 			async fetchShopDetail() {
@@ -148,8 +149,37 @@
 				this.withdrawAmount=this.canWithDraw
 				this.$refs.amountInput.initialMoney(this.withdrawAmount)
 			},
-			withdrawConfirm(){
-				
+			async withdrawConfirm(){
+				if (this.$isEmpty(this.bank)) {
+					this.$u.toast('请选择银行')
+					return
+				}
+				let params={
+					shopId:this.vuex_shopId,
+					amount:parseFloat(this.withdrawAmount),
+					bankId:this.bank.id
+				}
+				let orderId=(await this.$api.withdraw.submit(params)).data
+				if (this.$isEmpty(orderId)) {
+					this.$u.toast('提现失败')
+					return
+				}
+				let data={
+					orderId,
+					orderType:"USER_WITHDRAW"
+				}
+				let res=await this.$api.withdraw.yeeWithdraw(data)
+				if (res.data.status=="SUCCESS") {
+					this.$dialog.showModal('银行处理中').then(()=>{
+						this.$back()
+					})
+					return
+				}
+				if (res.data.returnMsg=='账户余额不足') {
+					this.$dialog.showModalAndBack('提现失败,平台账户余额不足')
+					return
+				}
+				this.$dialog.showModalAndBack(res.data.returnMsg)
 			}
 		}
 	};

+ 17 - 0
utils/dialog.js

@@ -17,6 +17,23 @@ dialog.showModal=(content,isShowCancel=true,title='提示',)=>{
 		});
 	})
 }
+
+dialog.showModalAndBack=(content)=>{
+    uni.showModal({
+    	title: "提示",
+    	content: content,
+    	showCancel:false,
+    	success: (res)=>{
+    		if (res.confirm) {
+    			uni.navigateBack({
+    				delta:1
+    			})
+    		} 
+    	}
+    });
+}
+
+
 dialog.showLoading=(title='加载中...')=>{
 	uni.showLoading({
 		title