shop-applet/pages/margin/margin.vue

437 lines
11 KiB
Vue
Raw Normal View History

2023-09-26 20:41:49 +08:00
<template>
2023-10-07 10:03:29 +08:00
<view class="">
<view class="info">
<view class="bg"></view>
<view class="card">
2023-10-26 18:42:19 +08:00
<view class="title">店铺押金信息</view>
2023-10-07 10:03:29 +08:00
<view class="item">
2023-10-26 18:42:19 +08:00
<text>已缴纳押金</text>
2023-12-28 18:59:31 +08:00
<text>{{merchant_Data.paid_margin}}</text>
2023-10-07 10:03:29 +08:00
</view>
<view class="item">
2023-10-26 18:42:19 +08:00
<text>剩余缴纳押金</text>
2023-12-28 18:59:31 +08:00
<text>{{merchant_Data.unpaid_margin}}</text>
2023-10-07 10:03:29 +08:00
</view>
<view class="item">
2023-11-04 16:55:55 +08:00
<text>缴纳押金账户</text>
2023-12-28 18:59:31 +08:00
<text class="text">{{merchant_Data.mer_name}}</text>
2023-10-07 10:03:29 +08:00
</view>
</view>
2023-09-26 20:41:49 +08:00
</view>
2023-10-07 10:03:29 +08:00
<view class="price">
<view class="title">缴纳金额</view>
<view class="tab">
<view class="item active" style="margin: 0;">{{merchant_Data.margin}}</view>
</view>
2024-03-09 17:11:28 +08:00
<button class="btn" :class="{'btn-d': merchant_Data.is_margin != 1}" @click="paydecimal">{{merchant_Data.is_margin != 1?"无需缴纳":"缴纳"}}</button>
2023-10-07 10:03:29 +08:00
</view>
<!-- <view class="tip">
2023-09-26 20:41:49 +08:00
<view class="title">注意事项</view>
<view class="text">充值后帐户的金额不能提现可用于商城消费使用佣金导入账户之后不能再次导出不可提现账户充值出现问题可联系商城客服也可拨打商城客服热线<text @click="copyPhone('4008888888')">4008888888</text>
</view>
</view> -->
2023-12-28 18:59:31 +08:00
2024-03-11 18:01:40 +08:00
<u-tabs :list="[{name: '订单补缴记录'},{name: '充值记录'}]" @click="changeCurrent" lineColor="#f56c6c" :activeStyle="{
2023-12-28 18:59:31 +08:00
color: '#333',
fontWeight: 'bold',
transform: 'scale(1.05)'
}"
:inactiveStyle="{
color: '#333',
transform: 'scale(1)'
}"></u-tabs>
<block v-if="current==0">
<view class="content-order" v-for="(item,i ) in deductList">
<view class="deduct">扣除编号{{item.financial_record_sn}}</view>
<view class="deduct">扣除金额<text style="color: #ff5c2d;">{{item.number}}</text></view>
2024-03-11 18:01:40 +08:00
<view class="deduct">扣费方式{{item.financial_type=='auto_margin'? '订单自动补缴': '其他扣除'}}</view>
2023-12-28 18:59:31 +08:00
<view class="deduct">订单编号{{item.order_sn}}</view>
<view class="deduct">扣除时间{{item.create_time}}</view>
</view>
<view class='loadingicon acea-row row-center-wrapper' v-if='deductList.length > 0'>
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle2}}
</view>
<view class='loadingicon acea-row row-center-wrapper' v-else>
没有更多了
</view>
</block>
<block v-if="current==1">
<view class="content-order" v-for="(item,i ) in productList">
<view class="view">订单编号{{item.order_sn}}</view>
<view class="view">支付金额{{item.total_price}}</view>
<view class="view">支付状态{{item.pay_type==1?'已支付':'待支付'}}</view>
<view class="view">支付时间{{item.pay_time}}</view>
</view>
<view class='loadingicon acea-row row-center-wrapper' v-if='productList.length > 0'>
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view>
<view class='loadingicon acea-row row-center-wrapper' v-else>
没有更多了
</view>
</block>
2023-09-26 20:41:49 +08:00
</view>
</template>
<script>
import {
merchant,
paymerchant,
2023-12-28 18:59:31 +08:00
marginlist,
autoMarginlist
2023-09-26 20:41:49 +08:00
} from '@/api/api.js'
2023-12-28 18:59:31 +08:00
import { Toast } from '../../libs/uniApi'
2023-09-26 20:41:49 +08:00
export default {
data() {
return {
2023-10-07 10:03:29 +08:00
mer_id: 0,
2023-09-26 20:41:49 +08:00
merchant_Data: {},
2023-10-07 10:03:29 +08:00
where: {
page: 1,
limit: 10
2023-09-26 20:41:49 +08:00
},
2023-12-28 18:59:31 +08:00
where2: {
page: 1,
limit: 10
},
2023-10-07 10:03:29 +08:00
productList: [],
2023-12-28 18:59:31 +08:00
deductList: [],
2023-09-26 20:41:49 +08:00
loadend: false,
loading: false,
loadTitle: '加载更多',
2023-12-28 18:59:31 +08:00
loadend2: false,
loading2: false,
loadTitle2: '加载更多',
current: 0
2023-09-26 20:41:49 +08:00
}
},
onLoad(e) {
this.mer_id = e.mer_id
this.decimal()
2023-12-28 18:59:31 +08:00
// this.list(true);
this.autoList(true);
2023-09-26 20:41:49 +08:00
},
onReachBottom() {
2023-12-28 18:59:31 +08:00
if(this.current==0){
this.loadend2 = false;
this.loading2 = false;
this.autoList(false);
}else {
this.loadend = false;
this.loading = false;
this.list(false);
2023-10-07 10:03:29 +08:00
}
2023-09-26 20:41:49 +08:00
},
methods: {
2023-10-07 10:03:29 +08:00
list(isPage) {
2023-09-26 20:41:49 +08:00
let that = this;
if (that.loadend) return;
if (that.loading) return;
if (isPage === true) that.$set(that, 'productList', []);
that.loading = true;
that.loadTitle = '';
2023-10-07 10:03:29 +08:00
marginlist(that.where).then(res => {
2023-09-26 20:41:49 +08:00
let list = res.data.list;
let productList = that.$util.SplitArray(list, that.productList);
let loadend = list.length < that.where.limit;
that.loadend = loadend;
that.loading = false;
that.loadTitle = loadend ? '已全部加载' : '加载更多';
setTimeout(() => {
that.$set(that, 'productList', productList);
}, 500)
2023-10-07 10:03:29 +08:00
2023-09-26 20:41:49 +08:00
that.$set(that.where, 'page', that.where.page + 1);
if (that.where.page == 1 && res.data.list.length <= 0) that.emptyShow = true
}).catch(err => {
that.loading = false;
that.loadTitle = '加载更多';
});
2023-10-07 10:03:29 +08:00
2023-09-26 20:41:49 +08:00
},
2023-10-26 18:42:19 +08:00
//获取押金信息
2023-09-26 20:41:49 +08:00
decimal() {
merchant({
id: this.mer_id
}).then((res) => {
this.merchant_Data = res.data
});
},
2023-10-26 18:42:19 +08:00
//缴纳押金
2023-09-26 20:41:49 +08:00
paydecimal() {
if (this.merchant_Data.is_margin != 1) {
this.$util.Tips({
2023-10-26 18:42:19 +08:00
title: '暂时无需缴纳押金'
2023-09-26 20:41:49 +08:00
});
} else {
2023-10-07 10:03:29 +08:00
let that = this
2023-09-26 20:41:49 +08:00
uni.showModal({
title: '提示',
2023-10-26 18:42:19 +08:00
content: '商户' + this.merchant_Data.mer_name + '是否同意缴纳押金',
2023-10-07 10:03:29 +08:00
success: (res) => {
2023-09-26 20:41:49 +08:00
if (res.confirm) {
// console.log('用户点击确定');
paymerchant().then((res) => {
2024-03-09 17:11:28 +08:00
try{
uni.requestPayment({
provider: 'wxpay',
orderInfo: res.data
.config, //微信、支付宝订单数据 【注意微信的订单信息,键值应该全部是小写,不能采用驼峰命名】
success: (res) => {
this.$util.Tips({
title: '支付成功'
});
this.decimal()
this.list(true)
},
fail: (err) => {
this.$util.Tips({
title: '支付失败'
});
console.log('fail:' + JSON.stringify(err));
}
});
}catch(err){
Toast('请前往小程序中支付')
}
2023-09-26 20:41:49 +08:00
}).catch((err) => {
2023-11-09 17:58:21 +08:00
this.$util.Tips({
title: err
});
2023-09-26 20:41:49 +08:00
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
2023-10-07 10:03:29 +08:00
2023-09-26 20:41:49 +08:00
}
2023-10-07 10:03:29 +08:00
2023-09-26 20:41:49 +08:00
},
2023-12-28 18:59:31 +08:00
changeCurrent(e){
this.current = e.index;
if(e.index==0){
this.loadend = false;
this.loading = false;
this.autoList(true);
}else {
this.loadend = false;
this.loading = false;
this.list(true)
}
},
autoList(isPage){
let that = this;
if (that.loadend2) return;
if (that.loading2) return;
if (isPage === true) that.$set(that, 'deductList', []);
that.loading2 = true;
that.loadTitle2 = '';
2024-03-09 17:11:28 +08:00
autoMarginlist(this.mer_id, that.where2).then(res=>{
2023-12-28 18:59:31 +08:00
let list = res.data;
let deductList = that.$util.SplitArray(list, that.deductList);
let loadend = list.length < that.where2.limit;
that.loadend2 = loadend;
that.loading2 = false;
that.loadTitle2 = loadend ? '已全部加载' : '加载更多';
setTimeout(() => {
that.$set(that, 'deductList', deductList);
}, 500);
that.$set(that.where2, 'page', that.where2.page + 1);
if (that.where2.page == 1 && res.data.length <= 0) that.emptyShow = true
}).catch(err=>{
console.log(err);
that.loading2 = false;
that.loadTitle2 = '加载更多';
})
}
2023-09-26 20:41:49 +08:00
}
}
</script>
<style>
</style>
<style lang="scss">
2023-10-07 10:03:29 +08:00
page {
background-color: #fff;
}
.content-order {
2023-12-28 18:59:31 +08:00
background: #fff;
2023-10-07 10:03:29 +08:00
border-radius: 21rpx 21rpx;
2023-12-28 18:59:31 +08:00
margin: 0 28rpx;
2023-10-07 10:03:29 +08:00
margin-top: 30rpx;
2023-12-28 18:59:31 +08:00
padding: 28rpx;
box-shadow: 0 0 10rpx 2rpx rgba(0, 0, 0, 0.1);
2023-10-07 10:03:29 +08:00
2023-12-28 18:59:31 +08:00
.view {
2023-10-07 10:03:29 +08:00
font-size: 30rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
2023-12-28 18:59:31 +08:00
.deduct{
}
2023-10-07 10:03:29 +08:00
}
.info {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
height: 250rpx;
.bg {
background-color: #FF5C2D;
height: 170rpx;
width: 100vw;
border-radius: 0rpx 0rpx 28rpx 28rpx;
position: absolute;
top: 0;
left: 0;
}
.card {
width: 694rpx;
2023-12-28 18:59:31 +08:00
height: 270rpx;
2023-10-07 10:03:29 +08:00
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;
2023-12-28 18:59:31 +08:00
font-size: 30rpx;
2023-10-07 10:03:29 +08:00
display: flex;
flex-direction: column;
2023-12-28 18:59:31 +08:00
justify-content: space-between;
2023-10-07 10:03:29 +08:00
position: absolute;
top: 0;
2023-12-28 18:59:31 +08:00
2023-10-07 10:03:29 +08:00
.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;
}
2023-12-28 18:59:31 +08:00
.text{
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
2023-10-07 10:03:29 +08:00
}
}
}
.price {
display: flex;
flex-direction: column;
padding: 0 28rpx;
2023-12-28 18:59:31 +08:00
margin-top: 90rpx;
2023-10-07 10:03:29 +08:00
.title {
font-size: 32rpx;
font-weight: 600;
color: #333333;
line-height: 39rpx;
2023-12-28 18:59:31 +08:00
margin-bottom: 30rpx;
2023-10-07 10:03:29 +08:00
}
.tab {
display: flex;
flex-wrap: wrap;
justify-content: left;
width: 694rpx;
.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;
}
.active {
border: 2rpx solid #FF5C2D;
color: #FF5C2D;
}
}
.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;
}
.btn {
width: 694rpx;
height: 84rpx;
2023-12-28 18:59:31 +08:00
margin-top: 30rpx;
2023-10-07 10:03:29 +08:00
background: #FF5C2D;
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;
}
2024-03-09 17:11:28 +08:00
.btn-d{
background-color: #999;
}
2023-10-07 10:03:29 +08:00
}
.tip {
display: flex;
flex-direction: column;
padding: 0 28rpx;
margin-top: 84rpx;
.title {
font-size: 32rpx;
font-weight: 500;
color: #FF5C2D;
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;
}
2023-09-26 20:41:49 +08:00
}
</style>