Showing
1 changed file
with
27 additions
and
5 deletions
| @@ -451,6 +451,29 @@ export default { | @@ -451,6 +451,29 @@ export default { | ||
| 451 | 451 | ||
| 452 | 452 | ||
| 453 | 453 | ||
| 454 | + // TTS:逐字加空格,避免数字被读成数值(如 801 → 八百零一) | ||
| 455 | + toTtsSpacedText(str) { | ||
| 456 | + if (!str && str !== 0) return ''; | ||
| 457 | + return String(str).split('').join(' '); | ||
| 458 | + }, | ||
| 459 | + | ||
| 460 | + // TTS:区域名保持原读法,仅将包间名逐字拆开 | ||
| 461 | + buildTtsTablesText(tablesText, deskStr) { | ||
| 462 | + if (!tablesText) return ''; | ||
| 463 | + let result = String(tablesText); | ||
| 464 | + const names = String(deskStr || '') | ||
| 465 | + .split('、') | ||
| 466 | + .filter(Boolean) | ||
| 467 | + .sort((a, b) => b.length - a.length); | ||
| 468 | + if (!names.length) { | ||
| 469 | + return result.replace(/\d/g, d => d + ' ').replace(/ +/g, ' ').trim(); | ||
| 470 | + } | ||
| 471 | + names.forEach(name => { | ||
| 472 | + result = result.split(name).join(this.toTtsSpacedText(name)); | ||
| 473 | + }); | ||
| 474 | + return result; | ||
| 475 | + }, | ||
| 476 | + | ||
| 454 | // 文字转语音的方法(2-13页面) | 477 | // 文字转语音的方法(2-13页面) |
| 455 | textToSpeechFun(sid, reserve) { | 478 | textToSpeechFun(sid, reserve) { |
| 456 | console.log('reservereserve-----', reserve); | 479 | console.log('reservereserve-----', reserve); |
| @@ -509,9 +532,8 @@ export default { | @@ -509,9 +532,8 @@ export default { | ||
| 509 | }) | 532 | }) |
| 510 | data.detail.rname = data.detail.rname.trim() | 533 | data.detail.rname = data.detail.rname.trim() |
| 511 | let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : ''; | 534 | let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : ''; |
| 512 | - let charArray = data.seller.deskStr.split(''); | ||
| 513 | - let modifiedArray = charArray.map(char => char + ' '); | ||
| 514 | - let resultString = modifiedArray.join('').slice(0, -1); | 535 | + let resultString = this.toTtsSpacedText(data.seller.deskStr || ''); |
| 536 | + let tablesTextForTts = this.buildTtsTablesText(data.seller.tablesText, data.seller.deskStr); | ||
| 515 | const replacements = { | 537 | const replacements = { |
| 516 | "{店铺名}": data.seller.name, | 538 | "{店铺名}": data.seller.name, |
| 517 | "{年月日}": data.seller.yearMonthDay, | 539 | "{年月日}": data.seller.yearMonthDay, |
| @@ -519,7 +541,7 @@ export default { | @@ -519,7 +541,7 @@ export default { | ||
| 519 | "{餐段}": data.seller.soltName, | 541 | "{餐段}": data.seller.soltName, |
| 520 | "{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide, | 542 | "{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide, |
| 521 | "{包间名}": resultString, | 543 | "{包间名}": resultString, |
| 522 | - "{区域名+包间名}": data.seller.tablesText, | 544 | + "{区域名+包间名}": tablesTextForTts, |
| 523 | "{经理名字}": data.staffinfo.name, | 545 | "{经理名字}": data.staffinfo.name, |
| 524 | "{客人姓名+称呼}": data.detail.rname ? (data.detail.rname + str) : str == '贵宾' ? '贵宾' : '', | 546 | "{客人姓名+称呼}": data.detail.rname ? (data.detail.rname + str) : str == '贵宾' ? '贵宾' : '', |
| 525 | "{预订日期}": data.seller.yearMonthDay, | 547 | "{预订日期}": data.seller.yearMonthDay, |
| @@ -698,7 +720,7 @@ export default { | @@ -698,7 +720,7 @@ export default { | ||
| 698 | userinfo | 720 | userinfo |
| 699 | }).then(res => { | 721 | }).then(res => { |
| 700 | if (res.ret == 200) { | 722 | if (res.ret == 200) { |
| 701 | - util.toast('赴约成功', 'none') | 723 | + util.toast('赴约成功', 'none', 2500) |
| 702 | this.setData({ | 724 | this.setData({ |
| 703 | isShowBtn: false, | 725 | isShowBtn: false, |
| 704 | }) | 726 | }) |
-
Please register or login to post a comment