Kaynağa Gözat

Add native mini program service ticket submission and results

彭峰 2 gün önce
ebeveyn
işleme
20b1448817

+ 2 - 1
app.json

@@ -16,7 +16,8 @@
       "root": "yuban",
       "root": "yuban",
       "name": "语伴",
       "name": "语伴",
       "pages": [
       "pages": [
-        "pages/index/index"
+        "pages/index/index",
+        "pages/service-desk/index"
       ]
       ]
     }
     }
   ],
   ],

+ 30 - 0
test/service-desk.test.cjs

@@ -0,0 +1,30 @@
+const {test}=require('node:test');
+const assert=require('node:assert/strict');
+const {readFileSync}=require('node:fs');
+const {mapRecords, replyChoices, normalizeContactPhone}=require('../utils/service-desk');
+
+test('工单列表只保留用户可见字段并区分不同结单状态',()=>{
+  const deleted={
+    id:'deleted',createdAt:new Date(),get:k=>({isDeleted:true,progress:'已完成',resolutionSummary:'deleted'})[k],
+  };
+  const row={
+    id:'synthetic',createdAt:new Date(),get:k=>({ticketNo:'AR-01',progress:'已受理',resolutionStatus:'不予处理',
+      resolutionSummary:'用户可见结论',internalNote:'synthetic private',contactPhone:'synthetic redacted'})[k],
+  };
+  const items=mapRecords([row,deleted],'ai_reply_report');
+  assert.equal(items.length,1);
+  assert.equal(items[0].status,'不予处理');
+  assert.equal(items[0].result,'用户可见结论');
+  assert.ok(!JSON.stringify(items).includes('synthetic private'));
+  assert.ok(!JSON.stringify(items).includes('synthetic redacted'));
+  assert.doesNotMatch(readFileSync(require.resolve('../yuban/pages/service-desk/index.wxml'),'utf8'),/internalNote/);
+});
+test('只列出可举报的回复,上一条消息保持可选并限制长度',()=>{
+  const choices=replyChoices([{role:'system',content:'系统消息'}, {role:'user',content:'上一条提问',id:'u'},
+    {role:'assistant',content:'合成回复',id:'a'}, {role:'assistant',content:'隐藏回复',hidden:true}]);
+  assert.equal(choices.length,1);
+  assert.equal(choices[0].id,'a');
+  assert.deepEqual(choices[0].previous,{id:'u',text:'上一条提问'});
+  assert.equal(normalizeContactPhone(' 138-0000-1234 '),'13800001234');
+  assert.equal(normalizeContactPhone('foo123'),'');
+});

+ 166 - 0
utils/service-desk.js

@@ -0,0 +1,166 @@
+const { restrictionMessageForUser } = require('./login-restrictions');
+
+const TABS = [
+  { key: 'cooperation', label: '机构合作', prefix: 'CO', initial: '待处理' },
+  { key: 'feedback', label: '问题反馈', prefix: 'FB', initial: '待处理' },
+  { key: 'ai_reply_report', label: 'AI 回复举报', prefix: 'AR', initial: '已受理' },
+];
+
+const REPORT_CATEGORIES = [
+  { value: 'identity_misleading', label: 'AI 身份误导' },
+  { value: 'life_health_harm', label: '自伤、自杀或暴力不当回复' },
+  { value: 'emotional_manipulation', label: '情感操控或诱导沉迷' },
+  { value: 'privacy_leak', label: '隐私泄露' },
+  { value: 'minor_inappropriate', label: '未成年人不适宜' },
+  { value: 'other_harmful', label: '虚假或其他有害内容' },
+];
+
+function normalizeContactPhone(value) {
+  const phone = String(value || '').trim().replace(/[ ()-]/g, '');
+  return /^\+?[0-9]{7,15}$/.test(phone) ? phone : '';
+}
+
+function referenceId(value, className) {
+  if (typeof value === 'string') return value.startsWith(className + '$') ? value.slice(className.length + 1) : value;
+  return String(value?.id || value?.objectId || '');
+}
+
+function authContext(app) {
+  const parse = app.Parse;
+  const user = parse?.User?.current();
+  const sessionToken = user?.getSessionToken?.();
+  const companyId = referenceId(user?.get('company'), 'Company');
+  if (!sessionToken || !user?.id || !companyId || companyId !== app.globalData.company || restrictionMessageForUser(user)) return null;
+  return { parse, user, sessionToken, companyId };
+}
+
+function pointer(parse, className, objectId) {
+  const obj = new parse.Object(className);
+  obj.id = objectId;
+  return obj;
+}
+
+function ownedQuery(scope, table, owner) {
+  const query = new scope.parse.Query(table);
+  query.equalTo('company', pointer(scope.parse, 'Company', scope.companyId));
+  query.equalTo(owner, pointer(scope.parse, '_User', scope.user.id));
+  query.notEqualTo('isDeleted', true);
+  return query;
+}
+
+function displayTime(value) {
+  const time = value instanceof Date ? value : new Date(value);
+  if (!Number.isFinite(time.getTime())) return '';
+  const two = n => String(n).padStart(2, '0');
+  return `${time.getFullYear()}-${two(time.getMonth() + 1)}-${two(time.getDate())} ${two(time.getHours())}:${two(time.getMinutes())}`;
+}
+
+function mapRecords(records, type) {
+  return records.filter(row => row.get('isDeleted') !== true).map(row => ({
+    id: row.id,
+    ticketNo: String(row.get('ticketNo') || ''),
+    status: String((type === 'ai_reply_report' && row.get('resolutionStatus')) || row.get('progress') || ''),
+    category: type === 'ai_reply_report' ? String(row.get('reportCategoryLabel') || '') : '',
+    snippet: String(row.get('content') || '').slice(0, 100),
+    result: String(row.get('resolutionSummary') || ''),
+    submittedAt: displayTime(row.createdAt),
+  }));
+}
+
+async function listTickets(scope, type) {
+  const query = ownedQuery(scope, 'ServiceTicket', 'submitter');
+  query.equalTo('ticketType', type);
+  query.select('ticketNo', 'content', 'progress', 'resolutionStatus', 'resolutionSummary', 'reportCategoryLabel');
+  query.descending('createdAt');
+  query.limit(40);
+  return mapRecords(await query.find({ sessionToken: scope.sessionToken }), type);
+}
+
+async function listConversations(scope) {
+  const query = ownedQuery(scope, 'ChatSession', 'user');
+  query.select('title', 'sessionType');
+  query.descending('updatedAt');
+  query.limit(30);
+  const rows = await query.find({ sessionToken: scope.sessionToken });
+  return rows.filter(row => row.get('sessionType') !== 'recording').map(row => ({
+    id: row.id,
+    label: [row.get('title') || '对话', displayTime(row.updatedAt || row.createdAt)].filter(Boolean).join(' · '),
+  }));
+}
+
+function replyChoices(messages) {
+  if (!Array.isArray(messages)) return [];
+  let previous = null;
+  const replies = [];
+  messages.forEach((message, index) => {
+    if (!message || message.hidden === true) return;
+    const source = message.content ?? message.text;
+    const text = typeof source === 'string' ? source.trim().slice(0, 4000) : '';
+    if (!text) return;
+    const id = String(message.id || message.clientMessageId || index);
+    if (message.role === 'user') previous = { id, text };
+    if (message.role === 'assistant' || message.role === 'ai') {
+      replies.push({ id, text, previous, label: text.slice(0, 72) });
+    }
+  });
+  return replies.slice(-50).reverse();
+}
+
+async function listReplies(scope, sessionId) {
+  const query = ownedQuery(scope, 'ChatSession', 'user');
+  query.equalTo('objectId', sessionId);
+  query.select('messageList', 'sessionType');
+  const row = await query.first({ sessionToken: scope.sessionToken });
+  if (!row || row.get('sessionType') === 'recording') return [];
+  return replyChoices(row.get('messageList'));
+}
+
+async function submitTicket(scope, type, form) {
+  const tab = TABS.find(item => item.key === type);
+  if (!tab) throw Error('工单类型无效');
+  const isAI = type === 'ai_reply_report';
+  const name = String(form.name || '').trim();
+  const content = String(form.content || '').trim().slice(0, isAI ? 500 : 2000);
+  const phone = normalizeContactPhone(form.phone);
+  const category = REPORT_CATEGORIES.find(item => item.value === form.category);
+  if (isAI && (!category || !form.sessionId || !form.reply?.text)) throw Error('请选择 AI 回复和举报类型');
+  if (!isAI && !phone) throw Error('请填写有效联系电话');
+  if (type === 'cooperation' && !name) throw Error('请填写联系人姓名');
+  if (type === 'feedback' && !content) throw Error('请填写问题描述');
+
+  const ticketNo = tab.prefix + '-' + Date.now().toString(36).toUpperCase() + '-' + Math.random().toString(36).slice(2, 8).toUpperCase();
+  const ticket = new scope.parse.Object('ServiceTicket');
+  ticket.set({
+    company: pointer(scope.parse, 'Company', scope.companyId),
+    submitter: pointer(scope.parse, '_User', scope.user.id),
+    submitterName: (type === 'cooperation' ? name : (scope.user.get('nickname') || '微信用户')).slice(0, 80),
+    ticketNo, ticketType: type, source: tab.label, progress: tab.initial, isDeleted: false,
+    content: content || (isAI ? category.label : ''),
+  });
+  if (isAI) {
+    const reply = form.reply;
+    const consentedMessages = [];
+    if (form.includePrevious && reply.previous) {
+      consentedMessages.push({ role: 'user', messageId: reply.previous.id, content: reply.previous.text });
+    }
+    consentedMessages.push({ role: 'assistant', messageId: reply.id, content: reply.text });
+    ticket.set({
+      session: pointer(scope.parse, 'ChatSession', form.sessionId),
+      sessionId: form.sessionId, assistantMessageId: reply.id,
+      resolutionStatus: tab.initial, priority: category.value === 'life_health_harm' ? 'P0' : 'P1',
+      reportCategory: category.value, reportCategoryLabel: category.label, consentedMessages,
+      expectedHandledAt: new Date(Date.now() + 86400000),
+      idempotencyKey: ['ai-reply-report-v1', scope.user.id, form.sessionId, reply.id, category.value].join(':'),
+    });
+  } else {
+    ticket.set('contactPhone', phone);
+    if (type === 'cooperation') ticket.set('companyName', String(form.organization || '').trim().slice(0, 120));
+  }
+  await ticket.save(null, { sessionToken: scope.sessionToken });
+  return ticketNo;
+}
+
+module.exports = {
+  TABS, REPORT_CATEGORIES, authContext, listTickets, listConversations, listReplies, submitTicket,
+  mapRecords, replyChoices, normalizeContactPhone,
+};

+ 4 - 0
yuban/components/home/index.js

@@ -48,6 +48,10 @@ Component({
       }
       }
     },
     },
 
 
+    onOpenServiceDesk() {
+      wx.navigateTo({ url: '/yuban/pages/service-desk/index' });
+    },
+
     onSwiperChange(e) {
     onSwiperChange(e) {
       const current = Number(e?.detail?.current ?? 0);
       const current = Number(e?.detail?.current ?? 0);
       this.setData({ activeSlide: current });
       this.setData({ activeSlide: current });

+ 1 - 0
yuban/components/home/index.wxml

@@ -30,5 +30,6 @@
       <text wx:if="{{!loading}}">立即使用</text>
       <text wx:if="{{!loading}}">立即使用</text>
       <text wx:else>正在进入...</text>
       <text wx:else>正在进入...</text>
     </button>
     </button>
+    <button class="support-btn" bindtap="onOpenServiceDesk">客服与反馈</button>
   </view>
   </view>
 </view>
 </view>

+ 14 - 2
yuban/components/home/index.wxss

@@ -20,8 +20,8 @@
 
 
 .carousel-dots {
 .carousel-dots {
   position: absolute;
   position: absolute;
-  bottom: 190rpx;
-  bottom: calc(env(safe-area-inset-bottom) + 150rpx);
+  bottom: 258rpx;
+  bottom: calc(env(safe-area-inset-bottom) + 218rpx);
   left: 50%;
   left: 50%;
   display: flex;
   display: flex;
   align-items: center;
   align-items: center;
@@ -70,6 +70,8 @@
   display: flex;
   display: flex;
   justify-content: center;
   justify-content: center;
   align-items: center;
   align-items: center;
+  flex-direction: column;
+  gap: 8rpx;
   padding: 0 48rpx 56rpx;
   padding: 0 48rpx 56rpx;
   padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
   padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
   box-sizing: border-box;
   box-sizing: border-box;
@@ -171,3 +173,13 @@
     transform: scale(1.003);
     transform: scale(1.003);
   }
   }
 }
 }
+
+
+.support-btn {
+  background: transparent;
+  color: #e5daff;
+  font-size: 26rpx;
+  line-height: 64rpx;
+  padding: 0 32rpx;
+}
+.support-btn::after { border: 0; }

+ 150 - 0
yuban/pages/service-desk/index.js

@@ -0,0 +1,150 @@
+const {
+  TABS, REPORT_CATEGORIES, authContext, listTickets, listConversations, listReplies, submitTicket,
+} = require('../../../utils/service-desk');
+const { restrictionMessage, restrictionMessageForUser } = require('../../../utils/login-restrictions');
+
+const emptyForm = () => ({ name: '', organization: '', phone: '', content: '' });
+
+Page({
+  data: {
+    tabs: TABS, categories: REPORT_CATEGORIES, active: 'cooperation',
+    signedIn: false, signingIn: false, loading: false, loadFailed: false,
+    form: emptyForm(), records: [], submitting: false, notice: '',
+    conversations: [], conversationsLoading: false, conversationsFailed: false, sessionIndex: -1,
+    replies: [], repliesLoading: false, repliesFailed: false, replyIndex: -1, categoryIndex: -1,
+    includePrevious: false,
+  },
+
+  onShow() {
+    const scope = authContext(getApp());
+    const owner = scope?.user.id || '';
+    if (this.owner !== owner) {
+      this.owner = owner;
+      this.setData({ signedIn: !!scope, records: [], notice: '', form: emptyForm(),
+        conversations: [], replies: [], sessionIndex: -1, replyIndex: -1,
+        categoryIndex: -1, includePrevious: false, conversationsLoading: false, repliesLoading: false,
+        conversationsFailed: false, repliesFailed: false, loading: false, loadFailed: false });
+    }
+    if (!scope) return;
+    void this.refreshRecords();
+    if (this.data.active === 'ai_reply_report' && !this.data.conversations.length) void this.refreshConversations();
+  },
+
+  onUnload() { this.closed = true; },
+
+  matches(scope) {
+    const current = authContext(getApp());
+    return !this.closed && current?.user.id === scope.user.id && current.sessionToken === scope.sessionToken;
+  },
+
+  async signIn() {
+    if (this.data.signingIn) return;
+    this.setData({ signingIn: true, notice: '' });
+    try {
+      const app = getApp();
+      const response = await app.checkAuth(true);
+      const restriction = restrictionMessage(response) || restrictionMessageForUser(app.Parse?.User?.current());
+      if (restriction) {
+        this.setData({ notice: restriction });
+      } else if (authContext(app)) {
+        this.onShow();
+      } else {
+        this.setData({ notice: '微信登录未完成,请重试。' });
+      }
+    } catch (error) {
+      this.setData({ notice: restrictionMessage(error) || '暂时无法登录,请稍后重试。' });
+    } finally {
+      this.setData({ signingIn: false });
+    }
+  },
+
+  selectTab(event) {
+    const active = event.currentTarget.dataset.key;
+    if (this.data.submitting || active === this.data.active || !TABS.some(item => item.key === active)) return;
+    this.setData({ active, records: [], notice: '', loadFailed: false, form: emptyForm(),
+      sessionIndex: -1, replies: [], replyIndex: -1, categoryIndex: -1, includePrevious: false, repliesLoading: false, repliesFailed: false });
+    this.onShow();
+  },
+
+  async refreshRecords() {
+    const scope = authContext(getApp());
+    if (!scope) return;
+    const active = this.data.active;
+    const request = this.recordsRequest = (this.recordsRequest || 0) + 1;
+    const current = () => this.matches(scope) && request === this.recordsRequest && active === this.data.active;
+    this.setData({ loading: true, loadFailed: false });
+    try {
+      const records = await listTickets(scope, active);
+      if (current()) this.setData({ records });
+    } catch {
+      if (current()) this.setData({ loadFailed: true });
+    } finally {
+      if (current()) this.setData({ loading: false });
+    }
+  },
+
+  async refreshConversations() {
+    const scope = authContext(getApp());
+    if (!scope || this.data.conversationsLoading) return;
+    this.setData({ conversationsLoading: true, conversationsFailed: false });
+    try {
+      const conversations = await listConversations(scope);
+      if (this.matches(scope)) this.setData({ conversations });
+    } catch {
+      if (this.matches(scope)) this.setData({ conversationsFailed: true });
+    } finally {
+      if (this.matches(scope)) this.setData({ conversationsLoading: false });
+    }
+  },
+
+  async selectConversation(event) {
+    const scope = authContext(getApp());
+    const sessionIndex = Number(event.detail.value);
+    const selected = this.data.conversations[sessionIndex];
+    if (!scope || !selected) return;
+    const request = this.repliesRequest = (this.repliesRequest || 0) + 1;
+    const current = () => this.matches(scope) && request === this.repliesRequest && sessionIndex === this.data.sessionIndex;
+    this.setData({ sessionIndex, replies: [], replyIndex: -1, includePrevious: false, repliesLoading: true, repliesFailed: false });
+    try {
+      const replies = await listReplies(scope, selected.id);
+      if (current()) this.setData({ replies });
+    } catch {
+      if (current()) this.setData({ repliesFailed: true });
+    } finally {
+      if (current()) this.setData({ repliesLoading: false });
+    }
+  },
+
+  retryReplies() { void this.selectConversation({ detail: { value: this.data.sessionIndex } }); },
+  selectReply(event) { this.setData({ replyIndex: Number(event.detail.value), includePrevious: false }); },
+  selectCategory(event) { this.setData({ categoryIndex: Number(event.detail.value) }); },
+  togglePrevious(event) { this.setData({ includePrevious: event.detail.value.includes('previous') }); },
+
+  editField(event) {
+    const key = event.currentTarget.dataset.key;
+    if (Object.prototype.hasOwnProperty.call(emptyForm(), key)) this.setData({ ['form.' + key]: event.detail.value });
+  },
+
+  async submit() {
+    const scope = authContext(getApp());
+    if (!scope || this.data.submitting) return;
+    const { active, form, sessionIndex, conversations, replies, replyIndex, categoryIndex, includePrevious } = this.data;
+    this.setData({ submitting: true, notice: '' });
+    try {
+      const ticketNo = await submitTicket(scope, active, {
+        ...form, sessionId: conversations[sessionIndex]?.id, reply: replies[replyIndex],
+        category: REPORT_CATEGORIES[categoryIndex]?.value, includePrevious,
+      });
+      if (!this.matches(scope)) return;
+      this.setData({ form: emptyForm(), replyIndex: -1, categoryIndex: -1, includePrevious: false,
+        notice: '提交成功,工单号 ' + ticketNo + '。处理结果可在本页查看。' });
+      await this.refreshRecords();
+    } catch (error) {
+      const message = ['请填写有效联系电话', '请填写联系人姓名', '请填写问题描述', '请选择 AI 回复和举报类型'].includes(error?.message)
+        ? error.message : '提交结果待核对,请先刷新处理记录。';
+      if (this.matches(scope)) this.setData({ notice: message });
+    } finally {
+      if (!this.closed) this.setData({ submitting: false });
+    }
+  },
+});

+ 6 - 0
yuban/pages/service-desk/index.json

@@ -0,0 +1,6 @@
+{
+  "navigationStyle": "default",
+  "navigationBarTitleText": "客服与反馈",
+  "navigationBarBackgroundColor": "#171426",
+  "navigationBarTextStyle": "white"
+}

+ 76 - 0
yuban/pages/service-desk/index.wxml

@@ -0,0 +1,76 @@
+<view class="desk">
+  <view class="tabs">
+    <button wx:for="{{tabs}}" wx:key="key" class="tab {{active === item.key ? 'selected' : ''}}"
+      data-key="{{item.key}}" bindtap="selectTab" disabled="{{submitting}}">{{item.label}}</button>
+  </view>
+
+  <view wx:if="{{!signedIn}}" class="panel">
+    <text class="section-title">登录后提交并查看自己的工单</text>
+    <button class="primary" bindtap="signIn" loading="{{signingIn}}" disabled="{{signingIn}}">微信登录</button>
+    <text wx:if="{{notice}}" class="notice">{{notice}}</text>
+  </view>
+  <block wx:else>
+    <view class="panel form">
+      <view wx:if="{{active === 'cooperation'}}" class="field">
+        <text>联系人姓名</text>
+        <input maxlength="80" value="{{form.name}}" data-key="name" bindinput="editField" placeholder="必填" />
+      </view>
+      <view wx:if="{{active === 'cooperation'}}" class="field">
+        <text>机构名称</text>
+        <input maxlength="120" value="{{form.organization}}" data-key="organization" bindinput="editField" placeholder="选填" />
+      </view>
+      <view wx:if="{{active !== 'ai_reply_report'}}" class="field">
+        <text>联系电话</text>
+        <input maxlength="30" value="{{form.phone}}" data-key="phone" bindinput="editField" placeholder="请输入可接通的电话" />
+      </view>
+      <block wx:if="{{active === 'ai_reply_report'}}">
+        <text wx:if="{{conversationsLoading}}" class="meta">正在读取对话…</text>
+        <button wx:elif="{{conversationsFailed}}" class="secondary" bindtap="refreshConversations">重新读取对话</button>
+        <text wx:elif="{{!conversations.length}}" class="meta">暂无可举报的近期对话</text>
+        <picker wx:else mode="selector" range="{{conversations}}" range-key="label" bindchange="selectConversation" disabled="{{submitting}}">
+          <view class="pick">{{sessionIndex < 0 ? '选择自己的近期对话' : conversations[sessionIndex].label}}</view>
+        </picker>
+        <text wx:if="{{repliesLoading}}" class="meta">正在读取回复…</text>
+        <button wx:elif="{{repliesFailed}}" class="secondary" bindtap="retryReplies">重新读取回复</button>
+        <text wx:elif="{{sessionIndex >= 0 && !replies.length}}" class="meta">这段对话暂无可选回复</text>
+        <picker wx:if="{{replies.length}}" mode="selector" range="{{replies}}" range-key="label" bindchange="selectReply" disabled="{{submitting}}">
+          <view class="pick">{{replyIndex < 0 ? '选择要举报的回复' : replies[replyIndex].label}}</view>
+        </picker>
+        <view wx:if="{{replyIndex >= 0}}" class="excerpt">
+          <text class="meta">将随举报提交的 AI 回复</text>
+          <text selectable class="multiline">{{replies[replyIndex].text}}</text>
+          <checkbox-group wx:if="{{replies[replyIndex].previous}}" bindchange="togglePrevious">
+            <label><checkbox value="previous" checked="{{includePrevious}}" disabled="{{submitting}}" />同时提交我的上一条消息</label>
+            <text wx:if="{{includePrevious}}" selectable class="multiline">{{replies[replyIndex].previous.text}}</text>
+          </checkbox-group>
+        </view>
+        <picker mode="selector" range="{{categories}}" range-key="label" bindchange="selectCategory" disabled="{{submitting}}">
+          <view class="pick">{{categoryIndex < 0 ? '选择举报类型' : categories[categoryIndex].label}}</view>
+        </picker>
+      </block>
+      <view class="field">
+        <text>{{active === 'cooperation' ? '合作诉求' : active === 'feedback' ? '问题描述' : '补充说明(选填)'}}</text>
+        <textarea maxlength="{{active === 'ai_reply_report' ? 500 : 2000}}" value="{{form.content}}"
+          data-key="content" bindinput="editField" placeholder="填写具体情况" auto-height />
+      </view>
+      <button class="primary" bindtap="submit" loading="{{submitting}}" disabled="{{submitting}}">{{active === 'ai_reply_report' ? '提交举报' : '提交'}}</button>
+      <text wx:if="{{notice}}" selectable class="notice">{{notice}}</text>
+    </view>
+
+    <view class="panel">
+      <view class="record-header">
+        <text class="section-title">处理进度与结果</text>
+        <button class="secondary mini" bindtap="refreshRecords" disabled="{{loading}}">{{loadFailed ? '重试' : '刷新'}}</button>
+      </view>
+      <text wx:if="{{loading}}" class="meta">正在读取记录…</text>
+      <text wx:elif="{{loadFailed}}" class="meta">更新失败,请重试。</text>
+      <text wx:elif="{{!records.length}}" class="meta">暂无提交记录</text>
+      <view wx:for="{{records}}" wx:key="id" class="record">
+        <view class="record-header"><text class="meta">{{item.ticketNo}} · {{item.submittedAt}}</text><text class="status">{{item.status || '状态待确认'}}</text></view>
+        <text wx:if="{{item.category}}" class="meta">{{item.category}}</text>
+        <text wx:if="{{item.snippet}}" class="multiline">{{item.snippet}}</text>
+        <view wx:if="{{item.result}}" class="result"><text class="meta">处理结果</text><text selectable class="multiline">{{item.result}}</text></view>
+      </view>
+    </view>
+  </block>
+</view>

+ 24 - 0
yuban/pages/service-desk/index.wxss

@@ -0,0 +1,24 @@
+page { background: #110f1d; color: #f5f1ff; }
+.desk { padding: 28rpx 24rpx calc(28rpx + env(safe-area-inset-bottom)); }
+.tabs, .record-header { display: flex; gap: 12rpx; align-items: center; justify-content: space-between; }
+.tabs { margin-bottom: 24rpx; }
+.tab, .primary, .secondary { margin: 0; border-radius: 16rpx; color: #f5f1ff; font-size: 26rpx; }
+.tab { flex: 1; background: #242035; padding: 0 8rpx; line-height: 76rpx; }
+.selected { background: #7045cb; }
+.panel { background: #1b1729; padding: 24rpx; border-radius: 22rpx; margin-bottom: 20rpx; }
+.form, .field, .record, .result, .excerpt { display: flex; flex-direction: column; gap: 12rpx; }
+.form { gap: 24rpx; }
+.field, .record { font-size: 28rpx; }
+.field input, .field textarea, .pick { box-sizing: border-box; width: 100%; background: #282239; min-height: 76rpx; padding: 16rpx; border-radius: 12rpx; }
+.primary { background: #7045cb; margin-top: 12rpx; }
+.secondary { background: #302747; }
+.mini, .status { flex-shrink: 0; padding: 0 18rpx; font-size: 24rpx; }
+.section-title { font-size: 30rpx; font-weight: 600; }
+.meta, .notice { font-size: 24rpx; color: #c4b7d8; }
+.notice { display: block; margin-top: 12rpx; }
+.record { border-top: 1rpx solid #3e3551; padding: 20rpx 0; margin-top: 12rpx; }
+.status, .result { background: #302747; border-radius: 12rpx; }
+.status { line-height: 48rpx; }
+.result, .excerpt { padding: 16rpx; }
+.excerpt { background: #282239; border-radius: 12rpx; }
+.multiline { white-space: pre-wrap; word-break: break-word; line-height: 1.55; display: block; }