Parcourir la source

feat:提交代码,完成花费充值相关开发

longzc il y a 1 an
Parent
commit
520a1caddf

+ 12 - 1
src/apis/user.ts

@@ -237,10 +237,21 @@ enum API {
237 237
 	AUTH_VERIFY ='/api/auth/verify',
238 238
 	//提现
239 239
 	EXTRACT_CREATE='/api/user/extract/create',
240
+	//获取话费数据
241
+	HUAFEI_RECORD ='/api/huafei/record',
240 242
 	
241
-	
242 243
 }
243 244
 
245
+export function apiGetHuafeiList(data:any) {
246
+    return defHttp.post({
247
+        url: API.HUAFEI_RECORD,
248
+		data:{
249
+			limit:10,
250
+		page:data.page}
251
+    })
252
+}
253
+
254
+
244 255
 export function apiExtractCreate(data:any) {
245 256
     return defHttp.post({
246 257
         url: API.EXTRACT_CREATE,

+ 4 - 1
src/components/CXBPhoneLoginButton/CXBPhoneLoginButton.vue

@@ -3,6 +3,7 @@ import { authAppletPhone, bindPhone, getUserUnionId } from "~/apis/user";
3 3
 import { useUserStore } from "~/stores/userStore";
4 4
 import Cache from "~/utils/cache";
5 5
 const userStore = useUserStore()
6
+let openId =''
6 7
 const props = defineProps({
7 8
   text: {
8 9
     type: String,
@@ -29,6 +30,7 @@ function getPhoneNumber(e) {
29 30
             encryptedData: e.detail.encryptedData,
30 31
             iv: e.detail.iv,
31 32
           }
33
+		  openId= unionRes.openid
32 34
           if (shareId) {
33 35
             params.share_id = shareId
34 36
           }
@@ -45,6 +47,7 @@ function getPhoneNumber(e) {
45 47
             userStore.login(authRes.token, authRes.exp)
46 48
             userStore.setUID(authRes.user.uid)
47 49
             userStore.setUserInfo(authRes.user)
50
+			console.log("===unionRes",unionRes);
48 51
 
49 52
             // 绑定手机号
50 53
             bindPhone({
@@ -52,7 +55,7 @@ function getPhoneNumber(e) {
52 55
               sms: 1,
53 56
               sms_code: '1024',
54 57
               password: '12345678',
55
-              third_user_id: unionRes.unionid,
58
+              third_user_id: openId,
56 59
               type: 1
57 60
             }).then(bindRes => {
58 61
               Cache.clear('SHARE_ID')

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
src/pages.json


+ 8 - 8
src/pages/my-rules/index.vue

@@ -4,7 +4,7 @@ import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html'
4 4
 
5 5
 import { encodePhone } from "../../utils";
6 6
 import { getAgentInfo, getRules, getUserInfo } from "~/apis/user";
7
-import { CDM_URL ,ICON_CDN_URL} from '~/config/app';
7
+import { CDM_URL ,IMG_CDN_NEW_URL} from '~/config/app';
8 8
 
9 9
 const userStore = useUserStore()
10 10
 const ruleDetail = ref<{
@@ -38,20 +38,20 @@ const userType = computed(() => {
38 38
   // console.log('我是大哥',userStore.userInfo)
39 39
   const bangfu = userStore.userInfo?.is_bangfu ? '帮扶中心 ' : ''
40 40
   // console.log('我是帮扶',bangfu);
41
-
41
+ 
42 42
   // 普通用户
43 43
   if (userRichType == 0) {
44 44
     // if (bangfu) {
45 45
     //   return ['../../static/img-hy/帮扶中心.png', bangfu]
46 46
     // }
47
-    return [ICON_CDN_URL+'用户.png']
47
+    return [IMG_CDN_NEW_URL+'用户.png']
48 48
   }
49 49
   // 会员
50 50
   if (userRichType == 1) {
51 51
     // if (bangfu) {
52 52
     //   return ['../../static/img-hy/帮扶中心.png', bangfu]
53 53
     // }
54
-    return [ICON_CDN_URL+'会员.png']
54
+    return [IMG_CDN_NEW_URL+'会员.png']
55 55
 
56 56
   }
57 57
   // 创始人
@@ -59,7 +59,7 @@ const userType = computed(() => {
59 59
     // if (bangfu) {
60 60
     //   return ['../../static/img-hy/帮扶中心.png', bangfu]
61 61
     // }
62
-    return [ICON_CDN_URL+'创始人.png']
62
+    return [IMG_CDN_NEW_URL+'创始人.png']
63 63
   }
64 64
   // 合伙人
65 65
   if (userRichType == 4) {
@@ -67,19 +67,19 @@ const userType = computed(() => {
67 67
     // if (bangfu) {
68 68
     //   return ['../../static/img-hy/帮扶中心.png', bangfu]
69 69
     // }
70
-    return [ICON_CDN_URL+'高级会员.png']
70
+    return [IMG_CDN_NEW_URL+'高级会员.png']
71 71
   }
72 72
   if (userRichType == 8) {
73 73
     // if (bangfu) {
74 74
     //   return ['../../static/img-hy/帮扶中心.png', bangfu]
75 75
     // }
76
-    return [ICON_CDN_URL+'合伙人.png']
76
+    return [IMG_CDN_NEW_URL+'合伙人.png']
77 77
   }
78 78
   if (userRichType == 9) {
79 79
     // if (bangfu) {
80 80
     //   return ['../../static/img-hy/帮扶中心.png', bangfu]
81 81
     // }
82
-    return [ICON_CDN_URL+'联合创始人.png']
82
+    return [IMG_CDN_NEW_URL+'联合创始人.png']
83 83
   }
84 84
   if (!userRichType) {
85 85
     // if (bangfu) {

+ 9 - 1
src/pages/payment/index.vue

@@ -15,7 +15,7 @@ const state = reactive({
15 15
   orderId: '',
16 16
   code: '',
17 17
   memberType: 0,
18
-
18
+  initType:0,
19 19
   tabIndex: Number.NaN,
20 20
 })
21 21
 onLoad((options) => {
@@ -26,6 +26,7 @@ onLoad((options) => {
26 26
     state.orderList = options.OrderList
27 27
     state.payPrice = options.pay_price
28 28
     state.orderId = options.order_id
29
+	state.initType =options.initType
29 30
 
30 31
     console.log('options')
31 32
     console.log(options)
@@ -80,6 +81,13 @@ function handleConfirm() {
80 81
 }
81 82
 
82 83
 function onClickLeft() {
84
+	
85
+	if(	state.initType==1){
86
+	 uni.navigateBack({
87
+	   delta: 1,
88
+	 })
89
+		return
90
+	}
83 91
   uni.showModal({
84 92
     title: '确认要离开收银台?',
85 93
     content: '您的订单在24小时内未支付将被取消,请尽快完成支付。',

+ 10 - 10
src/pages/user/index.vue

@@ -226,29 +226,29 @@
226 226
 		// 普通用户
227 227
 		if (userRichType == 0)
228 228
 
229
-			return ICON_CDN_URL+'用户.png'
229
+			return IMG_CDN_NEW_URL+'用户.png'
230 230
 
231 231
 		// 会员
232 232
 		if (userRichType == 1)
233 233
 
234
-			return ICON_CDN_URL+'会员.png'
234
+			return IMG_CDN_NEW_URL+'会员.png'
235 235
 
236 236
 		if (userRichType == 3)
237 237
 
238
-			return ICON_CDN_URL+'创始人.png'
238
+			return IMG_CDN_NEW_URL+'创始人.png'
239 239
 
240 240
 		// 高级会员
241 241
 		if (userRichType == 4)
242 242
 
243
-			return ICON_CDN_URL+'高级会员.png'
243
+			return IMG_CDN_NEW_URL+'高级会员.png'
244 244
 
245 245
 		if (userRichType == 8)
246 246
 
247
-			return ICON_CDN_URL+'合伙人.png'
247
+			return IMG_CDN_NEW_URL+'合伙人.png'
248 248
 
249 249
 		if (userRichType == 9)
250 250
 
251
-			return ICON_CDN_URL+'联合创始人.png'
251
+			return IMG_CDN_NEW_URL+'联合创始人.png'
252 252
 
253 253
 		if (!userRichType)
254 254
 
@@ -266,7 +266,7 @@
266 266
 			return ''
267 267
 		// 股东
268 268
 		if (stockholder == 1)
269
-			return ICON_CDN_URL+'股东.png'
269
+			return IMG_CDN_NEW_URL+'股东.png'
270 270
 	})
271 271
 	// '':普通用户 district-区/县代 city-市代',
272 272
 	const areaType = computed(() => {
@@ -473,7 +473,7 @@
473 473
 							<div class="group_2 flex-col lolr ">
474 474
 								<div class="div_box pong1 ">
475 475
 									<div class="blue_1">
476
-										<image lazy-load class="off_3" :src="ICON_CDN_URL+'DLqy.png'" />
476
+										<image lazy-load class="off_3" :src="IMG_CDN_NEW_URL+'DLqy.png'" />
477 477
 										<span class="pan">代理区域</span>
478 478
 									</div>
479 479
 									<div class="blue_2 height1 ">
@@ -482,7 +482,7 @@
482 482
 								</div>
483 483
 								<div class="div_box pong2 ">
484 484
 									<div class="blue_1">
485
-										<image lazy-load class="off_3" :src="ICON_CDN_URL+'QYDL.png'" />
485
+										<image lazy-load class="off_3" :src="IMG_CDN_NEW_URL+'QYDL.png'" />
486 486
 										<span class="pan">代理权益</span>
487 487
 									</div>
488 488
 									<div class="block_1 flex-col blue_2 height2 ">
@@ -499,7 +499,7 @@
499 499
 							</div>
500 500
 						</div>
501 501
 						<div class="off_1" @click="onCancel">
502
-							<image lazy-load class="off_2" src="../../static/img-hy/关闭.png" />
502
+							<image lazy-load class="off_2" :src="IMG_CDN_NEW_URL+'关闭.png'" />
503 503
 						</div>
504 504
 					</FPopup>
505 505
 				</div>

+ 2 - 2
src/pages/user/login/index.vue

@@ -82,7 +82,7 @@ async function handleWexinLogin() {
82 82
         // params.share_id = shareId
83 83
         // params = Object.assign({}, params, { shareId })
84 84
         // }
85
-        wechatCheck(unionRes.unionid).then((checkRes) => {
85
+        wechatCheck(unionRes.openid).then((checkRes) => {
86 86
           userStore.login(checkRes.token, checkRes.exp)
87 87
           userStore.setUID(checkRes.user.uid)
88 88
           userStore.setUserInfo(checkRes.user)
@@ -163,7 +163,7 @@ async function handleWexinLogin() {
163 163
 
164 164
             setTimeout(() => {
165 165
               uni.navigateTo({
166
-                url: `/pages/user/login/bind-phone?type=1&third_user_id=${unionRes.unionid}&key=0`,
166
+                url: `/pages/user/login/bind-phone?type=1&third_user_id=${unionRes.openid}&key=0`,
167 167
               })
168 168
             }, 1000)
169 169
           }

+ 0 - 2
src/subPages/pages/order/index.vue

@@ -202,8 +202,6 @@ function onClickLeft() {
202 202
       uni.navigateBack()
203 203
     }
204 204
   } else {
205
-    // uni.navigateBack({
206
-    // })
207 205
     uni.switchTab({
208 206
       url: '/pages/user/index'
209 207
     })

+ 17 - 2
src/subPages/pages/phone-bill/index.vue

@@ -59,8 +59,15 @@
59 59
 	}
60 60
 	
61 61
 	function onHistoryClick(){
62
-		
62
+		uni.navigateTo({url:'/subPages/pages/phone-bill/list'})
63
+	}
64
+	
65
+	function isValidChineseMobile(phone) {
66
+	    const regex = /^1[3-9]\d{9}$/;
67
+	    return regex.test(phone);
63 68
 	}
69
+	 
70
+	
64 71
 	
65 72
 	function onSubmitClick(){
66 73
 		
@@ -72,9 +79,17 @@
72 79
 			})
73 80
 			 return
74 81
 		}
82
+		if(!isValidChineseMobile(phoneNum.value)){
83
+			uni.showToast({
84
+				title:'请输入正确手机号',
85
+				icon:'none'
86
+			})
87
+			 return
88
+		}
89
+		
75 90
 		apiRecharge(phoneNum.value,tabList.value[currentIndex.value ].money).then(res=>{
76 91
 				uni.navigateTo({
77
-					url: '/pages/payment/index?' + `pay_price=${tabList.value[currentIndex.value ].money}&order_id=${res.oid}&OrderList=${JSON.stringify({group_order_sn:order_sn})}`,
92
+					url: '/pages/payment/index?' + `initType=1&pay_price=${tabList.value[currentIndex.value ].money}&order_id=${res.oid}`,
78 93
 				})
79 94
 		})
80 95
 	}

+ 141 - 0
src/subPages/pages/phone-bill/list.vue

@@ -0,0 +1,141 @@
1
+<template>
2
+	<view class="contribute-container">
3
+		<view @click='onItemClick(item)' v-if="listInfo && listInfo.length!=0" class="phone-item-out" :key="'phone-item-'+index" v-for="(item,index) in listInfo">
4
+			<text class="phone">{{item.mobile}}</text>
5
+			<view class="phone-item">
6
+				<text class="price">充值金额:{{item.pay_money}}</text>
7
+				<text class="phone">{{dealType(item.status)}}</text>
8
+			</view>
9
+			<text class="data">{{item.create_time}}</text>
10
+			<view  class="item-line"></view>
11
+		</view>
12
+		<CXBEmpty v-else />
13
+	</view>
14
+</template>
15
+
16
+<script setup>
17
+	
18
+	import {
19
+		apiGetHuafeiList
20
+	} from '~/apis/user'
21
+	import {formatDate} from '~/utils/util'
22
+	import { getProductShare } from "~/apis/common";
23
+	import { useUserStore } from '~/stores/userStore'
24
+	import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
25
+	import{IMG_CDN_URL} from '~/config/app.ts'
26
+	
27
+	const currentIndex = ref(0)
28
+	const count=ref(1)
29
+    
30
+	const listInfo=ref([])
31
+	const state = reactive({
32
+		page :1
33
+	})
34
+	
35
+	onLoad((option) => {
36
+		getList()
37
+	})
38
+	
39
+	function onItemClick (item){
40
+		if(item.type==0){
41
+			// uni.navigateTo({
42
+			// 	url: '/pages/payment/index?' + `initType=1&pay_price=${tabList.value[currentIndex.value ].money}&order_id=${res.oid}`,
43
+			// })
44
+		}
45
+	}
46
+	
47
+	function dealType(types){
48
+		let type=''
49
+		if(types==0){
50
+			type='待支付'
51
+		}else if(types==1){
52
+			type='充值中'
53
+		}else if(types==2){
54
+			type='充值成功'
55
+		}else if(types==3){
56
+			type='充值失败'
57
+		}
58
+		return type
59
+	}
60
+	
61
+	function getList(){
62
+		uni.showLoading({
63
+			title:'加载中...'
64
+		})
65
+	    apiGetHuafeiList({page:state.page}).then(res => {
66
+			console.log("+==",res);
67
+	    	listInfo.value= res.list
68
+			count.value = res.count
69
+			uni.hideLoading()
70
+	    })
71
+	}
72
+	
73
+	
74
+	onReachBottom(() => {
75
+		if(dataList.value.length <count.value ){
76
+			state.page += 1
77
+			getList()
78
+		}
79
+	})
80
+	
81
+	onPullDownRefresh(() => {
82
+	   state.page=1
83
+	   getList()
84
+	   uni.stopPullDownRefresh()
85
+	})
86
+	
87
+</script>
88
+
89
+<style lang="scss" scoped>
90
+	.contribute-container {
91
+		display: flex;
92
+		flex-direction: column;
93
+		min-height: 100VH;
94
+		background-color: #fff;
95
+		box-sizing: border-box;
96
+		position: relative;
97
+		
98
+		.phone-item-out{
99
+			display: flex;
100
+			flex-direction: column;
101
+			padding-left: 20rpx;
102
+			box-sizing: border-box;
103
+			padding-right: 20rpx;
104
+			
105
+			.phone{
106
+				font-size: 28rpx;
107
+				color:#333;
108
+				margin-bottom: 20rpx;
109
+				margin-top: 20rpx;
110
+			}
111
+			.price{
112
+				font-size: 28rpx;
113
+				color:#333;
114
+				margin-bottom: 24rpx;
115
+				flex: 1;
116
+			}
117
+			.phone-item{
118
+				display: flex;
119
+				flex-direction: row;
120
+				align-items: center;
121
+			}
122
+			.data{
123
+				font-size: 26rpx;
124
+				color:#999;
125
+				margin-bottom: 20rpx;
126
+			}
127
+			.item-line{
128
+				height: 2rpx;
129
+				width: 100%;
130
+				background-color: #f8f8f8;
131
+			}
132
+		}
133
+		
134
+	}
135
+</style>
136
+
137
+<route lang="yaml">
138
+style:
139
+  navigationBarTitleText: 充值记录
140
+  enablePullDownRefresh: true
141
+</route>

+ 1 - 0
uni-pages.d.ts

@@ -110,6 +110,7 @@ interface NavigateToOptions {
110 110
        "/subPages/pages/order/third-order" |
111 111
        "/subPages/pages/pension_account/index" |
112 112
        "/subPages/pages/phone-bill/index" |
113
+       "/subPages/pages/phone-bill/list" |
113 114
        "/subPages/pages/quick-fuc/business" |
114 115
        "/subPages/pages/quick-fuc/life" |
115 116
        "/subPages/pages/quick-fuc/shop" |