合并代码

This commit is contained in:
sx 2025-02-23 13:32:05 +08:00
parent 409f137e89
commit d9f56e0fbb
11 changed files with 447 additions and 98 deletions

View File

@ -352,6 +352,47 @@ const mine = {
method: 'GET',
})
},
/**
* 查看已绑定的银行卡列表
* @param {Object} param
*/
getBankCards(param) {
return util.request({
url: '/user/bank-cards/getBankCards',
data: param.data,
query: param.query,
method: 'GET',
load: true,
})
},
/**
* 添加银行卡
* @param {Object} param
*/
addBankCard(param) {
return util.request({
url: '/user/bank-cards/addBankCard',
data: param.data,
query: param.query,
method: 'POST',
load: true,
})
},
/**
* 删除银行卡
* @param {Object} param
*/
deleteBankCard(param) {
return util.request({
url: '/user/bank-cards/deleteBankCard',
path: param.path,
method: 'DELETE',
load: true,
})
},
}
export default mine

View File

@ -190,6 +190,7 @@ const util = {
...params.header,
}
console.log('token', token)
if (token) params.header["Authorization"] = `Bearer ${token}`
// console.log('request url', url)
@ -213,7 +214,7 @@ const util = {
responseType: params.responseType || 'text',
// 请求成功返回
success: res => {
// console.log('request success', url, res, params.data ? params.data : '')
console.log('request success', url, res, params.data ? params.data : '')
// 关闭加载效果
if (params.load) {
uni.hideLoading()
@ -224,8 +225,7 @@ const util = {
// 登出
util.logout(() => {
util.alert('请先登录')
reject(res.data) // 链式回调0
reject(res.data)
// uni.reLaunch({
// url: '/login/login',
// })
@ -235,7 +235,6 @@ const util = {
params.success ? params.success(res.data) : ''
// 链式回调
resolve(res.data);
},
// 请求失败返回
fail: res => {
@ -1410,17 +1409,17 @@ const util = {
* @param {Function} cb 回调函数
*/
finalLogin(param, cb) {
try {
// 登录令牌
const token = param.data
// 缓存token
uni.setStorageSync('token', token)
console.log('set token', token)
// 开启加载
uni.showLoading({
mask: true
})
setTimeout(() => {
// 获取用户信息
util.getUserinfo((userinfo) => {
// 登录
@ -1435,9 +1434,7 @@ const util = {
//
cb ? cb() : ''
})
} catch (ev) {
console.log('finalLogin catch', ev)
}
}, 500)
},
// 登录腾讯聊天

View File

@ -57,7 +57,6 @@
//
function getMoreList() {
console.log('getMoreList', listPrototype)
if (listPrototype.total <= listPrototype.data.length) return
listPrototype.pageNum++
getList()

View File

@ -158,7 +158,7 @@
<view class="li mtb30" v-for="(item,index) in team.sonUser" :key="item.id">
<view class="menber df aic">
<view class="count mr20 plr10 cfff br10" v-if="item.isShop == 1"></view>
<view class="c333 f32">{{item.userNickname}}{{item.isShop}}</view>
<view class="c333 f32">{{item.userNickname}}</view>
<template v-if="item.sonList[0]">
<uni-icons @click="lowTeam(item)" type="up" color="#A45EFF" size="28rpx"
v-if="item.showSecond" />

View File

@ -17,6 +17,8 @@
import util from '@/common/js/util';
// api
import api from '@/api/index.js'
// 手机状态栏
import statusBar from '@/components/header/statusBar.vue';
// 首页视频
import indexVideo from '@/components/index/indexVideo.vue'
// 评论弹窗
@ -258,15 +260,41 @@
})
})
}
/**
* 返回
*/
function handleBack() {
const pages = getCurrentPages()
// 如果页面栈数量大于1
if (pages.length > 1) {
uni.navigateBack()
} else {
uni.switchTab({
url: '/pages/index/index'
})
}
}
</script>
<template>
<view class="page f1">
<view class="apex">
<statusBar />
<view class="head df fdr jcsb">
<view class="back" @click="handleBack">
<uni-icons type="left" color="#fff" size="40rpx" />
</view>
</view>
</view>
<!-- -->
<indexVideo ref="indexVideo" :statistic="statistic" :item="detail" :tabIndex="0" :isMine="isMine" :index="0"
:current="0" mode="detail" @showComment="handleShowCommentAlt" @showCollect="handleShowCollectAlt"
@showShareFirend="handleShowShareFirend" @like="videoLike" @detailMenu="detailMenu"
@dataCenter="handleDataCenter"@showProduct="handleShowProduct" @proBuy="handleProBuy" />
@dataCenter="handleDataCenter" @showProduct="handleShowProduct" @proBuy="handleProBuy" />
<!-- 评论弹窗 -->
<commentAlt ref="commentRef" />
@ -281,6 +309,20 @@
</view>
</template>
<style lang="scss">
//
<style lang="scss" scoped>
// 顶部
.apex {
position: fixed;
top: 0%;
left: 0;
right: 0;
// 返回
.back {
width: 40px;
height: 40px;
background-color: rgba(0, 0, 0, .8);
border-radius: 100rpx;
}
}
</style>

View File

@ -7,6 +7,7 @@
ref,
getCurrentInstance,
reactive,
computed,
} from 'vue'
import {
onLoad,
@ -16,6 +17,8 @@
import util from '@/common/js/util';
// api
import api from '@/api/index.js'
//
import statusBar from '@/components/header/statusBar.vue';
//
import indexVideo from '@/components/index/indexVideo.vue'
//
@ -24,6 +27,10 @@
import collectAlt from '@/components/index/collect.vue'
//
import shareFirendAlt from '@/components/index/shareFirend.vue'
//
import productAlt from '@/components/index/proDetailAlt.vue'
//
import productSpecAlt from '@/components/shop/detail/makeOrder.vue'
const {
proxy
@ -34,11 +41,17 @@
const detail = reactive({})
//
const isMine = ref(false)
//
const statistic = ref('0')
//
const userinfo = computed(() => uni.$store.state.userinfo)
onLoad((option) => {
if (option.videoId) videoId.value = option.videoId
//
if (option.isMine && option.isMine != 'false') isMine.value = option.isMine
//
if (option.statistic) statistic.value = option.statistic
//
getVideoDetail()
@ -64,12 +77,7 @@
}
}).then(rs => {
if (rs.code == 200) {
const result = rs.data
result.format_videoUrl = util.format_url(result.videoUrl, 'video')
result.format_header = util.format_url(result.header, 'img')
Object.assign(detail, result)
Object.assign(detail, rs.data)
//
proxy.$refs.indexVideo.play()
@ -107,41 +115,38 @@
proxy.$refs.shareFirendRef.open()
}
/**
* 视频点赞
* @param {Object} param 见下
* @param {Number} param.index 操作的视频下标
* @param {Number|String} param.isLike 点赞操作
* @param {Number|String} param.isLike 0.点赞 1.取消点赞
* @param {Number|String} param.likeType 点赞类型 0.公开赞 1.隐私赞
*/
function videoLike(param) {
const {
index,
isLike
} = param
const item = detail
//
let type = 1
// 0 1 3
if (item.isLike == 0) type = isLike
const data = {
// id
videoId: item.id,
// id
likeUserId: userinfo.value.id,
// id
targetUserId: item.userId,
// 0. 1.
likeType: param.likeType,
// // 0. 1.
isLike: param.isLike,
}
//
api.video.videoLike({
query: {
// 01 3
type,
// id
videoId: item.videoId,
}
data,
}).then(rs => {
if (rs.code == 200) {
//
item.isLike = {
0: 1,
1: 0,
3: 3,
} [type]
//
type == 1 ? item.likes-- : item.likes++
uni.$emit('updateVideo', {
...item,
...rs.data,
})
return
}
util.alert({
@ -206,17 +211,90 @@
* @param {Object} detail
*/
function handleDataCenter(detail) {
uni.navigateTo({
url: util.setUrl('/pages/index/dataCenter/dataCenter', {
videoId: detail.id,
})
})
}
/**
* 打开产品弹窗
* @param {Object} item 视频列表项
*/
function handleShowProduct(item) {
//
proxy.$refs.productAltRef.init(item.productId)
}
/**
* 商品弹窗购买
* @param {Object} product
*/
function handleProductBuy(product) {
Object.assign(productDetail, {}, product)
//
proxy.$refs.productSpecAltRef.open()
}
/**
* 商品购买
* @param {Object} video 视频列表
*/
function handleProBuy(video) {
//
api.shop.productDetail({
query: {
// id
productionId: video.productId,
},
}).then(rs => {
if (rs.code == 200) {
//
handleProductBuy(rs.data)
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
/**
* 返回
*/
function handleBack() {
const pages = getCurrentPages()
// 1
if (pages.length > 1) {
uni.navigateBack()
} else {
uni.switchTab({
url: '/pages/index/index'
})
}
}
</script>
<template>
<view class="page f1">
<view class="apex">
<statusBar />
<view class="head df fdr jcsb">
<view class="back" @click="handleBack">
<uni-icons type="left" color="#fff" size="40rpx" />
</view>
</view>
</view>
<!-- -->
<indexVideo ref="indexVideo" :statistic="1" :item="detail" :tabIndex="0" :isMine="isMine" :index="0"
<indexVideo ref="indexVideo" :statistic="statistic" :item="detail" :tabIndex="0" :isMine="isMine" :index="0"
:current="0" mode="detail" @showComment="handleShowCommentAlt" @showCollect="handleShowCollectAlt"
@showShareFirend="handleShowShareFirend" @like="videoLike" @detailMenu="detailMenu"
@dataCenter="handleDataCenter" />
@dataCenter="handleDataCenter" @showProduct="handleShowProduct" @proBuy="handleProBuy" />
<!-- 评论弹窗 -->
<commentAlt ref="commentRef" />
@ -224,9 +302,27 @@
<collectAlt ref="collectRef" />
<!-- 分享到好友弹窗 -->
<shareFirendAlt ref="shareFirendRef" />
<!-- 产品详情弹窗 -->
<productAlt ref="productAltRef" @buy="handleProductBuy" />
<!-- 产品立即下单弹窗 -->
<productSpecAlt ref="productSpecAltRef" :detail="productDetail" @confirm="handlePay" />
</view>
</template>
<style lang="scss">
//
<style lang="scss" scoped>
//
.apex {
position: fixed;
top: 0%;
left: 0;
right: 0;
//
.back {
width: 40px;
height: 40px;
background-color: rgba(0, 0, 0, .8);
border-radius: 100rpx;
}
}
</style>

View File

@ -57,6 +57,7 @@
function getLst() {
api.mine.myComment({
query: {
userId: userinfo.value.id,
pageNum: list.pageNum,
pageSize: list.pageSize,
}
@ -79,7 +80,6 @@
}).finally(() => {
uni.stopPullDownRefresh()
})
}
</script>

View File

@ -1,5 +1,82 @@
<script setup>
//
import {
ref,
computed,
reactive,
} from 'vue'
import {
useStore
} from 'vuex'
import {
onLoad,
onUnload,
} from '@dcloudio/uni-app'
//
import util from '@/common/js/util.js'
// api
import api from '@/api/index.js'
//
const list = reactive([])
//
const options = reactive([{
text: '解绑',
style: {
backgroundColor: '#007aff'
},
cb: (event) => removeBank(event)
}])
onLoad(() => {
//
getList()
//
addListener()
})
onUnload(() => {
//
removeListener()
})
//
function addListener() {
uni.$on('updateBindingBank', () => {
//
getList()
})
}
//
function removeListener() {
uni.$off('updateBindingBank')
}
//
function getList() {
api.mine.getBankCards({}).then(rs => {
if (rs.code == 200) {
Object.assign(list, rs.data)
list.push({
bankName: "建设银行",
cardHolderName: "商旭",
cardId: "1",
cardNumber: "6217002270031535710",
cardType: "DEBIT",
createTime: null,
delFlag: "0",
isDefault: null,
updateTime: null,
userId: 13,
})
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
//
function link(url) {
@ -7,18 +84,60 @@
url,
})
}
/**
* 右滑菜单项点击
* @param {Object} event
*/
function handleItem(event, item) {
console.log('event', event, item)
item.cb(item)
}
/**
* 删除银行卡
* @param {Object} item 银行卡信息
*/
function removeBank(item) {
util.alert({
content: '删除后不可恢复,确认删除?',
}).then(rs => {
api.mine.deleteBankCard({
path: [item.cardId],
}).then(rs => {
if (rs.code == 200) {
//
getList()
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
})
}
</script>
<template>
<view class="app">
<view class="list">
<view class="card item" v-for="(item,index) in 3" :key="index">
<view class="name">很行银行</view>
<view class="type">储蓄卡</view>
<view class="number">**** **** **** 0896</view>
<uni-swipe-action ref="swipeAction">
<view class="card item" v-for="(item,index) in list" :key="index">
<uni-swipe-action-item :right-options="options" @click="handleItem($event,item)">
<view class="main ptb30 plr40">
<view class="name">{{item.bankName}}</view>
<view class="type">
<text v-if="item.cardType == 'DEBIT'">储蓄卡</text>
<text v-else-if="item.cardType == 'CREDIT'">信用卡</text>
</view>
<view class="number">{{item.cardNumber}}</view>
</view>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
<view class="item add rows" @click="link('/pages/mine/setting/bankCardAdd')">
<view class="item add rows ptb30 plr40" @click="link('/pages/mine/setting/bankCardAdd')">
<view>添加银行卡</view>
<uni-icons type="right" color="#999" />
</view>
@ -27,10 +146,11 @@
</template>
<style lang="scss">
//
.list {
.item {
overflow: hidden;
margin: 20rpx;
padding: 30rpx 40rpx;
border-radius: 25rpx;
}

View File

@ -1,30 +1,83 @@
<script setup>
//
import {
reactive
} from 'vue';
ref,
reactive,
computed,
} from 'vue'
import {
useStore
} from 'vuex'
import {
onLoad,
} from '@dcloudio/uni-app'
//
import util from '@/common/js/util.js'
// api
import api from '@/api/index.js'
//
import getCode from '@/components/getCode/getCode'
//
const bankList = reactive([
{
name: '银行卡1',
},
{
name: '银行卡2',
},
{
name: '银行卡3',
},
])
const bankList = reactive([])
//
const form = reactive({
cardNumber: '',
phoneNumber: '',
userIdCard: '',
userRealName: '',
})
//
function handleSubmit() {
const data = {
...form
}
//
if (!data.phoneNumber) {
util.alert('手机号不能为空')
return
}
if (!data.userIdCard) {
util.alert('身份证号不能为空')
return
}
if (!data.cardNumber) {
util.alert('用户手机号不能为空')
return
}
if (!data.userRealName) {
util.alert('真实姓名不能为空')
return
}
//
api.mine.addBankCard({
data,
}).then(rs => {
if (rs.code == 200) {
uni.$emit('updateBindingBank')
util.alert('添加成功')
setTimeout(() => {
uni.navigateBack()
}, 500)
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
</script>
<template>
<view class="appbw">
<!-- 表单 -->
<view class="form mtb30 mlr40">
<view class="line">
<!-- <view class="line">
<view class="title">银行卡类型</view>
<view class="inputBox">
<picker :range="bankList" range-key="name">
@ -34,48 +87,47 @@
</view>
</picker>
</view>
</view>
</view> -->
<view class="line">
<view class="title">银行卡卡号</view>
<view class="inputBox">
<input class="input" type="text" placeholder="请输入银行卡卡号" />
<input class="input" v-model="form.cardNumber" type="text" placeholder="请输入银行卡卡号" />
</view>
</view>
<view class="line">
<view class="title">姓名</view>
<view class="inputBox">
<input class="input" type="text" placeholder="请输入姓名" />
<input class="input" v-model="form.userRealName" type="text" placeholder="请输入姓名" />
</view>
</view>
<view class="line">
<view class="title">身份证号</view>
<view class="inputBox">
<input class="input" type="text" placeholder="请输入身份证号" />
<input class="input" v-model="form.userIdCard" type="text" placeholder="请输入身份证号" />
</view>
</view>
<view class="line">
<view class="title">手机号银行绑定的手机号</view>
<view class="inputBox rows">
<input class="input" type="text" placeholder="请输入手机号" />
<view class="inputBox">
<input class="input" v-model="form.phoneNumber" type="text" placeholder="请输入手机号" />
</view>
</view>
<!-- <view class="line">
<view class="title">验证码</view>
<view class="inputBox rows">
<input class="input" type="text" placeholder="请输入验证码" />
<view class="getCode btn black plr30">
<getCode />
</view>
</view>
</view>
</view> -->
<view class="line">
<view class="title">验证码</view>
<view class="inputBox">
<input class="input" type="text" placeholder="请输入验证码" />
</view>
</view>
<view class="btn lg black mt50">绑定</view>
<view class="btn lg black mt50" @click="handleSubmit">绑定</view>
</view>
<view class="fill"></view>

View File

@ -1,4 +1,5 @@
<script setup>
//
import {
ref,
computed,

View File

@ -66,6 +66,7 @@ updateOrderDetail 更新订单详情
updateUserProduct 更新用户商品
updateBindingAccount 更新绑定账号
selectBindingBank 选择绑定的银行卡
updateBindingBank 更新绑定的银行卡
缓存
---