This commit is contained in:
zmj 2023-11-20 14:41:58 +08:00
parent dcf5a1a22f
commit 1f0ea2fe29
4 changed files with 391 additions and 355 deletions

View File

@ -151,6 +151,10 @@
], // /subpkg/townTask/townTask 1
navToList: ["village_task_type_4", "village_task_type_5", "town_task_type_6", "town_task_type_master_6", ],
// /subpkg/townTask/villageTask6
navToVillageTask6List: ['village_task_type_8', 'town_task_type_master_2', 'town_task_type_master_7',
'town_task_type_master_8'
]
};
@ -206,6 +210,10 @@
return this.navTo(
`/subpkg/townTask/villageTask4?task_id=${this.$props.datas?.id}&type_value=${this.$props.datas.task_type_value}`
);
if (this.navToVillageTask6List.includes(this.$props.datas.task_type_value))
return this.navTo(
`/subpkg/townTask/villageTask6?task_id=${this.$props.datas?.id}&type_value=${this.$props.datas.task_type_value}`
);
switch (this.$props.datas.task_type_value) {
case "1":
if (this.$store.state.app.userInfo.admin_id) this.navTo(
@ -239,27 +247,27 @@
// case 67:
// this.navTo(`/subpkg/townTask/villageTask6?task_id=${this.$props.datas?.id}`);
// break;
case "village_task_type_8":
this.navTo(`/subpkg/townTask/villageTask6?task_id=${this.$props.datas?.id}`);
break;
case "town_task_type_master_2":
this.navTo(
`/subpkg/townTask/villageTask6?task_id=${this.$props.datas?.id}&type_value=${this.$props.datas.task_type_value}`
);
break;
// case "village_task_type_8":
// this.navTo(`/subpkg/townTask/villageTask6?task_id=${this.$props.datas?.id}`);
// break;
// case "town_task_type_master_2":
// this.navTo(
// `/subpkg/townTask/villageTask6?task_id=${this.$props.datas?.id}&type_value=${this.$props.datas.task_type_value}`
// );
// break;
case "town_task_type_master_3":
this.navTo(`/subpkg/townTask/gatherRecords?task_id=${this.$props.datas?.id}`);
break;
case "town_task_type_master_7":
this.navTo(
`/subpkg/townTask/villageTask6?task_id=${this.$props.datas?.id}&type_value=${this.$props.datas.task_type_value}`
);
break;
case "town_task_type_master_8":
this.navTo(
`/subpkg/townTask/villageTask6?task_id=${this.$props.datas?.id}&type_value=${this.$props.datas.task_type_value}`
);
break;
// case "town_task_type_master_7":
// this.navTo(
// `/subpkg/townTask/villageTask6?task_id=${this.$props.datas?.id}&type_value=${this.$props.datas.task_type_value}`
// );
// break;
// case "town_task_type_master_8":
// this.navTo(
// `/subpkg/townTask/villageTask6?task_id=${this.$props.datas?.id}&type_value=${this.$props.datas.task_type_value}`
// );
// break;
default:
this.navTo('');
break;

View File

@ -1,359 +1,392 @@
<template>
<view class="">
<view class="info">
<view class="bg"></view>
<view class="card">
<view class="title">充值信息</view>
<view class="item">
<text>充值账户</text>
<text>{{$store.state.app.userInfo.company.company_name||''}}</text>
</view>
</view>
</view>
<view class="price">
<view class="title">充值金额</view>
<view class="tab">
<view v-if="task_id>0" class="item active" style="margin: 0;">{{this.payMoney.money}}</view>
<view v-else class="item" :class="index==changeMoney?'active':''" @click="changePrice(index)"
v-for="(item, index) in priceList" :key="index">{{item}}</view>
</view>
<input v-if="priceList[changeMoney]=='自定义'" class="input" type="digit" placeholder="输入充值金额(元)" v-model="payMoney.money" />
<button class="btn" @click="pay">充值</button>
<button class="btn btn2" @click="navToRecord">充值记录</button>
</view>
<!-- <view class="tip">
<view class="">
<view class="info">
<view class="bg"></view>
<view class="card">
<view class="title">充值信息</view>
<view class="item">
<text>充值账户</text>
<text>{{$store.state.app.userInfo.company.company_name||''}}</text>
</view>
</view>
</view>
<view class="price">
<view class="title">充值金额</view>
<view class="tab">
<view v-if="task_id>0" class="item active" style="margin: 0;">{{this.payMoney.money}}</view>
<view v-else class="item" :class="index==changeMoney?'active':''" @click="changePrice(index)"
v-for="(item, index) in priceList" :key="index">{{item}}</view>
</view>
<input v-if="priceList[changeMoney]=='自定义'" class="input" type="digit" placeholder="输入充值金额(元)"
v-model="payMoney.money" />
<button class="btn" @click="pay">充值</button>
<button class="btn btn2" @click="navToRecord">充值记录</button>
</view>
<!-- <view class="tip">
<view class="title">注意事项</view>
<view class="text">充值后帐户的金额不能提现可用于商城消费使用佣金导入账户之后不能再次导出不可提现账户充值出现问题可联系商城客服也可拨打商城客服热线<text @click="copyPhone('4008888888')">4008888888</text>
</view>
</view> -->
</view>
</view>
</template>
<script>
import { recharge, payWay, payPrepay, wechatJsConfig, payStatus } from "@/api/pay.js"
import { userInfo } from "@/api/oaUser.js"
import { Toast } from '@/libs/uniApi.js'
import { taskShareholder } from "@/api/task.js"
export default {
data() {
return {
priceList: ['10元','50元','100元','500元','1000元','5000元','10000元', '自定义'],
changeMoney: -1,
payMoney: {
money: ''
},
payTimer: null,
timeCount: 5,
task_id: -1, //id,,
task: {}
}
},
//
onNavigationBarButtonTap(res){
if (res.index === 0) {
this.navToRecord();
}
},
onLoad(options) {
if(options.task_id){
this.task_id=options.task_id;
this.loadTask();
}
},
methods: {
changePrice(index){
if(this.changeMoney == index)this.changeMoney = -1;
else this.changeMoney = index;
if(this.priceList[index]=='自定义')this.payMoney.money = '';
else this.payMoney.money = this.priceList[index].split('元')[0];
},
//
navToRecord(){
uni.navigateTo({
url: '/subpkg/topUpList/topUpList'
})
},
//
async loadTask(){
uni.showLoading({
title: '加载中',
mask: true
})
let res = await taskShareholder({
id: this.task_id
});
this.task = res.data;
this.payMoney.money = res.data?.extend?.shareholder?.money;
uni.hideLoading();
},
//
pay(){
if(!this.payMoney.money)return Toast('请先填写充值金额!')
if(this.payMoney.money<=0)return Toast('充值金额不能小于0!')
if(this.payTimer==null){
this.goRecharge();
this.payTimer = setInterval(()=>{
this.timeCount--;
if(this.timeCount<=0){
clearInterval(this.payTimer);
this.payTimer = null;
this.timeCount = 5;
}
}, 1000)
}
else Toast(this.timeCount+'秒后再支付!')
},
goRecharge() {
// console.log(obj);
uni.showLoading({
title:'获取支付信息',
success: async () => {
let queryData = {
money: this.payMoney.money,
type:300
};
if(this.task_id>0) {
queryData.task_id = this.task_id;
}
let { data } = await recharge(queryData);
let res = await payWay({
order_id: data.order_id,
from: data.from,
})
// console.log(res);
let res1 = await payPrepay({
from: data.from,
order_id: data.order_id,
pay_way: res.data.lists[0].pay_way
})
// console.log(res1.data, res1.data.config.package.split('=')[1]);
let obj = {
"appid": res1.data.config.appId, // - - AppId AppId
"noncestr": res1.data.config.nonceStr, //
"package": res1.data.config.package, //
"partnerid": res1.data.config.partnerid, //
"prepayid": res1.data.config.package.split('=')[1], //
"timestamp": res1.data.config.timestamp, //
"sign": res1.data.config.paySign
}
uni.getProvider({
service: 'payment',
success: (paymentList) => {
// console.log(paymentList);
uni.hideLoading();
uni.showLoading({
title:'微信支付中'
})
uni.requestPayment({
provider: 'wxpay',
// orderInfo: res1.data.config,
orderInfo: obj,
success: (e) => {
// console.log('', e);
uni.hideLoading();
payStatus({
order_id: data.order_id,
from: data.from,
}).then((status)=>{
uni.showToast({
icon: status.data.pay_status?'success':'none',
title: status.data.pay_status?'支付成功':'支付失败'
})
if(this.task_id>0){
uni.$emit('upBuyShare');
uni.navigateBack();
}
else{
userInfo().then(user=>{
this.$store.commit('setUserInfo', user.data);
})
}
})
},
fail: (e) => {
console.log(e);
uni.hideLoading();
uni.showToast({
icon:'error',
title: '支付失败!'
})
},
complete: () => {
if(this.task_id<=0)this.payMoney.money = '';
},
});
}
})
},
fail: (e) => {
uni.showToast({
icon:'error',
title:'请先安装微信'
})
}
})
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
import {
recharge,
payWay,
payPrepay,
wechatJsConfig,
payStatus
} from "@/api/pay.js"
import {
userInfo
} from "@/api/oaUser.js"
import {
Toast
} from '@/libs/uniApi.js'
import {
taskShareholder
} from "@/api/task.js"
export default {
data() {
return {
priceList: ['10元', '50元', '100元', '500元', '1000元', '5000元', '10000元', '自定义'],
changeMoney: -1,
payMoney: {
money: ''
},
payTimer: null,
timeCount: 5,
task_id: -1, //id,,
task: {},
obj: "323",
}
},
//
onNavigationBarButtonTap(res) {
if (res.index === 0) {
this.navToRecord();
}
},
onLoad(options) {
if (options.task_id) {
this.task_id = options.task_id;
this.loadTask();
}
},
methods: {
aa() {
return JSON.parse(this.obj)
},
changePrice(index) {
if (this.changeMoney == index) this.changeMoney = -1;
else this.changeMoney = index;
if (this.priceList[index] == '自定义') this.payMoney.money = '';
else this.payMoney.money = this.priceList[index].split('元')[0];
},
//
navToRecord() {
uni.navigateTo({
url: '/subpkg/topUpList/topUpList'
})
},
//
async loadTask() {
uni.showLoading({
title: '加载中',
mask: true
})
let res = await taskShareholder({
id: this.task_id
});
this.task = res.data;
this.payMoney.money = res.data?.extend?.shareholder?.money;
uni.hideLoading();
},
//
pay() {
if (!this.payMoney.money) return Toast('请先填写充值金额!')
if (this.payMoney.money <= 0) return Toast('充值金额不能小于0!')
if (this.payTimer == null) {
this.goRecharge();
this.payTimer = setInterval(() => {
this.timeCount--;
if (this.timeCount <= 0) {
clearInterval(this.payTimer);
this.payTimer = null;
this.timeCount = 5;
}
}, 1000)
} else Toast(this.timeCount + '秒后再支付!')
},
goRecharge() {
let that = this
// console.log(obj);
uni.showLoading({
title: '获取支付信息',
success: async () => {
let queryData = {
money: this.payMoney.money,
type: 300
};
if (this.task_id > 0) {
queryData.task_id = this.task_id;
}
let {
data
} = await recharge(queryData);
let res = await payWay({
order_id: data.order_id,
from: data.from,
})
// console.log(res);
let res1 = await payPrepay({
from: data.from,
order_id: data.order_id,
pay_way: res.data.lists[0].pay_way
})
// console.log(res1.data, res1.data.config.package.split('=')[1]);
let obj = {
"appid": res1.data.appid, // - - AppId AppId
"noncestr": res1.data.noncestr, //
"package": res1.data.package, //
"partnerid": res1.data.partnerid, //
"prepayid": res1.data.prepayid, //
"timestamp": res1.data.timestamp, //
"sign": res1.data.sign
}
uni.getProvider({
service: 'payment',
success: (paymentList) => {
// console.log(paymentList);
uni.hideLoading();
uni.showLoading({
title: '微信支付中'
})
uni.requestPayment({
provider: 'wxpay',
// orderInfo: res1.data.config,
orderInfo: obj,
success: (e) => {
// console.log('', e);
uni.hideLoading();
payStatus({
order_id: data.order_id,
from: data.from,
}).then((status) => {
uni.showToast({
icon: status.data
.pay_status ?
'success' : 'none',
title: status.data
.pay_status ?
'支付成功' : '支付失败'
})
if (this.task_id > 0) {
uni.$emit('upBuyShare');
uni.navigateBack();
} else {
userInfo().then(user => {
this.$store.commit(
'setUserInfo',
user.data);
})
}
})
},
fail: (e) => {
console.log(e);
uni.hideLoading();
uni.showToast({
icon: 'error',
title: '支付失败!'
})
},
complete: () => {
if (this.task_id <= 0) this.payMoney.money =
'';
},
});
}
})
},
fail: (e) => {
uni.showToast({
icon: 'error',
title: '请先安装微信'
})
}
})
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
page {
background-color: #fff;
}
page {
background-color: #fff;
}
.info {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
height: 250rpx;
.info {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
height: 250rpx;
.bg {
background-color: $theme-oa-color;
height: 170rpx;
width: 100vw;
border-radius: 0rpx 0rpx 28rpx 28rpx;
position: absolute;
top: 0;
left: 0;
}
.bg {
background-color: $theme-oa-color;
height: 170rpx;
width: 100vw;
border-radius: 0rpx 0rpx 28rpx 28rpx;
position: absolute;
top: 0;
left: 0;
}
.card {
width: 694rpx;
min-height: 180rpx;
background: #FFFFFF;
margin-top: 38.55rpx;
box-shadow: 0rpx 0rpx 18rpx 2rpx rgba(50, 116, 249, 0.1);
border-radius: 14rpx 14rpx 14rpx 14rpx;
opacity: 1;
padding: 31.5rpx 28rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
position: absolute;
top: 0;
.card {
width: 694rpx;
min-height: 180rpx;
background: #FFFFFF;
margin-top: 38.55rpx;
box-shadow: 0rpx 0rpx 18rpx 2rpx rgba(50, 116, 249, 0.1);
border-radius: 14rpx 14rpx 14rpx 14rpx;
opacity: 1;
padding: 31.5rpx 28rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
position: absolute;
top: 0;
.title {
font-size: 32rpx;
font-weight: 600;
color: #333333;
padding-bottom: 10rpx;
}
.title {
font-size: 32rpx;
font-weight: 600;
color: #333333;
padding-bottom: 10rpx;
}
.item {
display: flex;
justify-content: space-between;
font-size: 32rpx;
font-weight: 400;
color: #333333;
text:nth-child(1){
flex-shrink: 0;
margin-right: 18rpx;
}
}
}
}
.item {
display: flex;
justify-content: space-between;
font-size: 32rpx;
font-weight: 400;
color: #333333;
.price {
display: flex;
flex-direction: column;
padding: 0 28rpx;
margin-top: 50rpx;
text:nth-child(1) {
flex-shrink: 0;
margin-right: 18rpx;
}
}
}
}
.title {
font-size: 32rpx;
font-weight: 600;
color: #333333;
line-height: 39rpx;
margin-bottom: 42rpx;
}
.price {
display: flex;
flex-direction: column;
padding: 0 28rpx;
margin-top: 50rpx;
.tab {
display: flex;
flex-wrap: wrap;
justify-content: left;
width: 694rpx;
.title {
font-size: 32rpx;
font-weight: 600;
color: #333333;
line-height: 39rpx;
margin-bottom: 42rpx;
}
.item {
width: 217rpx;
height: 131rpx;
margin: 0 auto;
margin-bottom: 20rpx;
border-radius: 7rpx 7rpx 7rpx 7rpx;
border: 2rpx solid #F5F5F5;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
font-weight: 500;
line-height: 32rpx;
}
.tab {
display: flex;
flex-wrap: wrap;
justify-content: left;
width: 694rpx;
.active {
border: 2rpx solid $theme-oa-color;
color: $theme-oa-color;
}
}
.item {
width: 217rpx;
height: 131rpx;
margin: 0 auto;
margin-bottom: 20rpx;
border-radius: 7rpx 7rpx 7rpx 7rpx;
border: 2rpx solid #F5F5F5;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
font-weight: 500;
line-height: 32rpx;
}
.input {
width: 100%;
height: 112rpx;
background: #F5F5F5;
border-radius: 56rpx 56rpx 56rpx 56rpx;
opacity: 1;
padding: 0 45.56rpx;
box-sizing: border-box;
font-size: 28rpx;
font-weight: 400;
color: #333;
line-height: 35rpx;
}
.active {
border: 2rpx solid $theme-oa-color;
color: $theme-oa-color;
}
}
.btn {
width: 694rpx;
height: 84rpx;
margin-top: 73.6rpx;
background: $theme-oa-color;
box-shadow: 0rpx 14rpx 44rpx 2rpx #E9EFF5;
border-radius: 42rpx 42rpx 42rpx 42rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
font-weight: 400;
color: #FFFFFF;
}
.btn2{
background-color: #fff;
color: #333;
border: 1px solid #eee;
}
}
.input {
width: 100%;
height: 112rpx;
background: #F5F5F5;
border-radius: 56rpx 56rpx 56rpx 56rpx;
opacity: 1;
padding: 0 45.56rpx;
box-sizing: border-box;
font-size: 28rpx;
font-weight: 400;
color: #333;
line-height: 35rpx;
}
.tip {
display: flex;
flex-direction: column;
padding: 0 28rpx;
margin-top: 84rpx;
.btn {
width: 694rpx;
height: 84rpx;
margin-top: 73.6rpx;
background: $theme-oa-color;
box-shadow: 0rpx 14rpx 44rpx 2rpx #E9EFF5;
border-radius: 42rpx 42rpx 42rpx 42rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
font-weight: 400;
color: #FFFFFF;
}
.title {
font-size: 32rpx;
font-weight: 500;
color: $theme-oa-color;
line-height: 32rpx;
margin-bottom: 21rpx;
}
.btn2 {
background-color: #fff;
color: #333;
border: 1px solid #eee;
}
}
.text {
font-size: 28rpx;
font-weight: 400;
color: rgba(0, 0, 0, 0.6);
line-height: 42rpx;
-webkit-background-clip: text;
}
}
.tip {
display: flex;
flex-direction: column;
padding: 0 28rpx;
margin-top: 84rpx;
.title {
font-size: 32rpx;
font-weight: 500;
color: $theme-oa-color;
line-height: 32rpx;
margin-bottom: 21rpx;
}
.text {
font-size: 28rpx;
font-weight: 400;
color: rgba(0, 0, 0, 0.6);
line-height: 42rpx;
-webkit-background-clip: text;
}
}
</style>

View File

@ -163,8 +163,6 @@
}
},
async submitFn() {
if (!this.amount) return Toast("请输入金额")
let data = {
id: this.task_id,

View File

@ -211,9 +211,6 @@
video_annex: this.videoList
});
}
this.other.is_commit = 1;
this.approve_status = 1;
Toast('提交成功');