Browse Source

'优化回收页面'

master
Lj 3 weeks ago
parent
commit
81c2a13403
6 changed files with 339 additions and 636 deletions
  1. +0
    -357
      111.json
  2. +5
    -0
      api/model/index.js
  3. +31
    -22
      pages/component/recycle.vue
  4. +245
    -242
      pages/subcomponent/promo-qrcode.vue
  5. +52
    -13
      pages/subcomponent/promotion-profit-detail.vue
  6. +6
    -2
      pages/subcomponent/promotion.vue

+ 0
- 357
111.json View File

@ -1,357 +0,0 @@
{
"success": true,
"message": "订单列表",
"code": 200,
"result": {
"records": [
{
"id": "1938571653868953601",
"createBy": null,
"createTime": "2025-06-27 20:14:35",
"updateBy": null,
"updateTime": "2025-06-30 16:09:45",
"state": 0,
"status": 1,
"userId": "1937353794657214465",
"image": null,
"shopClass": null,
"title": ",",
"name": "1",
"phone": "19330214982",
"price": null,
"address": "北京市 市辖区 东城区",
"addressDetail": "123",
"oneMoney": null,
"twoMoney": null,
"pid": "0",
"hasChild": "1",
"goTime": "2025-06-27 11:00:00",
"wliu": null,
"onePrice": null,
"unit": null,
"num": 4,
"details": null,
"ordeNo": null,
"wliuNo": null,
"shopId": null,
"addressId": "1937379022158454786",
"testingStatus": null,
"testingInstructions": null,
"testingTime": null,
"testingImages": null,
"isBy": "N",
"isUserId": null,
"pinId": null,
"qualifiedNum": null,
"noQualifiedNum": null,
"unrecyclable": null,
"estimatedPrice": "34.00-70",
"type": 0,
"commonOrderList": [
{
"id": "1938571654040920065",
"createBy": null,
"createTime": "2025-06-27 20:14:34",
"updateBy": null,
"updateTime": null,
"state": null,
"status": null,
"userId": null,
"image": "https://oss.ddmhs.top/upload/微信图片_20250327142201_compressed_1750725386304.jpg",
"shopClass": "1926937920342679554",
"title": "成人羽绒服",
"name": null,
"phone": null,
"price": null,
"address": null,
"addressDetail": null,
"oneMoney": null,
"twoMoney": null,
"pid": "1938571653868953601",
"hasChild": "1",
"goTime": null,
"wliu": null,
"onePrice": 10,
"unit": null,
"num": 2,
"details": "品相无要求,允许脏破烂",
"ordeNo": null,
"wliuNo": null,
"shopId": "1934553607584104450",
"addressId": null,
"testingStatus": null,
"testingInstructions": null,
"testingTime": null,
"testingImages": null,
"isBy": "N",
"isUserId": null,
"pinId": "1934782097801625602",
"qualifiedNum": null,
"noQualifiedNum": null,
"unrecyclable": null,
"estimatedPrice": "20.00-40",
"type": 0,
"commonOrderList": null,
"orderCheckList": null,
"pinName": null,
"testingInstructionsText": null
},
{
"id": "1938571655089496065",
"createBy": null,
"createTime": "2025-06-27 20:14:34",
"updateBy": null,
"updateTime": null,
"state": null,
"status": null,
"userId": null,
"image": "https://oss.ddmhs.top/upload/微信图片_20250327142201_compressed_1750725386304.jpg",
"shopClass": "1926937920342679554",
"title": "成人羽绒服",
"name": null,
"phone": null,
"price": null,
"address": null,
"addressDetail": null,
"oneMoney": null,
"twoMoney": null,
"pid": "1938571653868953601",
"hasChild": "1",
"goTime": null,
"wliu": null,
"onePrice": 10,
"unit": null,
"num": 1,
"details": "品相无要求,允许脏破烂",
"ordeNo": null,
"wliuNo": null,
"shopId": "1934553607584104450",
"addressId": null,
"testingStatus": null,
"testingInstructions": null,
"testingTime": null,
"testingImages": null,
"isBy": "N",
"isUserId": null,
"pinId": "1934787027673300993",
"qualifiedNum": null,
"noQualifiedNum": null,
"unrecyclable": null,
"estimatedPrice": "10.00-20",
"type": 0,
"commonOrderList": null,
"orderCheckList": null,
"pinName": null,
"testingInstructionsText": null
},
{
"id": "1938571655802527746",
"createBy": null,
"createTime": "2025-06-27 20:14:34",
"updateBy": null,
"updateTime": null,
"state": null,
"status": null,
"userId": null,
"image": "https://oss.ddmhs.top/upload/9559824354_2091552637_compressed_1750069406515.jpg",
"shopClass": "1926937920342679554",
"title": "成人羽绒裤",
"name": null,
"phone": null,
"price": null,
"address": null,
"addressDetail": null,
"oneMoney": null,
"twoMoney": null,
"pid": "1938571653868953601",
"hasChild": "1",
"goTime": null,
"wliu": null,
"onePrice": 4,
"unit": null,
"num": 1,
"details": "品相无要求,允许脏破烂",
"ordeNo": null,
"wliuNo": null,
"shopId": "1934554028000165889",
"addressId": null,
"testingStatus": null,
"testingInstructions": null,
"testingTime": null,
"testingImages": null,
"isBy": "N",
"isUserId": null,
"pinId": "1934782097801625602",
"qualifiedNum": null,
"noQualifiedNum": null,
"unrecyclable": null,
"estimatedPrice": "4.00-10",
"type": 0,
"commonOrderList": null,
"orderCheckList": null,
"pinName": null,
"testingInstructionsText": null
}
],
"orderCheckList": null,
"pinName": null,
"testingInstructionsText": null
},
{
"id": "1931291436998561793",
"createBy": null,
"createTime": "2025-06-07 18:05:35",
"updateBy": "testadmin",
"updateTime": "2025-06-11 17:09:07",
"state": 0,
"status": 1,
"userId": "1926466450139209729",
"image": "",
"shopClass": null,
"title": "组合订单",
"name": "test",
"phone": "13973220018",
"price": 0.04,
"address": "上海市 市辖区 浦东新区",
"addressDetail": "浦东足球场",
"oneMoney": 0,
"twoMoney": 0,
"pid": "0",
"hasChild": "1",
"goTime": "",
"wliu": "",
"onePrice": null,
"unit": "",
"num": 4,
"details": "",
"ordeNo": "",
"wliuNo": "",
"shopId": "",
"addressId": "",
"testingStatus": null,
"testingInstructions": "",
"testingTime": null,
"testingImages": "",
"isBy": "N",
"isUserId": "",
"pinId": null,
"qualifiedNum": null,
"noQualifiedNum": null,
"unrecyclable": null,
"estimatedPrice": null,
"type": 0,
"commonOrderList": [
{
"id": "1931291437237637121",
"createBy": null,
"createTime": "2025-06-07 18:05:35",
"updateBy": null,
"updateTime": null,
"state": null,
"status": null,
"userId": null,
"image": "https://oss.budingxiaoshuo.com/upload/1748937726110_1748937743252.jpg",
"shopClass": null,
"title": "长款羽绒服",
"name": null,
"phone": null,
"price": 0.02,
"address": null,
"addressDetail": null,
"oneMoney": null,
"twoMoney": null,
"pid": "1931291436998561793",
"hasChild": "0",
"goTime": null,
"wliu": null,
"onePrice": null,
"unit": null,
"num": 2,
"details": null,
"ordeNo": null,
"wliuNo": null,
"shopId": "1929811145330352130",
"addressId": null,
"testingStatus": null,
"testingInstructions": null,
"testingTime": null,
"testingImages": null,
"isBy": "N",
"isUserId": null,
"pinId": null,
"qualifiedNum": null,
"noQualifiedNum": null,
"unrecyclable": null,
"estimatedPrice": null,
"type": 0,
"commonOrderList": null,
"orderCheckList": null,
"pinName": null,
"testingInstructionsText": null
},
{
"id": "1931291437770313729",
"createBy": null,
"createTime": "2025-06-07 18:05:35",
"updateBy": null,
"updateTime": null,
"state": null,
"status": null,
"userId": null,
"image": "https://oss.budingxiaoshuo.com/upload/u40321610211486391468fm253fmtautoapp120fJPEG_1748938036727.webp",
"shopClass": null,
"title": "羽绒棉服",
"name": null,
"phone": null,
"price": 0.02,
"address": null,
"addressDetail": null,
"oneMoney": null,
"twoMoney": null,
"pid": "1931291436998561793",
"hasChild": "0",
"goTime": null,
"wliu": null,
"onePrice": null,
"unit": null,
"num": 2,
"details": null,
"ordeNo": null,
"wliuNo": null,
"shopId": "1929812185941368834",
"addressId": null,
"testingStatus": null,
"testingInstructions": null,
"testingTime": null,
"testingImages": null,
"isBy": "N",
"isUserId": null,
"pinId": null,
"qualifiedNum": null,
"noQualifiedNum": null,
"unrecyclable": null,
"estimatedPrice": null,
"type": 0,
"commonOrderList": null,
"orderCheckList": null,
"pinName": null,
"testingInstructionsText": null
}
],
"orderCheckList": null,
"pinName": null,
"testingInstructionsText": null
}
],
"total": 2,
"size": 20,
"current": 1,
"orders": [],
"optimizeCountSql": true,
"searchCount": true,
"countId": null,
"maxLimit": null,
"pages": 1
},
"timestamp": 1751460139197
}

+ 5
- 0
api/model/index.js View File

@ -238,6 +238,11 @@ const api = {
method: 'POST',
auth: true,
},
income: {
url: '/recycle-admin/applet/money/income',
method: 'POST',
auth: true,
},
}
export default api

+ 31
- 22
pages/component/recycle.vue View File

@ -84,6 +84,15 @@
<view class="goods-info-wrap">
<view class="goods-header">
<text class="goods-name">{{item.name}}</text>
</view>
<text class="goods-desc">{{item.service}}</text>
<view class="rules-brand-row">
<view class="rules-link" @click="showRules(item)">
<view class="rules">
<text>回收规则</text>
<uni-icons type="right" size="14" color="#999"></uni-icons>
</view>
</view>
<view class="brand-check-placeholder" v-if="item.isPin === 'Y'">
<view class="brand-check" @click="checkBrand(index)">
<text>查看品牌</text>
@ -91,13 +100,6 @@
</view>
</view>
</view>
<text class="goods-desc">{{item.service}}</text>
<view class="rules-link" @click="showRules(item)">
<view class="rules">
<text>回收规则</text>
<uni-icons type="right" size="14" color="#999"></uni-icons>
</view>
</view>
<view class="goods-info">
<view class="price-info">
<text class="price-symbol">¥</text>
@ -667,7 +669,7 @@ export default {
// 0
if (newQty === 0) {
this.$delete(item.brandQuantities, brandId)
delete item.brandQuantities[brandId]
}
return
} else {
@ -698,7 +700,7 @@ export default {
// 0
if (newQty === 0) {
this.$delete(item.brandQuantities, brandInfo.brandId)
delete item.brandQuantities[brandInfo.brandId]
}
this.closeBrandReducePopup()
@ -917,7 +919,7 @@ export default {
// 0
if (newQty === 0) {
this.$delete(originalItem.brandQuantities, item.brandId)
delete originalItem.brandQuantities[item.brandId]
}
//
@ -1595,7 +1597,7 @@ export default {
font-size: 20rpx;
color: #999;
display: block;
margin-bottom: 20rpx;
// margin-bottom: 20rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@ -1672,19 +1674,26 @@ export default {
}
}
.rules-link {
margin-top: 20rpx;
}
.rules-link .rules {
.rules-brand-row {
display: flex;
align-items: center;
font-family: PingFang SC;
font-weight: 400;
font-size: 12px;
line-height: 140%;
letter-spacing: 0%;
color: #666;
margin-top: 20rpx;
gap: 16rpx;
.rules-link {
margin-top: 0;
.rules {
display: inline-flex;
align-items: center;
font-family: PingFang SC;
font-weight: 400;
font-size: 12px;
color: #666;
white-space: nowrap;
}
}
.brand-check-placeholder {
margin-left: 12rpx;
}
}
}


+ 245
- 242
pages/subcomponent/promo-qrcode.vue View File

@ -7,23 +7,23 @@
</view>
<text class="title">推广链接</text>
</view>
<!-- 页面内容 -->
<view class="content">
<!-- 用户信息 -->
<!-- 用户信息 -->
<view class="user-info-modal">
<view class="avatar-frame">
<view class="avatar-frame">
<image class="avatar-img" :src="userInfo.headImage || '/static/avatar.png'" mode="aspectFill" />
</view>
<view class="nickname">{{ userInfo.nickName || '用户' }}</view>
</view>
<view class="nickname">{{userInfo.nickName || '用户'}}</view>
</view>
<!-- 二维码区 -->
<view class="qrcode-modal-section">
<image class="qrcode-img" :src="qrcodeUrl" mode="widthFix" />
<!-- <view class="invite-code">邀请码{{inviteCode}}</view> -->
</view>
<!-- 底部按钮 -->
<view class="bottom-btns-modal">
<!-- 二维码区 -->
<view class="qrcode-modal-section">
<image class="qrcode-img" :src="qrcodeUrl" mode="widthFix" />
<!-- <view class="invite-code">邀请码{{inviteCode}}</view> -->
</view>
<!-- 底部按钮 -->
<view class="bottom-btns-modal">
<button class="btn gray" open-type="share">分享给好友</button>
<button class="btn green" @tap="saveToAlbum">保存到本地</button>
</view>
@ -32,279 +32,282 @@
</template>
<script>
import pullRefreshMixin from '@/pages/mixins/pullRefreshMixin.js'
import config from '@/api/config.js'
import pullRefreshMixin from '@/pages/mixins/pullRefreshMixin.js'
import config from '@/api/config.js'
export default {
mixins: [pullRefreshMixin],
data() {
return {
userInfo: {},
qrcodeUrl: '/static/qrcode.png',
inviteCode: '888888',
}
export default {
mixins: [pullRefreshMixin],
data() {
return {
userInfo: {},
qrcodeUrl: '/static/qrcode.png',
inviteCode: '888888',
}
},
onLoad() {
//
this.fetchUserInfo()
this.getQrcode()
},
//
// #ifdef MP-WEIXIN
onShareAppMessage() {
return {
title: `${this.userInfo.nickName || '用户'}邀请您一起参与旧衣回收`,
path: `/pages/component/home?shareId=${this.inviteCode}`,
imageUrl: this.qrcodeUrl || '/static/share-default.png'
}
},
onShareTimeline() {
return {
title: `${this.userInfo.nickName || '用户'}邀请您一起参与旧衣回收,环保从我做起!`,
query: `shareId=${this.inviteCode}`,
imageUrl: this.qrcodeUrl || '/static/share-default.png'
}
},
// #endif
methods: {
async onRefresh() {
//
await new Promise(resolve => setTimeout(resolve, 1000))
uni.stopPullRefresh()
},
onLoad() {
//
this.fetchUserInfo()
this.getQrcode()
navigateBack() {
uni.navigateBack()
},
//
// #ifdef MP-WEIXIN
onShareAppMessage() {
return {
title: `${this.userInfo.nickName || '用户'}邀请您一起参与旧衣回收`,
path: `/pages/component/home?shareId=${this.inviteCode}`,
imageUrl: this.qrcodeUrl || '/static/share-default.png'
//
fetchUserInfo() {
if (uni.getStorageSync('token')) {
this.$api("getUserByToken", {}, (res) => {
if (res.code == 200) {
this.userInfo = res.result
//
if (res.result.intentioCode) {
this.inviteCode = res.result.intentioCode
}
}
})
}
},
onShareTimeline() {
return {
title: `${this.userInfo.nickName || '用户'}邀请您一起参与旧衣回收,环保从我做起!`,
query: `shareId=${this.inviteCode}`,
imageUrl: this.qrcodeUrl || '/static/share-default.png'
getQrcode() {
//
if (getApp().globalData.qr_path) {
console.log('获取到二维码路径', getApp().globalData.qr_path)
this.qrcodeUrl = getApp().globalData.qr_path
} else {
console.log('全局二维码路径不存在')
uni.getImageInfo({
src: `${config.baseUrl}/recycle-admin/applet/promotion/getInviteCode?token=${uni.getStorageSync('token')}`,
success: res => {
getApp().globalData.qr_path = res.path
console.log(getApp().globalData.qr_path, 'qr_path')
this.qrcodeUrl = getApp().globalData.qr_path
},
fail: err => {
console.log('QR code load failed:', err)
}
})
}
},
// #endif
methods: {
async onRefresh() {
//
await new Promise(resolve => setTimeout(resolve, 1000))
uni.stopPullRefresh()
},
navigateBack() {
uni.navigateBack()
},
//
fetchUserInfo() {
if (uni.getStorageSync('token')) {
this.$api("getUserByToken", {}, (res) => {
if (res.code == 200) {
this.userInfo = res.result
//
if (res.result.intentioCode) {
this.inviteCode = res.result.intentioCode
//
saveToAlbum() {
if (!this.qrcodeUrl) {
uni.showToast({
title: '二维码还未加载完成',
icon: 'none'
})
return
}
//
uni.getSetting({
success: (res) => {
if (!res.authSetting['scope.writePhotosAlbum']) {
//
uni.authorize({
scope: 'scope.writePhotosAlbum',
success: () => {
this.doSaveImage()
},
fail: () => {
//
uni.showModal({
title: '提示',
content: '需要您授权保存相册权限',
showCancel: false,
success: () => {
uni.openSetting()
}
})
}
}
})
})
} else {
//
this.doSaveImage()
}
}
},
getQrcode(){
//
if (getApp().globalData.qr_path) {
console.log('获取到二维码路径', getApp().globalData.qr_path)
this.qrcodeUrl = getApp().globalData.qr_path
} else {
console.log('全局二维码路径不存在')
uni.getImageInfo({
src: `${config.baseUrl}/recycle-admin/applet/promotion/getInviteCode?token=${uni.getStorageSync('token')}`,
success: res => {
getApp().globalData.qr_path = res.path
console.log(getApp().globalData.qr_path, 'qr_path')
this.qrcodeUrl = getApp().globalData.qr_path
},
fail: err => {
console.log('QR code load failed:', err)
}
})
},
//
doSaveImage() {
uni.saveImageToPhotosAlbum({
filePath: this.qrcodeUrl,
success: () => {
uni.showToast({
title: '保存成功',
icon: 'success'
})
}
},
//
saveToAlbum() {
if (!this.qrcodeUrl) {
},
fail: (err) => {
console.log('保存失败', err)
uni.showToast({
title: '二维码还未加载完成',
title: '保存失败',
icon: 'none'
})
return
}
//
uni.getSetting({
success: (res) => {
if (!res.authSetting['scope.writePhotosAlbum']) {
//
uni.authorize({
scope: 'scope.writePhotosAlbum',
success: () => {
this.doSaveImage()
},
fail: () => {
//
uni.showModal({
title: '提示',
content: '需要您授权保存相册权限',
showCancel: false,
success: () => {
uni.openSetting()
}
})
}
})
} else {
//
this.doSaveImage()
}
}
})
},
//
doSaveImage() {
uni.saveImageToPhotosAlbum({
filePath: this.qrcodeUrl,
success: () => {
uni.showToast({
title: '保存成功',
icon: 'success'
})
},
fail: (err) => {
console.log('保存失败', err)
uni.showToast({
title: '保存失败',
icon: 'none'
})
}
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.promo-modal-page {
min-height: 100vh;
background: #f8f8f8;
padding-bottom: calc(140rpx + env(safe-area-inset-bottom));
overflow: hidden;
height: 100vh;
}
.promo-modal-page {
min-height: 100vh;
background: #f8f8f8;
padding-bottom: calc(140rpx + env(safe-area-inset-bottom));
overflow: hidden;
height: 100vh;
}
.nav-bar {
display: flex;
align-items: center;
height: calc(150rpx + var(--status-bar-height));
padding: 0 32rpx;
padding-top: var(--status-bar-height);
background: #fff;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 999;
box-sizing: border-box;
.nav-bar {
display: flex;
align-items: center;
height: calc(150rpx + var(--status-bar-height));
padding: 0 32rpx;
padding-top: var(--status-bar-height);
background: #fff;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 999;
box-sizing: border-box;
.back {
padding: 20rpx;
margin-left: -20rpx;
}
.back {
padding: 20rpx;
margin-left: -20rpx;
}
.title {
flex: 1;
text-align: center;
font-size: 34rpx;
font-weight: 500;
color: #222;
}
.title {
flex: 1;
text-align: center;
font-size: 34rpx;
font-weight: 500;
color: #222;
}
}
.content {
padding: 30rpx 0 0 0;
margin-top: calc(150rpx + var(--status-bar-height) + 80rpx);
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
box-sizing: border-box;
.content {
padding: 30rpx 0 0 0;
margin-top: calc(150rpx + var(--status-bar-height) + 80rpx);
height: 100%;
.user-info-modal {
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
box-sizing: border-box;
margin-bottom: 48rpx;
.user-info-modal {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 48rpx;
.avatar-frame {
width: 104rpx;
height: 104rpx;
border-radius: 10rpx;
overflow: hidden;
background: #f2f2f2;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.10);
.avatar-frame {
.avatar-img {
width: 104rpx;
height: 104rpx;
border-radius: 10rpx;
overflow: hidden;
background: #f2f2f2;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.10);
.avatar-img {
width: 104rpx;
height: 104rpx;
object-fit: cover;
display: block;
}
object-fit: cover;
display: block;
}
}
.nickname {
margin-top: 24rpx;
font-size: 32rpx;
font-weight: bold;
color: #222;
text-align: center;
}
.nickname {
margin-top: 24rpx;
font-size: 32rpx;
font-weight: bold;
color: #222;
text-align: center;
}
}
.qrcode-modal-section {
width: 300rpx;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 48rpx;
.qrcode-modal-section {
width: 300rpx;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 48rpx;
.qrcode-img {
width: 100%;
height: 100%;
background: #fff;
border-radius: 24rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
}
.qrcode-img {
width: 100%;
height: 100%;
background: #fff;
border-radius: 24rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
}
.invite-code {
margin-top: 32rpx;
font-size: 30rpx;
color: #222;
font-weight: bold;
text-align: center;
}
.invite-code {
margin-top: 32rpx;
font-size: 30rpx;
color: #222;
font-weight: bold;
text-align: center;
}
}
.bottom-btns-modal {
position: fixed;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: space-between;
padding: 24rpx 32rpx calc(env(safe-area-inset-bottom) + 24rpx) 32rpx;
background: #fff;
z-index: 100;
.bottom-btns-modal {
position: fixed;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: space-between;
padding: 24rpx 32rpx calc(env(safe-area-inset-bottom) + 24rpx) 32rpx;
background: #fff;
z-index: 100;
.btn {
flex: 1;
height: 88rpx;
border-radius: 44rpx;
font-size: 32rpx;
font-weight: bold;
margin: 0 12rpx;
border: none;
.btn {
flex: 1;
height: 88rpx;
border-radius: 44rpx;
font-size: 32rpx;
font-weight: bold;
margin: 0 12rpx;
border: none;
display: flex;
align-items: center;
justify-content: center;
&.gray {
background: linear-gradient(90deg, #b2f08d, #39e9d2);
color: #fff;
}
&.gray {
background: linear-gradient(90deg, #b2f08d, #39e9d2);
color: #fff;
}
&.green {
background: linear-gradient(90deg, #b2f08d, #39e9d2);
color: #fff;
}
&.green {
background: linear-gradient(90deg, #b2f08d, #39e9d2);
color: #fff;
}
}
}
}
</style>

+ 52
- 13
pages/subcomponent/promotion-profit-detail.vue View File

@ -20,6 +20,8 @@
<view class="profit-type">{{ item.type }}</view>
<text class="profit-amount">+¥{{ item.amount }}</text>
</view>
<view v-if="isLoading" style="text-align:center;color:#bbb;padding:20rpx;">加载中...</view>
<view v-else-if="!hasMore && profits.length > 0" style="text-align:center;color:#bbb;padding:20rpx;">没有更多了</view>
</view>
</view>
</view>
@ -29,24 +31,57 @@
export default {
data() {
return {
profits: [
{ avatar: 'https://randomuser.me/api/portraits/men/1.jpg', name: '李世海', date: '04-27', type: '用户下单', amount: 10 },
{ avatar: 'https://randomuser.me/api/portraits/women/2.jpg', name: '周静', date: '04-27', type: '拉新', amount: 10 },
{ avatar: 'https://randomuser.me/api/portraits/women/3.jpg', name: '周海', date: '04-27', type: '拉新', amount: 10 },
{ avatar: 'https://randomuser.me/api/portraits/men/4.jpg', name: '冯启彬', date: '04-27', type: '拉新', amount: 10 },
{ avatar: 'https://randomuser.me/api/portraits/men/5.jpg', name: '李娟', date: '04-27', type: '用户下单', amount: 10 },
{ avatar: 'https://randomuser.me/api/portraits/men/6.jpg', name: '李书琪', date: '04-27', type: '用户下单', amount: 10 },
{ avatar: 'https://randomuser.me/api/portraits/men/7.jpg', name: '赵香光', date: '04-27', type: '用户下单', amount: 10 },
{ avatar: 'https://randomuser.me/api/portraits/men/4.jpg', name: '冯启彬', date: '04-27', type: '拉新', amount: 10 },
{ avatar: 'https://randomuser.me/api/portraits/men/5.jpg', name: '李娟', date: '04-27', type: '用户下单', amount: 10 },
{ avatar: 'https://randomuser.me/api/portraits/men/6.jpg', name: '李书琪', date: '04-27', type: '用户下单', amount: 10 },
{ avatar: 'https://randomuser.me/api/portraits/men/7.jpg', name: '赵香光', date: '04-27', type: '用户下单', amount: 10 },
]
profits: [],
pageNo: 1,
pageSize: 10,
hasMore: true,
isLoading: false
}
},
onLoad() {
this.pageNo = 1;
this.hasMore = true;
this.fetchProfits();
},
onReachBottom() {
if (this.hasMore && !this.isLoading) {
this.fetchProfits(true);
}
},
methods: {
goBack() {
uni.navigateBack();
},
fetchProfits(isLoadMore = false) {
if (this.isLoading || (!this.hasMore && isLoadMore)) return;
this.isLoading = true;
const token = uni.getStorageSync('token') || '';
this.$api && this.$api('income', {
key: token,
pageNo: this.pageNo,
pageSize: this.pageSize
}, res => {
this.isLoading = false;
if (res.code === 200 && res.result && res.result.records) {
const newList = res.result.records.map(item => ({
avatar: item.formUser?.headImage || '',
name: item.formUser?.name || '',
date: (item.createTime || '').slice(5, 10),
type: item.title,
amount: item.formUser.price
}));
if (isLoadMore) {
this.profits = this.profits.concat(newList);
} else {
this.profits = newList;
}
//
this.hasMore = (res.result.current * res.result.size) < res.result.total;
if (this.hasMore) {
this.pageNo = res.result.current + 1;
}
}
});
}
}
}
@ -86,6 +121,10 @@ export default {
.main-content {
margin-top: calc(150rpx + var(--status-bar-height));
margin-bottom: 40rpx;
min-height: 100vh;
overflow-y: auto;
width: 100vw;
box-sizing: border-box;
}
.profit-list-card {
background: #fff;


+ 6
- 2
pages/subcomponent/promotion.vue View File

@ -696,9 +696,13 @@ export default {
font-weight: bold;
margin: 0 12rpx;
border: none;
background: linear-gradient(90deg, #b2f08d, #39e9d2);
display: flex;
align-items: center;
justify-content: center;
&.gray {
background: #f5f5f5;
color: #999;
background: linear-gradient(90deg, #b2f08d, #39e9d2);
color: #fff;
}
&.green {
background: linear-gradient(90deg, #42dfc2, #9be48f);


Loading…
Cancel
Save