diff --git a/pages/login/logon.vue b/pages/login/logon.vue index 81ae28d..6896095 100644 --- a/pages/login/logon.vue +++ b/pages/login/logon.vue @@ -57,6 +57,7 @@ getCodes, getsLogin } from '../../request/api/api'; + import { isPhone } from '@/utils/phone.js'; export default { data() { return { @@ -93,7 +94,8 @@ }) return } - if (!/^1[345678]\d{9}$/.test(this.form['mobile'])) { + // 与后端 checkPhone 统一:含 19 号段 + if (!isPhone(this.form['mobile'])) { // uni.showToast({ // title: '请输入正确的手机号', // duration: 2000, @@ -137,6 +139,14 @@ }) }, register() { + if (!isPhone(this.form['mobile'])) { + this.$refs.uToast.show({ + title: '请输入正确的手机号', + type: 'default', + icon: false + }) + return + } if (this.form['pwd'] == []) { uni.showToast({ title: '请输入验证码', diff --git a/subPackages/my/my-drug/drug-info.vue b/subPackages/my/my-drug/drug-info.vue index 0121862..3a46ba8 100644 --- a/subPackages/my/my-drug/drug-info.vue +++ b/subPackages/my/my-drug/drug-info.vue @@ -78,6 +78,14 @@ + + + 本单为医生代支付 + + @@ -156,6 +164,15 @@ ¥{{orderInfo.product_order.total_pay_price}} + + 付款方式 + + 医生代支付 + + 支付时间 @@ -805,6 +822,21 @@ export default { font-weight: 500; color: #222; } + .proxy-pay-banner { + margin: 20rpx 24rpx 0; + padding: 16rpx 24rpx; + background: #F5E8FF; + border-radius: 12rpx; + } + .proxy-pay-banner-text { + font-size: 26rpx; + color: #722ED1; + font-weight: 600; + } + .proxy-pay-inline { + color: #722ED1; + font-weight: 600; + } .agreen { padding: 60rpx 50rpx 20rpx; diff --git a/subPackages/my/my-drug/drug-list.vue b/subPackages/my/my-drug/drug-list.vue index 913df12..0c07c29 100644 --- a/subPackages/my/my-drug/drug-list.vue +++ b/subPackages/my/my-drug/drug-list.vue @@ -49,7 +49,14 @@ v-if="item.prescription_type" /> - {{item.status_string}} + + + 代支付 + {{item.status_string}} + @@ -713,6 +720,21 @@ export default { } } + .status_wrap { + display: flex; + flex-direction: column; + align-items: flex-end; + flex-shrink: 0; + gap: 8rpx; + } + .proxy_pay_tag { + font-size: 22rpx; + color: #722ED1; + background: #F5E8FF; + padding: 4rpx 12rpx; + border-radius: 8rpx; + font-weight: 600; + } .status_txt { font-size: 28rpx; font-weight: 500; diff --git a/subPackages/my/myinfo-add.vue b/subPackages/my/myinfo-add.vue index 3586313..a1e2d8a 100644 --- a/subPackages/my/myinfo-add.vue +++ b/subPackages/my/myinfo-add.vue @@ -374,6 +374,7 @@ userRelation } from '../../request/api/api'; import { checkProfileTexts, handleSecurityError, SCENE_PROFILE } from '@/utils/content-security.js'; + import { assertPhone, isPhone } from '@/utils/phone.js'; export default { data() { return { @@ -831,6 +832,10 @@ }); return false; } + // 就诊人手机号与后端 PatientService 一致 + if (!assertPhone(this.phone)) { + return false; + } return true; }, validatePatientAge() { @@ -874,7 +879,7 @@ }); return false; } - if (!/^\d{11}$/.test(this.guardianForm.mobile)) { + if (!isPhone(this.guardianForm.mobile)) { uni.showToast({ title: '监护人手机号格式不正确', icon: 'none', diff --git a/subPackages/my/myinfo-edit.vue b/subPackages/my/myinfo-edit.vue index 95e0ea1..a325fe9 100644 --- a/subPackages/my/myinfo-edit.vue +++ b/subPackages/my/myinfo-edit.vue @@ -355,6 +355,7 @@ userRelation } from '../../request/api/api'; import { checkProfileTexts, handleSecurityError, SCENE_PROFILE } from '@/utils/content-security.js'; + import { assertPhone, isPhone } from '@/utils/phone.js'; export default { data() { return { @@ -1015,6 +1016,10 @@ }); return false; } + // 就诊人手机号与后端 PatientService 一致 + if (!assertPhone(this.phone)) { + return false; + } return true; }, calcAgeFromIdCard(idCard) { @@ -1071,7 +1076,7 @@ }); return false; } - if (!/^\d{11}$/.test(this.guardianForm.mobile)) { + if (!isPhone(this.guardianForm.mobile)) { uni.showToast({ title: '监护人手机号格式不正确', icon: 'none', diff --git a/subPackages/setup/choose-area.vue b/subPackages/setup/choose-area.vue index 94fb69a..0adee69 100644 --- a/subPackages/setup/choose-area.vue +++ b/subPackages/setup/choose-area.vue @@ -83,6 +83,7 @@ height:' 68rpx',borderRadio:'8rpx'}"> getaddressEdit, getaddressList } from '../../request/api/api' + import { assertPhone } from '@/utils/phone.js' export default { data() { return { @@ -144,6 +145,10 @@ height:' 68rpx',borderRadio:'8rpx'}"> }, // 新增地址 getAdd() { + // 收货手机号与后端一致:大陆 11 位号段 + if (!assertPhone(this.mobile, '请填写收货人手机号', '收货人手机号格式不正确')) { + return + } let list = { name: this.name, mobile: this.mobile, @@ -211,6 +216,10 @@ height:' 68rpx',borderRadio:'8rpx'}"> // 修改地址 getEdit() { + const editMobile = this.from[0] && this.from[0].mobile + if (!assertPhone(editMobile, '请填写收货人手机号', '收货人手机号格式不正确')) { + return + } let list = { id: this.id, name: this.from[0].name, diff --git a/subPackages/shop/orders.vue b/subPackages/shop/orders.vue index 610215f..1020168 100644 --- a/subPackages/shop/orders.vue +++ b/subPackages/shop/orders.vue @@ -24,7 +24,13 @@ {{item.store.name}} 西药(中成) - {{item.status_string}} + + 代支付 + {{item.status_string}} + @@ -397,6 +403,22 @@ color: #FC3636; } + .status_wrap { + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 8rpx; + flex-shrink: 0; + } + .proxy_pay_tag { + font-size: 22rpx; + color: #722ED1; + background: #F5E8FF; + padding: 4rpx 12rpx; + border-radius: 8rpx; + font-weight: 600; + } + } .item { diff --git a/utils/phone.js b/utils/phone.js new file mode 100644 index 0000000..b794ded --- /dev/null +++ b/utils/phone.js @@ -0,0 +1,38 @@ +/** + * 大陆手机号校验(与后端 UtilsService::checkPhone 一致) + * 规则:11 位,号段 13-19(^1[3456789]\d{9}$) + */ + +const MOBILE_REG = /^1[3456789]\d{9}$/; + +/** + * 判断是否为合法大陆手机号(不弹 toast) + * @param {string|number|null|undefined} phone + * @returns {boolean} + */ +export function isPhone(phone) { + if (phone === null || phone === undefined) { + return false; + } + return MOBILE_REG.test(String(phone).trim()); +} + +/** + * 校验手机号;不合法时 toast 并返回 false + * @param {string|number|null|undefined} phone + * @param {string} [emptyMsg='请输入手机号'] + * @param {string} [invalidMsg='手机号格式不正确'] + * @returns {boolean} + */ +export function assertPhone(phone, emptyMsg = '请输入手机号', invalidMsg = '手机号格式不正确') { + const value = phone === null || phone === undefined ? '' : String(phone).trim(); + if (!value) { + uni.showToast({ title: emptyMsg, icon: 'none' }); + return false; + } + if (!MOBILE_REG.test(value)) { + uni.showToast({ title: invalidMsg, icon: 'none' }); + return false; + } + return true; +}