Browse Source

feat(分享): 添加微信分享功能及相关配置

refactor(支付): 移除wxPay中冗余的JSSDK配置代码
fix(优惠券): 修复优惠券列表获取时机问题
style(表单): 优化textarea组件样式代码结构
feat(提现): 增加H5端微信商户转账功能
docs(配置): 更新重定向URL配置
pull/9/head
前端-胡立永 1 month ago
parent
commit
922517dc3b
12 changed files with 145 additions and 75 deletions
  1. +7
    -0
      api/model/login.js
  2. +2
    -2
      config.js
  3. +3
    -0
      main.js
  4. +15
    -0
      pages_order/auth/wxUserInfo.vue
  5. +6
    -3
      pages_order/components/formTextarea.vue
  6. +3
    -1
      pages_order/mine/coupon.vue
  7. +84
    -56
      pages_order/mine/runningWater.vue
  8. +4
    -1
      pages_order/order/createOrder.vue
  9. +4
    -2
      store/store.js
  10. +4
    -0
      utils/index.js
  11. +5
    -5
      utils/pay.js
  12. +8
    -5
      utils/share.js

+ 7
- 0
api/model/login.js View File

@ -45,6 +45,13 @@ const api = {
method: 'GET',
auth: true,
},
//公众号签名
getVipShareSign : {
url: '/share/getVipShareSign',
method: 'GET',
},
}
export default api

+ 2
- 2
config.js View File

@ -15,12 +15,12 @@ const config = {
dev: {
baseUrl: 'http://augcl.natapp1.cc/massage-admin/massage',
// redirect : 'http://h5.xzaiyp.top',
redirect : 'https://wwwh5.yurangongfang.com',
redirect : 'https://wwwh5.yurangongfang.com/',
},
prod: {
baseUrl: 'https://www.yurangongfang.com/massage-admin/massage',
// baseUrl: 'https://www.yurangongfang.com/massage-admin/massage',
redirect : 'https://wwwh5.yurangongfang.com',
redirect : 'https://wwwh5.yurangongfang.com/',
},
}


+ 3
- 0
main.js View File

@ -41,6 +41,9 @@ function GetQueryString(name) {
}catch(e){}
}
GetQueryString('vid');
import share from '@/utils/share.js'
share()
// #endif


+ 15
- 0
pages_order/auth/wxUserInfo.vue View File

@ -45,6 +45,8 @@
<view class="label">
手机号
</view>
<!-- #ifdef MP-WEIXIN -->
<view class="content">
<input v-if="userInfoForm.phone"
placeholder-class="uni-placeholder"
@ -64,6 +66,19 @@
</button>
</view>
</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="content">
<input
placeholder-class="uni-placeholder"
placeholder="请输入手机号"
style="text-align: right;"
v-model="userInfoForm.phone"
/>
</view>
<!-- #endif -->
</view>
</view>


+ 6
- 3
pages_order/components/formTextarea.vue View File

@ -2,9 +2,12 @@
<uv-textarea :value="value" @input="$emit('input', $event)" :placeholder="placeholder" height="175rpx" border="none"
:customStyle="{
backgroundColor: '#F5F5F5',
borderRadius: '6rpx',
}" placeholderStyle="color: '#999999';
fontSize: '28rpx';"></uv-textarea>
borderRadius: '6rpx',}"
></uv-textarea>
<!--
:placeholderStyle="{color: '#999999',
fontSize: '28rpx'}" -->
</template>


+ 3
- 1
pages_order/mine/coupon.vue View File

@ -50,7 +50,9 @@
},
},
onShow() {
this.getCouponList()
this.$nextTick(() => {
this.getCouponList()
})
},
data() {
return {


+ 84
- 56
pages_order/mine/runningWater.vue View File

@ -4,13 +4,8 @@
<navbar title="提现记录" leftClick @leftClick="$utils.navigateBack" color="#fff" />
<view class="tools">
<uv-datetime-picker
ref="datetimePicker"
v-model="selectedTime"
mode="year-month"
confirmColor="#84A73F"
@confirm="onTimeChange"
></uv-datetime-picker>
<uv-datetime-picker ref="datetimePicker" v-model="selectedTime" mode="year-month" confirmColor="#84A73F"
@confirm="onTimeChange"></uv-datetime-picker>
<button plain class="flex btn" @click="openTimePicker">
<text>{{ displaySelectedTime }}</text>
<image class="btn-icon" src="../static/runningWater/icon-arrow.png" mode="widthFix"></image>
@ -19,19 +14,15 @@
<view class="card list">
<template v-if="list.length">
<view class="flex list-item"
v-for="(item, index) in list"
:key="index"
>
<image class="list-item-icon" src="../static/runningWater/icon-commission.png" mode="widthFix"></image>
<view class="flex list-item" v-for="(item, index) in list" :key="index">
<image class="list-item-icon" src="../static/runningWater/icon-commission.png" mode="widthFix">
</image>
<view class="list-item-info">
<view class="highlight">佣金提现</view>
<view>{{ item.createTime }}</view>
</view>
<view class="list-item-value">{{ `-${item.amount}` }}</view>
<view class="uni-color-btn"
@click="withdraw(item)"
v-if="item.status == 0">领取</view>
<view class="uni-color-btn" @click="withdraw(item)" v-if="item.status == 0">领取</view>
</view>
</template>
<template v-else>
@ -51,12 +42,12 @@
selectedTime: new Date(),
x: ['+', '-', '-', '+'],
mixinsListApi: "queryCashoutLog",//getWaterPageList
mixinsListApi: "queryCashoutLog", //getWaterPageList
beforeDate: new Date(), //
afterDate: new Date(), //
totalMoney : 0,
totalWithdraw : 0,
totalMoney: 0,
totalWithdraw: 0,
}
},
computed: {
@ -74,9 +65,9 @@
//
handleSelectCalendars(day) {
console.log(day);
// let beforeDate = this.getYearMonth(day?.range?.before)
// let afterDate = this.getYearMonth(day?.range?.after)
// this.beforeYear = beforeDate.year;
@ -84,8 +75,8 @@
// this.afterYear = afterDate.year;
// this.afterMonth = afterDate.month;
},
getDataThen(list, total, result){
getDataThen(list, total, result) {
this.totalMoney = result.totalMoney
this.totalWithdraw = result.totalWithdraw
this.list = result.page.records
@ -99,45 +90,82 @@
// todo
console.log('--onTimeChange', e)
},
withdraw(item){
requestMerchantTransferH5(item, fn) {
wx.ready(function() {
wx.checkJsApi({
jsApiList: ['requestMerchantTransfer'],
success: function(res) {
if (res.checkResult['requestMerchantTransfer']) {
WeixinJSBridge.invoke('requestMerchantTransfer', {
appId: this.$config.appId,
mchId: this.$config.mchId,
package: item.packageInfo,
},
function(res) {
if (res.err_msg === 'requestMerchantTransfer:ok') {
// res.err_msgsuccess
fn && fn()
}
}
);
} else {
alert('你的微信版本过低,请更新至最新版本。');
}
}
});
});
},
withdraw(item) {
// #ifdef H5
this.requestMerchantTransferH5(item, () => {
this.$store.commit('getUserInfo')
this.$store.commit('getRiceInfo')
this.$api('getMoney', {
id: item.id,
}).then(res => {
this.getData()
})
})
return
// #endif
//
if (!wx.canIUse('requestMerchantTransfer')) {
wx.showModal({
content: '你的微信版本过低,请更新至最新版本。',
showCancel: false,
});
return
wx.showModal({
content: '你的微信版本过低,请更新至最新版本。',
showCancel: false,
});
return
}
// API
wx.requestMerchantTransfer({
mchId: this.$config.mchId,
appId: wx.getAccountInfoSync().miniProgram.appId,
package: item.packageInfo,
success: (res) => {
uni.showToast({
title: '提现申请已提交',
icon: 'success'
})
this.$store.commit('getUserInfo')
appId: wx.getAccountInfoSync().miniProgram.appId,
mchId: this.$config.mchId,
package: item.packageInfo,
success: (res) => {
this.$store.commit('getUserInfo')
this.$store.commit('getRiceInfo')
this.$api('getMoney', {
id : item.id,
id: item.id,
}).then(res => {
this.getData()
})
},
fail: (res) => {
console.log('fail:', res);
uni.showToast({
title: '提现失败,请稍后再试',
icon: 'none'
})
},
complete: (res) => {
console.log('requestMerchantTransfer完成:', res);
}
},
fail: (res) => {
console.log('fail:', res);
uni.showToast({
title: '提现失败,请稍后再试',
icon: 'none'
})
},
complete: (res) => {
console.log('requestMerchantTransfer完成:', res);
}
});
},
}
@ -148,13 +176,13 @@
.page {
background-color: $uni-bg-color;
min-height: 100vh;
/deep/ .nav-bar__view {
background-image: linear-gradient(#84A73F, #D8FF8F);
}
}
.uni-color-btn{
.uni-color-btn {
padding: 10rpx 20rpx;
margin: 0;
font-size: 26rpx;
@ -179,7 +207,7 @@
}
}
}
.list {
margin: 9rpx 13rpx;
padding: 31rpx 20rpx;


+ 4
- 1
pages_order/order/createOrder.vue View File

@ -115,7 +115,6 @@
}
},
onShow() {
this.getCouponList()
},
methods: {
//
@ -125,6 +124,9 @@
//
openCoupon() {
this.$refs.couponPopup.open('bottom')
this.$nextTick(() => {
this.getCouponList()
})
},
//
selectCoupon(e) {
@ -179,6 +181,7 @@
// #ifdef H5
console.log('$wxPay');
await this.$wxPay(res)
// #endif
}


+ 4
- 2
store/store.js View File

@ -73,6 +73,7 @@ const store = new Vuex.Store({
h5Login(state, config){
Vue.set(state, 'userInfo', config.userInfo)
uni.setStorageSync('token', config.token)
uni.setStorageSync('userInfo', config.userInfo)
uni.reLaunch({
url: '/pages/index/index'
})
@ -124,11 +125,12 @@ const store = new Vuex.Store({
api('getInfo', res => {
if (res.code == 200) {
Vue.set(state, 'userInfo', res.result)
uni.setStorageSync('userInfo', res.result)
if (!state.userInfo.nickName ||
!state.userInfo.headImage
// ||
// !state.userInfo.phone
||
!state.userInfo.phone
) {
uni.showModal({
title: '申请获取您的信息!',


+ 4
- 0
utils/index.js View File

@ -13,6 +13,10 @@ import md5 from './lib/md5.js'
// #ifdef H5
import jWeixin from './lib/jweixin-module.js'
console.log('jWeixin', jWeixin);
import { wxPay } from './pay.js'
Vue.prototype.$jWeixin = jWeixin
Vue.prototype.$wxPay = wxPay


+ 5
- 5
utils/pay.js View File

@ -10,11 +10,11 @@ import jWeixin from './lib/jweixin-module.js'
export function wxPay(res) {
return new Promise((resolve, reject) => {
// 配置微信JSSDK
jWeixin.config({
debug: false,
appId: res.result.appId, //必填,公众号的唯一标识
jsApiList: ['chooseWXPay'] //必填,需要使用的JS接口列表
});
// jWeixin.config({
// debug: false,
// appId: res.result.appId, //必填,公众号的唯一标识
// jsApiList: ['chooseWXPay'] //必填,需要使用的JS接口列表
// });
// JSSDK配置成功后的回调
jWeixin.ready(function() {


+ 8
- 5
utils/share.js View File

@ -1,11 +1,12 @@
import api from '@/api/api.js'
import config from "../config.js"
import jWeixin from './lib/jweixin-module.js'
import Vue from 'vue'
function share() { //微信分享
//获取签名
let data = {
url: import.meta.env.VITE_REDIRECT_URI + '/#/'
url: Vue.prototype.$config.redirect
}
api('getVipShareSign', data, res => {
if (res.code == 200) {
@ -25,7 +26,9 @@ function share() { //微信分享
'updateTimelineShareData',
'updateAppMessageShareData',
'onMenuShareWeibo',
'getLocation'
'getLocation',
'chooseWXPay',
'requestMerchantTransfer',
]
});
@ -33,9 +36,9 @@ function share() { //微信分享
// 微信分享的数据
var shareData = {
"link": addQueryParams(data.url),
"desc": "泰柔到家",
"title": "泰柔到家,温柔呵护每一刻!",
imgUrl : import.meta.env.VITE_REDIRECT_URI + '/static/share/logo.png',
"desc": "愈然工坊",
"title": "愈然工坊,温柔呵护每一刻!",
imgUrl : Vue.prototype.$config.redirect + '/static/share/logo.png',
success: function() {
//分享成功可以做相应的数据处理
// uni.showToast({


Loading…
Cancel
Save