| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816 |
- <template>
- <view class="detail-page">
- <!-- 背景层 -->
- <view class="header-bg"></view>
- <!-- 顶部内容层 -->
- <view class="header-section">
- <view class="header-content">
- <view class="title-group">
- <text class="main-title">感冒灵大批量跨区域客户</text>
- <text class="sub-title">订单维度:单笔订单实际盒数 {{ ">" }} 20000盒</text>
- <text class="sub-title">地域维度:出库企业所在省份 ≠ 入库企业所在省份</text>
- </view>
- <view class="stat-box">
- <text class="stat-num">{{ totalCount }}</text>
- <text class="stat-unit">家</text>
- </view>
- </view>
- <view class="header-toolbar">
- <view class="update-tip">
- <!-- <text class="tip-icon">🕒</text> -->
- <text>统计日期:{{
- formatDate(
- new Date().setDate(new Date().getDate() - 1),
- "YYYY-MM-DD",
- ) || "--"
- }}</text>
- </view>
- <view class="filter-wrap">
- <view class="selector" @click.stop="toggleProvinceDropdown">
- <text class="selector-text">{{
- selectedProvince || "全部省份"
- }}</text>
- <text class="selector-arrow" :class="{ open: dropdownProvinceOpen }"></text>
- </view>
- </view>
- </view>
- </view>
- <!-- 列表区域 -->
- <scroll-view class="list-scroll" scroll-y="true" refresher-enabled :refresher-triggered="isRefreshing"
- @refresherrefresh="onRefresh">
- <view class="list-container">
- <view class="card-item" v-for="(item, index) in rows" :key="index" @click="toDetail(item)">
- <view class="card-header">
- <view class="header-left">
- <text class="index-num">{{ index + 1 }}</text>
- <text class="company-name">{{ item.customerName }}</text>
- <text class="level-tag" :class="getLevelClass(item.customerLevel)">
- {{ item.customerLevel }}
- </text>
- </view>
- <view class="header-right">
- <text class="alert-count">{{ item.totalWarningAmount }}次预警</text>
- </view>
- </view>
- <view class="card-body">
- <view class="info-grid">
- <view class="info-item">
- <text class="label">省份</text>
- <text class="value">{{ item.customerProvinceName }}</text>
- </view>
- <view class="info-item">
- <text class="label">责任人</text>
- <text class="value">{{ item.responsibleManager }}</text>
- </view>
- <view class="info-item">
- <text class="label">性质</text>
- <text class="value">{{ item.customerCategory }}</text>
- </view>
- </view>
- </view>
- </view>
- <view v-if="!loading && rows.length === 0" class="empty-data">
- <EmptyView text="无相关数据" />
- </view>
- </view>
- </scroll-view>
- <!-- 底部按钮区 -->
- <view class="footer-btn-area">
- <button class="action-btn history-btn" @click="handleHistory">
- 历史记录
- </button>
- <button class="action-btn export-btn" @click="handleExport">
- 导出至邮箱
- </button>
- </view>
- <!-- 蒙层 -->
- <view class="report-export-create-modal-mask" v-if="emailModalOpen" @click="closeEmailModal"
- @touchmove.stop.prevent></view>
- <!-- 邮箱导出弹窗 -->
- <view class="report-export-create-modal report-export-create-email-modal"
- :class="{ 'report-export-create-modal--open': emailModalOpen }" v-if="emailModalOpen">
- <view class="report-export-create-modal-title">
- <text>发送至邮箱</text>
- <view class="report-export-create-modal-close" @click.stop="closeEmailModal">×</view>
- </view>
- <view class="report-export-create-modal-body">
- <up-input v-model="emailForm.email" border="none" :customStyle="{
- backgroundColor: '#ebf3fb',
- height: '80rpx',
- paddingLeft: '20rpx',
- }" placeholder="请填写邮箱" @input="emailError = false">
- <template #suffix>
- <view style="margin-right: 20rpx; color: #666">@999.com.cn</view>
- </template>
- </up-input>
- <text v-if="emailError" class="report-export-error-text">请输入邮箱</text>
- </view>
- <view class="report-export-create-modal-footer">
- <view class="report-export-create-modal-btn cancel-btn" @click.stop="closeEmailModal">取消</view>
- <view class="report-export-create-modal-btn confirm-btn" @click.stop="handleSendEmail">发送</view>
- </view>
- </view>
- <!-- 独立的下拉菜单层 -->
- <view class="dropdown-layer" v-if="dropdownProvinceOpen" @click.stop>
- <view class="dropdown">
- <view class="dropdown-search-bar">
- <input class="dropdown-search-input" v-model="provinceSearchText" placeholder="搜索省份..."
- placeholder-style="color: #999" />
- </view>
- <scroll-view scroll-y="true" class="dropdown-scroll-view">
- <view class="dropdown-item" v-for="(p, i) in filteredProvinceList" :key="p || i" :class="{
- active: p === selectedProvince || (!selectedProvince && i === 0),
- }" @click.stop="selectProvince(p)">
- {{ p || "全部省份" }}
- <text v-if="p === selectedProvince || (!selectedProvince && i === 0)" class="check-mark">✓</text>
- </view>
- <view v-if="filteredProvinceList.length === 0" class="dropdown-empty">暂无数据</view>
- </scroll-view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import EmptyView from "../../../wigets/empty.vue";
- import request from "../../../request/index.js";
- import { formatDate } from "../../../utils/utils.js";
- export default {
- components: {
- EmptyView,
- },
- data() {
- return {
- isRefreshing: false,
- loading: false,
- rows: [],
- allRows: [],
- dropdownProvinceOpen: false,
- provinceSearchText: "",
- provinceList: [""],
- selectedProvince: "",
- totalCount: 0,
- emailModalOpen: false,
- emailForm: {
- email: "",
- },
- emailError: false,
- };
- },
- created() {
- this.resetFetch();
- this.getProviceList();
- const userEmail = uni.getStorageSync('traceCode_useremail')
- this.emailForm.email = userEmail
- },
- methods: {
- formatDate,
- getProviceList() {
- request("/common/getProviceList", {
- path: "traceabilityReport/pages/ganmaoling/index.vue",
- }).then((res) => {
- if (res.code == 200) {
- const _data = res.data || [];
- this.provinceList = ["", ..._data.map((item) => item.regionName)];
- }
- });
- },
- getLevelClass(level) {
- if (level === "VIP") return "tag-vip";
- if (level === "二级") return "tag-l2";
- if (level === "三级") return "tag-l3";
- return "tag-default";
- },
- fetchList() {
- if (this.loading) return;
- this.loading = true;
- request(
- `/report/ganmaoling/list?days=1`,
- {
- path: "traceabilityReport/pages/ganmaoling/index.vue",
- },
- "get",
- ).then((res) => {
- if (res.code == 200) {
- this.allRows = res.data || [];
- this.applyFilter();
- }
- this.loading = false;
- this.isRefreshing = false;
- });
- },
- async onRefresh() {
- this.isRefreshing = true;
- this.fetchList();
- },
- resetFetch() {
- this.rows = [];
- this.fetchList();
- },
- applyFilter() {
- if (!this.selectedProvince) {
- this.rows = [...this.allRows];
- } else {
- this.rows = this.allRows.filter(item => item.customerProvinceName === this.selectedProvince);
- }
- this.totalCount = this.rows.length;
- },
- toggleProvinceDropdown() {
- this.dropdownProvinceOpen = !this.dropdownProvinceOpen;
- },
- closeProvinceDropdown() {
- this.dropdownProvinceOpen = false;
- },
- selectProvince(province) {
- this.selectedProvince = province || "";
- this.dropdownProvinceOpen = false;
- this.applyFilter();
- },
- toDetail(item) {
- uni.navigateTo({
- url: `/traceCodePackages/traceabilityReport/pages/ganmaoling/detail/index?name=${encodeURIComponent(item.customerName)}&updatedTime=${item.updatedTime || ""}`,
- });
- },
- handleExport() {
- if (this.rows.length == 0) {
- uni.showToast({
- title: '暂无数据...',
- icon: 'none'
- })
- return
- }
- this.emailModalOpen = true;
- this.emailError = false;
- },
- closeEmailModal() {
- this.emailModalOpen = false;
- },
- handleSendEmail() {
- if (!this.emailForm.email) {
- this.emailError = true;
- return;
- }
- uni.showLoading({ title: "发送中..." });
- const yesterday = new Date();
- yesterday.setDate(yesterday.getDate() - 1);
- const dateStr = this.formatDate(yesterday, "YYYY-MM-DD");
- request(
- `/report/ganmaoling/sendemail`,
- {
- updatedTime: dateStr,
- emailAddress: '635509855@qq.com',//this.emailForm.email + "@999.com.cn",
- path: "traceabilityReport/pages/ganmaoling/index.vue",
- },
- "post",
- ).then((res) => {
- uni.hideLoading();
- if (res.code == 200) {
- uni.showToast({
- title: "发送成功",
- icon: "success",
- });
- this.closeEmailModal();
- } else {
- uni.showToast({
- title: res.msg || "发送失败",
- icon: "none",
- });
- }
- });
- },
- handleHistory() {
- uni.navigateTo({
- url: "/traceCodePackages/traceabilityReport/pages/ganmaoling/history/index",
- });
- },
- },
- computed: {
- filteredProvinceList() {
- if (!this.provinceSearchText) {
- return this.provinceList;
- }
- return this.provinceList.filter((p) =>
- p?.toLowerCase()?.includes(this.provinceSearchText.toLowerCase()),
- );
- },
- },
- };
- </script>
- <style scoped>
- .detail-page {
- display: flex;
- flex-direction: column;
- height: calc(100vh - 116rpx - env(safe-area-inset-bottom));
- box-sizing: border-box;
- background: #f5f7fa;
- position: relative;
- }
- /* Header Background Layer */
- .header-bg {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 320rpx;
- /* Fixed height for background */
- background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
- border-bottom-left-radius: 40rpx;
- border-bottom-right-radius: 40rpx;
- z-index: 1;
- box-shadow: 0 10rpx 30rpx rgba(24, 144, 255, 0.2);
- }
- /* Header Content Layer */
- .header-section {
- padding: 40rpx 40rpx 80rpx;
- position: relative;
- z-index: 3;
- /* Above List */
- color: #fff;
- /* Transparent background to allow overlap effect */
- }
- .header-content {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- position: relative;
- z-index: 2;
- margin-bottom: 30rpx;
- }
- .title-group {
- display: flex;
- flex-direction: column;
- flex: 1;
- margin-right: 20rpx;
- }
- .main-title {
- font-size: 44rpx;
- font-weight: bold;
- margin-bottom: 16rpx;
- letter-spacing: 2rpx;
- line-height: 1.2;
- }
- .sub-title {
- font-size: 24rpx;
- opacity: 0.9;
- margin-bottom: 8rpx;
- line-height: 1.4;
- }
- .stat-box {
- display: flex;
- align-items: baseline;
- }
- .stat-num {
- font-size: 56rpx;
- font-weight: bold;
- margin-right: 8rpx;
- font-family: "DINAlternate-Bold", sans-serif;
- }
- .stat-unit {
- font-size: 24rpx;
- opacity: 0.8;
- }
- /* Header Toolbar */
- .header-toolbar {
- display: flex;
- justify-content: space-between;
- align-items: center;
- position: relative;
- z-index: 3;
- }
- .update-tip {
- display: inline-flex;
- align-items: center;
- background: rgba(255, 255, 255, 0.15);
- padding: 8rpx 20rpx;
- border-radius: 30rpx;
- font-size: 22rpx;
- backdrop-filter: blur(10px);
- }
- .tip-icon {
- margin-right: 8rpx;
- font-size: 20rpx;
- }
- /* Filter Styles */
- .filter-wrap {
- position: relative;
- }
- .selector {
- display: flex;
- align-items: center;
- color: #fff;
- font-size: 26rpx;
- font-weight: 500;
- padding: 8rpx 20rpx;
- background: rgba(255, 255, 255, 0.2);
- border-radius: 30rpx;
- border: 1rpx solid rgba(255, 255, 255, 0.3);
- }
- .selector-text {
- max-width: 200rpx;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .selector-arrow {
- margin-left: 10rpx;
- width: 0;
- height: 0;
- border-left: 8rpx solid transparent;
- border-right: 8rpx solid transparent;
- border-top: 10rpx solid #fff;
- transition: transform 0.3s;
- }
- .selector-arrow.open {
- transform: rotate(180deg);
- }
- /* Dropdown Layer (Absolute on top of everything) */
- .dropdown-layer {
- position: absolute;
- top: 300rpx;
- /* Adjust based on header layout */
- right: 40rpx;
- z-index: 999;
- }
- .dropdown {
- width: 360rpx;
- background: #fff;
- border-radius: 12rpx;
- box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.15);
- overflow: hidden;
- }
- .dropdown-search-bar {
- padding: 16rpx;
- border-bottom: 1rpx solid #f0f0f0;
- }
- .dropdown-search-input {
- background: #f5f7fa;
- height: 64rpx;
- border-radius: 32rpx;
- padding: 0 24rpx;
- font-size: 26rpx;
- }
- .dropdown-scroll-view {
- max-height: 400rpx;
- }
- .dropdown-item {
- padding: 20rpx 30rpx;
- font-size: 28rpx;
- color: #333;
- display: flex;
- justify-content: space-between;
- align-items: center;
- transition: background 0.2s;
- }
- .dropdown-item:active {
- background: #f5f7fa;
- }
- .dropdown-item.active {
- color: #1890ff;
- font-weight: 500;
- background: #e6f7ff;
- }
- .check-mark {
- font-size: 24rpx;
- }
- .dropdown-empty {
- padding: 40rpx;
- text-align: center;
- color: #999;
- font-size: 26rpx;
- }
- /* List Section */
- .list-scroll {
- flex: 1;
- height: 0;
- padding: 0 24rpx;
- box-sizing: border-box;
- margin-top: -50rpx;
- /* Overlap effect */
- position: relative;
- z-index: 2;
- /* Between bg and header content */
- }
- .list-container {
- padding-top: 10rpx;
- padding-bottom: calc(200rpx + env(safe-area-inset-bottom));
- }
- .card-item {
- background: #fff;
- border-radius: 20rpx;
- padding: 30rpx;
- margin-bottom: 24rpx;
- box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.05);
- transition: transform 0.2s;
- }
- .card-item:active {
- transform: scale(0.99);
- }
- .card-header {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- margin-bottom: 24rpx;
- }
- .header-left {
- flex: 1;
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- margin-right: 20rpx;
- gap: 12rpx;
- }
- .index-num {
- font-size: 24rpx;
- color: #999;
- font-family: monospace;
- }
- .company-name {
- font-size: 32rpx;
- font-weight: 600;
- color: #096dd9;
- line-height: 1.4;
- text-decoration: underline;
- }
- .level-tag {
- font-size: 20rpx;
- padding: 4rpx 12rpx;
- border-radius: 8rpx;
- white-space: nowrap;
- line-height: 1.2;
- }
- .header-right {
- flex-shrink: 0;
- }
- .tag-vip {
- background: linear-gradient(135deg, #e6f7ff, #bae7ff);
- color: #096dd9;
- }
- .tag-l2 {
- background: linear-gradient(135deg, #f6ffed, #d9f7be);
- color: #389e0d;
- }
- .tag-l3 {
- background: linear-gradient(135deg, #fff7e6, #ffe7ba);
- color: #d46b08;
- }
- .tag-default {
- background: #f5f5f5;
- color: #999;
- }
- .card-body {
- background: #f9fbfd;
- border-radius: 12rpx;
- padding: 24rpx;
- }
- .info-grid {
- display: flex;
- flex-wrap: wrap;
- gap: 24rpx;
- }
- .info-item {
- display: flex;
- align-items: center;
- min-width: 45%;
- }
- .info-item .label {
- font-size: 24rpx;
- color: #999;
- margin-right: 12rpx;
- }
- .info-item .value {
- font-size: 26rpx;
- color: #666;
- font-weight: 500;
- }
- .alert-count {
- font-size: 22rpx;
- color: #ff4d4f;
- background: rgba(255, 77, 79, 0.1);
- padding: 6rpx 16rpx;
- border-radius: 20rpx;
- font-weight: 600;
- }
- .empty-data {
- padding-top: 120rpx;
- }
- .footer-btn-area {
- padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
- background: #fff;
- box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.08);
- position: fixed;
- z-index: 100;
- bottom: 0;
- width: 100%;
- box-sizing: border-box;
- display: flex;
- gap: 24rpx;
- }
- .action-btn {
- flex: 1;
- height: 88rpx;
- line-height: 88rpx;
- border-radius: 44rpx;
- font-size: 30rpx;
- font-weight: 600;
- text-align: center;
- border: none;
- transition: all 0.3s;
- }
- .action-btn::after {
- border: none;
- }
- .action-btn:active {
- transform: scale(0.96);
- }
- .history-btn {
- background: #fff;
- color: #1890ff;
- border: 2rpx solid #1890ff;
- box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.1);
- }
- .export-btn {
- background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
- color: #fff;
- box-shadow: 0 6rpx 16rpx rgba(24, 144, 255, 0.35);
- }
- /* 弹窗样式 */
- .report-export-create-modal-mask {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.6);
- z-index: 999;
- backdrop-filter: blur(2px);
- }
- .report-export-create-modal {
- position: fixed;
- z-index: 1000;
- background: #fff;
- transition: all 0.3s ease;
- }
- .report-export-create-email-modal {
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 620rpx;
- border-radius: 24rpx;
- opacity: 0;
- visibility: hidden;
- overflow: hidden;
- }
- .report-export-create-email-modal.report-export-create-modal--open {
- opacity: 1;
- visibility: visible;
- }
- .report-export-create-modal-title {
- padding: 36rpx 32rpx;
- font-size: 36rpx;
- color: #333;
- text-align: center;
- font-weight: 600;
- border-bottom: 1rpx solid #f0f0f0;
- position: relative;
- }
- .report-export-create-modal-close {
- position: absolute;
- right: 32rpx;
- top: 50%;
- transform: translateY(-50%);
- font-size: 44rpx;
- color: #999;
- line-height: 1;
- padding: 10rpx;
- }
- .report-export-create-modal-body {
- padding: 48rpx 40rpx 32rpx;
- }
- .report-export-error-text {
- font-size: 24rpx;
- color: #ff4d4f;
- margin-top: 12rpx;
- display: block;
- }
- .report-export-create-modal-footer {
- padding: 0 40rpx 48rpx;
- display: flex;
- justify-content: space-between;
- gap: 24rpx;
- }
- .report-export-create-modal-btn {
- height: 88rpx;
- line-height: 88rpx;
- border-radius: 44rpx;
- text-align: center;
- font-size: 30rpx;
- font-weight: 600;
- flex: 1;
- margin: 0;
- }
- .cancel-btn {
- background: #f5f7fa;
- color: #666;
- border: 1rpx solid #e4e7ed;
- }
- .confirm-btn {
- background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
- color: #fff;
- box-shadow: 0 6rpx 16rpx rgba(24, 144, 255, 0.3);
- }
- </style>
|