sc
This commit is contained in:
@@ -48,3 +48,12 @@ export const getPersonAccount = async () => {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 修改密码
|
||||||
|
export const updatePassword = async data => {
|
||||||
|
return request({
|
||||||
|
url: '/system/user/profile/update-password',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -52,3 +52,12 @@ export const getDistributorDetail = id => {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 更新二维码状态
|
||||||
|
export const updateQrcodeStatus = data => {
|
||||||
|
return request({
|
||||||
|
url: '/applet/xunjia/distributor/status/update',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
<view class="back-icon">←</view>
|
<view class="back-icon">←</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="header-title">专属二维码管理</view>
|
<view class="header-title">专属二维码管理</view>
|
||||||
<view class="header-right" @click="generateBatchQrcode">
|
<view class="header-right">
|
||||||
<view class="batch-btn">批量生成</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -15,38 +14,23 @@
|
|||||||
<view class="filter-section">
|
<view class="filter-section">
|
||||||
<view class="filter-row">
|
<view class="filter-row">
|
||||||
<view class="filter-item">
|
<view class="filter-item">
|
||||||
<view class="filter-label">分销员</view>
|
<view class="filter-label">姓名</view>
|
||||||
<view class="filter-control">
|
|
||||||
<picker
|
|
||||||
:range="distributorOptions"
|
|
||||||
:value="distributorIndex"
|
|
||||||
@change="onDistributorChange"
|
|
||||||
class="picker"
|
|
||||||
>
|
|
||||||
<view class="picker-text">{{ distributorOptions[distributorIndex] }}</view>
|
|
||||||
</picker>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="filter-item">
|
|
||||||
<view class="filter-label">状态</view>
|
|
||||||
<view class="filter-control">
|
|
||||||
<picker
|
|
||||||
:range="statusOptions"
|
|
||||||
:value="statusIndex"
|
|
||||||
@change="onStatusChange"
|
|
||||||
class="picker"
|
|
||||||
>
|
|
||||||
<view class="picker-text">{{ statusOptions[statusIndex] }}</view>
|
|
||||||
</picker>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="filter-item">
|
|
||||||
<view class="filter-label">搜索</view>
|
|
||||||
<view class="filter-control">
|
<view class="filter-control">
|
||||||
<input
|
<input
|
||||||
v-model="searchKeyword"
|
v-model="name"
|
||||||
class="search-input"
|
class="search-input"
|
||||||
placeholder="请输入推广码或备注"
|
placeholder="请输入姓名"
|
||||||
|
@input="onSearch"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="filter-item">
|
||||||
|
<view class="filter-label">手机号</view>
|
||||||
|
<view class="filter-control">
|
||||||
|
<input
|
||||||
|
v-model="phone"
|
||||||
|
class="search-input"
|
||||||
|
placeholder="请输入手机号"
|
||||||
@input="onSearch"
|
@input="onSearch"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
@@ -65,46 +49,45 @@
|
|||||||
>
|
>
|
||||||
<view class="qrcode-card">
|
<view class="qrcode-card">
|
||||||
<view class="qrcode-header">
|
<view class="qrcode-header">
|
||||||
<view class="qrcode-code">{{ qrcode.code }}</view>
|
<view class="qrcode-code">{{ qrcode.id }}</view>
|
||||||
<view class="qrcode-status" :class="qrcode.statusClass">{{ qrcode.status }}</view>
|
<view class="qrcode-status" :class="qrcode.status == '0' ? 'status-active' : 'status-inactive'">{{ qrcode.status == '0' ? '已启用' : '已禁用' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="qrcode-body">
|
<view class="qrcode-body">
|
||||||
<view class="qrcode-image">
|
<view class="qrcode-image">
|
||||||
<!-- 模拟二维码图片 -->
|
<!-- 模拟二维码图片 -->
|
||||||
<view class="mock-qrcode">
|
<view class="mock-qrcode">
|
||||||
<view class="qrcode-pattern"></view>
|
<view class="qrcode-pattern">
|
||||||
<view class="qrcode-text">{{ qrcode.code }}</view>
|
<!-- 小程序二维码图片 -->
|
||||||
|
<image :src="qrcode.appletUrl" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="qrcode-info">
|
<view class="qrcode-info">
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<view class="info-label">分销员:</view>
|
<view class="info-label">分销员:</view>
|
||||||
<view class="info-value">{{ qrcode.distributor }}</view>
|
<view class="info-value">{{ qrcode.name }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="info-label">手机号:</view>
|
||||||
|
<view class="info-value">{{ qrcode.phone }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<view class="info-label">生成时间:</view>
|
<view class="info-label">生成时间:</view>
|
||||||
<view class="info-value">{{ qrcode.createTime }}</view>
|
<view class="info-value">{{ new Date(qrcode.createTime).toLocaleString() }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<view class="info-label">扫码次数:</view>
|
<view class="info-label">总收入:</view>
|
||||||
<view class="info-value">{{ qrcode.scanCount }}</view>
|
<view class="info-value">{{ qrcode.totalIncome }}</view>
|
||||||
</view>
|
|
||||||
<view class="info-item">
|
|
||||||
<view class="info-label">备注:</view>
|
|
||||||
<view class="info-value">{{ qrcode.remark }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="qrcode-footer">
|
<view class="qrcode-footer">
|
||||||
<view class="action-btn download-btn" @click="downloadQrcode(qrcode.id)">
|
<view class="action-btn download-btn" @click="previewQrcode(qrcode.appletUrl)">
|
||||||
下载
|
|
||||||
</view>
|
|
||||||
<view class="action-btn preview-btn" @click="previewQrcode(qrcode.id)">
|
|
||||||
预览
|
预览
|
||||||
</view>
|
</view>
|
||||||
<view class="action-btn" :class="qrcode.status === '启用' ? 'disable-btn' : 'enable-btn'"
|
<view class="action-btn" :class="qrcode.status == '0' ? 'disable-btn' : 'enable-btn'"
|
||||||
@click="toggleQrcodeStatus(qrcode.id, qrcode.status)">
|
@click="toggleQrcodeStatus(qrcode.id, qrcode.status)">
|
||||||
{{ qrcode.status === '启用' ? '禁用' : '启用' }}
|
{{ qrcode.status == '0' ? '禁用' : '启用' }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -145,179 +128,75 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from "vue"
|
import { ref, computed, onMounted } from "vue"
|
||||||
|
import { getDistributorPage, updateQrcodeStatus } from "@/api/distribution/distributor"
|
||||||
|
|
||||||
// 分销员选项
|
const name = ref('')
|
||||||
const distributorOptions = ['全部分销员', '张分销', '李分销', '王分销', '刘分销']
|
const phone = ref('')
|
||||||
const distributorIndex = ref(0)
|
|
||||||
|
|
||||||
// 状态选项
|
const qrcodeList = ref([])
|
||||||
const statusOptions = ['全部状态', '启用', '禁用']
|
|
||||||
const statusIndex = ref(0)
|
|
||||||
|
|
||||||
// 搜索关键词
|
|
||||||
const searchKeyword = ref('')
|
|
||||||
|
|
||||||
// 二维码列表
|
|
||||||
const qrcodeList = ref([
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
code: 'SD20260129001',
|
|
||||||
distributor: '张分销',
|
|
||||||
createTime: '2026-01-29 10:00:00',
|
|
||||||
scanCount: 120,
|
|
||||||
status: '启用',
|
|
||||||
statusClass: 'status-active',
|
|
||||||
remark: '推广活动专用'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
code: 'SD20260129002',
|
|
||||||
distributor: '李分销',
|
|
||||||
createTime: '2026-01-29 11:00:00',
|
|
||||||
scanCount: 89,
|
|
||||||
status: '启用',
|
|
||||||
statusClass: 'status-active',
|
|
||||||
remark: '日常推广'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
code: 'SD20260129003',
|
|
||||||
distributor: '王分销',
|
|
||||||
createTime: '2026-01-29 12:00:00',
|
|
||||||
scanCount: 45,
|
|
||||||
status: '禁用',
|
|
||||||
statusClass: 'status-inactive',
|
|
||||||
remark: '备用二维码'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
code: 'SD20260129004',
|
|
||||||
distributor: '刘分销',
|
|
||||||
createTime: '2026-01-29 13:00:00',
|
|
||||||
scanCount: 67,
|
|
||||||
status: '启用',
|
|
||||||
statusClass: 'status-active',
|
|
||||||
remark: '线下活动专用'
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
// 分页信息
|
|
||||||
const currentPage = ref(1)
|
const currentPage = ref(1)
|
||||||
const totalQrcodes = ref(100)
|
const totalQrcodes = ref(100)
|
||||||
const pageSize = ref(12)
|
const pageSize = ref(12)
|
||||||
|
|
||||||
// 计算总页数
|
|
||||||
const totalPages = computed(() => {
|
const totalPages = computed(() => {
|
||||||
return Math.ceil(totalQrcodes.value / pageSize.value)
|
return Math.ceil(totalQrcodes.value / pageSize.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 实际项目中应从接口获取二维码列表
|
loadQrcodeList()
|
||||||
// loadQrcodeList()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 返回上一页
|
async function loadQrcodeList() {
|
||||||
|
const res = await getDistributorPage({
|
||||||
|
pageNo: currentPage.value,
|
||||||
|
pageSize: pageSize.value,
|
||||||
|
name: name.value,
|
||||||
|
phone: phone.value
|
||||||
|
})
|
||||||
|
qrcodeList.value = res.data.list || []
|
||||||
|
totalQrcodes.value = res.data.total || 0
|
||||||
|
}
|
||||||
|
|
||||||
function goBack() {
|
function goBack() {
|
||||||
uni.navigateBack({ delta: 1 })
|
uni.navigateBack({ delta: 1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量生成二维码
|
|
||||||
function generateBatchQrcode() {
|
|
||||||
uni.showModal({
|
|
||||||
title: '批量生成二维码',
|
|
||||||
content: '请输入要生成的二维码数量',
|
|
||||||
editable: true,
|
|
||||||
placeholderText: '请输入数量',
|
|
||||||
success: function(res) {
|
|
||||||
if (res.confirm && res.content) {
|
|
||||||
const count = parseInt(res.content)
|
|
||||||
if (isNaN(count) || count <= 0 || count > 100) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '请输入1-100之间的数字',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.showLoading({ title: '生成中...' })
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: `成功生成${count}个二维码`,
|
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
// 实际项目中应调用接口批量生成二维码
|
|
||||||
// generateBatchQrcodes(count)
|
|
||||||
}, 1500)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 分销员变更
|
|
||||||
function onDistributorChange(e) {
|
|
||||||
const value = e.detail.value
|
|
||||||
distributorIndex.value = value
|
|
||||||
// 实际项目中应根据分销员筛选二维码
|
|
||||||
// filterQrcodeList()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 状态变更
|
|
||||||
function onStatusChange(e) {
|
|
||||||
const value = e.detail.value
|
|
||||||
statusIndex.value = value
|
|
||||||
// 实际项目中应根据状态筛选二维码
|
|
||||||
// filterQrcodeList()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 搜索
|
|
||||||
function onSearch() {
|
function onSearch() {
|
||||||
// 实际项目中应根据关键词搜索二维码
|
currentPage.value = 1
|
||||||
// searchQrcodeList()
|
loadQrcodeList()
|
||||||
}
|
|
||||||
|
|
||||||
// 下载二维码
|
|
||||||
function downloadQrcode(id) {
|
|
||||||
uni.showLoading({ title: '下载中...' })
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: '下载成功',
|
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
// 实际项目中应调用接口下载二维码
|
|
||||||
// downloadQrcodeById(id)
|
|
||||||
}, 1000)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 预览二维码
|
// 预览二维码
|
||||||
function previewQrcode(id) {
|
function previewQrcode(url) {
|
||||||
uni.showToast({
|
uni.previewImage({
|
||||||
title: '预览功能开发中',
|
urls: [url],
|
||||||
icon: 'none'
|
current: url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换二维码状态
|
// 切换二维码状态
|
||||||
function toggleQrcodeStatus(id, currentStatus) {
|
function toggleQrcodeStatus(id, currentStatus) {
|
||||||
const newStatus = currentStatus === '启用' ? '禁用' : '启用'
|
const newStatus = currentStatus == '0' ? '1' : '0'
|
||||||
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '切换状态',
|
title: '切换状态',
|
||||||
content: `确定要${newStatus === '启用' ? '启用' : '禁用'}该二维码吗?`,
|
content: `确定要${newStatus == '1' ? '启用' : '禁用'}该二维码吗?`,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// 实际项目中应调用接口切换二维码状态
|
updateQrcodeStatus({
|
||||||
const qrcode = qrcodeList.value.find(item => item.id === id)
|
id,
|
||||||
if (qrcode) {
|
status: newStatus
|
||||||
qrcode.status = newStatus
|
}).then(res => {
|
||||||
qrcode.statusClass = newStatus === '启用' ? 'status-active' : 'status-inactive'
|
if (res.code == 0) {
|
||||||
}
|
uni.showToast({
|
||||||
uni.showToast({
|
title: `二维码已${newStatus == '1' ? '启用' : '禁用'}`,
|
||||||
title: `二维码已${newStatus}`,
|
icon: 'success'
|
||||||
icon: 'success'
|
})
|
||||||
|
// 刷新当前页数据
|
||||||
|
loadQrcodeList()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,7 +210,7 @@
|
|||||||
}
|
}
|
||||||
currentPage.value = page
|
currentPage.value = page
|
||||||
// 实际项目中应加载指定页码的二维码
|
// 实际项目中应加载指定页码的二维码
|
||||||
// loadQrcodePage(page)
|
loadQrcodeList()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -551,11 +430,12 @@
|
|||||||
.info-item {
|
.info-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 18rpx;
|
font-size: 18rpx;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-label {
|
.info-label {
|
||||||
color: #606266;
|
color: #606266;
|
||||||
width: 80rpx;
|
width: 125rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-value {
|
.info-value {
|
||||||
|
|||||||
@@ -194,14 +194,7 @@
|
|||||||
|
|
||||||
// 跳转到首页
|
// 跳转到首页
|
||||||
proxy.$tab.reLaunch('/pages/index')
|
proxy.$tab.reLaunch('/pages/index')
|
||||||
} catch (error) {
|
} finally {
|
||||||
// 登录失败
|
|
||||||
uni.showToast({
|
|
||||||
title: error.message || "登录失败,请重试",
|
|
||||||
icon: "none",
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
// 结束登录状态
|
// 结束登录状态
|
||||||
isLoggingIn.value = false
|
isLoggingIn.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,8 +253,7 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
currentPage.value = page
|
currentPage.value = page
|
||||||
// 实际项目中应加载指定页码的核验码
|
loadCodeList()
|
||||||
// loadCodePage(page)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取状态文本
|
// 获取状态文本
|
||||||
|
|||||||
@@ -111,6 +111,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from "vue"
|
import { ref, computed } from "vue"
|
||||||
|
import { updatePassword } from "@/api/account"
|
||||||
|
|
||||||
// 密码表单
|
// 密码表单
|
||||||
const passwordForm = ref({
|
const passwordForm = ref({
|
||||||
@@ -220,20 +221,15 @@
|
|||||||
// 实际项目中应调用接口修改密码
|
// 实际项目中应调用接口修改密码
|
||||||
uni.showLoading({ title: '修改中...' })
|
uni.showLoading({ title: '修改中...' })
|
||||||
|
|
||||||
setTimeout(() => {
|
updatePassword({
|
||||||
uni.hideLoading()
|
oldPassword: passwordForm.value.oldPassword,
|
||||||
uni.showModal({
|
newPassword: passwordForm.value.newPassword
|
||||||
title: '修改成功',
|
}).then(res => {
|
||||||
content: '密码修改成功,请重新登录',
|
if (res.code == 0) {
|
||||||
showCancel: false,
|
uni.hideLoading()
|
||||||
success: function() {
|
uni.showToast({ title: '密码修改成功', icon: 'none' })
|
||||||
// 实际项目中应跳转到登录页面
|
}
|
||||||
uni.redirectTo({
|
})
|
||||||
url: '/pages/login/index'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, 1000)
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 分销员功能 -->
|
<!-- 分销员功能 -->
|
||||||
<view v-if="checkPermi(['work:distribution:selfPromotion'])" class="feature-card" @click="goToPersonalPromotion">
|
<view v-if="checkPermi(['work:distribution:selfPromotion'])" class="feature-card" @click="goToQrCodeManage">
|
||||||
<view class="feature-icon log-icon">
|
<view class="feature-icon log-icon">
|
||||||
<view class="icon-text">📱</view>
|
<view class="icon-text">📱</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
Reference in New Issue
Block a user