ylong 6 months ago
parent
commit
0f3fcefd37

+ 16 - 4
App.vue

@@ -26,9 +26,9 @@ export default {
 	},
 	onLaunch(options) {
 		console.log(options, "onLaunch系统信息");
-		let that = this;
 		let params = {};
 		if (options.query) {
+			// #ifdef MP-WEIXIN
 			if (options.query.scene) {
 				// 对 scene 进行解码
 				const decodeScene = decodeURIComponent(options.query.scene);
@@ -48,13 +48,19 @@ export default {
 				} else if (params.upsellCode) {
 					// 用于书籍加价的邀请码,关联订单 id 和 isbn
 					uni.setStorageSync('upsellCode', params.upsellCode)
-					that.globalData.upsellCode = params.upsellCode
+					this.globalData.upsellCode = params.upsellCode
 					console.log('解析出的 upsellCode 参数:', params.upsellCode);
 					this.slientLogin(params.upsellCode, 'upsellCode');
-				} else {
+				} else if(params.exclusiveCode) {
+					uni.setStorageSync('exclusiveCode', params.exclusiveCode)
+					this.globalData.exclusiveCode = params.exclusiveCode
+					console.log('解析出的 exclusiveCode 参数:', params.exclusiveCode);
+					this.slientLogin(params.exclusiveCode, 'exclusiveCode');
+				}else{
 					this.slientLogin();
 				}
 			}
+			// #endif
 
 			// 如果链接参数中有一个名为 inviteCode 的参数
 			if (options.query.inviteCode) {
@@ -64,9 +70,15 @@ export default {
 			// 如果链接参数中有一个名为 upsellCode 的参数
 			if (options.query.upsellCode) {
 				uni.setStorageSync('upsellCode', options.query.upsellCode)
-				that.globalData.upsellCode = options.query.upsellCode
+				this.globalData.upsellCode = options.query.upsellCode
 				this.slientLogin(options.query.upsellCode, 'upsellCode');
 			}
+			// 如果链接参数中有一个名为 exclusiveCode 的参数
+			if (options.query.exclusiveCode) {
+				uni.setStorageSync('exclusiveCode', options.query.exclusiveCode)
+				this.globalData.exclusiveCode = options.query.exclusiveCode
+				this.slientLogin(options.query.exclusiveCode, 'exclusiveCode');
+			}
 		}else{
 			this.slientLogin()
 		}

+ 1 - 0
components/floating-drag.vue

@@ -153,6 +153,7 @@ export default {
 
         // 触摸移动
         touchMove(e) {
+            if(!e) return;
             // 阻止默认行为,防止页面滚动
             e.preventDefault && e.preventDefault();
             e.stopPropagation && e.stopPropagation();

+ 6 - 1
manifest.json

@@ -122,7 +122,12 @@
     "mp-alipay" : {
         "usingComponents" : true,
         "component2" : true,
-        "appid" : "2021005103690548"
+        "appid" : "2021005103690548",
+		"permission": {
+		  "scope.userPhoneNumber": {
+			"desc": "获取用户手机号"
+		  }
+		}
     },
     "mp-qq" : {
         "optimization" : {

+ 2 - 2
pages-mine/components/order-return-actions.vue

@@ -9,7 +9,7 @@
             </template>
 
             <!-- 待取件 -->
-            <button v-if="status === 2" class="action-btn" @click.stop="handleAction('confirm')">确认收货</button>
+            <button v-if="status == 2" class="action-btn" @click.stop="handleAction('confirm')">确认收货</button>
         </view>
     </view>
 </template>
@@ -20,7 +20,7 @@ export default {
     name: 'OrderActions',
     props: {
         status: {
-            type: Number,
+            type: [Number, String],
             required: true
         },
         order: {

+ 1 - 1
pages-mine/pages/customer-service.vue

@@ -8,7 +8,7 @@
 export default {
     data() {
         return {
-            serviceUrl: 'https://testweb.shuhi.com/chat.html'
+            serviceUrl: 'https://zfbkf.shuhi.com/s/132094qkhm'
         }
     }
 }

+ 56 - 25
pages-mine/pages/partner/partner-apply.vue

@@ -5,7 +5,14 @@
             <view class="form-section">
                 <u-form-item label="新手机号" prop="mobile">
                     <u-input v-model="form.mobile" placeholder="获取手机号码" />
-                    <u-button slot="right" type="success" size="mini" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"plain>获取手机号</u-button>
+                    <!-- #ifdef MP-WEIXIN -->
+                    <u-button slot="right" type="success" size="mini" open-type="getPhoneNumber"
+                        @getphonenumber="getPhoneNumber" plain>获取手机号</u-button>
+                    <!-- #endif -->
+                    <!-- #ifdef MP-ALIPAY -->
+                    <button class="phone-btn" slot="right" type="success" size="mini" scope="phoneNumber"
+                        open-type="getAuthorize" @getAuthorize="onGetAuthorize" @error="handleAuthError">获取手机号</button>
+                    <!-- #endif -->
                 </u-form-item>
 
                 <u-form-item label="验证码" prop="verifyCode">
@@ -23,13 +30,8 @@
                 </u-form-item>
 
                 <u-form-item label="地址选择" prop="address" required>
-                    <uni-data-picker
-                        v-model="selAddressCodes"
-                        :localdata="dataList"
-                        placeholder="请选择所在区县"
-                        popup-title="请选择所在区县"
-                        @change="cityChange"
-                    ></uni-data-picker>
+                    <uni-data-picker v-model="selAddressCodes" :localdata="dataList" placeholder="请选择所在区县"
+                        popup-title="请选择所在区县" @change="cityChange"></uni-data-picker>
                 </u-form-item>
 
                 <u-form-item label="学校" prop="school" required>
@@ -120,6 +122,20 @@ export default {
             this.form.cityId = value[1].value;
             this.form.districtId = value[2].value || "";
         },
+        //支付宝获取手机号
+        onGetAuthorize(e) {
+            my.getPhoneNumber({
+                success: (res) => {
+                    this.getPhoneNumberApi(res.response, 'alipay')
+                },
+                fail: (err) => {
+                    console.log('获取手机号失败', err);
+                }
+            })
+        },
+        handleAuthError(e) {
+            console.log(e, 'handleAuthError')
+        },
 
         // 获取手机号
         async getPhoneNumber(e) {
@@ -133,23 +149,7 @@ export default {
                 });
 
                 // 调用后端接口解密手机号
-                uni.$u.http
-                    .post("/token/user/wxMobileUpdate", {
-                        code: e.detail.code,
-                    })
-                    .then((res) => {
-                        if (res.code === 200) {
-                            // 更新手机号
-                            this.form.mobile = res.data.mobile;
-
-                            uni.showToast({
-                                title: "绑定成功",
-                                icon: "success",
-                            });
-                        } else {
-                            uni.$u.toast("手机号获取失败");
-                        }
-                    });
+                this.getPhoneNumberApi(e.detail.code)
             } catch (error) {
                 uni.$u.toast("手机号获取失败");
             } finally {
@@ -157,6 +157,23 @@ export default {
             }
         },
 
+        // 获取手机号
+        getPhoneNumberApi(code, type = 'wechat') {
+            let params = type === 'wechat' ? { code } : code
+            // 调用后端接口解密手机号
+            uni.$u.http.post('/token/user/wxMobileUpdate', params).then(res => {
+                if (res.code === 200) {
+                    this.form.mobile = res.data.mobile;
+                    uni.showToast({
+                        title: "手机号绑定成功",
+                        icon: "success",
+                    });
+                } else {
+                    uni.$u.toast(res.msg);
+                }
+            })
+        },
+
         async getCode() {
             if (!this.form.mobile) {
                 uni.$u.toast("请先获取手机号");
@@ -256,6 +273,20 @@ export default {
         }
     }
 
+    .phone-btn {
+        color: #19be6b;
+        border: 1px solid #71d5a1;
+        background-color: #dbf1e1;
+        font-size: 12px;
+        padding: 0 20rpx;
+        height: 52rpx;
+        line-height: 52rpx;
+        border-radius: 2rpx;
+        &::after{
+            border: none;
+        }
+    }
+
     .fixed-bottom {
         position: fixed;
         left: 0;

+ 76 - 19
pages-mine/pages/setting.vue

@@ -17,7 +17,8 @@
                     <view class="value avatarbox">
                         <button style="flex: none;" open-type="chooseAvatar" class="avatarBtn"
                             @chooseavatar="onChooseavatar">
-                            <u-avatar shape="circle" style="height: 72rpx;" size="72" :src="userInfo.imgPath"></u-avatar>
+                            <u-avatar shape="circle" style="height: 72rpx;" size="72"
+                                :src="userInfo.imgPath"></u-avatar>
                         </button>
                     </view>
                 </u-form-item>
@@ -33,12 +34,23 @@
                 <!-- 手机号 -->
                 <u-form-item label="手机号">
                     <view class="value phone-value">
+                        <!-- #ifdef MP-WEIXIN -->
                         <button class="get-phone-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
                             <text class="common-text-2" v-if="userInfo.mobile">{{ userInfo.mobile }}</text>
                             <text class="common-text" v-else>未绑定</text>
                             <u-icon :color="arrowColor" style="margin-left: 20rpx;" size="28"
                                 name="arrow-right"></u-icon>
                         </button>
+                        <!-- #endif -->
+                        <!-- #ifdef MP-ALIPAY -->
+                        <button class="get-phone-btn" open-type="getAuthorize" scope="phoneNumber"
+                            @getAuthorize="onGetAuthorize" @error="handleAuthError">
+                            <text class="common-text-2" v-if="userInfo.mobile">{{ userInfo.mobile }}</text>
+                            <text class="common-text" v-else>未绑定2</text>
+                            <u-icon :color="arrowColor" style="margin-left: 20rpx;" size="28"
+                                name="arrow-right"></u-icon>
+                        </button>
+                        <!-- #endif -->
                     </view>
                 </u-form-item>
             </u-form>
@@ -103,10 +115,34 @@ export default {
         // 选择并上传头像
         async onChooseavatar(e) {
             const tempFilePath = e.detail.avatarUrl
+            // http://tfs.alipayobjects.com/images/partner/TB1kQ2kXv5GDuNjHvSCXXczuXXa
+            console.log(tempFilePath, 'onChooseavatar')
             if (!tempFilePath) {
                 return uni.$u.toast('获取头像失败')
             }
-
+            // #ifdef MP-ALIPAY
+            // 下载支付宝头像
+            //将tempFilePath转换为https://tfs.alipayobjects.com/images/partner/TB1kQ2kXv5GDuNjHvSCXXczuXXa
+            let url = tempFilePath.indexOf('http://') > -1 ? tempFilePath.replace('http://', 'https://') : tempFilePath
+            my.downloadFile({
+                url: url,
+                success: (res) => {
+                    if (res.statusCode === 200) {
+                        let aliTempFilePath = res.tempFilePath
+                        this.uploadAvatar(aliTempFilePath)
+                    }
+                },
+                fail: (err) => {
+                    console.log(err, 'downloadFile fail')
+                }
+            })
+            // #endif
+            // #ifdef MP-WEIXIN
+            this.uploadAvatar(tempFilePath)
+            // #endif
+        },
+        //上传头像
+        async uploadAvatar(tempFilePath){
             try {
                 this.uploading = true
                 uni.showLoading({
@@ -131,6 +167,7 @@ export default {
             }
         },
 
+
         // 文件上传方法
         uploadFile(filePath) {
             return new Promise((resolve, reject) => {
@@ -157,6 +194,42 @@ export default {
             })
         },
 
+        onGetAuthorize(e) {
+            console.log(e, 'onGetAuthorize')
+            my.getPhoneNumber({
+                success: (res) => {
+                    this.getPhoneNumberApi(res.response, 'alipay')
+                },
+                fail: (err) => {
+                    console.log('获取手机号失败', err);
+                }
+            })
+        },
+
+        handleAuthError(e) {
+            console.log(e, 'handleAuthError')
+        },
+
+        //获取手机号的接口
+        getPhoneNumberApi(code, type = 'wechat') {
+            let params = type === 'wechat' ? { code } : code
+            // 调用后端接口解密手机号
+            uni.$u.http.post('/token/user/wxMobileUpdate', params).then(res => {
+                if (res.code === 200) {
+                    // 更新本地用户信息
+                    this.userInfo.mobile = res.data.mobile
+
+                    uni.showToast({
+                        title: '绑定成功',
+                        icon: 'success'
+                    })
+                } else {
+                    uni.$u.toast('手机号绑定失败')
+                }
+            })
+        },
+
+
         // 获取手机号
         async getPhoneNumber(e) {
             if (e.detail.errMsg !== 'getPhoneNumber:ok') {
@@ -167,23 +240,7 @@ export default {
                 uni.showLoading({
                     title: '手机号获取中'
                 })
-
-                // 调用后端接口解密手机号
-                uni.$u.http.post('/token/user/wxMobileUpdate', {
-                    code: e.detail.code
-                }).then(res => {
-                    if (res.code === 200) {
-                        // 更新本地用户信息
-                        this.userInfo.mobile = res.data.mobile
-
-                        uni.showToast({
-                            title: '绑定成功',
-                            icon: 'success'
-                        })
-                    } else {
-                        uni.$u.toast('手机号绑定失败')
-                    }
-                })
+                this.getPhoneNumberApi(e.detail.code)
             } catch (error) {
                 uni.$u.toast('手机号绑定失败')
             } finally {

+ 3 - 1
pages-mine/pages/wallet.vue

@@ -83,7 +83,9 @@ export default {
     },
     onLoad() {
         this.getWithdrawInfo()
-        this.$refs.pageRef.loadData(true, { queryTypes: '' })
+        this.$nextTick(() => {
+            this.$refs.pageRef.loadData(true, { queryTypes: '' })
+        })
     },
     methods: {
         async getWithdrawInfo() {

+ 14 - 1
pages-mine/pages/withdraw.vue

@@ -2,7 +2,7 @@
     <view class="withdraw-page">
         <!-- 微信账户信息 -->
         <view class="wechat-account">
-            <image class="avatar" :src="userInfo.imgPath" mode="aspectFill"></image>
+            <image class="avatar" :src="userInfo.imgPath || 'https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/logo3.png'" mode="aspectFill"></image>
             <view class="account-info">
                 <text class="nickname">{{ userInfo.nickName }}</text>
                 <text class="amount">可提现金额:</text>
@@ -24,15 +24,28 @@
             <!-- 到账账户 -->
             <view class="flex-a common-gray mt-40">
                 <view class="common-text-2">到账账户:</view>
+                <!-- #ifdef MP-WEIXIN -->
                 <view class="wechat-pay">
                     <image src="../static/wx.png" mode="aspectFit" class="wechat-icon"></image>
                     <text>微信零钱</text>
                 </view>
+                <!-- #endif -->
+                <!-- #ifdef MP-ALIPAY -->
+                <view class="wechat-pay">
+                    <image src="../static/alipay.png" mode="aspectFit" class="wechat-icon"></image>
+                    <text>支付宝</text>
+                </view>
+                <!-- #endif -->
             </view>
 
             <!-- 提现说明 -->
             <view class="mt-20 flex-d common-gray">
+                <!-- #ifdef MP-WEIXIN -->
                 <text class="tip-item">1.用户需微信实名才能申请提现;</text>
+                <!-- #endif -->
+                <!-- #ifdef MP-ALIPAY -->
+                <text class="tip-item">1.用户需支付宝实名才能申请提现;</text>
+                <!-- #endif -->
                 <text class="tip-item">2.用户单笔提现金额需小于200元;</text>
                 <text class="tip-item">3.用户申请提现以后,余额会显示冻结,提现金额最晚会在72小时到账(周末、节假日顺延)</text>
             </view>

+ 11 - 5
pages/mine/components/withdrawal-progress.vue

@@ -19,7 +19,9 @@
                 <view class="progress-steps">
                     <!-- Step 1: 申请提现 -->
                     <view class="step-item completed">
-                        <u-icon class="step-icon yuan-icon" name="red-packet" color="#ffffff" size="40"></u-icon>
+                        <view class="step-icon yuan-icon">
+                            <u-icon name="red-packet" color="#ffffff" size="40"></u-icon>
+                        </view>
                         <view class="step-label">申请提现</view>
                     </view>
 
@@ -33,7 +35,9 @@
                         class="step-item"
                         :class="{ completed: orderInfo.status > 1, current: orderInfo.status == 1 }"
                     >
-                        <u-icon class="step-icon yuan-icon" name="account" color="#ffffff" size="40"></u-icon>
+                        <view class="step-icon yuan-icon">
+                            <u-icon name="account" color="#ffffff" size="40"></u-icon>
+                        </view>
                         <view class="step-label">后台审核</view>
                     </view>
 
@@ -47,7 +51,9 @@
                         class="step-item"
                         :class="{ completed: orderInfo.status > 2, current: orderInfo.status == 2 }"
                     >
-                        <u-icon class="step-icon yuan-icon" name="checkmark-circle" color="#ffffff" size="40"></u-icon>
+                        <view class="step-icon yuan-icon">
+                            <u-icon name="checkmark-circle" color="#ffffff" size="40"></u-icon>
+                        </view>
                         <view class="step-label">申请人确认</view>
                     </view>
                 </view>
@@ -105,7 +111,7 @@ export default {
 };
 </script>
 
-<style lang="scss" scoped>
+<style lang="scss">
 .modal-content {
     background: linear-gradient(-90deg, #98e05f, #0de3ac);
     border-radius: 26rpx;
@@ -156,7 +162,7 @@ export default {
         flex-direction: column;
         align-items: center;
         position: relative;
-        width: 25%;
+        width: 27%;
 
         .step-icon {
             width: 80rpx;

+ 2 - 0
uview-ui/libs/request/index.js

@@ -20,7 +20,9 @@ class Request {
 			this.options = interceptorRequest;
 		}
 		options.dataType = options.dataType || this.config.dataType;
+		// #ifdef MP-WEIXIN
 		options.responseType = options.responseType || this.config.responseType;
+		// #endif
 		options.url = options.url || '';
 		options.params = options.params || {};
 		options.header = Object.assign({}, this.config.header, options.header);